Bug 641426. Part 3: Convert gfxRect::pos/size to x/y/width/height. r=joe,sr=cjones
authorRobert O'Callahan <robert@ocallahan.org>
Tue, 19 Apr 2011 15:07:21 +1200
changeset 68276 1baef3c464337523b0878573ae4bc706e9340d11
parent 68275 12f37ad53b412057e9e98bbab58f444b6fb7aa6d
child 68277 2629bcfa2816c709f11a57e39dd2e4976034656a
push idunknown
push userunknown
push dateunknown
reviewersjoe, cjones
bugs641426
milestone6.0a1
Bug 641426. Part 3: Convert gfxRect::pos/size to x/y/width/height. r=joe,sr=cjones
content/canvas/src/nsCanvasRenderingContext2D.cpp
gfx/layers/ImageLayers.h
gfx/src/nsRenderingContext.cpp
gfx/thebes/gfxContext.cpp
gfx/thebes/gfxFont.cpp
gfx/thebes/gfxRect.cpp
gfx/thebes/gfxRect.h
layout/base/nsCSSRendering.cpp
layout/base/nsCSSRenderingBorders.cpp
layout/base/nsLayoutUtils.cpp
layout/generic/nsObjectFrame.cpp
layout/mathml/nsMathMLmencloseFrame.cpp
layout/svg/base/src/nsSVGFilterInstance.cpp
layout/svg/base/src/nsSVGPathGeometryFrame.cpp
layout/svg/base/src/nsSVGUtils.cpp
widget/src/windows/nsNativeThemeWin.cpp
--- a/content/canvas/src/nsCanvasRenderingContext2D.cpp
+++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp
@@ -2764,17 +2764,17 @@ nsCanvasRenderingContext2D::DrawOrMeasur
     default:
         NS_ERROR("mTextBaseline holds invalid value");
         return NS_ERROR_FAILURE;
     }
 
     processor.mPt.y += anchorY;
 
     // correct bounding box to get it to be the correct size/position
-    processor.mBoundingBox.size.width = totalWidth;
+    processor.mBoundingBox.width = totalWidth;
     processor.mBoundingBox.MoveBy(processor.mPt);
 
     processor.mPt.x *= processor.mAppUnitsPerDevPixel;
     processor.mPt.y *= processor.mAppUnitsPerDevPixel;
 
     // if text is over aMaxWidth, then scale the text horizontally such that its
     // width is precisely aMaxWidth
     gfxContextAutoSaveRestore autoSR;
--- a/gfx/layers/ImageLayers.h
+++ b/gfx/layers/ImageLayers.h
@@ -339,17 +339,17 @@ public:
   MOZ_LAYER_DECL_NAME("ImageLayer", TYPE_IMAGE)
 
   virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface)
   {
     // Snap image edges to pixel boundaries
     gfxRect snap(0, 0, 0, 0);
     if (mContainer) {
       gfxIntSize size = mContainer->GetCurrentSize();
-      snap.size = gfxSize(size.width, size.height);
+      snap.SizeTo(gfxSize(size.width, size.height));
     }
     // Snap our local transform first, and snap the inherited transform as well.
     // This makes our snapping equivalent to what would happen if our content
     // was drawn into a ThebesLayer (gfxContext would snap using the local
     // transform, then we'd snap again when compositing the ThebesLayer).
     mEffectiveTransform =
         SnapTransform(GetLocalTransform(), snap, nsnull)*
         SnapTransform(aTransformToSurface, gfxRect(0, 0, 0, 0), nsnull);
--- a/gfx/src/nsRenderingContext.cpp
+++ b/gfx/src/nsRenderingContext.cpp
@@ -303,36 +303,36 @@ nsRenderingContext::DrawRect(nscoord aX,
 static PRBool
 ConditionRect(gfxRect& r) {
     // if either x or y is way out of bounds;
     // note that we don't handle negative w/h here
     if (r.X() > CAIRO_COORD_MAX || r.Y() > CAIRO_COORD_MAX)
         return PR_FALSE;
 
     if (r.X() < 0.0) {
-        r.size.width += r.X();
-        if (r.size.width < 0.0)
+        r.width += r.X();
+        if (r.width < 0.0)
             return PR_FALSE;
-        r.pos.x = 0.0;
+        r.x = 0.0;
     }
 
     if (r.XMost() > CAIRO_COORD_MAX) {
-        r.size.width = CAIRO_COORD_MAX - r.X();
+        r.width = CAIRO_COORD_MAX - r.X();
     }
 
     if (r.Y() < 0.0) {
-        r.size.height += r.Y();
+        r.height += r.Y();
         if (r.Height() < 0.0)
             return PR_FALSE;
 
-        r.pos.y = 0.0;
+        r.y = 0.0;
     }
 
     if (r.YMost() > CAIRO_COORD_MAX) {
-        r.size.height = CAIRO_COORD_MAX - r.Y();
+        r.height = CAIRO_COORD_MAX - r.Y();
     }
     return PR_TRUE;
 }
 
 void
 nsRenderingContext::FillRect(const nsRect& aRect)
 {
     gfxRect r(GFX_RECT_FROM_TWIPS_RECT(aRect));
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -357,18 +357,18 @@ gfxContext::DeviceToUser(const gfxSize& 
     cairo_device_to_user_distance(mCairo, &ret.width, &ret.height);
     return ret;
 }
 
 gfxRect
 gfxContext::DeviceToUser(const gfxRect& rect) const
 {
     gfxRect ret = rect;
-    cairo_device_to_user(mCairo, &ret.pos.x, &ret.pos.y);
-    cairo_device_to_user_distance(mCairo, &ret.size.width, &ret.size.height);
+    cairo_device_to_user(mCairo, &ret.x, &ret.y);
+    cairo_device_to_user_distance(mCairo, &ret.width, &ret.height);
     return ret;
 }
 
 gfxPoint
 gfxContext::UserToDevice(const gfxPoint& point) const
 {
     gfxPoint ret = point;
     cairo_user_to_device(mCairo, &ret.x, &ret.y);
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -3619,22 +3619,22 @@ gfxTextRun::AccumulatePartialLigatureMet
                             aProvider, aStart, aEnd, &metrics);
 
     // Clip the bounding box to the ligature part
     gfxFloat bboxLeft = metrics.mBoundingBox.X();
     gfxFloat bboxRight = metrics.mBoundingBox.XMost();
     // Where we are going to start "drawing" relative to our left baseline origin
     gfxFloat origin = IsRightToLeft() ? metrics.mAdvanceWidth - data.mPartAdvance : 0;
     ClipPartialLigature(this, &bboxLeft, &bboxRight, origin, &data);
-    metrics.mBoundingBox.pos.x = bboxLeft;
-    metrics.mBoundingBox.size.width = bboxRight - bboxLeft;
+    metrics.mBoundingBox.x = bboxLeft;
+    metrics.mBoundingBox.width = bboxRight - bboxLeft;
 
     // mBoundingBox is now relative to the left baseline origin for the entire
     // ligature. Shift it left.
-    metrics.mBoundingBox.pos.x -=
+    metrics.mBoundingBox.x -=
         IsRightToLeft() ? metrics.mAdvanceWidth - (data.mPartAdvance + data.mPartWidth)
             : data.mPartAdvance;    
     metrics.mAdvanceWidth = data.mPartWidth;
 
     aMetrics->CombineWith(metrics, IsRightToLeft());
 }
 
 gfxTextRun::Metrics
--- a/gfx/thebes/gfxRect.cpp
+++ b/gfx/thebes/gfxRect.cpp
@@ -92,66 +92,66 @@ WithinEpsilonOfInteger(gfxFloat aX, gfxF
 {
     return fabs(NS_round(aX) - aX) <= fabs(aEpsilon);
 }
 
 PRBool
 gfxRect::WithinEpsilonOfIntegerPixels(gfxFloat aEpsilon) const
 {
     NS_ASSERTION(-0.5 < aEpsilon && aEpsilon < 0.5, "Nonsense epsilon value");
-    return (WithinEpsilonOfInteger(pos.x, aEpsilon) &&
-            WithinEpsilonOfInteger(pos.y, aEpsilon) &&
-            WithinEpsilonOfInteger(size.width, aEpsilon) &&
-            WithinEpsilonOfInteger(size.height, aEpsilon));
+    return (WithinEpsilonOfInteger(x, aEpsilon) &&
+            WithinEpsilonOfInteger(y, aEpsilon) &&
+            WithinEpsilonOfInteger(width, aEpsilon) &&
+            WithinEpsilonOfInteger(height, aEpsilon));
 }
 
 void
 gfxRect::Round()
 {
     // Note that don't use NS_round here. See the comment for this method in gfxRect.h
     gfxFloat x0 = NS_floor(X() + 0.5);
     gfxFloat y0 = NS_floor(Y() + 0.5);
     gfxFloat x1 = NS_floor(XMost() + 0.5);
     gfxFloat y1 = NS_floor(YMost() + 0.5);
 
-    pos.x = x0;
-    pos.y = y0;
+    x = x0;
+    y = y0;
 
-    size.width = x1 - x0;
-    size.height = y1 - y0;
+    width = x1 - x0;
+    height = y1 - y0;
 }
 
 void
 gfxRect::RoundIn()
 {
     gfxFloat x0 = NS_ceil(X());
     gfxFloat y0 = NS_ceil(Y());
     gfxFloat x1 = NS_floor(XMost());
     gfxFloat y1 = NS_floor(YMost());
 
-    pos.x = x0;
-    pos.y = y0;
+    x = x0;
+    y = y0;
 
-    size.width = x1 - x0;
-    size.height = y1 - y0;
+    width = x1 - x0;
+    height = y1 - y0;
 }
 
 void
 gfxRect::RoundOut()
 {
     gfxFloat x0 = NS_floor(X());
     gfxFloat y0 = NS_floor(Y());
     gfxFloat x1 = NS_ceil(XMost());
     gfxFloat y1 = NS_ceil(YMost());
 
-    pos.x = x0;
-    pos.y = y0;
+    x = x0;
+    y = y0;
 
-    size.width = x1 - x0;
-    size.height = y1 - y0;
+    width = x1 - x0;
+    height = y1 - y0;
 }
 
 /* Clamp r to CAIRO_COORD_MIN .. CAIRO_COORD_MAX
  * these are to be device coordinates.
  *
  * Cairo is currently using 24.8 fixed point,
  * so -2^24 .. 2^24-1 is our valid
  */
@@ -159,40 +159,40 @@ gfxRect::RoundOut()
 #define CAIRO_COORD_MAX (16777215.0)
 #define CAIRO_COORD_MIN (-16777216.0)
 
 void
 gfxRect::Condition()
 {
     // if either x or y is way out of bounds;
     // note that we don't handle negative w/h here
-    if (pos.x > CAIRO_COORD_MAX) {
-        pos.x = CAIRO_COORD_MAX;
-        size.width = 0.0;
+    if (x > CAIRO_COORD_MAX) {
+        x = CAIRO_COORD_MAX;
+        width = 0.0;
     } 
 
-    if (pos.y > CAIRO_COORD_MAX) {
-        pos.y = CAIRO_COORD_MAX;
-        size.height = 0.0;
+    if (y > CAIRO_COORD_MAX) {
+        y = CAIRO_COORD_MAX;
+        height = 0.0;
     }
 
-    if (pos.x < CAIRO_COORD_MIN) {
-        size.width += pos.x - CAIRO_COORD_MIN;
-        if (size.width < 0.0)
-            size.width = 0.0;
-        pos.x = CAIRO_COORD_MIN;
+    if (x < CAIRO_COORD_MIN) {
+        width += x - CAIRO_COORD_MIN;
+        if (width < 0.0)
+            width = 0.0;
+        x = CAIRO_COORD_MIN;
     }
 
-    if (pos.y < CAIRO_COORD_MIN) {
-        size.height += pos.y - CAIRO_COORD_MIN;
-        if (size.height < 0.0)
-            size.height = 0.0;
-        pos.y = CAIRO_COORD_MIN;
+    if (y < CAIRO_COORD_MIN) {
+        height += y - CAIRO_COORD_MIN;
+        if (height < 0.0)
+            height = 0.0;
+        y = CAIRO_COORD_MIN;
     }
 
-    if (pos.x + size.width > CAIRO_COORD_MAX) {
-        size.width = CAIRO_COORD_MAX - pos.x;
+    if (x + width > CAIRO_COORD_MAX) {
+        width = CAIRO_COORD_MAX - x;
     }
 
-    if (pos.y + size.height > CAIRO_COORD_MAX) {
-        size.height = CAIRO_COORD_MAX - pos.y;
+    if (y + height > CAIRO_COORD_MAX) {
+        height = CAIRO_COORD_MAX - y;
     }
 }
--- a/gfx/thebes/gfxRect.h
+++ b/gfx/thebes/gfxRect.h
@@ -68,130 +68,126 @@ namespace mozilla {
 
 static inline mozilla::css::Corner operator++(mozilla::css::Corner& corner, int) {
     NS_PRECONDITION(corner >= NS_CORNER_TOP_LEFT &&
                     corner < NS_NUM_CORNERS, "Out of range corner");
     corner = mozilla::css::Corner(corner + 1);
     return corner;
 }
 
-struct THEBES_API gfxRect {
-    // pt? point?
-    gfxPoint pos;
-    gfxSize size;
+struct THEBES_API gfxRect
+{
+    gfxFloat x, y;
+    gfxFloat width, height;
 
     gfxRect() {}
-    gfxRect(const gfxPoint& _pos, const gfxSize& _size) : pos(_pos), size(_size) {}
+    gfxRect(const gfxPoint& _pos, const gfxSize& _size) :
+        x(_pos.x), y(_pos.y), width(_size.width), height(_size.height) {}
     gfxRect(gfxFloat _x, gfxFloat _y, gfxFloat _width, gfxFloat _height) :
-        pos(_x, _y), size(_width, _height) {}
+        x(_x), y(_y), width(_width), height(_height) {}
 
     int operator==(const gfxRect& s) const {
-        return (pos == s.pos) && (size == s.size);
+        return x == s.x && y == s.y && width == s.width && height == s.height;
     }
     int operator!=(const gfxRect& s) const {
-        return (pos != s.pos) || (size != s.size);
+        return !(*this == s);
     }
 
-    void MoveTo(const gfxPoint& aPt) { pos = aPt; }
+    void MoveTo(const gfxPoint& aPt) { x = aPt.x; y = aPt.y; }
     const gfxRect& MoveBy(const gfxPoint& aPt) {
-        pos = pos + aPt;
+        x += aPt.x;
+        y += aPt.y;
         return *this;
     }
-    void SizeTo(const gfxSize& aSize) { size = aSize; }
+    void SizeTo(const gfxSize& aSize) { width = aSize.width; height = aSize.height; }
 
     gfxRect operator+(const gfxPoint& aPt) const {
-        return gfxRect(pos + aPt, size);
+        return gfxRect(x + aPt.x, y + aPt.y, width, height);
     }
     gfxRect operator-(const gfxPoint& aPt) const {
-        return gfxRect(pos - aPt, size);
+        return gfxRect(x - aPt.x, y - aPt.y, width, height);
     }
     gfxRect operator+(const gfxSize& aSize) const {
-        return gfxRect(pos + gfxPoint(aSize.width, aSize.height), size);
+        return gfxRect(x + aSize.width, y + aSize.height, width, height);
     }
     gfxRect operator-(const gfxSize& aSize) const {
-        return gfxRect(pos - gfxPoint(aSize.width, aSize.height), size);
+        return gfxRect(x - aSize.width, y - aSize.height, width, height);
     }
     gfxRect operator*(const gfxFloat aScale) const {
-        return gfxRect(pos * aScale, size * aScale);
+        return gfxRect(x * aScale, y * aScale, width * aScale, height * aScale);
     }
 
     const gfxRect& operator+=(const gfxPoint& aPt) {
-        pos += aPt;
+        x += aPt.x;
+        y += aPt.y;
         return *this;
     }
     const gfxRect& operator-=(const gfxPoint& aPt) {
-        pos -= aPt;
-        return *this;
-    }
-    const gfxRect& operator+=(const gfxSize& aSize) {
-        pos += gfxPoint(aSize.width, aSize.height);
-        return *this;
-    }
-    const gfxRect& operator-=(const gfxSize& aSize) {
-        pos -= gfxPoint(aSize.width, aSize.height);
+        x -= aPt.x;
+        y -= aPt.y;
         return *this;
     }
 
-    gfxFloat Width() const { return size.width; }
-    gfxFloat Height() const { return size.height; }
-    gfxFloat X() const { return pos.x; }
-    gfxFloat Y() const { return pos.y; }
-    gfxFloat XMost() const { return pos.x + size.width; }
-    gfxFloat YMost() const { return pos.y + size.height; }
+    gfxFloat Width() const { return width; }
+    gfxFloat Height() const { return height; }
+    gfxFloat X() const { return x; }
+    gfxFloat Y() const { return y; }
+    gfxFloat XMost() const { return x + width; }
+    gfxFloat YMost() const { return y + height; }
 
-    PRBool IsEmpty() const { return size.width <= 0 || size.height <= 0; }
+    PRBool IsEmpty() const { return width <= 0 || height <= 0; }
     gfxRect Intersect(const gfxRect& aRect) const;
     gfxRect Union(const gfxRect& aRect) const;
     PRBool Contains(const gfxRect& aRect) const;
     PRBool Contains(const gfxPoint& aPoint) const;
 
     /**
      * Return true if all components of this rect are within
      * aEpsilon of integer coordinates, defined as
      *   |round(coord) - coord| <= |aEpsilon|
      * for x,y,width,height.
      */
     PRBool WithinEpsilonOfIntegerPixels(gfxFloat aEpsilon) const;
 
-    gfxSize Size() const { return size; }
+    gfxSize Size() const { return gfxSize(width, height); }
 
     void Inset(gfxFloat k) {
-        pos.x += k;
-        pos.y += k;
-        size.width = PR_MAX(0.0, size.width - k * 2.0);
-        size.height = PR_MAX(0.0, size.height - k * 2.0);
+        x += k;
+        y += k;
+        width = PR_MAX(0.0, width - k * 2.0);
+        height = PR_MAX(0.0, height - k * 2.0);
     }
 
     void Inset(gfxFloat top, gfxFloat right, gfxFloat bottom, gfxFloat left) {
-        pos.x += left;
-        pos.y += top;
-        size.width = PR_MAX(0.0, size.width - (right+left));
-        size.height = PR_MAX(0.0, size.height - (bottom+top));
+        x += left;
+        y += top;
+        width = PR_MAX(0.0, width - (right+left));
+        height = PR_MAX(0.0, height - (bottom+top));
     }
 
     void Inset(const gfxFloat *sides) {
         Inset(sides[0], sides[1], sides[2], sides[3]);
     }
 
     void Inset(const gfxIntSize& aSize) {
         Inset(aSize.height, aSize.width, aSize.height, aSize.width);
     }
 
     void Outset(gfxFloat k) {
-        pos.x -= k;
-        pos.y -= k;
-        size.width = PR_MAX(0.0, size.width + k * 2.0);
-        size.height = PR_MAX(0.0, size.height + k * 2.0);
+        x -= k;
+        y -= k;
+        width = PR_MAX(0.0, width + k * 2.0);
+        height = PR_MAX(0.0, height + k * 2.0);
     }
 
     void Outset(gfxFloat top, gfxFloat right, gfxFloat bottom, gfxFloat left) {
-        pos.x -= left;
-        pos.y -= top;
-        size.width = PR_MAX(0.0, size.width + (right+left));
-        size.height = PR_MAX(0.0, size.height + (bottom+top));
+        x -= left;
+        y -= top;
+        width = PR_MAX(0.0, width + (right+left));
+        height = PR_MAX(0.0, height + (bottom+top));
     }
 
     void Outset(const gfxFloat *sides) {
         Outset(sides[0], sides[1], sides[2], sides[3]);
     }
 
     void Outset(const gfxIntSize& aSize) {
         Outset(aSize.height, aSize.width, aSize.height, aSize.width);
@@ -214,21 +210,21 @@ struct THEBES_API gfxRect {
     // original rectangle contains the resulting rectangle.
     void RoundIn();
     
     // Snap the rectangle edges to integer coordinates, such that the
     // resulting rectangle contains the original rectangle.
     void RoundOut();
 
     // grabbing specific points
-    gfxPoint TopLeft() const { return gfxPoint(pos); }
-    gfxPoint TopRight() const { return pos + gfxPoint(size.width, 0.0); }
-    gfxPoint BottomLeft() const { return pos + gfxPoint(0.0, size.height); }
-    gfxPoint BottomRight() const { return pos + gfxPoint(size.width, size.height); }
-    gfxPoint Center() const { return pos + gfxPoint(size.width, size.height)/2.0; }
+    gfxPoint TopLeft() const { return gfxPoint(x, y); }
+    gfxPoint TopRight() const { return gfxPoint(x, y) + gfxPoint(width, 0.0); }
+    gfxPoint BottomLeft() const { return gfxPoint(x, y) + gfxPoint(0.0, height); }
+    gfxPoint BottomRight() const { return gfxPoint(x, y) + gfxPoint(width, height); }
+    gfxPoint Center() const { return gfxPoint(x, y) + gfxPoint(width, height)/2.0; }
 
     gfxPoint AtCorner(mozilla::css::Corner corner) const {
         switch (corner) {
             case NS_CORNER_TOP_LEFT: return TopLeft();
             case NS_CORNER_TOP_RIGHT: return TopRight();
             case NS_CORNER_BOTTOM_RIGHT: return BottomRight();
             case NS_CORNER_BOTTOM_LEFT: return BottomLeft();
             default:
@@ -267,37 +263,37 @@ struct THEBES_API gfxRect {
     /* Conditions this border to Cairo's max coordinate space.
      * The caller can check IsEmpty() after Condition() -- if it's TRUE,
      * the caller can possibly avoid doing any extra rendering.
      */
     void Condition();
 
     void Scale(gfxFloat k) {
         NS_ASSERTION(k >= 0.0, "Invalid (negative) scale factor");
-        pos.x *= k;
-        pos.y *= k;
-        size.width *= k;
-        size.height *= k;
+        x *= k;
+        y *= k;
+        width *= k;
+        height *= k;
     }
 
     void Scale(gfxFloat sx, gfxFloat sy) {
         NS_ASSERTION(sx >= 0.0, "Invalid (negative) scale factor");
         NS_ASSERTION(sy >= 0.0, "Invalid (negative) scale factor");
-        pos.x *= sx;
-        pos.y *= sy;
-        size.width *= sx;
-        size.height *= sy;
+        x *= sx;
+        y *= sy;
+        width *= sx;
+        height *= sy;
     }
 
     void ScaleInverse(gfxFloat k) {
         NS_ASSERTION(k > 0.0, "Invalid (negative) scale factor");
-        pos.x /= k;
-        pos.y /= k;
-        size.width /= k;
-        size.height /= k;
+        x /= k;
+        y /= k;
+        width /= k;
+        height /= k;
     }
 };
 
 struct THEBES_API gfxCornerSizes {
     gfxSize sizes[NS_NUM_CORNERS];
 
     gfxCornerSizes () { }
 
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -3440,17 +3440,17 @@ nsCSSRendering::PaintDecorationLine(gfxC
       aGfxContext->Save();
       contextIsSaved = PR_TRUE;
       aGfxContext->Clip(rect);
       gfxFloat dashWidth = lineHeight * DOT_LENGTH * DASH_LENGTH;
       gfxFloat dash[2] = { dashWidth, dashWidth };
       aGfxContext->SetLineCap(gfxContext::LINE_CAP_BUTT);
       aGfxContext->SetDash(dash, 2, 0.0);
       // We should continue to draw the last dash even if it is not in the rect.
-      rect.size.width += dashWidth;
+      rect.width += dashWidth;
       break;
     }
     case NS_STYLE_TEXT_DECORATION_STYLE_DOTTED: {
       aGfxContext->Save();
       contextIsSaved = PR_TRUE;
       aGfxContext->Clip(rect);
       gfxFloat dashWidth = lineHeight * DOT_LENGTH;
       gfxFloat dash[2];
@@ -3459,17 +3459,17 @@ nsCSSRendering::PaintDecorationLine(gfxC
         dash[1] = dashWidth * 2.0;
         aGfxContext->SetLineCap(gfxContext::LINE_CAP_ROUND);
       } else {
         dash[0] = dashWidth;
         dash[1] = dashWidth;
       }
       aGfxContext->SetDash(dash, 2, 0.0);
       // We should continue to draw the last dot even if it is not in the rect.
-      rect.size.width += dashWidth;
+      rect.width += dashWidth;
       break;
     }
     case NS_STYLE_TEXT_DECORATION_STYLE_WAVY:
       aGfxContext->Save();
       contextIsSaved = PR_TRUE;
       aGfxContext->Clip(rect);
       if (lineHeight > 2.0) {
         aGfxContext->SetAntialiasMode(gfxContext::MODE_COVERAGE);
@@ -3481,17 +3481,17 @@ nsCSSRendering::PaintDecorationLine(gfxC
       }
       break;
     default:
       NS_ERROR("Invalid style value!");
       return;
   }
 
   // The y position should be set to the middle of the line.
-  rect.pos.y += lineHeight / 2;
+  rect.y += lineHeight / 2;
 
   aGfxContext->SetColor(gfxRGBA(aColor));
   aGfxContext->SetLineWidth(lineHeight);
   switch (aStyle) {
     case NS_STYLE_TEXT_DECORATION_STYLE_SOLID:
       aGfxContext->NewPath();
       aGfxContext->MoveTo(rect.TopLeft());
       aGfxContext->LineTo(rect.TopRight());
@@ -3510,17 +3510,17 @@ nsCSSRendering::PaintDecorationLine(gfxC
        * |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX| ^
        * |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX| | lineHeight
        * |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX| v
        * +-------------------------------------------+
        */
       aGfxContext->NewPath();
       aGfxContext->MoveTo(rect.TopLeft());
       aGfxContext->LineTo(rect.TopRight());
-      rect.size.height -= lineHeight;
+      rect.height -= lineHeight;
       aGfxContext->MoveTo(rect.BottomLeft());
       aGfxContext->LineTo(rect.BottomRight());
       aGfxContext->Stroke();
       break;
     case NS_STYLE_TEXT_DECORATION_STYLE_DOTTED:
     case NS_STYLE_TEXT_DECORATION_STYLE_DASHED:
       aGfxContext->NewPath();
       aGfxContext->MoveTo(rect.TopLeft());
@@ -3552,17 +3552,17 @@ nsCSSRendering::PaintDecorationLine(gfxC
        *     the rect;
        *  3. Goes down to bottom of the area at 45 degrees.
        *  4. Slides to right horizontaly, see |flatLengthAtVertex|.
        *  5. Goes up to top of the area at 45 degrees.
        *  6. Slides to right horizontaly.
        *  7. Repeat from 2 until reached to right-most edge of the area.
        */
 
-      rect.pos.x += lineHeight / 2.0;
+      rect.x += lineHeight / 2.0;
       aGfxContext->NewPath();
 
       gfxPoint pt(rect.TopLeft());
       gfxFloat rightMost = pt.x + rect.Width() + lineHeight;
       gfxFloat adv = rect.Height() - lineHeight;
       gfxFloat flatLengthAtVertex = NS_MAX((lineHeight - 1.0) * 2.0, 1.0);
 
       pt.x -= lineHeight;
@@ -3644,17 +3644,17 @@ nsCSSRendering::GetTextDecorationRectInt
 
   gfxFloat lineHeight = NS_round(aLineSize.height);
   lineHeight = NS_MAX(lineHeight, 1.0);
 
   gfxFloat ascent = NS_round(aAscent);
   gfxFloat descentLimit = NS_floor(aDescentLimit);
 
   gfxFloat suggestedMaxRectHeight = NS_MAX(NS_MIN(ascent, descentLimit), 1.0);
-  r.size.height = lineHeight;
+  r.height = lineHeight;
   if (aStyle == NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE) {
     /**
      *  We will draw double line as:
      *
      * +-------------------------------------------+
      * |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX| ^
      * |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX| | lineHeight
      * |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX| v
@@ -3663,46 +3663,46 @@ nsCSSRendering::GetTextDecorationRectInt
      * |                                           | v
      * |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX| ^
      * |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX| | lineHeight
      * |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX| v
      * +-------------------------------------------+
      */
     gfxFloat gap = NS_round(lineHeight / 2.0);
     gap = NS_MAX(gap, 1.0);
-    r.size.height = lineHeight * 2.0 + gap;
+    r.height = lineHeight * 2.0 + gap;
     if (canLiftUnderline) {
       if (r.Height() > suggestedMaxRectHeight) {
         // Don't shrink the line height, because the thickness has some meaning.
         // We can just shrink the gap at this time.
-        r.size.height = NS_MAX(suggestedMaxRectHeight, lineHeight * 2.0 + 1.0);
+        r.height = NS_MAX(suggestedMaxRectHeight, lineHeight * 2.0 + 1.0);
       }
     }
   } else if (aStyle == NS_STYLE_TEXT_DECORATION_STYLE_WAVY) {
     /**
      *  We will draw wavy line as:
      *
      * +-------------------------------------------+
      * |XXXXX            XXXXXX            XXXXXX  | ^
      * |XXXXXX          XXXXXXXX          XXXXXXXX | | lineHeight
      * |XXXXXXX        XXXXXXXXXX        XXXXXXXXXX| v
      * |     XXX      XXX      XXX      XXX      XX|
      * |      XXXXXXXXXX        XXXXXXXXXX        X|
      * |       XXXXXXXX          XXXXXXXX          |
      * |        XXXXXX            XXXXXX           |
      * +-------------------------------------------+
      */
-    r.size.height = lineHeight > 2.0 ? lineHeight * 4.0 : lineHeight * 3.0;
+    r.height = lineHeight > 2.0 ? lineHeight * 4.0 : lineHeight * 3.0;
     if (canLiftUnderline) {
       if (r.Height() > suggestedMaxRectHeight) {
         // Don't shrink the line height even if there is not enough space,
         // because the thickness has some meaning.  E.g., the 1px wavy line and
         // 2px wavy line can be used for different meaning in IME selections
         // at same time.
-        r.size.height = NS_MAX(suggestedMaxRectHeight, lineHeight * 2.0);
+        r.height = NS_MAX(suggestedMaxRectHeight, lineHeight * 2.0);
       }
     }
   }
 
   gfxFloat baseline = NS_floor(aPt.y + aAscent + 0.5);
   gfxFloat offset = 0.0;
   switch (aDecoration) {
     case NS_STYLE_TEXT_DECORATION_UNDERLINE:
@@ -3726,17 +3726,17 @@ nsCSSRendering::GetTextDecorationRectInt
       gfxFloat extra = NS_floor(r.Height() / 2.0 + 0.5);
       extra = NS_MAX(extra, lineHeight);
       offset = aOffset - lineHeight + extra;
       break;
     }
     default:
       NS_ERROR("Invalid decoration value!");
   }
-  r.pos.y = baseline - NS_floor(offset + 0.5);
+  r.y = baseline - NS_floor(offset + 0.5);
   return r;
 }
 
 // ------------------
 // ImageRenderer
 // ------------------
 ImageRenderer::ImageRenderer(nsIFrame* aForFrame,
                              const nsStyleImage* aImage,
--- a/layout/base/nsCSSRenderingBorders.cpp
+++ b/layout/base/nsCSSRenderingBorders.cpp
@@ -389,19 +389,19 @@ nsCSSBorderRenderer::DoSideClipWithoutCo
   // corner indexing; that is, 0 == SIDE_TOP and 0 == CORNER_TOP_LEFT,
   // with both proceeding clockwise.
   gfxSize sideCornerSum = mBorderCornerDimensions[mozilla::css::Corner(aSide)]
                         + mBorderCornerDimensions[mozilla::css::Corner(NEXT_SIDE(aSide))];
   gfxRect rect(mOuterRect.TopLeft() + offset,
                mOuterRect.Size() - sideCornerSum);
 
   if (aSide == NS_SIDE_TOP || aSide == NS_SIDE_BOTTOM)
-    rect.size.height = mBorderWidths[aSide];
+    rect.height = mBorderWidths[aSide];
   else
-    rect.size.width = mBorderWidths[aSide];
+    rect.width = mBorderWidths[aSide];
 
   mContext->Rectangle(rect);
 }
 
 // The side border type and the adjacent border types are
 // examined and one of the different types of clipping (listed
 // below) is selected.
 
@@ -606,34 +606,34 @@ nsCSSBorderRenderer::FillSolidBorder(con
 
   // If two sides meet at a corner that we're rendering, then
   // make sure that we adjust one of the sides to avoid overlap.
   // This is especially important in the case of colors with
   // an alpha channel.
 
   if ((aSides & (SIDE_BIT_TOP | SIDE_BIT_LEFT)) == (SIDE_BIT_TOP | SIDE_BIT_LEFT)) {
     // adjust the left's top down a bit
-    r[NS_SIDE_LEFT].pos.y += aBorderSizes[NS_SIDE_TOP];
-    r[NS_SIDE_LEFT].size.height -= aBorderSizes[NS_SIDE_TOP];
+    r[NS_SIDE_LEFT].y += aBorderSizes[NS_SIDE_TOP];
+    r[NS_SIDE_LEFT].height -= aBorderSizes[NS_SIDE_TOP];
   }
 
   if ((aSides & (SIDE_BIT_TOP | SIDE_BIT_RIGHT)) == (SIDE_BIT_TOP | SIDE_BIT_RIGHT)) {
     // adjust the top's left a bit
-    r[NS_SIDE_TOP].size.width -= aBorderSizes[NS_SIDE_RIGHT];
+    r[NS_SIDE_TOP].width -= aBorderSizes[NS_SIDE_RIGHT];
   }
 
   if ((aSides & (SIDE_BIT_BOTTOM | SIDE_BIT_RIGHT)) == (SIDE_BIT_BOTTOM | SIDE_BIT_RIGHT)) {
     // adjust the right's bottom a bit
-    r[NS_SIDE_RIGHT].size.height -= aBorderSizes[NS_SIDE_BOTTOM];
+    r[NS_SIDE_RIGHT].height -= aBorderSizes[NS_SIDE_BOTTOM];
   }
 
   if ((aSides & (SIDE_BIT_BOTTOM | SIDE_BIT_LEFT)) == (SIDE_BIT_BOTTOM | SIDE_BIT_LEFT)) {
     // adjust the bottom's left a bit
-    r[NS_SIDE_BOTTOM].pos.x += aBorderSizes[NS_SIDE_LEFT];
-    r[NS_SIDE_BOTTOM].size.width -= aBorderSizes[NS_SIDE_LEFT];
+    r[NS_SIDE_BOTTOM].x += aBorderSizes[NS_SIDE_LEFT];
+    r[NS_SIDE_BOTTOM].width -= aBorderSizes[NS_SIDE_LEFT];
   }
 
   // Filling these one by one is faster than filling them all at once.
   for (PRUint32 i = 0; i < 4; i++) {
     if (aSides & (1 << i)) {
       mContext->NewPath();
       mContext->Rectangle(r[i]);
       mContext->Fill();
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -1010,20 +1010,20 @@ nsLayoutUtils::RoundGfxRectToAppRect(con
 {
   /* Get a new gfxRect whose units are app units by scaling by the specified factor. */
   gfxRect scaledRect = aRect * aFactor;
 
   /* Round outward. */
   scaledRect.RoundOut();
 
   /* We now need to constrain our results to the max and min values for coords. */
-  ConstrainToCoordValues(scaledRect.pos.x);
-  ConstrainToCoordValues(scaledRect.pos.y);
-  ConstrainToCoordValues(scaledRect.size.width);
-  ConstrainToCoordValues(scaledRect.size.height);
+  ConstrainToCoordValues(scaledRect.x);
+  ConstrainToCoordValues(scaledRect.y);
+  ConstrainToCoordValues(scaledRect.width);
+  ConstrainToCoordValues(scaledRect.height);
 
   /* Now typecast everything back.  This is guaranteed to be safe. */
   return nsRect(nscoord(scaledRect.X()), nscoord(scaledRect.Y()),
                 nscoord(scaledRect.Width()), nscoord(scaledRect.Height()));
 }
 
 
 nsRegion
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -5995,37 +5995,37 @@ void nsPluginInstanceOwner::Paint(gfxCon
   // to provide crisper and faster drawing.
   gfxRect pluginRect = aFrameRect;
   if (aContext->UserToDevicePixelSnapped(pluginRect)) {
     pluginRect = aContext->DeviceToUser(pluginRect);
   }
 
   // Round out the dirty rect to plugin pixels to ensure the plugin draws
   // enough pixels for interpolation to device pixels.
-  gfxRect dirtyRect = aDirtyRect + -pluginRect.pos;
+  gfxRect dirtyRect = aDirtyRect - pluginRect.TopLeft();
   dirtyRect.RoundOut();
 
   // Plugins can only draw an integer number of pixels.
   //
   // With translation-only transformation matrices, pluginRect is already
   // pixel-aligned.
   //
   // With more complex transformations, modifying the scales in the
   // transformation matrix could retain subpixel accuracy and let the plugin
   // draw a suitable number of pixels for interpolation to device pixels in
   // Renderer::Draw, but such cases are not common enough to warrant the
   // effort now.
-  nsIntSize pluginSize(NS_lround(pluginRect.size.width),
-                       NS_lround(pluginRect.size.height));
+  nsIntSize pluginSize(NS_lround(pluginRect.width),
+                       NS_lround(pluginRect.height));
 
   // Determine what the plugin needs to draw.
-  nsIntRect pluginDirtyRect(PRInt32(dirtyRect.pos.x),
-                            PRInt32(dirtyRect.pos.y),
-                            PRInt32(dirtyRect.size.width),
-                            PRInt32(dirtyRect.size.height));
+  nsIntRect pluginDirtyRect(PRInt32(dirtyRect.x),
+                            PRInt32(dirtyRect.y),
+                            PRInt32(dirtyRect.width),
+                            PRInt32(dirtyRect.height));
   if (!pluginDirtyRect.
       IntersectRect(nsIntRect(0, 0, pluginSize.width, pluginSize.height),
                     pluginDirtyRect))
     return;
 
   NPWindow* window;
   GetWindow(window);
 
@@ -6038,17 +6038,17 @@ void nsPluginInstanceOwner::Paint(gfxCon
 
   PRBool transparent;
   mInstance->IsTransparent(&transparent);
   if (!transparent)
     rendererFlags |= Renderer::DRAW_IS_OPAQUE;
 
   // Renderer::Draw() draws a rectangle with top-left at the aContext origin.
   gfxContextAutoSaveRestore autoSR(aContext);
-  aContext->Translate(pluginRect.pos);
+  aContext->Translate(pluginRect.TopLeft());
 
   Renderer renderer(window, this, pluginSize, pluginDirtyRect);
 #ifdef MOZ_WIDGET_GTK2
   // This is the visual used by the widgets, 24-bit if available.
   GdkVisual* gdkVisual = gdk_rgb_get_visual();
   Visual* visual = gdk_x11_visual_get_xvisual(gdkVisual);
   Screen* screen =
     gdk_x11_screen_get_xscreen(gdk_visual_get_screen(gdkVisual));
--- a/layout/mathml/nsMathMLmencloseFrame.cpp
+++ b/layout/mathml/nsMathMLmencloseFrame.cpp
@@ -779,17 +779,17 @@ void nsDisplayNotation::Paint(nsDisplayL
 
   rect.Inset(e / 2.0);
 
   gfxCtx->NewPath();
 
   switch(mType)
     {
     case NOTATION_CIRCLE:
-      gfxCtx->Ellipse(rect.Center(), rect.size);
+      gfxCtx->Ellipse(rect.Center(), rect.Size());
       break;
 
     case NOTATION_ROUNDEDBOX:
       gfxCtx->RoundedRectangle(rect, gfxCornerSizes(3 * e), PR_TRUE);
       break;
 
     case NOTATION_UPDIAGONALSTRIKE:
       gfxCtx->Line(rect.BottomLeft(), rect.TopRight());
--- a/layout/svg/base/src/nsSVGFilterInstance.cpp
+++ b/layout/svg/base/src/nsSVGFilterInstance.cpp
@@ -135,23 +135,23 @@ nsSVGFilterInstance::ComputeFilterPrimit
       gfxRect(0, 0, mFilterSpaceSize.width, mFilterSpaceSize.height);
   }
 
   gfxRect feArea = nsSVGUtils::GetRelativeRect(mPrimitiveUnits,
     &fE->mLengthAttributes[nsSVGFE::X], mTargetBBox, mTargetFrame);
   gfxRect region = UserSpaceToFilterSpace(feArea);
 
   if (!fE->HasAttr(kNameSpaceID_None, nsGkAtoms::x))
-    region.pos.x = defaultFilterSubregion.X();
+    region.x = defaultFilterSubregion.X();
   if (!fE->HasAttr(kNameSpaceID_None, nsGkAtoms::y))
-    region.pos.y = defaultFilterSubregion.Y();
+    region.y = defaultFilterSubregion.Y();
   if (!fE->HasAttr(kNameSpaceID_None, nsGkAtoms::width))
-    region.size.width = defaultFilterSubregion.Width();
+    region.width = defaultFilterSubregion.Width();
   if (!fE->HasAttr(kNameSpaceID_None, nsGkAtoms::height))
-    region.size.height = defaultFilterSubregion.Height();
+    region.height = defaultFilterSubregion.Height();
 
   // We currently require filter primitive subregions to be pixel-aligned.
   // Following the spec, any pixel partially in the region is included
   // in the region.
   region.RoundOut();
   aPrimitive->mImage.mFilterPrimitiveSubregion = region;
 }
 
--- a/layout/svg/base/src/nsSVGPathGeometryFrame.cpp
+++ b/layout/svg/base/src/nsSVGPathGeometryFrame.cpp
@@ -270,17 +270,17 @@ nsSVGPathGeometryFrame::UpdateCoveredReg
 
   if (HasStroke()) {
     SetupCairoStrokeGeometry(context);
     if (extent.Width() <= 0 && extent.Height() <= 0) {
       // If 'extent' is empty, its position will not be set. Although
       // GetUserStrokeExtent gets the extents wrong we can still use it
       // to get the device space position of zero length stroked paths.
       extent = context->GetUserStrokeExtent();
-      extent += extent.Size()/2;
+      extent += gfxPoint(extent.width, extent.height)/2;
       extent.SizeTo(gfxSize(0, 0));
     }
     extent = nsSVGUtils::PathExtentsToMaxStrokeExtents(extent, this);
   } else if (GetStyleSVG()->mFill.mType == eStyleSVGPaintType_None) {
     extent = gfxRect(0, 0, 0, 0);
   }
 
   if (!extent.IsEmpty()) {
--- a/layout/svg/base/src/nsSVGUtils.cpp
+++ b/layout/svg/base/src/nsSVGUtils.cpp
@@ -1188,29 +1188,29 @@ nsSVGUtils::GetClipRectForFrame(nsIFrame
       disp->mOverflowY == NS_STYLE_OVERFLOW_HIDDEN) {
 
     nsIntRect clipPxRect =
       disp->mClip.ToOutsidePixels(aFrame->PresContext()->AppUnitsPerDevPixel());
     gfxRect clipRect =
       gfxRect(clipPxRect.x, clipPxRect.y, clipPxRect.width, clipPxRect.height);
 
     if (NS_STYLE_CLIP_RIGHT_AUTO & disp->mClipFlags) {
-      clipRect.size.width = aWidth - clipRect.X();
+      clipRect.width = aWidth - clipRect.X();
     }
     if (NS_STYLE_CLIP_BOTTOM_AUTO & disp->mClipFlags) {
-      clipRect.size.height = aHeight - clipRect.Y();
+      clipRect.height = aHeight - clipRect.Y();
     }
 
     if (disp->mOverflowX != NS_STYLE_OVERFLOW_HIDDEN) {
-      clipRect.pos.x = aX;
-      clipRect.size.width = aWidth;
+      clipRect.x = aX;
+      clipRect.width = aWidth;
     }
     if (disp->mOverflowY != NS_STYLE_OVERFLOW_HIDDEN) {
-      clipRect.pos.y = aY;
-      clipRect.size.height = aHeight;
+      clipRect.y = aY;
+      clipRect.height = aHeight;
     }
      
     return clipRect;
   }
   return gfxRect(aX, aY, aWidth, aHeight);
 }
 
 void
--- a/widget/src/windows/nsNativeThemeWin.cpp
+++ b/widget/src/windows/nsNativeThemeWin.cpp
@@ -1254,23 +1254,23 @@ nsNativeThemeWin::DrawWidgetBackground(n
 
   tr.ScaleInverse(p2a);
   dr.ScaleInverse(p2a);
 
   /* See GetWidgetOverflow */
   if (aWidgetType == NS_THEME_DROPDOWN_BUTTON &&
       part == CBP_DROPMARKER_VISTA && IsHTMLContent(aFrame))
   {
-    tr.pos.y -= 1.0;
-    tr.size.width += 1.0;
-    tr.size.height += 2.0;
-
-    dr.pos.y -= 1.0;
-    dr.size.width += 1.0;
-    dr.size.height += 2.0;
+    tr.y -= 1.0;
+    tr.width += 1.0;
+    tr.height += 2.0;
+
+    dr.y -= 1.0;
+    dr.width += 1.0;
+    dr.height += 2.0;
   }
 
   nsRefPtr<gfxContext> ctx = aContext->ThebesContext();
 
   gfxWindowsNativeDrawing nativeDrawing(ctx, dr, GetWidgetNativeDrawingFlags(aWidgetType));
 
 RENDER_AGAIN: