2011-05-11 Levi Weintraub <leviw@chromium.org>
authorleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 May 2011 21:33:01 +0000 (21:33 +0000)
committerleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 May 2011 21:33:01 +0000 (21:33 +0000)
        Reviewed by Eric Seidel.

        Switch RenderBoxModelObject::paintBorder to use IntRect instead of four ints
        https://bugs.webkit.org/show_bug.cgi?id=60591

        Switching RenderBoxModelObject::paintBorder to use IntRect instead of four ints representing a rect.

        No new tests since there is no functionality change.

        * rendering/InlineFlowBox.cpp:
        (WebCore::InlineFlowBox::paintBoxDecorations):
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::paintBoxDecorationsWithSize):
        * rendering/RenderBoxModelObject.cpp:
        (WebCore::RenderBoxModelObject::paintBorder):
        * rendering/RenderBoxModelObject.h:
        * rendering/RenderFieldset.cpp:
        (WebCore::RenderFieldset::paintBoxDecorations):
        * rendering/RenderTable.cpp:
        (WebCore::RenderTable::paintBoxDecorations):
        * rendering/RenderTableCell.cpp:
        (WebCore::RenderTableCell::paintBoxDecorations):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@86272 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/InlineFlowBox.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/RenderBoxModelObject.h
Source/WebCore/rendering/RenderFieldset.cpp
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderTableCell.cpp

index d1dc1f342afc18ad37f9a903c4fbcb69c5afd08a..3aea4fa98e94a4ed8efdc8752a0babfd844d2a40 100644 (file)
@@ -1,3 +1,28 @@
+2011-05-11  Levi Weintraub  <leviw@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Switch RenderBoxModelObject::paintBorder to use IntRect instead of four ints
+        https://bugs.webkit.org/show_bug.cgi?id=60591
+
+        Switching RenderBoxModelObject::paintBorder to use IntRect instead of four ints representing a rect.
+
+        No new tests since there is no functionality change.
+
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::InlineFlowBox::paintBoxDecorations):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::paintBoxDecorationsWithSize):
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintBorder):
+        * rendering/RenderBoxModelObject.h:
+        * rendering/RenderFieldset.cpp:
+        (WebCore::RenderFieldset::paintBoxDecorations):
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::paintBoxDecorations):
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::paintBoxDecorations):
+
 2011-05-11  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r86255.
index 44248a514b78203ac1c1c677ad7bcf8c3346e923..5113ba437c00c53f7a25f9a99467d85047cf29b7 100644 (file)
@@ -1127,7 +1127,7 @@ void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
             // The simple case is where we either have no border image or we are the only box for this object.  In those
             // cases only a single call to draw is required.
             if (!hasBorderImage || (!prevLineBox() && !nextLineBox()))
-                boxModelObject()->paintBorder(context, tx, ty, w, h, renderer()->style(), BackgroundBleedNone, includeLogicalLeftEdge(), includeLogicalRightEdge());
+                boxModelObject()->paintBorder(context, IntRect(tx, ty, w, h), renderer()->style(), BackgroundBleedNone, includeLogicalLeftEdge(), includeLogicalRightEdge());
             else {
                 // We have a border image that spans multiple lines.
                 // We need to adjust tx and ty by the width of all previous lines.
@@ -1150,7 +1150,7 @@ void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
 
                 GraphicsContextStateSaver stateSaver(*context);
                 context->clip(IntRect(tx, ty, w, h));
-                boxModelObject()->paintBorder(context, stripX, stripY, stripWidth, stripHeight, renderer()->style());
+                boxModelObject()->paintBorder(context, IntRect(stripX, stripY, stripWidth, stripHeight), renderer()->style());
             }
         }
     }
index a0aa3c312afbf3ed6b45012aca83f78f741d58ea..dffa30b55b5c079d103383e0938d31fd6d7149e7 100644 (file)
@@ -873,7 +873,7 @@ void RenderBox::paintBoxDecorationsWithSize(PaintInfo& paintInfo, int tx, int ty
 
     // The theme will tell us whether or not we should also paint the CSS border.
     if ((!style()->hasAppearance() || (!themePainted && theme()->paintBorderOnly(this, paintInfo, IntRect(tx, ty, width, height)))) && style()->hasBorder())
-        paintBorder(paintInfo.context, tx, ty, width, height, style(), bleedAvoidance);
+        paintBorder(paintInfo.context, IntRect(tx, ty, width, height), style(), bleedAvoidance);
 
     if (bleedAvoidance == BackgroundBleedUseTransparencyLayer)
         paintInfo.context->endTransparencyLayer();
index 4173e410ece7b64549a5dd5111fddd4021bbf7b7..1445dff49ed446a8835224ea4b3345a448e31a7b 100644 (file)
@@ -1346,11 +1346,11 @@ void RenderBoxModelObject::paintTranslucentBorderSides(GraphicsContext* graphics
     }
 }
 
-void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, int ty, int w, int h,
-                                       const RenderStyle* style, BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
+void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, const IntRect& rect, const RenderStyle* style,
+                                       BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
 {
     // border-image is not affected by border-radius.
-    if (paintNinePieceImage(graphicsContext, IntRect(tx, ty, w, h), style, style->borderImage()))
+    if (paintNinePieceImage(graphicsContext, rect, style, style->borderImage()))
         return;
 
     if (graphicsContext->paintingDisabled())
@@ -1359,9 +1359,8 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
     BorderEdge edges[4];
     getBorderEdgeInfo(edges, includeLogicalLeftEdge, includeLogicalRightEdge);
 
-    IntRect borderRect(tx, ty, w, h);
-    RoundedIntRect outerBorder = style->getRoundedBorderFor(borderRect, includeLogicalLeftEdge, includeLogicalRightEdge);
-    RoundedIntRect innerBorder = style->getRoundedInnerBorderFor(borderRect, includeLogicalLeftEdge, includeLogicalRightEdge);
+    RoundedIntRect outerBorder = style->getRoundedBorderFor(rect, includeLogicalLeftEdge, includeLogicalRightEdge);
+    RoundedIntRect innerBorder = style->getRoundedInnerBorderFor(rect, includeLogicalLeftEdge, includeLogicalRightEdge);
 
     const AffineTransform& currentCTM = graphicsContext->getCTM();
     // FIXME: this isn't quite correct. We may want to antialias when scaled by a non-integral value, or when the translation is non-integral.
@@ -1587,12 +1586,12 @@ void RenderBoxModelObject::drawBoxSideFromPath(GraphicsContext* graphicsContext,
     graphicsContext->drawRect(borderRect);
 }
 #else
-void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, int ty, int w, int h,
-                                       const RenderStyle* style, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
+void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, const IntRect& rect, const RenderStyle* style,
+                                       BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
 {
     // FIXME: This old version of paintBorder should be removed when all ports implement 
     // GraphicsContext::clipConvexPolygon()!! This should happen soon.
-    if (paintNinePieceImage(graphicsContext, IntRect(tx, ty, w, h), style, style->borderImage()))
+    if (paintNinePieceImage(graphicsContext, rect, style, style->borderImage()))
         return;
 
     const Color& topColor = style->visitedDependentColor(CSSPropertyBorderTopColor);
@@ -1617,7 +1616,7 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
     bool renderBottom = bottomStyle > BHIDDEN && !bottomTransparent && (horizontal || includeLogicalRightEdge);
 
 
-    RoundedIntRect border(tx, ty, w, h);
+    RoundedIntRect border(rect);
     
     GraphicsContextStateSaver stateSaver(*graphicsContext, false);
     if (style->hasBorderRadius()) {
@@ -1646,18 +1645,18 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
             || (topColor == rightColor && topTransparent == rightTransparent && topStyle >= OUTSET
                 && (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET));
 
-        int x = tx;
-        int x2 = tx + w;
+        int x = rect.x();
+        int x2 = rect.maxX();
         if (renderRadii) {
             x += border.radii().topLeft().width();
             x2 -= border.radii().topRight().width();
         }
 
-        drawLineForBoxSide(graphicsContext, x, ty, x2, ty + style->borderTopWidth(), BSTop, topColor, topStyle,
+        drawLineForBoxSide(graphicsContext, x, rect.y(), x2, rect.y() + style->borderTopWidth(), BSTop, topColor, topStyle,
                    ignoreLeft ? 0 : style->borderLeftWidth(), ignoreRight ? 0 : style->borderRightWidth());
 
         if (renderRadii) {
-            int leftY = ty;
+            int leftY = rect.y();
 
             // We make the arc double thick and let the clip rect take care of clipping the extra off.
             // We're doing this because it doesn't seem possible to match the curve of the clip exactly
@@ -1665,7 +1664,7 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
             thickness = style->borderTopWidth() * 2;
 
             if (border.radii().topLeft().width()) {
-                int leftX = tx;
+                int leftX = rect.x();
                 // The inner clip clips inside the arc. This is especially important for 1px borders.
                 bool applyLeftInnerClip = (style->borderLeftWidth() < border.radii().topLeft().width())
                     && (style->borderTopWidth() < border.radii().topLeft().height())
@@ -1685,7 +1684,7 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
             }
 
             if (border.radii().topRight().width()) {
-                int rightX = tx + w - border.radii().topRight().width() * 2;
+                int rightX = rect.maxX() - border.radii().topRight().width() * 2;
                 bool applyRightInnerClip = (style->borderRightWidth() < border.radii().topRight().width())
                     && (style->borderTopWidth() < border.radii().topRight().height())
                     && (topStyle != DOUBLE || style->borderTopWidth() > 6);
@@ -1719,22 +1718,22 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
             || (bottomColor == rightColor && bottomTransparent == rightTransparent && bottomStyle >= OUTSET
                 && (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET));
 
-        int x = tx;
-        int x2 = tx + w;
+        int x = rect.x();
+        int x2 = rect.maxX();
         if (renderRadii) {
             x += border.radii().bottomLeft().width();
             x2 -= border.radii().bottomRight().width();
         }
 
-        drawLineForBoxSide(graphicsContext, x, ty + h - style->borderBottomWidth(), x2, ty + h, BSBottom, bottomColor, bottomStyle,
+        drawLineForBoxSide(graphicsContext, x, rect.maxY() - style->borderBottomWidth(), x2, rect.maxY(), BSBottom, bottomColor, bottomStyle,
                    ignoreLeft ? 0 : style->borderLeftWidth(), ignoreRight ? 0 : style->borderRightWidth());
 
         if (renderRadii) {
             thickness = style->borderBottomWidth() * 2;
 
             if (border.radii().bottomLeft().width()) {
-                int leftX = tx;
-                int leftY = ty + h - border.radii().bottomLeft().height() * 2;
+                int leftX = rect.x();
+                int leftY = rect.maxY() - border.radii().bottomLeft().height() * 2;
                 bool applyLeftInnerClip = (style->borderLeftWidth() < border.radii().bottomLeft().width())
                     && (style->borderBottomWidth() < border.radii().bottomLeft().height())
                     && (bottomStyle != DOUBLE || style->borderBottomWidth() > 6);
@@ -1758,8 +1757,8 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
             }
 
             if (border.radii().bottomRight().width()) {
-                int rightY = ty + h - border.radii().bottomRight().height() * 2;
-                int rightX = tx + w - border.radii().bottomRight().width() * 2;
+                int rightY = rect.maxY() - border.radii().bottomRight().height() * 2;
+                int rightX = rect.maxX() - border.radii().bottomRight().width() * 2;
                 bool applyRightInnerClip = (style->borderRightWidth() < border.radii().bottomRight().width())
                     && (style->borderBottomWidth() < border.radii().bottomRight().height())
                     && (bottomStyle != DOUBLE || style->borderBottomWidth() > 6);
@@ -1788,22 +1787,22 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
             || (bottomColor == leftColor && bottomTransparent == leftTransparent && leftStyle >= OUTSET
                 && (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET));
 
-        int y = ty;
-        int y2 = ty + h;
+        int y = rect.y();
+        int y2 = rect.maxY();
         if (renderRadii) {
             y += border.radii().topLeft().height();
             y2 -= border.radii().bottomLeft().height();
         }
 
-        drawLineForBoxSide(graphicsContext, tx, y, tx + style->borderLeftWidth(), y2, BSLeft, leftColor, leftStyle,
+        drawLineForBoxSide(graphicsContext, rect.x(), y, rect.x() + style->borderLeftWidth(), y2, BSLeft, leftColor, leftStyle,
                    ignoreTop ? 0 : style->borderTopWidth(), ignoreBottom ? 0 : style->borderBottomWidth());
 
         if (renderRadii && (!upperLeftBorderStylesMatch || !lowerLeftBorderStylesMatch)) {
-            int topX = tx;
+            int topX = rect.x();
             thickness = style->borderLeftWidth() * 2;
 
             if (!upperLeftBorderStylesMatch && border.radii().topLeft().width()) {
-                int topY = ty;
+                int topY = rect.y();
                 bool applyTopInnerClip = (style->borderLeftWidth() < border.radii().topLeft().width())
                     && (style->borderTopWidth() < border.radii().topLeft().height())
                     && (leftStyle != DOUBLE || style->borderLeftWidth() > 6);
@@ -1822,7 +1821,7 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
             }
 
             if (!lowerLeftBorderStylesMatch && border.radii().bottomLeft().width()) {
-                int bottomY = ty + h - border.radii().bottomLeft().height() * 2;
+                int bottomY = rect.maxY() - border.radii().bottomLeft().height() * 2;
                 bool applyBottomInnerClip = (style->borderLeftWidth() < border.radii().bottomLeft().width())
                     && (style->borderBottomWidth() < border.radii().bottomLeft().height())
                     && (leftStyle != DOUBLE || style->borderLeftWidth() > 6);
@@ -1853,22 +1852,22 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
                 && (rightStyle >= DOTTED || rightStyle == INSET)
                 && (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET));
 
-        int y = ty;
-        int y2 = ty + h;
+        int y = rect.y();
+        int y2 = rect.maxY();
         if (renderRadii) {
             y += border.radii().topRight().height();
             y2 -= border.radii().bottomRight().height();
         }
 
-        drawLineForBoxSide(graphicsContext, tx + w - style->borderRightWidth(), y, tx + w, y2, BSRight, rightColor, rightStyle,
+        drawLineForBoxSide(graphicsContext, rect.maxX() - style->borderRightWidth(), y, rect.maxX(), y2, BSRight, rightColor, rightStyle,
                    ignoreTop ? 0 : style->borderTopWidth(), ignoreBottom ? 0 : style->borderBottomWidth());
 
         if (renderRadii && (!upperRightBorderStylesMatch || !lowerRightBorderStylesMatch)) {
             thickness = style->borderRightWidth() * 2;
 
             if (!upperRightBorderStylesMatch && border.radii().topRight().width()) {
-                int topX = tx + w - border.radii().topRight().width() * 2;
-                int topY = ty;
+                int topX = rect.maxX() - border.radii().topRight().width() * 2;
+                int topY = rect.y();
                 bool applyTopInnerClip = (style->borderRightWidth() < border.radii().topRight().width())
                     && (style->borderTopWidth() < border.radii().topRight().height())
                     && (rightStyle != DOUBLE || style->borderRightWidth() > 6);
@@ -1887,8 +1886,8 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
             }
 
             if (!lowerRightBorderStylesMatch && border.radii().bottomRight().width()) {
-                int bottomX = tx + w - border.radii().bottomRight().width() * 2;
-                int bottomY = ty + h - border.radii().bottomRight().height() * 2;
+                int bottomX = rect.maxX() - border.radii().bottomRight().width() * 2;
+                int bottomY = rect.maxY() - border.radii().bottomRight().height() * 2;
                 bool applyBottomInnerClip = (style->borderRightWidth() < border.radii().bottomRight().width())
                     && (style->borderBottomWidth() < border.radii().bottomRight().height())
                     && (rightStyle != DOUBLE || style->borderRightWidth() > 6);
index 0cc7cb1897ca5c00918c83be39ce7c02756f68b4..da28922c281a0efbd3d5ce73a031269367037ff5 100644 (file)
@@ -118,7 +118,7 @@ public:
 
     virtual void childBecameNonInline(RenderObject* /*child*/) { }
 
-    void paintBorder(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, BackgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
+    void paintBorder(GraphicsContext*, const IntRect&, const RenderStyle*, BackgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
     bool paintNinePieceImage(GraphicsContext*, const IntRect&, const RenderStyle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver);
     void paintBoxShadow(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
     void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, int tx, int ty, int width, int height, BackgroundBleedAvoidance, InlineFlowBox* = 0, int inlineBoxWidth = 0, int inlineBoxHeight = 0, CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0);
index eb8befc7a02864cbccdb950ab9e18325a6e1babc..34206f71b3295c98a2f1d911f9d74a4de81ad45b 100644 (file)
@@ -167,7 +167,7 @@ void RenderFieldset::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
         graphicsContext->clipOut(IntRect(clipLeft, ty + legend->y(), clipWidth, legend->height()));
     }
 
-    paintBorder(paintInfo.context, tx, ty, w, h, style());
+    paintBorder(paintInfo.context, IntRect(tx, ty, w, h), style());
 }
 
 void RenderFieldset::paintMask(PaintInfo& paintInfo, int tx, int ty)
index 74ac33bf42f25633630c6abc6aa5a3973e8cf230..b99e4badde655eb08f514d5269a30f1cdd13ef15 100644 (file)
@@ -570,7 +570,7 @@ void RenderTable::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
     paintBoxShadow(paintInfo.context, rect.x(), rect.y(), rect.width(), rect.height(), style(), Inset);
 
     if (style()->hasBorder() && !collapseBorders())
-        paintBorder(paintInfo.context, rect.x(), rect.y(), rect.width(), rect.height(), style());
+        paintBorder(paintInfo.context, rect, style());
 }
 
 void RenderTable::paintMask(PaintInfo& paintInfo, int tx, int ty)
index 463564261059a5cc9d57a86397656baa23dafa01..d75519e505dc3ce205f233b870480af7979bee1b 100644 (file)
@@ -1020,7 +1020,7 @@ void RenderTableCell::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
     if (!style()->hasBorder() || tableElt->collapseBorders())
         return;
 
-    paintBorder(paintInfo.context, tx, ty, w, h, style());
+    paintBorder(paintInfo.context, IntRect(tx, ty, w, h), style());
 }
 
 void RenderTableCell::paintMask(PaintInfo& paintInfo, int tx, int ty)