Title: [246766] trunk
Revision
246766
Author
[email protected]
Date
2019-06-24 15:44:09 -0700 (Mon, 24 Jun 2019)

Log Message

REGRESSION (r246725 ): Crashes on twitch.tv
https://bugs.webkit.org/show_bug.cgi?id=199176
Source/WebCore:

rdar://problem/52071249

Reviewed by Zalan Bujtas.

With a composited negative z-index child inside a scroller, we can register the overflow scroll
proxy node before we've traversed the overflow layer, so it that layer hasn't got its OverflowScrollingNode
yet. Thus, AsyncScrollingCoordinator::setRelatedOverflowScrollingNodes() can be called with an empty vector.
Avoid crashing when this happens.

Test: scrollingcoordinator/scrolling-tree/scroller-with-negative-z-child.html

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::setRelatedOverflowScrollingNodes):
* page/scrolling/cocoa/ScrollingTreeOverflowScrollProxyNode.mm:
(WebCore::ScrollingTreeOverflowScrollProxyNode::commitStateBeforeChildren):

LayoutTests:

Reviewed by Zalan Bujtas.

* scrollingcoordinator/scrolling-tree/scroller-with-negative-z-child-expected.txt: Added.
* scrollingcoordinator/scrolling-tree/scroller-with-negative-z-child.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (246765 => 246766)


--- trunk/LayoutTests/ChangeLog	2019-06-24 22:29:00 UTC (rev 246765)
+++ trunk/LayoutTests/ChangeLog	2019-06-24 22:44:09 UTC (rev 246766)
@@ -1,3 +1,13 @@
+2019-06-24  Simon Fraser  <[email protected]>
+
+        REGRESSION (r246725 ): Crashes on twitch.tv
+        https://bugs.webkit.org/show_bug.cgi?id=199176
+
+        Reviewed by Zalan Bujtas.
+
+        * scrollingcoordinator/scrolling-tree/scroller-with-negative-z-child-expected.txt: Added.
+        * scrollingcoordinator/scrolling-tree/scroller-with-negative-z-child.html: Added.
+
 2019-06-24  Alexey Shvayka  <[email protected]>
 
         Add Array.prototype.{flat,flatMap} to unscopables

Added: trunk/LayoutTests/scrollingcoordinator/scrolling-tree/scroller-with-negative-z-child-expected.txt (0 => 246766)


--- trunk/LayoutTests/scrollingcoordinator/scrolling-tree/scroller-with-negative-z-child-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/scrolling-tree/scroller-with-negative-z-child-expected.txt	2019-06-24 22:44:09 UTC (rev 246766)
@@ -0,0 +1,3 @@
+This test should not assert or crash
+
+

Added: trunk/LayoutTests/scrollingcoordinator/scrolling-tree/scroller-with-negative-z-child.html (0 => 246766)


--- trunk/LayoutTests/scrollingcoordinator/scrolling-tree/scroller-with-negative-z-child.html	                        (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/scrolling-tree/scroller-with-negative-z-child.html	2019-06-24 22:44:09 UTC (rev 246766)
@@ -0,0 +1,48 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+    <style>
+		.scroller {
+			position: relative;
+			overflow-y: scroll;
+			width: 300px;
+			height: 300px;
+			border: 1px solid black;
+		}
+		
+		.box {
+			position: relative;
+			margin: 20px;
+		    width: 100px;
+		    height: 100px;
+		    background-color: green;
+		}
+
+		.inside {
+			left: 20px;
+		}
+		
+		.negative {
+			z-index: -1;
+		    transform: translateZ(0);
+		}
+
+		.spacer {
+		    width: 40px;
+		    height: 500px;
+		    background-color: silver;
+		}
+    </style>
+	<script>
+		if (window.testRunner)
+			testRunner.dumpAsText();
+	</script>
+</head>
+<body>
+    <p>This test should not assert or crash</p>
+	<div class="scroller">
+        <div class="inside negative box"></div>
+        <div class="spacer"></div>
+	</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (246765 => 246766)


--- trunk/Source/WebCore/ChangeLog	2019-06-24 22:29:00 UTC (rev 246765)
+++ trunk/Source/WebCore/ChangeLog	2019-06-24 22:44:09 UTC (rev 246766)
@@ -1,3 +1,23 @@
+2019-06-24  Simon Fraser  <[email protected]>
+
+        REGRESSION (r246725 ): Crashes on twitch.tv
+        https://bugs.webkit.org/show_bug.cgi?id=199176
+        rdar://problem/52071249
+
+        Reviewed by Zalan Bujtas.
+        
+        With a composited negative z-index child inside a scroller, we can register the overflow scroll
+        proxy node before we've traversed the overflow layer, so it that layer hasn't got its OverflowScrollingNode
+        yet. Thus, AsyncScrollingCoordinator::setRelatedOverflowScrollingNodes() can be called with an empty vector.
+        Avoid crashing when this happens.
+
+        Test: scrollingcoordinator/scrolling-tree/scroller-with-negative-z-child.html
+
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::setRelatedOverflowScrollingNodes):
+        * page/scrolling/cocoa/ScrollingTreeOverflowScrollProxyNode.mm:
+        (WebCore::ScrollingTreeOverflowScrollProxyNode::commitStateBeforeChildren):
+
 2019-06-24  Chris Dumez  <[email protected]>
 
         Pages using Google's anti-flicker optimization may take ~5 seconds to do initial paint

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (246765 => 246766)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2019-06-24 22:29:00 UTC (rev 246765)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2019-06-24 22:44:09 UTC (rev 246766)
@@ -715,8 +715,10 @@
         downcast<ScrollingStatePositionedNode>(node)->setRelatedOverflowScrollingNodes(WTFMove(relatedNodes));
     else if (is<ScrollingStateOverflowScrollProxyNode>(node)) {
         auto* overflowScrollProxyNode = downcast<ScrollingStateOverflowScrollProxyNode>(node);
-        ASSERT(relatedNodes.size() == 1);
-        overflowScrollProxyNode->setOverflowScrollingNode(relatedNodes[0]);
+        if (!relatedNodes.isEmpty())
+            overflowScrollProxyNode->setOverflowScrollingNode(relatedNodes[0]);
+        else
+            overflowScrollProxyNode->setOverflowScrollingNode(0);
     } else
         ASSERT_NOT_REACHED();
 }

Modified: trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeOverflowScrollProxyNode.mm (246765 => 246766)


--- trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeOverflowScrollProxyNode.mm	2019-06-24 22:29:00 UTC (rev 246765)
+++ trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeOverflowScrollProxyNode.mm	2019-06-24 22:44:09 UTC (rev 246766)
@@ -57,10 +57,12 @@
     if (overflowProxyStateNode.hasChangedProperty(ScrollingStateOverflowScrollProxyNode::OverflowScrollingNode))
         m_overflowScrollingNodeID = overflowProxyStateNode.overflowScrollingNode();
 
-    auto& relatedNodes = scrollingTree().overflowRelatedNodes();
-    relatedNodes.ensure(m_overflowScrollingNodeID, [] {
-        return Vector<ScrollingNodeID>();
-    }).iterator->value.append(scrollingNodeID());
+    if (m_overflowScrollingNodeID) {
+        auto& relatedNodes = scrollingTree().overflowRelatedNodes();
+        relatedNodes.ensure(m_overflowScrollingNodeID, [] {
+            return Vector<ScrollingNodeID>();
+        }).iterator->value.append(scrollingNodeID());
+    }
 
     scrollingTree().nodesWithRelatedOverflow().add(scrollingNodeID());
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to