Adding a child to a ScrollingStateNode needs to trigger a tree state commit
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2019 05:42:06 +0000 (05:42 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2019 05:42:06 +0000 (05:42 +0000)
commit3cb950ea14fde178f209dbcae40aa767c87ed1fa
tree88ee384d1d55fd031cbcec9437c9a09dbdda6f8a
parenta292318565b4830ae1cef61306f83fd4e14be64c
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.

Source/WebCore:

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):

LayoutTests:

* 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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240326 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/platform/ios/scrollingcoordinator/gain-scrolling-node-parent-expected.txt [new file with mode: 0644]
LayoutTests/platform/ios/scrollingcoordinator/lose-scrolling-node-parent-expected.txt [new file with mode: 0644]
LayoutTests/scrollingcoordinator/gain-scrolling-node-parent-expected.txt [new file with mode: 0644]
LayoutTests/scrollingcoordinator/gain-scrolling-node-parent.html [new file with mode: 0644]
LayoutTests/scrollingcoordinator/lose-scrolling-node-parent-expected.txt [new file with mode: 0644]
LayoutTests/scrollingcoordinator/lose-scrolling-node-parent.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/scrolling/ScrollingStateNode.cpp
Source/WebCore/page/scrolling/ScrollingStateNode.h
Source/WebCore/page/scrolling/ScrollingStateTree.cpp