Title: [178490] trunk
Revision
178490
Author
[email protected]
Date
2015-01-14 23:59:09 -0800 (Wed, 14 Jan 2015)

Log Message

Graphics corruption after Find on some pages
https://bugs.webkit.org/show_bug.cgi?id=140489

Reviewed by Zalan Bujtas.

Source/WebCore:

After doing a Find on http://shop.outlier.cc/shop/retail/chino.html,
garbage could appear on some parts of the page. This is caused by creating
a compositing layer which is marked as opaque, yet failing to paint the entire
layer contents.

This was caused by a bug in RenderBox::computeBackgroundIsKnownToBeObscured()
logic. On the page in question, doing a Find could cause overflow:hidden sections
to get scrolled (since Find can reveal the selection by scrolling overflow).
However, the render tree walking under RenderBox::foregroundIsKnownToBeOpaqueInRect()
fails to take overflow scrolling into account, so gives the wrong answer
in some content configurations. As a result, we'd think that the background
is obscured, and never paint it.

Conservative fix is to have isCandidateForOpaquenessTest() return false
when the content has any non-zero scroll offset.

Tests: compositing/contents-opaque/opaque-with-scrolled.html
       fast/backgrounds/opaque-scrolled-paint-background.html

* rendering/RenderBox.cpp:
(WebCore::isCandidateForOpaquenessTest):

LayoutTests:

Two new tests. The first one just reports that we have an opaque compositing
layer. The second one tests the the user-visible symptom of the missing
background.

* compositing/contents-opaque/opaque-with-scrolled-expected.txt: Added.
* compositing/contents-opaque/opaque-with-scrolled.html: Added.
* fast/backgrounds/opaque-scrolled-paint-background-expected.html: Added.
* fast/backgrounds/opaque-scrolled-paint-background.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (178489 => 178490)


--- trunk/LayoutTests/ChangeLog	2015-01-15 07:45:38 UTC (rev 178489)
+++ trunk/LayoutTests/ChangeLog	2015-01-15 07:59:09 UTC (rev 178490)
@@ -1,3 +1,19 @@
+2015-01-14  Simon Fraser  <[email protected]>
+
+        Graphics corruption after Find on some pages
+        https://bugs.webkit.org/show_bug.cgi?id=140489
+
+        Reviewed by Zalan Bujtas.
+        
+        Two new tests. The first one just reports that we have an opaque compositing
+        layer. The second one tests the the user-visible symptom of the missing
+        background.
+
+        * compositing/contents-opaque/opaque-with-scrolled-expected.txt: Added.
+        * compositing/contents-opaque/opaque-with-scrolled.html: Added.
+        * fast/backgrounds/opaque-scrolled-paint-background-expected.html: Added.
+        * fast/backgrounds/opaque-scrolled-paint-background.html: Added.
+
 2015-01-14  Alexey Proskuryakov  <[email protected]>
 
         <rdar://problem/17748495> Multiple compositing tests fail to repaint on WK1

Added: trunk/LayoutTests/compositing/contents-opaque/opaque-with-scrolled-expected.txt (0 => 178490)


--- trunk/LayoutTests/compositing/contents-opaque/opaque-with-scrolled-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/contents-opaque/opaque-with-scrolled-expected.txt	2015-01-15 07:59:09 UTC (rev 178490)
@@ -0,0 +1,19 @@
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 20.00 20.00)
+          (bounds 200.00 200.00)
+          (contentsOpaque 1)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/compositing/contents-opaque/opaque-with-scrolled.html (0 => 178490)


--- trunk/LayoutTests/compositing/contents-opaque/opaque-with-scrolled.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/contents-opaque/opaque-with-scrolled.html	2015-01-15 07:59:09 UTC (rev 178490)
@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        #indicator {
+            position: absolute;
+            top: 20px;
+            left: 20px;
+            width: 200px;
+            height: 200px;
+            background-color: red;
+        }
+        
+        .composited {
+          -webkit-transform: translateZ(0);
+        }
+        
+        .container {
+            position: absolute;
+            top: 20px;
+            left: 20px;
+        }
+
+        .solid-background {
+            position: relative;
+            float: left;
+            width: 200px;
+            height: 200px;
+            background-color: green;
+            z-index: 0;
+        }
+        
+        #scrollable {
+            width: 100%;
+            height: 100%;
+            overflow: hidden;
+        }
+        
+        .opaque {
+            background-color: gray;
+            width: 100%;
+            height: 100%;
+        }
+        
+        .non-opaque {
+            background-color: transparent;
+            width: 100%;
+            height: 100%;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+
+        window.addEventListener('load', function() {
+            document.getElementById('scrollable').scrollTop = 200;
+            if (window.testRunner && window.internals)
+                document.getElementById('layertree').innerText = window.internals.layerTreeAsText(document);
+        }, false);
+    </script>
+</head>
+<body>
+
+<div class="composited container">
+    <div class="solid-background">
+        <div id="scrollable">
+            <div class="opaque">
+            </div>
+            <div class="non-opaque">
+            </div>
+        </div>
+    </div>
+</div>
+
+<pre id="layertree"></pre>
+
+</body>
+</html>

Added: trunk/LayoutTests/fast/backgrounds/opaque-scrolled-paint-background-expected.html (0 => 178490)


--- trunk/LayoutTests/fast/backgrounds/opaque-scrolled-paint-background-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/backgrounds/opaque-scrolled-paint-background-expected.html	2015-01-15 07:59:09 UTC (rev 178490)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        #indicator {
+            position: absolute;
+            top: 20px;
+            left: 20px;
+            width: 200px;
+            height: 200px;
+            background-color: green;
+        }
+    </style>
+</head>
+<body>
+
+<div id="indicator"></div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/backgrounds/opaque-scrolled-paint-background.html (0 => 178490)


--- trunk/LayoutTests/fast/backgrounds/opaque-scrolled-paint-background.html	                        (rev 0)
+++ trunk/LayoutTests/fast/backgrounds/opaque-scrolled-paint-background.html	2015-01-15 07:59:09 UTC (rev 178490)
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        #indicator {
+            position: absolute;
+            top: 20px;
+            left: 20px;
+            width: 200px;
+            height: 200px;
+            background-color: red;
+        }
+        
+        .container {
+            position: absolute;
+            top: 20px;
+            left: 20px;
+        }
+
+        .solid-background {
+            position: relative;
+            float: left;
+            width: 200px;
+            height: 200px;
+            background-color: green;
+            z-index: 0;
+        }
+        
+        #scrollable {
+            width: 100%;
+            height: 100%;
+            overflow: hidden;
+        }
+        
+        .opaque {
+            background-color: gray;
+            width: 100%;
+            height: 100%;
+        }
+        
+        .non-opaque {
+            background-color: transparent;
+            width: 100%;
+            height: 100%;
+        }
+    </style>
+    <script>
+        window.addEventListener('load', function() {
+            document.getElementById('scrollable').scrollTop = 200;
+        }, false);
+    </script>
+</head>
+<body>
+
+<div id="indicator"></div>
+
+<div class="container">
+    <div class="solid-background">
+        <div id="scrollable">
+            <div class="opaque">
+            </div>
+            <div class="non-opaque">
+            </div>
+        </div>
+    </div>
+</div>
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (178489 => 178490)


--- trunk/Source/WebCore/ChangeLog	2015-01-15 07:45:38 UTC (rev 178489)
+++ trunk/Source/WebCore/ChangeLog	2015-01-15 07:59:09 UTC (rev 178490)
@@ -1,3 +1,32 @@
+2015-01-14  Simon Fraser  <[email protected]>
+
+        Graphics corruption after Find on some pages
+        https://bugs.webkit.org/show_bug.cgi?id=140489
+
+        Reviewed by Zalan Bujtas.
+        
+        After doing a Find on http://shop.outlier.cc/shop/retail/chino.html,
+        garbage could appear on some parts of the page. This is caused by creating
+        a compositing layer which is marked as opaque, yet failing to paint the entire
+        layer contents.
+        
+        This was caused by a bug in RenderBox::computeBackgroundIsKnownToBeObscured()
+        logic. On the page in question, doing a Find could cause overflow:hidden sections
+        to get scrolled (since Find can reveal the selection by scrolling overflow).
+        However, the render tree walking under RenderBox::foregroundIsKnownToBeOpaqueInRect()
+        fails to take overflow scrolling into account, so gives the wrong answer
+        in some content configurations. As a result, we'd think that the background
+        is obscured, and never paint it.
+        
+        Conservative fix is to have isCandidateForOpaquenessTest() return false
+        when the content has any non-zero scroll offset.
+
+        Tests: compositing/contents-opaque/opaque-with-scrolled.html
+               fast/backgrounds/opaque-scrolled-paint-background.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::isCandidateForOpaquenessTest):
+
 2015-01-14  Jer Noble  <[email protected]>
 
         [Mac][MSE] Stalled YouTube playback does not allow display to sleep.

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (178489 => 178490)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2015-01-15 07:45:38 UTC (rev 178489)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2015-01-15 07:59:09 UTC (rev 178490)
@@ -1400,6 +1400,8 @@
             return false;
         if (childLayer->hasTransform() || childLayer->isTransparent() || childLayer->hasFilter())
             return false;
+        if (!childBox.scrolledContentOffset().isZero())
+            return false;
     }
     return true;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to