Title: [88102] trunk/Source/WebCore
Revision
88102
Author
e...@chromium.org
Date
2011-06-04 02:53:36 -0700 (Sat, 04 Jun 2011)

Log Message

2011-06-04  Emil A Eklund  <e...@chromium.org>

        Reviewed by Eric Seidel.

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

        Covered by existing tests.

        * editing/Editor.cpp:
        (WebCore::Editor::insideVisibleArea):
        * platform/graphics/IntRect.h:
        (WebCore::IntRect::contract):
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::nodeAtPoint):
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::pushContentsClip):
        (WebCore::RenderBox::overflowClipRect):
        * rendering/RenderBox.h:
        * rendering/RenderBoxModelObject.cpp:
        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::calculateClipRects):
        (WebCore::RenderLayer::calculateRects):
        (WebCore::RenderLayer::repaintBlockSelectionGaps):
        * rendering/RenderLayerBacking.cpp:
        (WebCore::clipBox):
        * rendering/RenderTable.cpp:
        (WebCore::RenderTable::overflowClipRect):
        (WebCore::RenderTable::nodeAtPoint):
        * rendering/RenderTable.h:
        * rendering/RenderTableSection.cpp:
        (WebCore::RenderTableSection::nodeAtPoint):
        * rendering/svg/RenderSVGRoot.cpp:
        (WebCore::RenderSVGRoot::paint):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (88101 => 88102)


--- trunk/Source/WebCore/ChangeLog	2011-06-04 09:24:10 UTC (rev 88101)
+++ trunk/Source/WebCore/ChangeLog	2011-06-04 09:53:36 UTC (rev 88102)
@@ -1,3 +1,39 @@
+2011-06-04  Emil A Eklund  <e...@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Convert RenderBox::overflowClipRect to IntPoint
+        https://bugs.webkit.org/show_bug.cgi?id=62032
+
+        Covered by existing tests.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::insideVisibleArea):
+        * platform/graphics/IntRect.h:
+        (WebCore::IntRect::contract):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::nodeAtPoint):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::pushContentsClip):
+        (WebCore::RenderBox::overflowClipRect):
+        * rendering/RenderBox.h:
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::calculateClipRects):
+        (WebCore::RenderLayer::calculateRects):
+        (WebCore::RenderLayer::repaintBlockSelectionGaps):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::clipBox):
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::overflowClipRect):
+        (WebCore::RenderTable::nodeAtPoint):
+        * rendering/RenderTable.h:
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::nodeAtPoint):
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::paint):
+
 2011-06-04  Adam Barth  <aba...@webkit.org>
 
         Reviewed by Eric Seidel.

Modified: trunk/Source/WebCore/editing/Editor.cpp (88101 => 88102)


--- trunk/Source/WebCore/editing/Editor.cpp	2011-06-04 09:24:10 UTC (rev 88101)
+++ trunk/Source/WebCore/editing/Editor.cpp	2011-06-04 09:53:36 UTC (rev 88102)
@@ -2568,7 +2568,7 @@
     if (!(container->style()->overflowX() == OHIDDEN || container->style()->overflowY() == OHIDDEN))
         return true;
 
-    IntRect rectInPageCoords = container->overflowClipRect(0, 0);
+    IntRect rectInPageCoords = container->overflowClipRect(IntPoint());
     IntRect rectInFrameCoords = IntRect(renderer->x() * -1, renderer->y() * -1,
                                     rectInPageCoords.width(), rectInPageCoords.height());
 
@@ -2597,7 +2597,7 @@
     if (!(container->style()->overflowX() == OHIDDEN || container->style()->overflowY() == OHIDDEN))
         return true;
 
-    IntRect rectInPageCoords = container->overflowClipRect(0, 0);
+    IntRect rectInPageCoords = container->overflowClipRect(IntPoint());
     IntRect rectInFrameCoords = IntRect(renderer->x() * -1, renderer->y() * -1,
                                     rectInPageCoords.width(), rectInPageCoords.height());
     IntRect resultRect = range->boundingBox();

Modified: trunk/Source/WebCore/platform/graphics/IntRect.h (88101 => 88102)


--- trunk/Source/WebCore/platform/graphics/IntRect.h	2011-06-04 09:24:10 UTC (rev 88101)
+++ trunk/Source/WebCore/platform/graphics/IntRect.h	2011-06-04 09:53:36 UTC (rev 88102)
@@ -113,6 +113,8 @@
 
     void expand(const IntSize& size) { m_size += size; }
     void expand(int dw, int dh) { m_size.expand(dw, dh); }
+    void contract(const IntSize& size) { m_size -= size; }
+    void contract(int dw, int dh) { m_size.expand(-dw, -dh); }
 
     void shiftXEdgeTo(int edge)
     {

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (88101 => 88102)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-06-04 09:24:10 UTC (rev 88101)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-06-04 09:53:36 UTC (rev 88102)
@@ -3923,7 +3923,7 @@
     bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer();
     bool useClip = (hasControlClip() || useOverflowClip);
     IntRect hitTestArea(result.rectForPoint(pointInContainer));
-    bool checkChildren = !useClip || (hasControlClip() ? controlClipRect(toPoint(localOffset)).intersects(hitTestArea) : overflowClipRect(localOffset.width(), localOffset.height(), IncludeOverlayScrollbarSize).intersects(hitTestArea));
+    bool checkChildren = !useClip || (hasControlClip() ? controlClipRect(toPoint(localOffset)).intersects(hitTestArea) : overflowClipRect(toPoint(localOffset), IncludeOverlayScrollbarSize).intersects(hitTestArea));
     if (checkChildren) {
         // Hit test descendants first.
         IntSize scrolledOffset(localOffset);

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (88101 => 88102)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2011-06-04 09:24:10 UTC (rev 88101)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2011-06-04 09:53:36 UTC (rev 88102)
@@ -1114,7 +1114,7 @@
         paintObject(paintInfo, IntPoint(tx, ty));
         paintInfo.phase = PaintPhaseChildBlockBackgrounds;
     }
-    IntRect clipRect(isControlClip ? controlClipRect(IntPoint(tx, ty)) : overflowClipRect(tx, ty));
+    IntRect clipRect(isControlClip ? controlClipRect(IntPoint(tx, ty)) : overflowClipRect(IntPoint(tx, ty)));
     paintInfo.context->save();
     if (style()->hasBorderRadius())
         paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(IntRect(tx, ty, width(), height())));
@@ -1135,26 +1135,18 @@
         paintInfo.phase = originalPhase;
 }
 
-IntRect RenderBox::overflowClipRect(int tx, int ty, OverlayScrollbarSizeRelevancy relevancy)
+IntRect RenderBox::overflowClipRect(const IntPoint& location, OverlayScrollbarSizeRelevancy relevancy)
 {
     // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the property
     // here.
+    IntRect clipRect(location + IntSize(borderLeft(), borderTop()),
+        size() - IntSize(borderLeft() + borderRight(), borderTop() + borderBottom()));
 
-    int bLeft = borderLeft();
-    int bTop = borderTop();
-
-    int clipX = tx + bLeft;
-    int clipY = ty + bTop;
-    int clipWidth = width() - bLeft - borderRight();
-    int clipHeight = height() - bTop - borderBottom();
-
     // Subtract out scrollbars if we have them.
-    if (layer()) {
-        clipWidth -= layer()->verticalScrollbarWidth(relevancy);
-        clipHeight -= layer()->horizontalScrollbarHeight(relevancy);
-    }
+    if (layer())
+        clipRect.contract(layer()->verticalScrollbarWidth(relevancy), layer()->horizontalScrollbarHeight(relevancy));
 
-    return IntRect(clipX, clipY, clipWidth, clipHeight);
+    return clipRect;
 }
 
 IntRect RenderBox::clipRect(int tx, int ty)

Modified: trunk/Source/WebCore/rendering/RenderBox.h (88101 => 88102)


--- trunk/Source/WebCore/rendering/RenderBox.h	2011-06-04 09:24:10 UTC (rev 88101)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2011-06-04 09:53:36 UTC (rev 88102)
@@ -345,7 +345,7 @@
     
     virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
 
-    virtual IntRect overflowClipRect(int tx, int ty, OverlayScrollbarSizeRelevancy relevancy = IgnoreOverlayScrollbarSize);
+    virtual IntRect overflowClipRect(const IntPoint& location, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize);
     IntRect clipRect(int tx, int ty);
     virtual bool hasControlClip() const { return false; }
     virtual IntRect controlClipRect(const IntPoint&) const { return IntRect(); }

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (88101 => 88102)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2011-06-04 09:24:10 UTC (rev 88101)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2011-06-04 09:53:36 UTC (rev 88102)
@@ -655,7 +655,7 @@
     IntRect scrolledPaintRect = rect;
     if (clippedWithLocalScrolling) {
         // Clip to the overflow area.
-        context->clip(toRenderBox(this)->overflowClipRect(rect.x(), rect.y()));
+        context->clip(toRenderBox(this)->overflowClipRect(rect.location()));
         
         // Adjust the paint rect to reflect a scrolled content box with borders at the ends.
         IntSize offset = layer()->scrolledContentOffset();

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (88101 => 88102)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2011-06-04 09:24:10 UTC (rev 88101)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2011-06-04 09:53:36 UTC (rev 88102)
@@ -3374,7 +3374,7 @@
         }
         
         if (renderer()->hasOverflowClip()) {
-            IntRect newOverflowClip = toRenderBox(renderer())->overflowClipRect(offset.x(), offset.y(), relevancy);
+            IntRect newOverflowClip = toRenderBox(renderer())->overflowClipRect(offset, relevancy);
             clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.overflowClipRect()));
             if (renderer()->isPositioned() || renderer()->isRelPositioned())
                 clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect()));
@@ -3438,7 +3438,7 @@
     if (renderer()->hasOverflowClip() || renderer()->hasClip()) {
         // This layer establishes a clip of some kind.
         if (renderer()->hasOverflowClip())
-            foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(offset.x(), offset.y(), relevancy));
+            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());
@@ -3510,7 +3510,7 @@
     IntRect rect = m_blockSelectionGapsBounds;
     rect.move(-scrolledContentOffset());
     if (renderer()->hasOverflowClip())
-        rect.intersect(toRenderBox(renderer())->overflowClipRect(0, 0));
+        rect.intersect(toRenderBox(renderer())->overflowClipRect(IntPoint()));
     if (renderer()->hasClip())
         rect.intersect(toRenderBox(renderer())->clipRect(0, 0));
     if (!rect.isEmpty())

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (88101 => 88102)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2011-06-04 09:24:10 UTC (rev 88101)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2011-06-04 09:53:36 UTC (rev 88102)
@@ -316,7 +316,7 @@
 {
     IntRect result = PaintInfo::infiniteRect();
     if (renderer->hasOverflowClip())
-        result = renderer->overflowClipRect(0, 0);
+        result = renderer->overflowClipRect(IntPoint());
 
     if (renderer->hasClip())
         result.intersect(renderer->clipRect(0, 0));

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (88101 => 88102)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2011-06-04 09:24:10 UTC (rev 88101)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2011-06-04 09:53:36 UTC (rev 88102)
@@ -1171,9 +1171,9 @@
     return firstNonEmptySection->logicalTop() + firstNonEmptySection->firstLineBoxBaseline();
 }
 
-IntRect RenderTable::overflowClipRect(int tx, int ty, OverlayScrollbarSizeRelevancy relevancy)
+IntRect RenderTable::overflowClipRect(const IntPoint& location, OverlayScrollbarSizeRelevancy relevancy)
 {
-    IntRect rect = RenderBlock::overflowClipRect(tx, ty, relevancy);
+    IntRect rect = RenderBlock::overflowClipRect(location, relevancy);
     
     // If we have a caption, expand the clip to include the caption.
     // FIXME: Technically this is wrong, but it's virtually impossible to fix this
@@ -1184,10 +1184,10 @@
     if (m_caption) {
         if (style()->isHorizontalWritingMode()) {
             rect.setHeight(height());
-            rect.setY(ty);
+            rect.setY(location.y());
         } else {
             rect.setWidth(width());
-            rect.setX(tx);
+            rect.setX(location.x());
         }
     }
 
@@ -1200,7 +1200,7 @@
     ty += y();
 
     // Check kids first.
-    if (!hasOverflowClip() || overflowClipRect(tx, ty).intersects(result.rectForPoint(pointInContainer))) {
+    if (!hasOverflowClip() || overflowClipRect(IntPoint(tx, ty)).intersects(result.rectForPoint(pointInContainer))) {
         for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
             if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child == m_caption)) {
                 IntPoint childPoint = flipForWritingMode(toRenderBox(child), IntPoint(tx, ty), ParentToChildFlippingAdjustment);

Modified: trunk/Source/WebCore/rendering/RenderTable.h (88101 => 88102)


--- trunk/Source/WebCore/rendering/RenderTable.h	2011-06-04 09:24:10 UTC (rev 88101)
+++ trunk/Source/WebCore/rendering/RenderTable.h	2011-06-04 09:53:36 UTC (rev 88102)
@@ -231,7 +231,7 @@
 
     virtual void computeLogicalWidth();
 
-    virtual IntRect overflowClipRect(int tx, int ty, OverlayScrollbarSizeRelevancy relevancy = IgnoreOverlayScrollbarSize);
+    virtual IntRect overflowClipRect(const IntPoint& location, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize);
 
     virtual void addOverflowFromChildren();
 

Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (88101 => 88102)


--- trunk/Source/WebCore/rendering/RenderTableSection.cpp	2011-06-04 09:24:10 UTC (rev 88101)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp	2011-06-04 09:53:36 UTC (rev 88102)
@@ -1153,7 +1153,7 @@
     tx += x();
     ty += y();
 
-    if (hasOverflowClip() && !overflowClipRect(tx, ty).intersects(result.rectForPoint(pointInContainer)))
+    if (hasOverflowClip() && !overflowClipRect(IntPoint(tx, ty)).intersects(result.rectForPoint(pointInContainer)))
         return false;
 
     if (m_hasOverflowingCell) {

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (88101 => 88102)


--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp	2011-06-04 09:24:10 UTC (rev 88101)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp	2011-06-04 09:53:36 UTC (rev 88102)
@@ -290,7 +290,7 @@
     childPaintInfo.context->save();
 
     // Apply initial viewport clip - not affected by overflow handling
-    childPaintInfo.context->clip(overflowClipRect(borderBoxOriginInContainer.x(), borderBoxOriginInContainer.y()));
+    childPaintInfo.context->clip(overflowClipRect(borderBoxOriginInContainer));
 
     // Convert from container offsets (html renderers) to a relative transform (svg renderers).
     // Transform from our paint container's coordinate system to our local coords.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to