Title: [209697] trunk
Revision
209697
Author
[email protected]
Date
2016-12-11 20:58:02 -0800 (Sun, 11 Dec 2016)

Log Message

REGRESSION (r200283): Transform, overflow hidden and filter combination completely hides the element
https://bugs.webkit.org/show_bug.cgi?id=161509

Reviewed by David Hyatt.
Source/WebCore:

When the filter painting code needs to recompute a paintDirtyRect, it was using selfClipRect()
which is obviously wrong because it returns a rect in absolute coordinates. Use code factored
out of localClipRect() instead, which returns a rect relative to the painting root.

Test: css3/filters/filter-on-overflow-hidden.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintLayerContents):

LayoutTests:

* css3/filters/filter-on-overflow-hidden-expected.html: Added.
* css3/filters/filter-on-overflow-hidden.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (209696 => 209697)


--- trunk/LayoutTests/ChangeLog	2016-12-12 03:11:18 UTC (rev 209696)
+++ trunk/LayoutTests/ChangeLog	2016-12-12 04:58:02 UTC (rev 209697)
@@ -1,3 +1,13 @@
+2016-12-11  Simon Fraser  <[email protected]>
+
+        REGRESSION (r200283): Transform, overflow hidden and filter combination completely hides the element
+        https://bugs.webkit.org/show_bug.cgi?id=161509
+
+        Reviewed by David Hyatt.
+
+        * css3/filters/filter-on-overflow-hidden-expected.html: Added.
+        * css3/filters/filter-on-overflow-hidden.html: Added.
+
 2016-12-11  Darin Adler  <[email protected]>
 
         Remove uses of Dictionary in WebRTC IDL files

Added: trunk/LayoutTests/css3/filters/filter-on-overflow-hidden-expected.html (0 => 209697)


--- trunk/LayoutTests/css3/filters/filter-on-overflow-hidden-expected.html	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/filter-on-overflow-hidden-expected.html	2016-12-12 04:58:02 UTC (rev 209697)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .parent {
+            position: absolute;
+            top: 50px;
+            left: 50px;
+            width: 100px;
+            height: 100px;
+            padding: 20px;
+            outline: 1px solid black;
+            transform: translateZ(0);
+        }
+        .box {
+            height: 100%;
+            width: 100%;
+            overflow: hidden;
+            background-color: green;
+        }
+        
+        .masker {
+            position: absolute;
+            top: 65px;
+            left: 65px;
+            width: 90px;
+            height: 90px;
+            border: 10px solid black;
+        }
+        
+    </style>
+</head>
+<body>
+    <div class="parent">
+        <div class="box">
+        </div>
+    </div>
+    
+    <div class="masker">
+    </div>
+</body>
+</html>

Added: trunk/LayoutTests/css3/filters/filter-on-overflow-hidden.html (0 => 209697)


--- trunk/LayoutTests/css3/filters/filter-on-overflow-hidden.html	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/filter-on-overflow-hidden.html	2016-12-12 04:58:02 UTC (rev 209697)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .parent {
+            position: absolute;
+            top: 50px;
+            left: 50px;
+            width: 100px;
+            height: 100px;
+            padding: 20px;
+            outline: 1px solid black;
+            transform: translateZ(0);
+        }
+        .box {
+            height: 100%;
+            width: 100%;
+            overflow: hidden;
+            background-color: green;
+            filter: blur(2px);
+        }
+        
+        .masker {
+            position: absolute;
+            top: 65px;
+            left: 65px;
+            width: 90px;
+            height: 90px;
+            border: 10px solid black;
+        }
+        
+    </style>
+</head>
+<body>
+    <div class="parent">
+        <div class="box">
+        </div>
+    </div>
+    
+    <div class="masker">
+    </div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (209696 => 209697)


--- trunk/Source/WebCore/ChangeLog	2016-12-12 03:11:18 UTC (rev 209696)
+++ trunk/Source/WebCore/ChangeLog	2016-12-12 04:58:02 UTC (rev 209697)
@@ -1,3 +1,19 @@
+2016-12-11  Simon Fraser  <[email protected]>
+
+        REGRESSION (r200283): Transform, overflow hidden and filter combination completely hides the element
+        https://bugs.webkit.org/show_bug.cgi?id=161509
+
+        Reviewed by David Hyatt.
+        
+        When the filter painting code needs to recompute a paintDirtyRect, it was using selfClipRect() 
+        which is obviously wrong because it returns a rect in absolute coordinates. Use code factored
+        out of localClipRect() instead, which returns a rect relative to the painting root.
+
+        Test: css3/filters/filter-on-overflow-hidden.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::paintLayerContents):
+
 2016-12-11  Saam Barati  <[email protected]>
 
         We should be able to throw exceptions from Wasm code and when Wasm frames are on the stack

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (209696 => 209697)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2016-12-12 03:11:18 UTC (rev 209696)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2016-12-12 04:58:02 UTC (rev 209697)
@@ -4390,7 +4390,7 @@
             if (!localPaintingInfo.clipToDirtyRect && renderer().hasOverflowClip()) {
                 // We can turn clipping back by requesting full repaint for the overflow area.
                 localPaintingInfo.clipToDirtyRect = true;
-                paintDirtyRect = selfClipRect();
+                paintDirtyRect = clipRectRelativeToAncestor(localPaintingInfo.rootLayer, offsetFromRoot, LayoutRect::infiniteRect());
             }
             collectFragments(layerFragments, localPaintingInfo.rootLayer, paintDirtyRect, ExcludeCompositedPaginatedLayers,
                 (localPaintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, IgnoreOverlayScrollbarSize,
@@ -5769,18 +5769,24 @@
     return clippingRootLayer->renderer().localToAbsoluteQuad(FloatQuad(foregroundRect.rect())).enclosingBoundingBox();
 }
 
+LayoutRect RenderLayer::clipRectRelativeToAncestor(RenderLayer* ancestor, LayoutSize offsetFromAncestor, const LayoutRect& constrainingRect) const
+{
+    LayoutRect layerBounds;
+    ClipRect backgroundRect;
+    ClipRect foregroundRect;
+    auto clipRectType = !m_enclosingPaginationLayer || m_enclosingPaginationLayer == ancestor ? PaintingClipRects : TemporaryClipRects;
+    ClipRectsContext clipRectsContext(ancestor, clipRectType);
+    calculateRects(clipRectsContext, constrainingRect, layerBounds, backgroundRect, foregroundRect, offsetFromAncestor);
+    return backgroundRect.rect();
+}
+
 LayoutRect RenderLayer::selfClipRect() const
 {
     // FIXME: border-radius not accounted for.
     // FIXME: Regions not accounted for.
     RenderLayer* clippingRootLayer = clippingRootForPainting();
-    LayoutRect layerBounds;
-    ClipRect backgroundRect;
-    ClipRect foregroundRect;
-    auto clipRectType = !m_enclosingPaginationLayer || m_enclosingPaginationLayer == clippingRootLayer ? PaintingClipRects : TemporaryClipRects;
-    ClipRectsContext clipRectsContext(clippingRootLayer, clipRectType);
-    calculateRects(clipRectsContext, renderer().view().documentRect(), layerBounds, backgroundRect, foregroundRect, offsetFromAncestor(clippingRootLayer));
-    return clippingRootLayer->renderer().localToAbsoluteQuad(FloatQuad(backgroundRect.rect())).enclosingBoundingBox();
+    LayoutRect clipRect = clipRectRelativeToAncestor(clippingRootLayer, offsetFromAncestor(clippingRootLayer), renderer().view().documentRect());
+    return clippingRootLayer->renderer().localToAbsoluteQuad(FloatQuad(clipRect)).enclosingBoundingBox();
 }
 
 LayoutRect RenderLayer::localClipRect(bool& clipExceedsBounds) const
@@ -5790,15 +5796,7 @@
     // FIXME: Regions not accounted for.
     RenderLayer* clippingRootLayer = clippingRootForPainting();
     LayoutSize offsetFromRoot = offsetFromAncestor(clippingRootLayer);
-
-    LayoutRect layerBounds;
-    ClipRect backgroundRect;
-    ClipRect foregroundRect;
-    auto clipRectType = !m_enclosingPaginationLayer || m_enclosingPaginationLayer == clippingRootLayer ? PaintingClipRects : TemporaryClipRects;
-    ClipRectsContext clipRectsContext(clippingRootLayer, clipRectType);
-    calculateRects(clipRectsContext, LayoutRect::infiniteRect(), layerBounds, backgroundRect, foregroundRect, offsetFromRoot);
-
-    LayoutRect clipRect = backgroundRect.rect();
+    LayoutRect clipRect = clipRectRelativeToAncestor(clippingRootLayer, offsetFromRoot, LayoutRect::infiniteRect());
     if (clipRect.isInfinite())
         return clipRect;
 

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (209696 => 209697)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2016-12-12 03:11:18 UTC (rev 209696)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2016-12-12 04:58:02 UTC (rev 209697)
@@ -726,6 +726,8 @@
     void computeRepaintRectsIncludingDescendants();
     void clearRepaintRects();
 
+    LayoutRect clipRectRelativeToAncestor(RenderLayer* ancestor, LayoutSize offsetFromAncestor, const LayoutRect& constrainingRect) const;
+
     void clipToRect(GraphicsContext&, const LayerPaintingInfo&, const ClipRect&, BorderRadiusClippingRule = IncludeSelfForBorderRadius);
     void restoreClip(GraphicsContext&, const LayerPaintingInfo&, const ClipRect&);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to