Diff
Modified: trunk/LayoutTests/ChangeLog (240325 => 240326)
--- trunk/LayoutTests/ChangeLog 2019-01-23 05:30:09 UTC (rev 240325)
+++ trunk/LayoutTests/ChangeLog 2019-01-23 05:42:06 UTC (rev 240326)
@@ -1,5 +1,19 @@
2019-01-22 Simon Fraser <[email protected]>
+ Adding a child to a ScrollingStateNode needs to trigger a tree state commit
+ https://bugs.webkit.org/show_bug.cgi?id=193682
+
+ Reviewed by Zalan Bujtas.
+
+ * platform/ios/scrollingcoordinator/gain-scrolling-node-parent-expected.txt: Added.
+ * platform/ios/scrollingcoordinator/lose-scrolling-node-parent-expected.txt: Added.
+ * scrollingcoordinator/gain-scrolling-node-parent-expected.txt: Added.
+ * scrollingcoordinator/gain-scrolling-node-parent.html: Added.
+ * scrollingcoordinator/lose-scrolling-node-parent-expected.txt: Added.
+ * scrollingcoordinator/lose-scrolling-node-parent.html: Added.
+
+2019-01-22 Simon Fraser <[email protected]>
+
Make scrollingcoordinator tests only run on iOS/macOS WK2
https://bugs.webkit.org/show_bug.cgi?id=193690
Added: trunk/LayoutTests/platform/ios/scrollingcoordinator/gain-scrolling-node-parent-expected.txt (0 => 240326)
--- trunk/LayoutTests/platform/ios/scrollingcoordinator/gain-scrolling-node-parent-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/ios/scrollingcoordinator/gain-scrolling-node-parent-expected.txt 2019-01-23 05:42:06 UTC (rev 240326)
@@ -0,0 +1,42 @@
+Scrolling content
+Middle scrolling content
+Inner scrolling content
+
+(Frame scrolling node
+ (scrollable area size 800 600)
+ (contents size 800 600)
+ (scrollable area parameters
+ (horizontal scroll elasticity 1)
+ (vertical scroll elasticity 1)
+ (horizontal scrollbar mode 0)
+ (vertical scrollbar mode 0))
+ (visual viewport enabled 1)
+ (layout viewport at (0,0) size 800x600)
+ (min layout viewport origin (0,0))
+ (max layout viewport origin (0,0))
+ (behavior for fixed 0)
+ (children 1
+ (Overflow scrolling node
+ (scrollable area size 420 320)
+ (contents size 443 1041)
+ (scrollable area parameters
+ (horizontal scroll elasticity 1)
+ (vertical scroll elasticity 1)
+ (horizontal scrollbar mode 0)
+ (vertical scrollbar mode 0))
+ (children 1
+ (Overflow scrolling node
+ (scrollable area size 420 320)
+ (contents size 420 1020)
+ (scrollable area parameters
+ (horizontal scroll elasticity 1)
+ (vertical scroll elasticity 1)
+ (horizontal scrollbar mode 0)
+ (vertical scrollbar mode 0))
+ )
+ )
+ )
+ )
+)
+
+
Added: trunk/LayoutTests/platform/ios/scrollingcoordinator/lose-scrolling-node-parent-expected.txt (0 => 240326)
--- trunk/LayoutTests/platform/ios/scrollingcoordinator/lose-scrolling-node-parent-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/ios/scrollingcoordinator/lose-scrolling-node-parent-expected.txt 2019-01-23 05:42:06 UTC (rev 240326)
@@ -0,0 +1,42 @@
+Scrolling content
+Middle scrolling content
+Inner scrolling content
+
+(Frame scrolling node
+ (scrollable area size 800 600)
+ (contents size 800 600)
+ (scrollable area parameters
+ (horizontal scroll elasticity 1)
+ (vertical scroll elasticity 1)
+ (horizontal scrollbar mode 0)
+ (vertical scrollbar mode 0))
+ (visual viewport enabled 1)
+ (layout viewport at (0,0) size 800x600)
+ (min layout viewport origin (0,0))
+ (max layout viewport origin (0,0))
+ (behavior for fixed 0)
+ (children 1
+ (Overflow scrolling node
+ (scrollable area size 420 320)
+ (contents size 443 1041)
+ (scrollable area parameters
+ (horizontal scroll elasticity 1)
+ (vertical scroll elasticity 1)
+ (horizontal scrollbar mode 0)
+ (vertical scrollbar mode 0))
+ (children 1
+ (Overflow scrolling node
+ (scrollable area size 420 320)
+ (contents size 420 1020)
+ (scrollable area parameters
+ (horizontal scroll elasticity 1)
+ (vertical scroll elasticity 1)
+ (horizontal scrollbar mode 0)
+ (vertical scrollbar mode 0))
+ )
+ )
+ )
+ )
+)
+
+
Added: trunk/LayoutTests/scrollingcoordinator/gain-scrolling-node-parent-expected.txt (0 => 240326)
--- trunk/LayoutTests/scrollingcoordinator/gain-scrolling-node-parent-expected.txt (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/gain-scrolling-node-parent-expected.txt 2019-01-23 05:42:06 UTC (rev 240326)
@@ -0,0 +1,42 @@
+Scrolling content
+Middle scrolling content
+Inner scrolling content
+
+(Frame scrolling node
+ (scrollable area size 800 600)
+ (contents size 800 600)
+ (scrollable area parameters
+ (horizontal scroll elasticity 2)
+ (vertical scroll elasticity 2)
+ (horizontal scrollbar mode 0)
+ (vertical scrollbar mode 0))
+ (visual viewport enabled 1)
+ (layout viewport at (0,0) size 800x600)
+ (min layout viewport origin (0,0))
+ (max layout viewport origin (0,0))
+ (behavior for fixed 0)
+ (children 1
+ (Overflow scrolling node
+ (scrollable area size 405 305)
+ (contents size 443 1039)
+ (scrollable area parameters
+ (horizontal scroll elasticity 1)
+ (vertical scroll elasticity 1)
+ (horizontal scrollbar mode 0)
+ (vertical scrollbar mode 0))
+ (children 1
+ (Overflow scrolling node
+ (scrollable area size 405 305)
+ (contents size 405 1020)
+ (scrollable area parameters
+ (horizontal scroll elasticity 1)
+ (vertical scroll elasticity 1)
+ (horizontal scrollbar mode 0)
+ (vertical scrollbar mode 0))
+ )
+ )
+ )
+ )
+)
+
+
Added: trunk/LayoutTests/scrollingcoordinator/gain-scrolling-node-parent.html (0 => 240326)
--- trunk/LayoutTests/scrollingcoordinator/gain-scrolling-node-parent.html (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/gain-scrolling-node-parent.html 2019-01-23 05:42:06 UTC (rev 240326)
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Check that scrolling nodes get reparented when an ancestor is removed</title>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ if (window.internals)
+ window.internals.settings.setAsyncOverflowScrollingEnabled(true);
+
+ function doTest() {
+ requestAnimationFrame(() => {
+ document.getElementById('target').classList.add('changed');
+ if (window.internals)
+ document.getElementById('scrollingTree').innerText = window.internals.scrollingStateTreeAsText() + "\n";
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+ });
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+ <style>
+ .scroller {
+ background-color: silver;
+ border: 1px solid black;
+ padding: 10px;
+ width: 400px;
+ height: 300px;
+ overflow: scroll;
+ }
+
+ #target.changed {
+ overflow: visible;
+ }
+
+ .scrolling-content {
+ height: 1000px;
+ }
+ </style>
+</head>
+<body>
+ <div class="scroller">
+ <div class="scrolling-content">
+ Scrolling content
+ <div class="intermediate scroller" id="target">
+ <div class="scrolling-content">
+ Middle scrolling content
+ <div class="inner scroller">
+ <div class="scrolling-content">
+ Inner scrolling content
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <pre id="scrollingTree"></pre>
+</body>
+</html>
Added: trunk/LayoutTests/scrollingcoordinator/lose-scrolling-node-parent-expected.txt (0 => 240326)
--- trunk/LayoutTests/scrollingcoordinator/lose-scrolling-node-parent-expected.txt (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/lose-scrolling-node-parent-expected.txt 2019-01-23 05:42:06 UTC (rev 240326)
@@ -0,0 +1,42 @@
+Scrolling content
+Middle scrolling content
+Inner scrolling content
+
+(Frame scrolling node
+ (scrollable area size 800 600)
+ (contents size 800 600)
+ (scrollable area parameters
+ (horizontal scroll elasticity 2)
+ (vertical scroll elasticity 2)
+ (horizontal scrollbar mode 0)
+ (vertical scrollbar mode 0))
+ (visual viewport enabled 1)
+ (layout viewport at (0,0) size 800x600)
+ (min layout viewport origin (0,0))
+ (max layout viewport origin (0,0))
+ (behavior for fixed 0)
+ (children 1
+ (Overflow scrolling node
+ (scrollable area size 405 305)
+ (contents size 443 1039)
+ (scrollable area parameters
+ (horizontal scroll elasticity 1)
+ (vertical scroll elasticity 1)
+ (horizontal scrollbar mode 0)
+ (vertical scrollbar mode 0))
+ (children 1
+ (Overflow scrolling node
+ (scrollable area size 405 305)
+ (contents size 405 1020)
+ (scrollable area parameters
+ (horizontal scroll elasticity 1)
+ (vertical scroll elasticity 1)
+ (horizontal scrollbar mode 0)
+ (vertical scrollbar mode 0))
+ )
+ )
+ )
+ )
+)
+
+
Added: trunk/LayoutTests/scrollingcoordinator/lose-scrolling-node-parent.html (0 => 240326)
--- trunk/LayoutTests/scrollingcoordinator/lose-scrolling-node-parent.html (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/lose-scrolling-node-parent.html 2019-01-23 05:42:06 UTC (rev 240326)
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Check that scrolling nodes get reparented when an ancestor is removed</title>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ if (window.internals)
+ window.internals.settings.setAsyncOverflowScrollingEnabled(true);
+
+ function doTest() {
+ requestAnimationFrame(() => {
+ document.getElementById('target').classList.add('changed');
+ if (window.internals)
+ document.getElementById('scrollingTree').innerText = window.internals.scrollingStateTreeAsText() + "\n";
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+ });
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+ <style>
+ .scroller {
+ background-color: silver;
+ border: 1px solid black;
+ padding: 10px;
+ width: 400px;
+ height: 300px;
+ overflow: scroll;
+ }
+
+ #target.changed {
+ overflow: visible;
+ }
+
+ .scrolling-content {
+ height: 1000px;
+ }
+ </style>
+</head>
+<body>
+ <div class="scroller">
+ <div class="scrolling-content">
+ Scrolling content
+ <div class="intermediate scroller" id="target">
+ <div class="scrolling-content">
+ Middle scrolling content
+ <div class="inner scroller">
+ <div class="scrolling-content">
+ Inner scrolling content
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <pre id="scrollingTree"></pre>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (240325 => 240326)
--- trunk/Source/WebCore/ChangeLog 2019-01-23 05:30:09 UTC (rev 240325)
+++ trunk/Source/WebCore/ChangeLog 2019-01-23 05:42:06 UTC (rev 240326)
@@ -1,3 +1,30 @@
+2019-01-22 Simon Fraser <[email protected]>
+
+ Adding a child to a ScrollingStateNode needs to trigger a tree state commit
+ https://bugs.webkit.org/show_bug.cgi?id=193682
+
+ Reviewed by Zalan Bujtas.
+
+ Scrolling tree mutations that re-arrange nodes (e.g. node reordering when z-index changes)
+ need to trigger scrolling tree updates, and currently do not.
+
+ Fix by adding a "ChildNodes" dirty bit to ScrollingStateNode. There isn't any code that consults
+ this flag when committing the scrolling tree because we always eagerly traverse children, but
+ we could use it to optimize later. The important part is that we use it to trigger a tree update.
+
+ Can't test via z-reordering until webkit.org/b/192529 is fixed.
+
+ Tests: scrollingcoordinator/gain-scrolling-node-parent.html
+ scrollingcoordinator/lose-scrolling-node-parent.html
+
+ * page/scrolling/ScrollingStateNode.cpp:
+ (WebCore::ScrollingStateNode::appendChild):
+ (WebCore::ScrollingStateNode::insertChild):
+ (WebCore::ScrollingStateNode::removeChildAtIndex):
+ * page/scrolling/ScrollingStateNode.h:
+ * page/scrolling/ScrollingStateTree.cpp:
+ (WebCore::ScrollingStateTree::attachNode):
+
2019-01-22 Devin Rousso <[email protected]>
Web Inspector: InspectorInstrumentation::willEvaluateScript should include column number
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp (240325 => 240326)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp 2019-01-23 05:30:09 UTC (rev 240325)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp 2019-01-23 05:42:06 UTC (rev 240326)
@@ -95,6 +95,7 @@
if (!m_children)
m_children = std::make_unique<Vector<RefPtr<ScrollingStateNode>>>();
m_children->append(WTFMove(childNode));
+ setPropertyChanged(ChildNodes);
}
void ScrollingStateNode::insertChild(Ref<ScrollingStateNode>&& childNode, size_t index)
@@ -107,8 +108,18 @@
}
m_children->insert(index, WTFMove(childNode));
+ setPropertyChanged(ChildNodes);
}
+void ScrollingStateNode::removeChildAtIndex(size_t index)
+{
+ ASSERT(m_children && index < m_children->size());
+ if (m_children && index < m_children->size()) {
+ m_children->remove(index);
+ setPropertyChanged(ChildNodes);
+ }
+}
+
size_t ScrollingStateNode::indexOfChild(ScrollingStateNode& childNode) const
{
if (!m_children)
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h (240325 => 240326)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h 2019-01-23 05:30:09 UTC (rev 240325)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h 2019-01-23 05:42:06 UTC (rev 240326)
@@ -208,6 +208,7 @@
enum {
ScrollLayer = 0,
+ ChildNodes,
NumStateNodeBits // This must remain at the last position.
};
typedef uint64_t ChangedProperties;
@@ -238,6 +239,8 @@
void appendChild(Ref<ScrollingStateNode>&&);
void insertChild(Ref<ScrollingStateNode>&&, size_t index);
+ void removeChildAtIndex(size_t index);
+
size_t indexOfChild(ScrollingStateNode&) const;
String scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const;
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp (240325 => 240326)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp 2019-01-23 05:30:09 UTC (rev 240325)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp 2019-01-23 05:42:06 UTC (rev 240326)
@@ -106,7 +106,7 @@
ASSERT(currentIndex != notFound);
Ref<ScrollingStateNode> protectedNode(*node);
- parent->children()->remove(currentIndex);
+ parent->removeChildAtIndex(currentIndex);
if (childIndex == notFound)
parent->appendChild(WTFMove(protectedNode));