Title: [198498] trunk/Source/WebCore
Revision
198498
Author
simon.fra...@apple.com
Date
2016-03-21 13:23:23 -0700 (Mon, 21 Mar 2016)

Log Message

Very flashy scrolling on http://quellish.tumblr.com page
https://bugs.webkit.org/show_bug.cgi?id=155728
rdar://problem/22299375

Reviewed by Zalan Bujtas.

http://quellish.tumblr.com/post/126712999812/how-on-earth-the-facebook-ios-application-is-so
has many elements that are nested inside elements with non-equal corner radius clipping.
This requires building bezier paths for the rounded-rect clip which is expensive.

For many rows of the table, we can avoid the rounded-rect clipping because the intersection
of the paintDirtyRect and the clip is actually rectangular.

* platform/graphics/FloatRoundedRect.cpp:
(WebCore::FloatRoundedRect::intersectionIsRectangular):
* platform/graphics/FloatRoundedRect.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::clipToRect):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (198497 => 198498)


--- trunk/Source/WebCore/ChangeLog	2016-03-21 20:13:25 UTC (rev 198497)
+++ trunk/Source/WebCore/ChangeLog	2016-03-21 20:23:23 UTC (rev 198498)
@@ -1,3 +1,24 @@
+2016-03-21  Simon Fraser  <simon.fra...@apple.com>
+
+        Very flashy scrolling on http://quellish.tumblr.com page
+        https://bugs.webkit.org/show_bug.cgi?id=155728
+        rdar://problem/22299375
+
+        Reviewed by Zalan Bujtas.
+
+        http://quellish.tumblr.com/post/126712999812/how-on-earth-the-facebook-ios-application-is-so
+        has many elements that are nested inside elements with non-equal corner radius clipping.
+        This requires building bezier paths for the rounded-rect clip which is expensive.
+
+        For many rows of the table, we can avoid the rounded-rect clipping because the intersection
+        of the paintDirtyRect and the clip is actually rectangular.
+
+        * platform/graphics/FloatRoundedRect.cpp:
+        (WebCore::FloatRoundedRect::intersectionIsRectangular):
+        * platform/graphics/FloatRoundedRect.h:
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::clipToRect):
+
 2016-03-21  Zalan Bujtas  <za...@apple.com>
 
         Web Inspector search icon does not fit when zoomed in.

Modified: trunk/Source/WebCore/platform/graphics/FloatRoundedRect.cpp (198497 => 198498)


--- trunk/Source/WebCore/platform/graphics/FloatRoundedRect.cpp	2016-03-21 20:13:25 UTC (rev 198497)
+++ trunk/Source/WebCore/platform/graphics/FloatRoundedRect.cpp	2016-03-21 20:23:23 UTC (rev 198498)
@@ -197,6 +197,12 @@
     m_radii.scale(widthRatio < heightRatio ? widthRatio : heightRatio);
 }
 
+// This is conservative; it does not test intrusion into the corner rects.
+bool FloatRoundedRect::intersectionIsRectangular(const FloatRect& rect) const
+{
+    return !(rect.intersects(topLeftCorner()) || rect.intersects(topRightCorner()) || rect.intersects(bottomLeftCorner()) || rect.intersects(bottomRightCorner()));
+}
+
 TextStream& operator<<(TextStream& ts, const FloatRoundedRect& roundedRect)
 {
     ts << roundedRect.rect().x() << " " << roundedRect.rect().y() << " " << roundedRect.rect().width() << " " << roundedRect.rect().height() << "\n";

Modified: trunk/Source/WebCore/platform/graphics/FloatRoundedRect.h (198497 => 198498)


--- trunk/Source/WebCore/platform/graphics/FloatRoundedRect.h	2016-03-21 20:13:25 UTC (rev 198497)
+++ trunk/Source/WebCore/platform/graphics/FloatRoundedRect.h	2016-03-21 20:23:23 UTC (rev 198498)
@@ -131,6 +131,8 @@
     bool isRenderable() const;
     bool xInterceptsAtY(float y, float& minXIntercept, float& maxXIntercept) const;
 
+    bool intersectionIsRectangular(const FloatRect&) const;
+
 private:
     FloatRect m_rect;
     Radii m_radii;

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (198497 => 198498)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2016-03-21 20:13:25 UTC (rev 198497)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2016-03-21 20:23:23 UTC (rev 198498)
@@ -3831,7 +3831,11 @@
             if (layer->renderer().hasOverflowClip() && layer->renderer().style().hasBorderRadius() && inContainingBlockChain(this, layer)) {
                 LayoutRect adjustedClipRect = LayoutRect(toLayoutPoint(layer->offsetFromAncestor(paintingInfo.rootLayer, AdjustForColumns)), layer->size());
                 adjustedClipRect.move(paintingInfo.subpixelAccumulation);
-                context.clipRoundedRect(layer->renderer().style().getRoundedInnerBorderFor(adjustedClipRect).pixelSnappedRoundedRectForPainting(deviceScaleFactor));
+                FloatRoundedRect roundedRect = layer->renderer().style().getRoundedInnerBorderFor(adjustedClipRect).pixelSnappedRoundedRectForPainting(deviceScaleFactor);
+                if (roundedRect.intersectionIsRectangular(paintingInfo.paintDirtyRect))
+                    context.clip(snapRectToDevicePixels(intersection(paintingInfo.paintDirtyRect, adjustedClipRect), deviceScaleFactor));
+                else
+                    context.clipRoundedRect(roundedRect);
             }
             
             if (layer == paintingInfo.rootLayer)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to