REGRESSION (r143070): Overflow:scroll content does not get clipped properly when...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Jun 2013 13:37:38 +0000 (13:37 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Jun 2013 13:37:38 +0000 (13:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=116859

Patch by Zalan Bujtas <zalan@apple.com> on 2013-06-03
Reviewed by Simon Fraser.

Apply proper clipping for overflow:scroll, when parent dictates
full repaint to ensure correct CSS3 filter effect.

When a particular layer has 'pixel moving' CSS3 filter(drop shadow, blur), it sets clipToDirtyRect
to false to force no clipping on itself and on the child layers too.
No clipping makes overflow:scroll behave like overflow:display, because
overflow::scroll gets clipped at RenderLayer level (as opposed to overflow::hidden).
This patch makes sure that both full repaint and clipping are ensured.

Source/WebCore:

Tests: css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on-parent.html
       css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on.html

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

LayoutTests:

* css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on-expected.html: Added.
* css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on-parent-expected.html: Added.
* css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on-parent.html: Added.
* css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on-expected.html [new file with mode: 0644]
LayoutTests/css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on-parent-expected.html [new file with mode: 0644]
LayoutTests/css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on-parent.html [new file with mode: 0644]
LayoutTests/css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayer.cpp

index 37fe6cc..7674bd1 100644 (file)
@@ -1,3 +1,24 @@
+2013-06-03  Zalan Bujtas  <zalan@apple.com>
+
+        REGRESSION (r143070): Overflow:scroll content does not get clipped properly when the parent box has CSS3 filter on.
+        https://bugs.webkit.org/show_bug.cgi?id=116859
+
+        Reviewed by Simon Fraser.
+
+        Apply proper clipping for overflow:scroll, when parent dictates
+        full repaint to ensure correct CSS3 filter effect.
+
+        When a particular layer has 'pixel moving' CSS3 filter(drop shadow, blur), it sets clipToDirtyRect 
+        to false to force no clipping on itself and on the child layers too.
+        No clipping makes overflow:scroll behave like overflow:display, because
+        overflow::scroll gets clipped at RenderLayer level (as opposed to overflow::hidden).
+        This patch makes sure that both full repaint and clipping are ensured.
+
+        * css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on-expected.html: Added.
+        * css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on-parent-expected.html: Added.
+        * css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on-parent.html: Added.
+        * css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on.html: Added.
+
 2013-06-03  Kangil Han  <kangil.han@samsung.com>
 
         [EFL] Remove obsolete test case from TestExpectations
diff --git a/LayoutTests/css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on-expected.html b/LayoutTests/css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on-expected.html
new file mode 100644 (file)
index 0000000..2cb4290
--- /dev/null
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        .cover {
+            overflow-y: hidden;
+            height: 30px;
+            width: 200px;
+        }
+
+        .box {
+            overflow-x: hidden;
+            height: 45px;
+            width: 85px;
+            -webkit-filter: blur(1px);
+        }
+               
+    </style>
+</head>
+
+<body>
+    <div class="cover">
+        <!-- You should not see the 'dolor' part of the text -->
+        <div class="box">Loremipsumdolor</div>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on-parent-expected.html b/LayoutTests/css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on-parent-expected.html
new file mode 100644 (file)
index 0000000..2871e81
--- /dev/null
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        .cover {
+            overflow-y: hidden;
+            height: 30px;
+            width: 200px;
+        }
+        
+        .box {
+            overflow-x: hidden;
+            height: 85px;
+            width: 80px;
+        }
+
+        .blur {
+            -webkit-filter: blur(1px);
+        }
+
+    </style>
+</head>
+
+<body>
+    <!-- You should not see the 'dolor' part of the text -->
+    <div class="cover">
+        <div class="blur"> 
+            <div class="box">Loremipsumdolor</div>
+        </div>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on-parent.html b/LayoutTests/css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on-parent.html
new file mode 100644 (file)
index 0000000..8b2ffbd
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        .cover {
+            overflow-y: hidden;
+            height: 30px;
+            width: 200px;
+        }
+        
+        .box {
+            overflow-x: scroll;
+            height: 85px;
+            width: 80px;
+        }
+
+        .blur {
+            -webkit-filter: blur(1px);
+        }
+
+    </style>
+</head>
+
+<body>
+    <!-- This div covers the scrollbar, so that we can reftest it with overflow:hidden. -->
+    <div class="cover">
+        <!-- You should not see the 'dolor' part of the text -->
+        <div class="blur"> 
+            <div class="box">Loremipsumdolor</div>
+        </div>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on.html b/LayoutTests/css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on.html
new file mode 100644 (file)
index 0000000..23f4591
--- /dev/null
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        .cover {
+            overflow-y: hidden;
+            height: 30px;
+            width: 200px;
+        }
+        .box {
+            overflow-x: scroll;
+            height: 45px;
+            width: 85px;
+            -webkit-filter: blur(1px);
+        }
+               
+    </style>
+</head>
+
+<body>
+    <!-- This div covers the scrollbar, so that we can reftest it with overflow:hidden. -->
+    <div class="cover">
+        <!-- You should not see the 'dolor' part of the text -->
+        <div class="box">Loremipsumdolor</div>
+    </div>
+</body>
+</html>
index 5d63103..f8b4921 100644 (file)
@@ -1,3 +1,25 @@
+2013-06-03  Zalan Bujtas  <zalan@apple.com>
+
+        REGRESSION (r143070): Overflow:scroll content does not get clipped properly when the parent box has CSS3 filter on.
+        https://bugs.webkit.org/show_bug.cgi?id=116859
+
+        Reviewed by Simon Fraser.
+
+        Apply proper clipping for overflow:scroll, when parent dictates
+        full repaint to ensure correct CSS3 filter effect.
+
+        When a particular layer has 'pixel moving' CSS3 filter(drop shadow, blur), it sets clipToDirtyRect 
+        to false to force no clipping on itself and on the child layers too.
+        No clipping makes overflow:scroll behave like overflow:display, because
+        overflow::scroll gets clipped at RenderLayer level (as opposed to overflow::hidden).
+        This patch makes sure that both full repaint and clipping are ensured.
+
+        Tests: css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on-parent.html
+               css3/filters/clipping-overflow-scroll-with-pixel-moving-effect-on.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::paintLayerContents):
+
 2013-05-22  Jocelyn Turcotte  <jocelyn.turcotte@digia.com>
 
         [Qt] Re-enable plugins on Mac.
index 4189c0d..9f04b9f 100644 (file)
@@ -3910,8 +3910,15 @@ void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti
     LayerFragments layerFragments;
     if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) {
         // Collect the fragments. This will compute the clip rectangles and paint offsets for each layer fragment, as well as whether or not the content of each
-        // fragment should paint.
-        collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.region, localPaintingInfo.paintDirtyRect,
+        // fragment should paint. If the parent's filter dictates full repaint to ensure proper filter effect,
+        // use the overflow clip as dirty rect, instead of no clipping. It maintains proper clipping for overflow::scroll.
+        LayoutRect paintDirtyRect = localPaintingInfo.paintDirtyRect;
+        if (!paintingInfo.clipToDirtyRect && renderer()->hasOverflowClip()) {
+            // We can turn clipping back by requesting full repaint for the overflow area.
+            localPaintingInfo.clipToDirtyRect = true;
+            paintDirtyRect = selfClipRect();
+        }
+        collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.region, paintDirtyRect,
             (localPaintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, IgnoreOverlayScrollbarSize,
             (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &offsetFromRoot);
         updatePaintingInfoForFragments(layerFragments, localPaintingInfo, localPaintFlags, shouldPaintContent, &offsetFromRoot);