Bug 216355 - Don't create event regions when the page has no subscrollers
Summary: Don't create event regions when the page has no subscrollers
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Scrolling (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-09-10 05:27 PDT by Antti Koivisto
Modified: 2020-09-10 11:36 PDT (History)
12 users (show)

See Also:


Attachments
patch (50.43 KB, patch)
2020-09-10 06:14 PDT, Antti Koivisto
no flags Details | Formatted Diff | Diff
patch (50.28 KB, patch)
2020-09-10 06:15 PDT, Antti Koivisto
simon.fraser: review+
koivisto: commit-queue+
Details | Formatted Diff | Diff
patch (50.30 KB, patch)
2020-09-10 11:04 PDT, Antti Koivisto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 2020-09-10 05:27:36 PDT
Unless the page uses features like touch-action we don't need event regions for plain main frame scrolling.
Comment 1 Antti Koivisto 2020-09-10 06:05:37 PDT
<rdar://problem/67900642>
Comment 2 Antti Koivisto 2020-09-10 06:14:31 PDT
Created attachment 408431 [details]
patch
Comment 3 Antti Koivisto 2020-09-10 06:15:10 PDT
Created attachment 408432 [details]
patch
Comment 4 Simon Fraser (smfr) 2020-09-10 08:57:50 PDT
Comment on attachment 408432 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=408432&action=review

> Source/WebCore/rendering/RenderLayerCompositor.cpp:880
> +        if (scrollingCoordinator && scrollingCoordinator->hasSubscrollers() != hadSubscrollers)
> +            invalidateEventRegionForAllFrames();

I don't like that this triggers a second compositing update just after we've finished one, and in all frames too!

This means that every page with one or more subscrollers now suffers from an extra full layer tree walk in all frames and a second compositing update.
Comment 5 Antti Koivisto 2020-09-10 09:29:14 PDT
> I don't like that this triggers a second compositing update just after we've
> finished one, and in all frames too!

No it doesn't. It just sets m_needsEventRegionUpdate bit in RenderLayerBacking.
Comment 6 Simon Fraser (smfr) 2020-09-10 09:42:39 PDT
Comment on attachment 408432 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=408432&action=review

> Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp:39
> +    scrollingStateTree().scrollingNodeAdded();

I wonder if ScrollingStateTree::addNode() is a better place to call this.

> Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp:80
> +    scrollingStateTree().scrollingNodeRemoved();

I wonder if ScrollingStateTree::willRemoveNode() is a better place to call this.

>> Source/WebCore/rendering/RenderLayerCompositor.cpp:880
>> +            invalidateEventRegionForAllFrames();
> 
> I don't like that this triggers a second compositing update just after we've finished one, and in all frames too!
> 
> This means that every page with one or more subscrollers now suffers from an extra full layer tree walk in all frames and a second compositing update.

I see now that we'll update regions at the end of the rendering update.
Comment 7 Antti Koivisto 2020-09-10 10:09:22 PDT
> I wonder if ScrollingStateTree::addNode() is a better place to call this.
> I wonder if ScrollingStateTree::willRemoveNode() is a better place to call
> this.

I considered it but this seemed like the most robust solution.
Comment 8 EWS 2020-09-10 10:40:39 PDT
commit-queue failed to commit attachment 408432 [details] to WebKit repository.
Comment 9 Antti Koivisto 2020-09-10 11:04:23 PDT
Created attachment 408461 [details]
patch
Comment 10 EWS 2020-09-10 11:36:29 PDT
Committed r266846: <https://trac.webkit.org/changeset/266846>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 408461 [details].