RESOLVED FIXED 195371
Compositing layer that renders two positioned elements should not hit test
https://bugs.webkit.org/show_bug.cgi?id=195371
Summary Compositing layer that renders two positioned elements should not hit test
Simon Fraser (smfr)
Reported 2019-03-06 13:17:54 PST
Created attachment 363780 [details] Testcase If the layer overlapping a scroller has two disjoint RenderLayers, it should not hit test in its entirety.
Attachments
Testcase (1.25 KB, text/html)
2019-03-06 13:17 PST, Simon Fraser (smfr)
no flags
wip (24.52 KB, patch)
2019-03-08 09:55 PST, Antti Koivisto
no flags
patch (36.15 KB, patch)
2019-03-11 06:14 PDT, Antti Koivisto
ews-watchlist: commit-queue-
Archive of layout-test-results from ews114 for mac-highsierra (2.41 MB, application/zip)
2019-03-11 08:02 PDT, EWS Watchlist
no flags
patch (36.61 KB, patch)
2019-03-11 08:52 PDT, Antti Koivisto
no flags
patch (36.64 KB, patch)
2019-03-11 09:15 PDT, Antti Koivisto
no flags
patch (36.25 KB, patch)
2019-03-11 09:18 PDT, Antti Koivisto
no flags
patch (36.25 KB, patch)
2019-03-11 09:23 PDT, Antti Koivisto
no flags
patch (36.12 KB, patch)
2019-03-11 09:30 PDT, Antti Koivisto
simon.fraser: review+
ews-watchlist: commit-queue-
Archive of layout-test-results from ews114 for mac-highsierra (2.29 MB, application/zip)
2019-03-11 11:30 PDT, EWS Watchlist
no flags
patch (36.55 KB, patch)
2019-03-12 02:24 PDT, Antti Koivisto
no flags
patch (37.33 KB, patch)
2019-03-12 06:55 PDT, Antti Koivisto
no flags
followup (2.90 KB, patch)
2019-03-12 14:59 PDT, Antti Koivisto
no flags
followup to fix the test (2.90 KB, patch)
2019-03-12 15:04 PDT, Antti Koivisto
no flags
Radar WebKit Bug Importer
Comment 1 2019-03-06 13:18:23 PST
Antti Koivisto
Comment 2 2019-03-08 09:55:04 PST
Simon Fraser (smfr)
Comment 3 2019-03-08 10:10:58 PST
Comment on attachment 364024 [details] wip View in context: https://bugs.webkit.org/attachment.cgi?id=364024&action=review > Source/WebCore/platform/graphics/GraphicsLayer.h:451 > + virtual void setEventRegion(std::unique_ptr<Region>) { } std::unique_ptr<Region>&& > Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:975 > + if (region == m_eventRegion) > + return; > + if (region && m_eventRegion && *region == *m_eventRegion) > + return; Use arePointingToEqualData()? > Source/WebCore/rendering/RenderLayerBacking.cpp:2591 > + m_graphicsLayer->setEventRegion(WTFMove(eventRegion)); Doing this in painting won't get you any regions for layers that don't paint (but still need to hit-test), like those with just color backgrounds (bug 195378). An alternative would be to do this as a RenderLayer tree walk. The relevant renderer hit-testing code is in Render*::nodeAtPoint(). I wonder if we can make a parallel method to every nodeAtPoint(), then call into it from a RenderLayer tree walk which is like what RenderLayer::hitTest/hitTestContents() do? That would be instead of using a paint phase, but it would make the region building code more similar to the hit-testing code. A longer term solution would be to change the hit-testing path to be iterator-like, with options to either do a hit-test, or to gather the region. > Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:69 > + [layer() setValue:nil forKey:WKRemoteLayerTreeNodePropertyKey]; These setValue:forKey: do show up in profiles; it's not very fast. > Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:96 > + fprintf(stderr, "RemoteLayerTreeNode::setEventRegion\n"); > + for (auto& rect : m_eventRegion->rects()) > + fprintf(stderr, "rect (%d %d %d %d)\n", rect.x(), rect.y(), rect.width(), rect.height()); Region::dump() > Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:103 > [layer() setValue:@(layerID) forKey:WKLayerIDPropertyKey]; > + [layer() setValue:[NSValue valueWithPointer:this] forKey:WKRemoteLayerTreeNodePropertyKey]; Rather than a second setValue:forKey:, can we instead just get to the remoteLayerTreeNode with ID via the RemoteLayerTreeContext?
Antti Koivisto
Comment 4 2019-03-11 05:03:07 PDT
> An alternative would be to do this as a RenderLayer tree walk. The relevant > renderer hit-testing code is in Render*::nodeAtPoint(). I wonder if we can > make a parallel method to every nodeAtPoint(), then call into it from a > RenderLayer tree walk which is like what > RenderLayer::hitTest/hitTestContents() do? That would be instead of using a > paint phase, but it would make the region building code more similar to the > hit-testing code. A longer term solution would be to change the hit-testing > path to be iterator-like, with options to either do a hit-test, or to gather > the region. I don't really want to add another hittest/paint-like tree-walk code path. Lets use a paint phase for now, it is not complex and can be easily factored into something else later. > Rather than a second setValue:forKey:, can we instead just get to the > remoteLayerTreeNode with ID via the RemoteLayerTreeContext? I moved the id to the RemoteLayerTreeNode too, eliminating the need for two separate key values. We could further improve this with custom layers that contain the back pointers as a regular members (most of the layers are under our control).
Antti Koivisto
Comment 5 2019-03-11 06:14:44 PDT
EWS Watchlist
Comment 6 2019-03-11 08:02:41 PDT
Comment on attachment 364249 [details] patch Attachment 364249 [details] did not pass mac-debug-ews (mac): Output: https://webkit-queues.webkit.org/results/11455439 New failing tests: displaylists/extent-includes-transforms.html
EWS Watchlist
Comment 7 2019-03-11 08:02:42 PDT
Created attachment 364252 [details] Archive of layout-test-results from ews114 for mac-highsierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews114 Port: mac-highsierra Platform: Mac OS X 10.13.6
Antti Koivisto
Comment 8 2019-03-11 08:52:16 PDT
Antti Koivisto
Comment 9 2019-03-11 09:15:05 PDT
Antti Koivisto
Comment 10 2019-03-11 09:18:04 PDT
Antti Koivisto
Comment 11 2019-03-11 09:23:53 PDT
Antti Koivisto
Comment 12 2019-03-11 09:30:02 PDT
Simon Fraser (smfr)
Comment 13 2019-03-11 11:04:24 PDT
Comment on attachment 364262 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=364262&action=review > Source/WebCore/rendering/RenderLayerBacking.cpp:2587 > + if (eventRegion->contains(roundedIntRect(compositedBounds()))) > + eventRegion = nullptr; When does this happen? Is this the case for a simple layer which is fully hit-testable? > Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:884 > + m_properties.eventRegion = std::make_unique<WebCore::Region>(*eventRegion); Is it worth comparing regions? Not doing so will trigger region encoding on every paint, right?
EWS Watchlist
Comment 14 2019-03-11 11:30:09 PDT
Comment on attachment 364262 [details] patch Attachment 364262 [details] did not pass mac-debug-ews (mac): Output: https://webkit-queues.webkit.org/results/11457257 New failing tests: displaylists/extent-includes-transforms.html
EWS Watchlist
Comment 15 2019-03-11 11:30:10 PDT
Created attachment 364273 [details] Archive of layout-test-results from ews114 for mac-highsierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews114 Port: mac-highsierra Platform: Mac OS X 10.13.6
Antti Koivisto
Comment 16 2019-03-11 12:23:48 PDT
> When does this happen? Is this the case for a simple layer which is fully > hit-testable? Yeah. Even trivial Region object is large so I don't want to keep it around in that case. We should probably optimize Region so that it does not allocate main data structure until something that can't be described by a single rect is added. > > Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:884 > > + m_properties.eventRegion = std::make_unique<WebCore::Region>(*eventRegion); > > Is it worth comparing regions? Not doing so will trigger region encoding on > every paint, right? Maybe, though complex cases are probably rare. I'll see about it.
Simon Fraser (smfr)
Comment 17 2019-03-11 13:56:08 PDT
(In reply to Antti Koivisto from comment #16) > > When does this happen? Is this the case for a simple layer which is fully > > hit-testable? > > Yeah. Even trivial Region object is large so I don't want to keep it around > in that case. We should probably optimize Region so that it does not > allocate main data structure until something that can't be described by a > single rect is added. It's a bit confusing that a null region in the UI process means "entire layer is the event region"; I have to think about whether the whole layer is clickable or not clickable. Some region-or-rect thing would be good here. > > > Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:884 > > > + m_properties.eventRegion = std::make_unique<WebCore::Region>(*eventRegion); > > > > Is it worth comparing regions? Not doing so will trigger region encoding on > > every paint, right? > > Maybe, though complex cases are probably rare. I'll see about it.
Antti Koivisto
Comment 18 2019-03-12 01:56:10 PDT
> Some region-or-rect thing would be good here. I think Region can be the region-or-rect thing with some optimisation. It almost is already.
Antti Koivisto
Comment 19 2019-03-12 02:24:54 PDT
Antti Koivisto
Comment 20 2019-03-12 02:25:41 PDT
*** Bug 195372 has been marked as a duplicate of this bug. ***
Antti Koivisto
Comment 21 2019-03-12 02:26:24 PDT
*** Bug 195370 has been marked as a duplicate of this bug. ***
Antti Koivisto
Comment 22 2019-03-12 06:55:07 PDT
WebKit Commit Bot
Comment 23 2019-03-12 07:44:37 PDT
The commit-queue encountered the following flaky tests while processing attachment 364385 [details]: legacy-animation-engine/imported/blink/animations/animation-events-prefixed-01.html bug 195621 (authors: dino@apple.com and graouts@apple.com) The commit-queue is continuing to process your patch.
WebKit Commit Bot
Comment 24 2019-03-12 07:45:38 PDT
Comment on attachment 364385 [details] patch Clearing flags on attachment: 364385 Committed r242794: <https://trac.webkit.org/changeset/242794>
WebKit Commit Bot
Comment 25 2019-03-12 07:45:41 PDT
All reviewed patches have been landed. Closing bug.
Ryan Haddad
Comment 26 2019-03-12 13:36:30 PDT
fast/scrolling/ios/overflow-scroll-overlap-2.html (added with this change) is consistently failing on iOS Simulator: --- /Volumes/Data/slave/ios-simulator-12-debug-tests-wk2/build/layout-test-results/fast/scrolling/ios/overflow-scroll-overlap-2-expected.txt +++ /Volumes/Data/slave/ios-simulator-12-debug-tests-wk2/build/layout-test-results/fast/scrolling/ios/overflow-scroll-overlap-2-actual.txt @@ -1,9 +1,9 @@ Test that scrollable areas with non-trivial overlap are correctly targeted. case 1: -case 2: Scrollable 2 -case 3: Scrollable 3 -case 4: Scrollable 4 -case 5: Scrollable 5 +case 2: +case 3: +case 4: +case 5: case 6: https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#tests=fast%2Fscrolling%2Fios%2Foverflow-scroll-overlap-2.html
Antti Koivisto
Comment 27 2019-03-12 14:12:55 PDT
Strange. Looking.
Shawn Roberts
Comment 28 2019-03-12 14:49:49 PDT
This is also causing a layout test image diff failure on Mac WK2 Reproduced locally with : run-webkit-tests animations/stacking-context-not-fill-forwards.html --iterations 500 -f --no-retry Failing ~11 times per 500 iteration run. Passes 1500 iterations in versions prior to 242794 Flakiness Dashboard : https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=animations%2Fstacking-context-not-fill-forwards.html Diff: https://build.webkit.org/results/Apple%20Mojave%20Release%20WK2%20(Tests)/r242797%20(3024)/animations/stacking-context-not-fill-forwards-diffs.html
Antti Koivisto
Comment 29 2019-03-12 14:59:59 PDT
Created attachment 364452 [details] followup
Antti Koivisto
Comment 30 2019-03-12 15:04:00 PDT
Created attachment 364456 [details] followup to fix the test
Antti Koivisto
Comment 31 2019-03-12 15:36:21 PDT
Note You need to log in before you can comment on or make changes to this bug.