WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Implements QRectF, QPointF, QSizeF
webcore-4462.patch (text/plain), 26.62 KB, created by
Kimmo Kinnunen
on 2005-10-18 07:26:23 PDT
(
hide
)
Description:
Implements QRectF, QPointF, QSizeF
Filename:
MIME Type:
Creator:
Kimmo Kinnunen
Created:
2005-10-18 07:26:23 PDT
Size:
26.62 KB
patch
obsolete
>Index: ForwardingHeaders/QPointF >=================================================================== >diff -Npu ForwardingHeaders/QPointF >--- ForwardingHeaders/QPointF 1 Jan 1970 00:00:00 -0000 >+++ ForwardingHeaders/QPointF 18 Oct 2005 10:56:52 -0000 >@@ -0,0 +1 @@ >+#import "KWQPointF.h" >Index: ForwardingHeaders/QRectF >=================================================================== >diff -Npu ForwardingHeaders/QRectF >--- ForwardingHeaders/QRectF 1 Jan 1970 00:00:00 -0000 >+++ ForwardingHeaders/QRectF 18 Oct 2005 10:56:46 -0000 >@@ -0,0 +1 @@ >+#import "KWQRectF.h" >Index: ForwardingHeaders/QSizeF >=================================================================== >diff -Npu ForwardingHeaders/QSizeF >--- ForwardingHeaders/QSizeF 1 Jan 1970 00:00:00 -0000 >+++ ForwardingHeaders/QSizeF 18 Oct 2005 10:56:36 -0000 >@@ -0,0 +1 @@ >+#import "KWQSizeF.h" >Index: kwq/KWQPointF.h >=================================================================== >diff -Npu kwq/KWQPointF.h >--- kwq/KWQPointF.h 1 Jan 1970 00:00:00 -0000 >+++ kwq/KWQPointF.h 18 Oct 2005 12:16:09 -0000 >@@ -0,0 +1,78 @@ >+/* >+ * Copyright (C) 2004 Apple Computer, Inc. All rights reserved. >+ * Copyright (C) 2005 Nokia. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef QPOINTF_H_ >+#define QPOINTF_H_ >+ >+#include "KWQDef.h" >+ >+// workaround for <rdar://problem/4294625> >+#if ! __LP64__ && ! NS_BUILD_32_LIKE_64 >+#undef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES >+#endif >+ >+#ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES >+typedef struct CGPoint NSPoint; >+#else >+typedef struct _NSPoint NSPoint; >+#endif >+typedef struct CGPoint CGPoint; >+class QPoint; >+ >+class QPointF { >+public: >+ QPointF(); >+ QPointF(float, float); >+ QPointF(const QPoint&); >+#ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES >+ explicit QPointF(const NSPoint &); >+#endif >+ explicit QPointF(const CGPoint &); >+ >+ float x() const { return xCoord; } >+ float y() const { return yCoord; } >+ >+ void setX(int x) { xCoord = x; } >+ void setY(int y) { yCoord = y; } >+ >+ bool isNull() const { return xCoord == 0.0f && yCoord == 0.0f; } >+ >+ QPointF &operator -=(const QPointF &two) { xCoord -= two.xCoord; yCoord -= two.yCoord; return *this; } >+ friend const QPointF operator*(const QPointF &p, double s); >+ friend QPointF operator+(const QPointF &, const QPointF &); >+ friend QPointF operator-(const QPointF &, const QPointF &); >+ >+#ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES >+ operator NSPoint() const; >+#endif >+ operator CGPoint() const; >+ >+private: >+ float xCoord; >+ float yCoord; >+}; >+ >+#endif >Index: kwq/KWQPointF.mm >=================================================================== >diff -Npu kwq/KWQPointF.mm >--- kwq/KWQPointF.mm 1 Jan 1970 00:00:00 -0000 >+++ kwq/KWQPointF.mm 18 Oct 2005 12:21:59 -0000 >@@ -0,0 +1,78 @@ >+/* >+ * Copyright (C) 2004 Apple Computer, Inc. All rights reserved. >+ * Copyright (C) 2005 Nokia. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#import "KWQPointF.h" >+#import "KWQPointArray.h" >+ >+QPointF::QPointF() : xCoord(0), yCoord(0) >+{ >+} >+ >+QPointF::QPointF(float xIn, float yIn) : xCoord(xIn), yCoord(yIn) >+{ >+} >+ >+QPointF::QPointF(const QPoint& p) :xCoord(p.x()), yCoord(p.y()) >+{ >+} >+ >+#ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES >+QPointF::QPointF(const NSPoint &p) : xCoord(p.x), yCoord(p.y) >+{ >+} >+#endif >+ >+QPointF::QPointF(const CGPoint &p) : xCoord(p.x), yCoord(p.y) >+{ >+} >+ >+#ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES >+QPointF::operator NSPoint() const >+{ >+ return NSMakePoint(xCoord, yCoord); >+} >+#endif >+ >+QPointF::operator CGPoint() const >+{ >+ return CGPointMake(xCoord, yCoord); >+} >+ >+QPointF operator+(const QPointF &a, const QPointF &b) >+{ >+ return QPointF(a.xCoord + b.xCoord, a.yCoord + b.yCoord); >+} >+ >+QPointF operator-(const QPointF &a, const QPointF &b) >+{ >+ return QPointF(a.xCoord - b.xCoord, a.yCoord - b.yCoord); >+} >+ >+const QPointF operator*(const QPointF &p, double s) >+{ >+ return QPointF((int)(p.xCoord * s), (int)(p.yCoord * s)); >+} >Index: kwq/KWQRectF.h >=================================================================== >diff -Npu kwq/KWQRectF.h >--- kwq/KWQRectF.h 1 Jan 1970 00:00:00 -0000 >+++ kwq/KWQRectF.h 18 Oct 2005 13:38:28 -0000 >@@ -0,0 +1,113 @@ >+/* >+ * Copyright (C) 2003 Apple Computer, Inc. All rights reserved. >+ * Copyright (C) 2003 Nokia. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef QRECTF_H_ >+#define QRECTF_H_ >+ >+#include "KWQSizeF.h" >+#include "KWQPointF.h" >+#include "KWQRect.h" >+ >+#ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES >+typedef struct CGRect NSRect; >+#else >+typedef struct _NSRect NSRect; >+#endif >+typedef struct CGRect CGRect; >+class QRect; >+ >+class QRectF { >+public: >+ QRectF(); >+ QRectF(QPointF p, QSizeF s); >+ QRectF(float, float, float, float); >+ QRectF(const QPointF &, const QPointF &); >+ QRectF(const QRect&); >+#ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES >+ explicit QRectF(const NSRect &); >+#endif >+ explicit QRectF(const CGRect &); >+ >+ bool isNull() const; >+ bool isValid() const; >+ bool isEmpty() const; >+ >+ float x() const { return xp; } >+ float y() const { return yp; } >+ float left() const { return xp; } >+ float top() const { return yp; } >+ float right() const; >+ float bottom() const; >+ float width() const { return w; } >+ float height() const { return h; } >+ >+ QPointF topLeft() const; >+ QPointF topRight() const; >+ QPointF bottomRight() const; >+ QPointF bottomLeft() const; >+ >+ QSizeF size() const; >+ void setX(float x) { xp = x; } >+ void setY(float y) { yp = y; } >+ void setWidth(float width) { w = width; } >+ void setHeight(float height) { h = height; } >+ void setRect(float x, float y, float width, float height) { xp = x; yp = y; w = width; h = height; } >+ QRectF intersect(const QRectF &) const; >+ bool intersects(const QRectF &) const; >+ QRectF unite(const QRectF &) const; >+ QRectF normalize() const; >+ >+ bool contains(const QPointF &point) const { return contains(point.x(), point.y()); } >+ >+ bool contains(float x, float y, bool proper = false) const { >+ if (proper) >+ return x > xp && (x < (xp + w - 1)) && y > yp && y < (yp + h - 1); >+ return x >= xp && x < (xp + w) && y >= yp && y < (yp + h); >+ } >+ >+ bool contains(const QRectF &rect) const { return intersect(rect) == rect; } >+ >+ void inflate(float s); >+ >+ inline QRectF operator&(const QRectF &r) const { return intersect(r); } >+ >+#ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES >+ operator NSRect() const; >+#endif >+ operator CGRect() const; >+ >+ QRect toRect() const; >+private: >+ float xp; >+ float yp; >+ float w; >+ float h; >+ >+ friend bool operator==(const QRectF &, const QRectF &); >+ friend bool operator!=(const QRectF &, const QRectF &); >+}; >+ >+#endif >Index: kwq/KWQRectF.mm >=================================================================== >diff -Npu kwq/KWQRectF.mm >--- kwq/KWQRectF.mm 1 Jan 1970 00:00:00 -0000 >+++ kwq/KWQRectF.mm 18 Oct 2005 13:38:36 -0000 >@@ -0,0 +1,221 @@ >+/* >+ * Copyright (C) 2003 Apple Computer, Inc. All rights reserved. >+ * Copyright (C) 2005 Nokia. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#import "KWQRectF.h" >+ >+#import <algorithm> >+ >+using std::max; >+using std::min; >+ >+QRectF::QRectF() : xp(0.0f), yp(0.0f), w(0.0f), h(0.0f) >+{ >+} >+ >+QRectF::QRectF(float x, float y, float width, float height) : xp(x), yp(y), w(width), h(height) >+{ >+} >+ >+QRectF::QRectF(QPointF p, QSizeF s) : xp(p.x()), yp(p.y()), w(s.width()), h(s.height()) >+{ >+} >+ >+QRectF::QRectF(const QPointF &topLeft, const QPointF &bottomRight) >+ :xp(topLeft.x()) >+ ,yp(topLeft.y()) >+ ,w(bottomRight.x() - topLeft.x() + 1.0f) >+ ,h(bottomRight.y() - topLeft.y() + 1.0f) >+{ >+} >+ >+QRectF::QRectF(const QRect& r) : xp(r.x()), yp(r.y()), w(r.width()), h(r.height()) >+{ >+} >+ >+#ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES >+QRectF::QRectF(const NSRect &r) : xp(r.origin.x), yp(r.origin.y), w(r.size.width), h(r.size.height) >+{ >+} >+#endif >+ >+QRectF::QRectF(const CGRect &r) : xp(r.origin.x), yp(r.origin.y), w(r.size.width), h(r.size.height) >+{ >+} >+ >+bool QRectF::isNull() const >+{ >+ return w == 0.0f && h == 0.0f; >+} >+ >+bool QRectF::isValid() const >+{ >+ return w > 0.0f && h > 0.0f; >+} >+ >+bool QRectF::isEmpty() const >+{ >+ return w <= 0.0f || h <= 0.0f; >+} >+ >+float QRectF::right() const >+{ >+ return xp + w - 1.0f; >+} >+ >+float QRectF::bottom() const >+{ >+ return yp + h - 1.0f; >+} >+ >+QPointF QRectF::topLeft() const >+{ >+ return QPointF(xp,yp); >+} >+ >+QPointF QRectF::topRight() const >+{ >+ return QPointF(right(),top()); >+} >+ >+QPointF QRectF::bottomRight() const >+{ >+ return QPointF(right(),bottom()); >+} >+ >+QPointF QRectF::bottomLeft() const >+{ >+ return QPointF(left(),bottom()); >+} >+ >+QSizeF QRectF::size() const >+{ >+ return QSizeF(w,h); >+} >+ >+QRectF QRectF::unite(const QRectF &r) const >+{ >+ if (r.isEmpty()) >+ return *this; >+ >+ if (isEmpty()) >+ return r; >+ >+ float nx, ny, nw, nh; >+ >+ nx = min(xp, r.xp); >+ ny = min(yp, r.yp); >+ >+ if (xp + w >= r.xp + r.w) { >+ nw = xp + w - nx; >+ } else { >+ nw = r.xp + r.w - nx; >+ } >+ >+ if (yp + h >= r.yp + r.h) { >+ nh = yp + h - ny; >+ } else { >+ nh = r.yp + r.h - ny; >+ } >+ >+ return QRectF(nx, ny, nw, nh); >+} >+ >+QRectF QRectF::normalize() const >+{ >+ QRectF newRect; >+ >+ newRect.xp = (w < 0.0f) ? (xp - w) : xp; >+ newRect.w = (w < 0.0f) ? -w : w; >+ >+ newRect.yp = (h < 0.0f) ? (yp - h) : yp; >+ newRect.h = (h < 0.0f) ? -h : h; >+ >+ return newRect; >+} >+ >+bool QRectF::intersects(const QRectF &r) const >+{ >+ return intersect(r).isValid(); >+} >+ >+QRectF QRectF::intersect(const QRectF &r) const >+{ >+ float nx, ny, nw, nh; >+ >+ nx = max(xp, r.xp); >+ ny = max(yp, r.yp); >+ >+ if (xp + w <= r.xp + r.w) { >+ nw = xp + w - nx; >+ } else { >+ nw = r.xp + r.w - nx; >+ } >+ >+ if (yp + h <= r.yp + r.h) { >+ nh = yp + h - ny; >+ } else { >+ nh = r.yp + r.h - ny; >+ } >+ >+ return QRectF(nx, ny, nw, nh); >+} >+ >+void QRectF::inflate(float s) >+{ >+ xp -= s; >+ yp -= s; >+ w += 2.0f * s; >+ h += 2.0f * s; >+} >+ >+#ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES >+QRectF::operator NSRect() const >+{ >+ return NSMakeRect(xp, yp, w, h); >+} >+#endif >+ >+QRectF::operator CGRect() const >+{ >+ return CGRectMake(xp, yp, w, h); >+} >+ >+QRect QRectF::toRect() const >+{ >+ return QRect(int(xp), int(yp), int(w), int(h)); >+} >+bool operator==(const QRectF &a, const QRectF &b) >+{ >+ return a.xp == b.xp && a.yp == b.yp && a.w == b.w && a.h == b.h; >+} >+ >+bool operator!=(const QRectF &a, const QRectF &b) >+{ >+ return !(a == b); >+} >+ >+ >Index: kwq/KWQSizeF.h >=================================================================== >diff -Npu kwq/KWQSizeF.h >--- kwq/KWQSizeF.h 1 Jan 1970 00:00:00 -0000 >+++ kwq/KWQSizeF.h 18 Oct 2005 12:15:24 -0000 >@@ -0,0 +1,76 @@ >+/* >+ * Copyright (C) 2003 Apple Computer, Inc. All rights reserved. >+ * Copyright (C) 2005 Nokia. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef QSIZEF_H_ >+#define QSIZEF_H_ >+ >+#include "KWQDef.h" >+ >+// workaround for <rdar://problem/4294625> >+#if ! __LP64__ && ! NS_BUILD_32_LIKE_64 >+#undef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES >+#endif >+ >+#ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES >+typedef struct CGSize NSSize; >+#else >+typedef struct _NSSize NSSize; >+#endif >+typedef struct CGSize CGSize; >+class QSize; >+ >+class QSizeF { >+public: >+ QSizeF(); >+ QSizeF(float,float); >+ QSizeF(const QSize&); >+#ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES >+ explicit QSizeF(const NSSize &); >+#endif >+ explicit QSizeF(const CGSize &); >+ >+ bool isValid() const; >+ float width() const { return w; } >+ float height() const { return h; } >+ void setWidth(float width) { w = width; } >+ void setHeight(float height) { h = height; } >+ QSizeF expandedTo(const QSizeF &) const; >+ >+#ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES >+ operator NSSize() const; >+#endif >+ operator CGSize() const; >+ >+ friend QSizeF operator+(const QSizeF &, const QSizeF &); >+ friend bool operator==(const QSizeF &, const QSizeF &); >+ friend bool operator!=(const QSizeF &, const QSizeF &); >+ >+private: >+ float w; >+ float h; >+}; >+ >+#endif >Index: kwq/KWQSizeF.mm >=================================================================== >diff -Npu kwq/KWQSizeF.mm >--- kwq/KWQSizeF.mm 1 Jan 1970 00:00:00 -0000 >+++ kwq/KWQSizeF.mm 18 Oct 2005 12:30:23 -0000 >@@ -0,0 +1,89 @@ >+/* >+ * Copyright (C) 2003 Apple Computer, Inc. All rights reserved. >+ * Copyright (C) 2005 Nokia. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#import "KWQSizeF.h" >+#import "KWQSize.h" >+ >+QSizeF::QSizeF() : w(-1.0f), h(-1.0f) >+{ >+} >+ >+QSizeF::QSizeF(float width, float height) : w(width), h(height) >+{ >+} >+ >+QSizeF::QSizeF(const QSize& o) : w(o.width()), h(o.height()) >+{ >+} >+ >+#ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES >+QSizeF::QSizeF(const NSSize &s) : w(s.width), h(s.height) >+{ >+} >+#endif >+ >+QSizeF::QSizeF(const CGSize &s) : w(s.width), h(s.height) >+{ >+} >+ >+bool QSizeF::isValid() const >+{ >+ return w >= 0.0f && h >= 0.0f; >+} >+ >+QSizeF QSizeF::expandedTo(const QSizeF &o) const >+{ >+ return QSizeF(w > o.w ? w : o.w, h > o.h ? h : o.h); >+} >+ >+#ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES >+QSizeF::operator NSSize() const >+{ >+ return NSMakeSize(w, h); >+} >+#endif >+ >+QSizeF::operator CGSize() const >+{ >+ return CGSizeMake(w, h); >+} >+ >+QSizeF operator+(const QSizeF &a, const QSizeF &b) >+{ >+ return QSizeF(a.w + b.w, a.h + b.h); >+} >+ >+bool operator==(const QSizeF &a, const QSizeF &b) >+{ >+ return a.w == b.w && a.h == b.h; >+} >+ >+bool operator!=(const QSizeF &a, const QSizeF &b) >+{ >+ return a.w != b.w || a.h != b.h; >+} >+ >Index: WebCore/WebCore.xcodeproj/project.pbxproj >=================================================================== >RCS file: /cvs/root/WebCore/WebCore.xcodeproj/project.pbxproj,v >retrieving revision 1.34 >diff -p -u -r1.34 WebCore/WebCore.xcodeproj/project.pbxproj >--- WebCore/WebCore.xcodeproj/project.pbxproj 9 Oct 2005 04:17:33 -0000 1.34 >+++ WebCore/WebCore.xcodeproj/project.pbxproj 18 Oct 2005 14:24:37 -0000 >@@ -9,6 +9,12 @@ > /* Begin PBXBuildFile section */ > 1A69D381085627410009880D /* domparser.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A69D37F085627410009880D /* domparser.h */; }; > 1A69D382085627410009880D /* domparser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A69D380085627410009880D /* domparser.cpp */; }; >+ 47AF53E00905299F006B77DE /* KWQPointF.h in Headers */ = {isa = PBXBuildFile; fileRef = 47AF50F709051B5E006B77DE /* KWQPointF.h */; }; >+ 47AF53E10905299F006B77DE /* KWQPointF.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47AF50F809051B5E006B77DE /* KWQPointF.mm */; }; >+ 47AF53E20905299F006B77DE /* KWQRectF.h in Headers */ = {isa = PBXBuildFile; fileRef = 47AF50F909051B5E006B77DE /* KWQRectF.h */; }; >+ 47AF53E30905299F006B77DE /* KWQRectF.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47AF50FA09051B5E006B77DE /* KWQRectF.mm */; }; >+ 47AF53E40905299F006B77DE /* KWQSizeF.h in Headers */ = {isa = PBXBuildFile; fileRef = 47AF50FB09051B5E006B77DE /* KWQSizeF.h */; }; >+ 47AF53E50905299F006B77DE /* KWQSizeF.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47AF50FC09051B5E006B77DE /* KWQSizeF.mm */; }; > 550A0BC9085F6039007353D6 /* dom_qname.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* dom_qname.cpp */; }; > 550A0BCA085F6039007353D6 /* dom_qname.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* dom_qname.h */; }; > 550A0BCD085F604D007353D6 /* htmlnames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BCB085F604D007353D6 /* htmlnames.cpp */; }; >@@ -2372,6 +2378,12 @@ > 2D90660B0665D937006B6F1A /* KWQClipboard.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KWQClipboard.h; sourceTree = "<group>"; }; > 2D90660C0665D937006B6F1A /* KWQClipboard.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQClipboard.mm; sourceTree = "<group>"; }; > 4758C44308C5F217009BAF05 /* KCanvasPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KCanvasPath.cpp; sourceTree = "<group>"; }; >+ 47AF50F709051B5E006B77DE /* KWQPointF.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KWQPointF.h; sourceTree = "<group>"; }; >+ 47AF50F809051B5E006B77DE /* KWQPointF.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQPointF.mm; sourceTree = "<group>"; }; >+ 47AF50F909051B5E006B77DE /* KWQRectF.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KWQRectF.h; sourceTree = "<group>"; }; >+ 47AF50FA09051B5E006B77DE /* KWQRectF.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQRectF.mm; sourceTree = "<group>"; }; >+ 47AF50FB09051B5E006B77DE /* KWQSizeF.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KWQSizeF.h; sourceTree = "<group>"; }; >+ 47AF50FC09051B5E006B77DE /* KWQSizeF.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQSizeF.mm; sourceTree = "<group>"; }; > 51111AC007BD812C00B7162C /* DOMUtility.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMUtility.mm; sourceTree = "<group>"; }; > 5150C2A10702629000AF642C /* WebDashboardRegion.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebDashboardRegion.h; sourceTree = "<group>"; }; > 5150C2A50702629800AF642C /* WebDashboardRegion.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WebDashboardRegion.m; sourceTree = "<group>"; }; >@@ -6781,6 +6793,12 @@ > F587871802DE3B8801EA4122 /* qt */ = { > isa = PBXGroup; > children = ( >+ 47AF50F709051B5E006B77DE /* KWQPointF.h */, >+ 47AF50F809051B5E006B77DE /* KWQPointF.mm */, >+ 47AF50F909051B5E006B77DE /* KWQRectF.h */, >+ 47AF50FA09051B5E006B77DE /* KWQRectF.mm */, >+ 47AF50FB09051B5E006B77DE /* KWQSizeF.h */, >+ 47AF50FC09051B5E006B77DE /* KWQSizeF.mm */, > F587867602DE3B8601EA4122 /* KWQApplication.h */, > F587867702DE3B8601EA4122 /* KWQMemArray.h */, > F58784C502DE375801EA4122 /* KWQArrayImpl.h */, >@@ -8138,6 +8156,9 @@ > A8EA434B08E14EAC004BC396 /* dom_kdomdocumentwrapper.h in Headers */, > 65C97AF408EA908800ACD273 /* config.h in Headers */, > E1EE773908F1086C00166870 /* WebCoreTextDecoder.h in Headers */, >+ 47AF53E00905299F006B77DE /* KWQPointF.h in Headers */, >+ 47AF53E20905299F006B77DE /* KWQRectF.h in Headers */, >+ 47AF53E40905299F006B77DE /* KWQSizeF.h in Headers */, > ); > runOnlyForDeploymentPostprocessing = 0; > }; >@@ -10343,6 +10364,9 @@ > A8EA434C08E14EAC004BC396 /* dom_kdomdocumentwrapper.cpp in Sources */, > A863312F08E3AB25009CFEF4 /* CDFInterface.cpp in Sources */, > E1EE773A08F1086C00166870 /* WebCoreTextDecoder.mm in Sources */, >+ 47AF53E10905299F006B77DE /* KWQPointF.mm in Sources */, >+ 47AF53E30905299F006B77DE /* KWQRectF.mm in Sources */, >+ 47AF53E50905299F006B77DE /* KWQSizeF.mm in Sources */, > ); > runOnlyForDeploymentPostprocessing = 0; > };
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 4462
:
3898
|
3903
|
3904
|
3905
|
3908
|
3910
|
4399
|
4400
|
4401
|
5378
|
5379
|
5441
|
5443