[webkit-changes] [WebKit/WebKit] b52ad6: [InteractionRegions] Add support for all non-unifo...

Etienne Segonzac noreply at github.com
Wed Dec 20 13:44:52 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b52ad6b19d1a80071f1aef489edf65ae1abcaed1
      https://github.com/WebKit/WebKit/commit/b52ad6b19d1a80071f1aef489edf65ae1abcaed1
  Author: Etienne Segonzac <sgz at apple.com>
  Date:   2023-12-20 (Wed, 20 Dec 2023)

  Changed paths:
    M LayoutTests/interaction-region/aria-roles-expected.txt
    M LayoutTests/interaction-region/border-radii-expected.txt
    M LayoutTests/interaction-region/border-radii.html
    M LayoutTests/interaction-region/button-in-link-expected.txt
    M LayoutTests/interaction-region/click-handler-dynamically-added-expected.txt
    M LayoutTests/interaction-region/click-handler-expected.txt
    M LayoutTests/interaction-region/click-handler-in-shadowed-layer-expected.txt
    M LayoutTests/interaction-region/consolidated-nested-regions-expected.txt
    M LayoutTests/interaction-region/display-table-expected.txt
    M LayoutTests/interaction-region/event-region-overflow-expected.txt
    M LayoutTests/interaction-region/full-page-overlay-expected.txt
    M LayoutTests/interaction-region/guard-overlap-expected.txt
    M LayoutTests/interaction-region/guard-overlap.html
    M LayoutTests/interaction-region/hover-style-expected.txt
    M LayoutTests/interaction-region/icon-inside-button-single-region-expected.txt
    M LayoutTests/interaction-region/ignore-catch-all-body-expected.txt
    M LayoutTests/interaction-region/inline-link-dark-background-expected.txt
    M LayoutTests/interaction-region/inline-link-expected.txt
    M LayoutTests/interaction-region/inline-link-in-composited-iframe-expected.txt
    M LayoutTests/interaction-region/inline-link-in-layer-expected.txt
    M LayoutTests/interaction-region/inline-link-in-non-composited-iframe-expected.txt
    M LayoutTests/interaction-region/inline-link-with-pointer-events-none-content-expected.txt
    M LayoutTests/interaction-region/input-type-file-region-expected.txt
    M LayoutTests/interaction-region/input-type-range-region-expected.txt
    M LayoutTests/interaction-region/interaction-layers-culling-expected.txt
    M LayoutTests/interaction-region/interaction-layers-culling-layer-type-change-expected.txt
    M LayoutTests/interaction-region/interaction-region-size-limit-expected.txt
    M LayoutTests/interaction-region/labels-expected.txt
    M LayoutTests/interaction-region/layer-tree-expected.txt
    A LayoutTests/interaction-region/layer-tree-shape-reset-expected.txt
    A LayoutTests/interaction-region/layer-tree-shape-reset.html
    M LayoutTests/interaction-region/layer-tree.html
    M LayoutTests/interaction-region/nested-composited-text-painter-expected.txt
    M LayoutTests/interaction-region/overlap-expected.txt
    M LayoutTests/interaction-region/overlap-same-group-expected.txt
    M LayoutTests/interaction-region/overlay-expected.txt
    M LayoutTests/interaction-region/paused-video-regions-expected.txt
    M LayoutTests/interaction-region/position-only-update-expected.txt
    M LayoutTests/interaction-region/pseudo-element-expected.txt
    M LayoutTests/interaction-region/split-inline-link-expected.txt
    M LayoutTests/interaction-region/text-controls-expected.txt
    M LayoutTests/interaction-region/text-input-expected.txt
    M LayoutTests/interaction-region/tiny-regions-expected.txt
    M LayoutTests/interaction-region/wrapped-inline-link-expected.txt
    M Source/WebCore/page/DebugPageOverlays.cpp
    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/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderBox.h
    M Source/WebCore/rendering/RenderLayerBacking.cpp
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm

  Log Message:
  -----------
  [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




More information about the webkit-changes mailing list