Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record InteractionRegions per RenderLayer, instead of all on the root #1438

Conversation

hortont424
Copy link
Contributor

@hortont424 hortont424 commented Jun 10, 2022

fc1dbe6

Record InteractionRegions per RenderLayer, instead of all on the root
https://bugs.webkit.org/show_bug.cgi?id=241503
<rdar://problem/93855866>

Reviewed by Simon Fraser.

* Source/WebCore/page/DebugPageOverlays.cpp:
(WebCore::pathsForRegion):
(WebCore::InteractionRegionOverlay::activeLayer const):
(WebCore::InteractionRegionOverlay::activeRegion const):
(WebCore::InteractionRegionOverlay::drawRect):
Hit test to the correct layer and retrieve regions from that layer for the debug overlay.
Also, fix some coordinate conversion now that we actually see non-root layers.

* Source/WebCore/page/InteractionRegion.cpp:
(WebCore::cursorTypeForElement):
(WebCore::interactionRegionForRenderedRegion):
(WebCore::absoluteBoundingRectForRange): Deleted.
(WebCore::regionForElement): Deleted.
(WebCore::interactionRegions): Deleted.
* Source/WebCore/page/InteractionRegion.h:
Refactor InteractionRegion to take the same arguments as EventRegion::unite(),
so we can call it from there. Use the painting-originated rects in the Region,
instead of computing them ourselves.

* Source/WebCore/rendering/EventRegion.cpp:
(WebCore::EventRegionContext::unite):
(WebCore::EventRegionContext::uniteInteractionRegions):
(WebCore::EventRegionContext::copyInteractionRegionsToEventRegion):
(WebCore::EventRegion::computeInteractionRegions): Deleted.
* Source/WebCore/rendering/EventRegion.h:
Collect InteractionRegions in a HashMap by element identifier, in order to
unite the rects for a given element -- but not *across* elements, like other EventRegions.
We need to keep them separate so that we can add an indicator for the united region.
Also, unusually, we maintain this map on the EventRegionContext as we paint, and copy them
to the serialized type at the end, to avoid having two different members on
EventRegion that are only valid on opposite sides of the process boundary.

* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateEventRegion):
Stop computing interaction regions for the root layer.

* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintObject):
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateScrollLayerClipping):
* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::paint):
* Source/WebCore/rendering/TextBoxPainter.cpp:
(WebCore::TextBoxPainter<TextBoxPath>::paint):
Plumb the renderer through to EventRegionContext so that we can use it in
InteractionRegion::interactionRegionForRenderedRegion.

* LayoutTests/interaction-region/click-handler-in-shadowed-layer-expected.txt: Added.
* LayoutTests/interaction-region/click-handler-in-shadowed-layer.html: Added.
* LayoutTests/interaction-region/inline-link-in-layer-expected.txt: Added.
* LayoutTests/interaction-region/inline-link-in-layer.html: Added.
* LayoutTests/interaction-region/inline-link-in-composited-iframe-expected.txt: Added.
* LayoutTests/interaction-region/inline-link-in-composited-iframe.html: Added.
* LayoutTests/interaction-region/inline-link-in-non-composited-iframe-expected.txt: Added.
* LayoutTests/interaction-region/inline-link-in-non-composited-iframe.html: Added.
Add some tests.

Canonical link: https://commits.webkit.org/251635@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295630 268f45cc-cd09-0410-ab3c-d52691b4dbfc

@hortont424 hortont424 self-assigned this Jun 10, 2022
@hortont424 hortont424 added WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore). WebKit Nightly Build labels Jun 10, 2022
@hortont424 hortont424 requested review from whsieh, smfr and grorg June 10, 2022 06:04
@webkit-early-warning-system webkit-early-warning-system added the merging-blocked Applied to prevent a change from being merged label Jun 10, 2022
@hortont424 hortont424 removed merging-blocked Applied to prevent a change from being merged WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore). WebKit Nightly Build labels Jun 13, 2022
@hortont424 hortont424 force-pushed the eng/Record-InteractionRegions-per-RenderLayer-instead-of-all-on-the-root branch from 527f2d1 to 6f18d65 Compare June 13, 2022 07:36
@hortont424 hortont424 added WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore). WebKit Nightly Build labels Jun 13, 2022
@webkit-early-warning-system webkit-early-warning-system added the merging-blocked Applied to prevent a change from being merged label Jun 13, 2022
Source/WebCore/platform/graphics/IntRect.h Outdated Show resolved Hide resolved
Source/WebCore/platform/graphics/IntRect.h Outdated Show resolved Hide resolved
Source/WebCore/rendering/RenderLayerBacking.cpp Outdated Show resolved Hide resolved
@hortont424 hortont424 removed merging-blocked Applied to prevent a change from being merged WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore). WebKit Nightly Build labels Jun 13, 2022
@hortont424 hortont424 force-pushed the eng/Record-InteractionRegions-per-RenderLayer-instead-of-all-on-the-root branch from 6f18d65 to fce77f3 Compare June 13, 2022 18:57
@hortont424 hortont424 added WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore). WebKit Nightly Build labels Jun 13, 2022
@webkit-early-warning-system webkit-early-warning-system added the merging-blocked Applied to prevent a change from being merged label Jun 13, 2022
(interaction regions [
(region
(rect (-3,-3) width=35 height=24)
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess there's an indentation bug with region dumping

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is! I keep meaning to fix it, but that belongs in another patch because it's going to change a lot of results.


if (frameView.ptr() != mainFrameView.ptr())
contentsRect.intersect(frameClipRect);
RefPtr<Element> element = dynamicDowncast<Element>(regionRenderer.node());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto

@hortont424 hortont424 removed merging-blocked Applied to prevent a change from being merged WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore). WebKit Nightly Build labels Jun 16, 2022
@hortont424 hortont424 force-pushed the eng/Record-InteractionRegions-per-RenderLayer-instead-of-all-on-the-root branch from fce77f3 to 72c5161 Compare June 16, 2022 23:30
@hortont424 hortont424 added WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore). WebKit Nightly Build labels Jun 16, 2022
@hortont424 hortont424 force-pushed the eng/Record-InteractionRegions-per-RenderLayer-instead-of-all-on-the-root branch from 72c5161 to 9aa81a6 Compare June 16, 2022 23:33
@hortont424 hortont424 added the merge-queue Applied to send a pull request to merge-queue label Jun 17, 2022
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/Record-InteractionRegions-per-RenderLayer-instead-of-all-on-the-root branch from 9aa81a6 to fc1dbe6 Compare June 17, 2022 06:58
@webkit-early-warning-system webkit-early-warning-system merged commit fc1dbe6 into WebKit:main Jun 17, 2022
@webkit-early-warning-system
Copy link
Collaborator

Committed r295630 (251635@main): https://commits.webkit.org/251635@main

Reviewed commits have been landed. Closing PR #1438 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system removed the merge-queue Applied to send a pull request to merge-queue label Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore).
Projects
None yet
3 participants