ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()) on nytimes.com...
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 May 2019 18:40:58 +0000 (18:40 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 May 2019 18:40:58 +0000 (18:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197776

Reviewed by Zalan Bujtas.

Source/WebCore:

Only try to paint into shared backing for layers that are able to be composited. This
avoids trying to do sharing for non-self-painting layers, which doesn't make sense.

Test: compositing/shared-backing/overflow-scroll/non-self-painting-layer-should-not-share.html

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::computeCompositingRequirements):

LayoutTests:

* compositing/shared-backing/overflow-scroll/non-self-painting-layer-should-not-share-expected.txt: Added.
* compositing/shared-backing/overflow-scroll/non-self-painting-layer-should-not-share.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/compositing/shared-backing/overflow-scroll/non-self-painting-layer-should-not-share-expected.txt [new file with mode: 0644]
LayoutTests/compositing/shared-backing/overflow-scroll/non-self-painting-layer-should-not-share.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayerCompositor.cpp

index 8bbf93e..7a8e888 100644 (file)
@@ -1,3 +1,13 @@
+2019-05-10  Simon Fraser  <simon.fraser@apple.com>
+
+        ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()) on nytimes.com after r245170
+        https://bugs.webkit.org/show_bug.cgi?id=197776
+
+        Reviewed by Zalan Bujtas.
+
+        * compositing/shared-backing/overflow-scroll/non-self-painting-layer-should-not-share-expected.txt: Added.
+        * compositing/shared-backing/overflow-scroll/non-self-painting-layer-should-not-share.html: Added.
+
 2019-05-10  Chris Fleizach  <cfleizach@apple.com>
 
         AX: Crash at WebKit: WebKit::WebSpeechSynthesisClient::speak
diff --git a/LayoutTests/compositing/shared-backing/overflow-scroll/non-self-painting-layer-should-not-share-expected.txt b/LayoutTests/compositing/shared-backing/overflow-scroll/non-self-painting-layer-should-not-share-expected.txt
new file mode 100644 (file)
index 0000000..4c3c44a
--- /dev/null
@@ -0,0 +1,5 @@
+Test passes if it does not assert in debug.
+
+this is clipped
+this is clipped
+
diff --git a/LayoutTests/compositing/shared-backing/overflow-scroll/non-self-painting-layer-should-not-share.html b/LayoutTests/compositing/shared-backing/overflow-scroll/non-self-painting-layer-should-not-share.html
new file mode 100644 (file)
index 0000000..928b248
--- /dev/null
@@ -0,0 +1,48 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+    <title>Tests that a non-self-painting layer doesn't get into the sharing list</title>
+    <style>
+        .scroller {
+            margin: 20px;
+            width: 300px;
+            height: 300px;
+            overflow: auto;
+            border: 2px solid black;
+            padding: 10px;
+        }
+
+        .clipping {
+            overflow: hidden;
+            top: 50px;
+            left: 200px;
+            height: 200px;
+            width: 200px;
+            border: 2px solid orange;
+        }
+        
+        .relative {
+            position: relative;
+        }
+
+        .spacer {
+            height: 150px;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+    </script>
+</head>
+<body>
+    <p>Test passes if it does not assert in debug.</p>
+    <div class="scroller">
+        <div class="clipping">this is clipped</div>
+        <div class="relative">
+            <div class="clipping">this is clipped</div>
+        </div>
+        <div class="spacer"></div>
+    </div>
+</body>
+</html>
+
index e074249..202999a 100644 (file)
@@ -1,3 +1,18 @@
+2019-05-10  Simon Fraser  <simon.fraser@apple.com>
+
+        ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()) on nytimes.com after r245170
+        https://bugs.webkit.org/show_bug.cgi?id=197776
+
+        Reviewed by Zalan Bujtas.
+
+        Only try to paint into shared backing for layers that are able to be composited. This
+        avoids trying to do sharing for non-self-painting layers, which doesn't make sense.
+
+        Test: compositing/shared-backing/overflow-scroll/non-self-painting-layer-should-not-share.html
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+
 2019-05-10  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         Fix a bunch of compiler warnings
index e3a4c9f..790791b 100644 (file)
@@ -915,7 +915,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor
 
         // If we're testing for overlap, we only need to composite if we overlap something that is already composited.
         if (overlapMap.overlapsLayers(layerExtent.bounds)) {
-            if (backingSharingState.backingProviderCandidate && backingProviderLayerCanIncludeLayer(*backingSharingState.backingProviderCandidate, layer)) {
+            if (backingSharingState.backingProviderCandidate && canBeComposited(layer) && backingProviderLayerCanIncludeLayer(*backingSharingState.backingProviderCandidate, layer)) {
                 backingSharingState.backingSharingLayers.append(makeWeakPtr(layer));
                 LOG(Compositing, " layer %p can share with %p", &layer, backingSharingState.backingProviderCandidate);
                 compositingReason = RenderLayer::IndirectCompositingReason::None;