[webkit-changes] [WebKit/WebKit] 2775f5: [InteractionRegions] Generated clip paths are some...

Etienne Segonzac noreply at github.com
Sat May 4 01:16:24 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2775f5bf7c3e8aeb9b44090c7a277aedcdb7d0e4
      https://github.com/WebKit/WebKit/commit/2775f5bf7c3e8aeb9b44090c7a277aedcdb7d0e4
  Author: Etienne Segonzac <sgz at apple.com>
  Date:   2024-05-04 (Sat, 04 May 2024)

  Changed paths:
    M LayoutTests/interaction-region/clip-path-expected.txt
    M LayoutTests/interaction-region/clip-path.html
    M LayoutTests/interaction-region/icon-masking-expected.txt
    M LayoutTests/interaction-region/icon-masking.html
    M LayoutTests/interaction-region/svg-expected.txt
    M LayoutTests/interaction-region/svg.html
    M Source/WebCore/page/InteractionRegion.cpp
    M Source/WebCore/page/InteractionRegion.h
    M Source/WebCore/rendering/EventRegion.cpp
    M Source/WebCore/rendering/EventRegion.h

  Log Message:
  -----------
  [InteractionRegions] Generated clip paths are sometimes offset from their element
https://bugs.webkit.org/show_bug.cgi?id=273428
<rdar://126865156>

Reviewed by Simon Fraser.

When generating Interaction Regions, the paths we build to match
shapes are complete and relative to the element's bounds.
But the Interaction Region's bounds respect clipping.
Provide the offset between the two to `interactionRegionForRenderedRegion`
so we can adjust the paths location if needed.
(Effectively moving the path in the mask layer on the UI-side.)

Also provide the current transform to skip shape generation for
rotations / skew (unsupported) and also to  avoid having to go through
`absoluteQuads` just to get a bounding size.

This applies to SVG elements, icons and CSS clip-paths.

For SVG icons (using image tags), always use the image from the
SVGImageCache to match what was just painted.

* Source/WebCore/page/InteractionRegion.h:
* Source/WebCore/page/InteractionRegion.cpp:
(WebCore::boundingSize):
(WebCore::absoluteBoundingRect): Deleted.
Don't use `absoluteQuads` to get the bounding size.
(WebCore::findIconImage):
Use `imageForRenderer` to make sure icon masking is based on what was
just painted (and potentially cached in the SVGImageCache).
(WebCore::interactionRegionForRenderedRegion):
For icons, generate the raster shape at 0x0 directly instead of doing an
extra translation.
For SVG elements, use the full viewBoxTransform instead of just the
scale.
Use the new `clipOffset`.

* Source/WebCore/rendering/EventRegion.h:
* Source/WebCore/rendering/EventRegion.cpp:
(WebCore::EventRegionContext::unite):
(WebCore::EventRegionContext::uniteInteractionRegions):
Pass an optional transform and the clip offset to
`interactionRegionForRenderedRegion`.

* LayoutTests/interaction-region/icon-masking.html:
Add test cases clipping on the top left corner (bitmap and SVG).
Add test cases with nested transforms (with and without compositing
layers).
Add a test case with rotation (no clip-path).
* LayoutTests/interaction-region/icon-masking-expected.txt:
New interaction regions, new guards on the SVG logo now matching the "is
complex shape" check, and floating point diff.
* LayoutTests/interaction-region/svg.html:
Add a test case clipping on the top left corner.
* LayoutTests/interaction-region/svg-expected.txt:
New interaction regions and floating point diff.
* LayoutTests/interaction-region/clip-path-expected.txt:
Add a test case clipping on the left and right edge.
Add test cases with rotation / skew (no clip-path).
* LayoutTests/interaction-region/clip-path.html:
New interaction regions.

Canonical link: https://commits.webkit.org/278371@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