-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[InteractionRegions] Add support for all non-uniform border-radius
https://bugs.webkit.org/show_bug.cgi?id=266491 <rdar://118884255> Reviewed by Tim Horton. To support all `border-radius` configurations on InteractionRegions, introduce an optional clip path. Generate RoundedRect based Paths when the corner radii are not uniform. Continue using masked corners when they can fully capture the shape. Use `PathUtilities::pathWithShrinkWrappedRects` for elements with multiple rects (like multi-line links). * Source/WebCore/page/InteractionRegion.h: Add an optional clip Path. Rename borderRadius to cornerRadius to make it clearer that it works with maskedCorners. (WebCore::operator==): Re-introduce a custom `==` operator. The compiler can't generate one now that the struct contains a Path. * Source/WebCore/page/InteractionRegion.cpp: Remove the unused `PathUtilities.h` include. (WebCore::interactionRegionForRenderedRegion): Add an optional clip Path. When the border radii are not uniform, generate a `clipPath` from `RenderBox#borderRoundedRect()`. (WebCore::operator<<): Update the dump format for the new clipPath field. Only dump the cornerRadius/masked corners when it is greater than 0. * Source/WebCore/rendering/RenderBox.h: * Source/WebCore/rendering/RenderBox.cpp: (WebCore::RenderBox::borderRoundedRect const): Add a method we can use for to generate either clip paths or masked corners. * Source/WebCore/rendering/EventRegion.h: Instead of accumulating the discovered rects for an element in a Region, use a Vector<FloatRect>> (to avoid rounding to an IntRect). * Source/WebCore/rendering/EventRegion.cpp: (WebCore::EventRegionContext::uniteInteractionRegions): Accumulate the discovered rects for an element in a Vector instead of a Region. (WebCore::EventRegionContext::shouldConsolidateInteractionRegion): Only consider consolidation with elements that have a single discovered rect (can't consolidate to a multi-line link). (WebCore::EventRegionContext::shrinkWrapInteractionRegions): Replace the shrink wrapping code with the great `PathUtilities::pathsWithShrinkWrappedRects`. This yields a single InteractionRegion with the proper rect and clip path. (WebCore::EventRegionContext::removeSuperfluousInteractionRegions): Update the guard overlapping logic to iterate over all known interaction rects (as opposed to checking once against each discovered Region). * Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in: Add an optional clip Path. * Source/WebCore/rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::paintDebugOverlays): * Source/WebCore/page/DebugPageOverlays.cpp: (WebCore::InteractionRegionOverlay::activeRegion const): (WebCore::InteractionRegionOverlay::drawRect): borderRadius -> cornerRadius * Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm: (WebKit::updateLayersForInteractionRegions): Generate a CAShapeLayer from the clipPath when present, and use it to mask the InteractionRegion layer. * Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _caLayerTreeAsText]): Dump the layer tree of the content view instead of the whole WKWebView. This makes the expectation files clearer and will help prevent churn when unrelated part of the code change. (dumpCALayer): Add basic support for layer and corner masking in the dump. * LayoutTests/interaction-region/border-radii.html: * LayoutTests/interaction-region/border-radii-expected.txt: This test already has non-uniform examples. Add borders and update expectations. * LayoutTests/interaction-region/guard-overlap.html: * LayoutTests/interaction-region/guard-overlap-expected.txt: Add a test with a guard overlapping a multi-line link. * LayoutTests/interaction-region/layer-tree.html: * LayoutTests/interaction-region/layer-tree-expected.txt: Add various shape cases to the layer test to cover the UIProcess changes. * LayoutTests/interaction-region/layer-tree-shape-reset-expected.txt: Added. * LayoutTests/interaction-region/layer-tree-shape-reset.html: Added. Add a new test making sure all shaping properties on InteractionRegion layers are properly reset if the style updates. * LayoutTests/interaction-region/aria-roles-expected.txt: * LayoutTests/interaction-region/button-in-link-expected.txt: * LayoutTests/interaction-region/click-handler-dynamically-added-expected.txt: * LayoutTests/interaction-region/click-handler-expected.txt: * LayoutTests/interaction-region/click-handler-in-shadowed-layer-expected.txt: * LayoutTests/interaction-region/consolidated-nested-regions-expected.txt: * LayoutTests/interaction-region/display-table-expected.txt: * LayoutTests/interaction-region/event-region-overflow-expected.txt: * LayoutTests/interaction-region/full-page-overlay-expected.txt: * LayoutTests/interaction-region/hover-style-expected.txt: * LayoutTests/interaction-region/icon-inside-button-single-region-expected.txt: * LayoutTests/interaction-region/ignore-catch-all-body-expected.txt: * LayoutTests/interaction-region/inline-link-dark-background-expected.txt: * LayoutTests/interaction-region/inline-link-expected.txt: * LayoutTests/interaction-region/inline-link-in-composited-iframe-expected.txt: * LayoutTests/interaction-region/inline-link-in-layer-expected.txt: * LayoutTests/interaction-region/inline-link-in-non-composited-iframe-expected.txt: * LayoutTests/interaction-region/inline-link-with-pointer-events-none-content-expected.txt: * LayoutTests/interaction-region/input-type-file-region-expected.txt: * LayoutTests/interaction-region/input-type-range-region-expected.txt: * LayoutTests/interaction-region/interaction-layers-culling-expected.txt: * LayoutTests/interaction-region/interaction-layers-culling-layer-type-change-expected.txt: * LayoutTests/interaction-region/interaction-region-size-limit-expected.txt: * LayoutTests/interaction-region/labels-expected.txt: * LayoutTests/interaction-region/nested-composited-text-painter-expected.txt: * LayoutTests/interaction-region/overlap-expected.txt: * LayoutTests/interaction-region/overlap-same-group-expected.txt: * LayoutTests/interaction-region/overlay-expected.txt: * LayoutTests/interaction-region/paused-video-regions-expected.txt: * LayoutTests/interaction-region/position-only-update-expected.txt: * LayoutTests/interaction-region/pseudo-element-expected.txt: * LayoutTests/interaction-region/split-inline-link-expected.txt: * LayoutTests/interaction-region/text-controls-expected.txt: * LayoutTests/interaction-region/text-input-expected.txt: * LayoutTests/interaction-region/tiny-regions-expected.txt: * LayoutTests/interaction-region/wrapped-inline-link-expected.txt: Update test expectations with clip paths and the new dump format. Canonical link: https://commits.webkit.org/272377@main
- Loading branch information
1 parent
938336b
commit b52ad6b
Showing
55 changed files
with
618 additions
and
1,234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.