2011-06-06 Emil A Eklund <eae@chromium.org>
authoreae@chromium.org <eae@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Jun 2011 19:57:36 +0000 (19:57 +0000)
committereae@chromium.org <eae@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Jun 2011 19:57:36 +0000 (19:57 +0000)
        Reviewed by Eric Seidel.

        Convert RenderBox::clipRect to IntPoint
        https://bugs.webkit.org/show_bug.cgi?id=62045

        Covered by existing tests.

        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::clipRect):
        * rendering/RenderBox.h:
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::calculateClipRects):
        (WebCore::RenderLayer::calculateRects):
        (WebCore::RenderLayer::repaintBlockSelectionGaps):
        * rendering/RenderLayerBacking.cpp:
        (WebCore::clipBox):

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayerBacking.cpp

index 3d15c55..01891f5 100644 (file)
@@ -1,3 +1,22 @@
+2011-06-06  Emil A Eklund  <eae@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Convert RenderBox::clipRect to IntPoint
+        https://bugs.webkit.org/show_bug.cgi?id=62045
+
+        Covered by existing tests.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::clipRect):
+        * rendering/RenderBox.h:
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::calculateClipRects):
+        (WebCore::RenderLayer::calculateRects):
+        (WebCore::RenderLayer::repaintBlockSelectionGaps):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::clipBox):
+
 2011-06-06  Peter Kasting  <pkasting@google.com>
 
         Reviewed by Antonio Gomes.
index f5c53fc..0a16bad 100644 (file)
@@ -1149,32 +1149,28 @@ IntRect RenderBox::overflowClipRect(const IntPoint& location, OverlayScrollbarSi
     return clipRect;
 }
 
-IntRect RenderBox::clipRect(int tx, int ty)
+IntRect RenderBox::clipRect(const IntPoint& location)
 {
-    int clipX = tx;
-    int clipY = ty;
-    int clipWidth = width();
-    int clipHeight = height();
-
+    IntRect clipRect(location, size());
     if (!style()->clipLeft().isAuto()) {
         int c = style()->clipLeft().calcValue(width());
-        clipX += c;
-        clipWidth -= c;
+        clipRect.move(c, 0);
+        clipRect.contract(c, 0);
     }
 
     if (!style()->clipRight().isAuto())
-        clipWidth -= width() - style()->clipRight().calcValue(width());
+        clipRect.contract(width() - style()->clipRight().calcValue(width()), 0);
 
     if (!style()->clipTop().isAuto()) {
         int c = style()->clipTop().calcValue(height());
-        clipY += c;
-        clipHeight -= c;
+        clipRect.move(0, c);
+        clipRect.contract(0, c);
     }
 
     if (!style()->clipBottom().isAuto())
-        clipHeight -= height() - style()->clipBottom().calcValue(height());
+        clipRect.contract(0, height() - style()->clipBottom().calcValue(height()));
 
-    return IntRect(clipX, clipY, clipWidth, clipHeight);
+    return clipRect;
 }
 
 int RenderBox::containingBlockLogicalWidthForContent() const
index 5b42a97..8f3332b 100644 (file)
@@ -346,7 +346,7 @@ public:
     virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
 
     virtual IntRect overflowClipRect(const IntPoint& location, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize);
-    IntRect clipRect(int tx, int ty);
+    IntRect clipRect(const IntPoint& location);
     virtual bool hasControlClip() const { return false; }
     virtual IntRect controlClipRect(const IntPoint&) const { return IntRect(); }
     bool pushContentsClip(PaintInfo&, int tx, int ty);
index a2ad5b6..e2d9fb7 100644 (file)
@@ -3379,7 +3379,7 @@ void RenderLayer::calculateClipRects(const RenderLayer* rootLayer, ClipRects& cl
                 clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect()));
         }
         if (renderer()->hasClip()) {
-            IntRect newPosClip = toRenderBox(renderer())->clipRect(offset.x(), offset.y());
+            IntRect newPosClip = toRenderBox(renderer())->clipRect(offset);
             clipRects.setPosClipRect(intersection(newPosClip, clipRects.posClipRect()));
             clipRects.setOverflowClipRect(intersection(newPosClip, clipRects.overflowClipRect()));
             clipRects.setFixedClipRect(intersection(newPosClip, clipRects.fixedClipRect()));
@@ -3440,7 +3440,7 @@ void RenderLayer::calculateRects(const RenderLayer* rootLayer, const IntRect& pa
             foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(offset, relevancy));
         if (renderer()->hasClip()) {
             // Clip applies to *us* as well, so go ahead and update the damageRect.
-            IntRect newPosClip = toRenderBox(renderer())->clipRect(offset.x(), offset.y());
+            IntRect newPosClip = toRenderBox(renderer())->clipRect(offset);
             backgroundRect.intersect(newPosClip);
             foregroundRect.intersect(newPosClip);
             outlineRect.intersect(newPosClip);
@@ -3511,7 +3511,7 @@ void RenderLayer::repaintBlockSelectionGaps()
     if (renderer()->hasOverflowClip())
         rect.intersect(toRenderBox(renderer())->overflowClipRect(IntPoint()));
     if (renderer()->hasClip())
-        rect.intersect(toRenderBox(renderer())->clipRect(0, 0));
+        rect.intersect(toRenderBox(renderer())->clipRect(IntPoint()));
     if (!rect.isEmpty())
         renderer()->repaintRectangle(rect);
 }
index 7a35ef6..f3cf0bb 100644 (file)
@@ -319,7 +319,7 @@ static IntRect clipBox(RenderBox* renderer)
         result = renderer->overflowClipRect(IntPoint());
 
     if (renderer->hasClip())
-        result.intersect(renderer->clipRect(0, 0));
+        result.intersect(renderer->clipRect(IntPoint()));
 
     return result;
 }