[webkit-changes] [WebKit/WebKit] e73e7e: [InteractionRegions] Add support for content hints
Etienne Segonzac
noreply at github.com
Thu Mar 7 12:44:55 PST 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e73e7e8fda6a5f2124272836545be23ab47754ef
https://github.com/WebKit/WebKit/commit/e73e7e8fda6a5f2124272836545be23ab47754ef
Author: Etienne Segonzac <sgz at apple.com>
Date: 2024-03-07 (Thu, 07 Mar 2024)
Changed paths:
A LayoutTests/interaction-region/content-hint-expected.txt
A LayoutTests/interaction-region/content-hint.html
M LayoutTests/interaction-region/overlap-same-group-expected.txt
M LayoutTests/interaction-region/wrapped-inline-link-expected.txt
M Source/WebCore/page/InteractionRegion.cpp
M Source/WebCore/page/InteractionRegion.h
M Source/WebCore/rendering/EventRegion.cpp
M Source/WebCore/rendering/EventRegion.h
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm
Log Message:
-----------
[InteractionRegions] Add support for content hints
https://bugs.webkit.org/show_bug.cgi?id=270525
<rdar://115490523>
Reviewed by Mike Wyrzykowski.
Introduce a new `contentHint` field for Interaction Regions, currently
Default or Photo.
Then detect regions generated for "photos" to flag them as such.
Rework the EventRegion consolidation code to avoid using unnecessary
clip paths, and to let regions with special content hints show through.
* Source/WebCore/page/InteractionRegion.h:
(WebCore::operator==):
Introduce a new ContentHint enum / field on the InteractionRegion
struct.
* Source/WebCore/page/InteractionRegion.cpp:
(WebCore::interactionRegionForRenderedRegion):
Detect images, videos and background images to add the proper content
hint when applicable.
The current heuristic is based on a minimum size and the lack of alpha.
(WebCore::operator<<):
Add the content hint to the dump when it's not the default one.
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
Add the content hint to the serialization.
* Source/WebCore/rendering/EventRegion.h:
* Source/WebCore/rendering/EventRegion.cpp:
(WebCore::EventRegionContext::uniteInteractionRegions):
For each interaction rect, keep track of the last content hint
encountered (we use the paint order to generate the regions).
(WebCore::EventRegionContext::shrinkWrappedInteractionRegions):
Build a vector of InteractionRegions to add to the EventRegion.
- Guards and occlusions are simply appended.
- For Interactions with a single rect, lookup the content hint (painted
last).
- When the elements has multiple discovered rects, check to see if we
need a shrinkWrapped clipPath or if we can use a single rect.
- If we have non-default content hints, give them their own
InteractionRegion.
(WebCore::EventRegionContext::removeSuperfluousInteractionRegions):
(WebCore::EventRegionContext::copyInteractionRegionsToEventRegion):
(WebCore::EventRegion::appendInteractionRegions):
(WebCore::EventRegionContext::shrinkWrapInteractionRegions): Deleted.
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm:
(WebKit::reconfigureLayerContentHint): Added.
Set the `contentRenderingHint` on the RCPGlowLayer.
(WebKit::applyBackgroundColorForDebuggingToLayer):
Add a custom debug style for photo layers.
(WebKit::createInteractionRegionLayer):
(WebKit::interactionRegionTypeForLayer):
Drive-by fix, Interaction Regions types are not booleans.
(WebKit::updateLayersForInteractionRegions):
Reconfigure Interaction layers with their latest content hint.
* LayoutTests/interaction-region/content-hint-expected.txt: Added.
* LayoutTests/interaction-region/content-hint.html: Added.
Add new tests for different content hints scenarios.
* LayoutTests/interaction-region/overlap-same-group-expected.txt:
* LayoutTests/interaction-region/wrapped-inline-link-expected.txt:
Re-baseline, now that we avoid using clip shapes for single rects.
Canonical link: https://commits.webkit.org/275801@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list