[webkit-changes] [WebKit/WebKit] e52382: Generate Interaction Regions for SVG shapes

Etienne Segonzac noreply at github.com
Sat Feb 24 02:03:24 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e52382b155e1f394a9f7817de0fc3cfe4b6a4bc3
      https://github.com/WebKit/WebKit/commit/e52382b155e1f394a9f7817de0fc3cfe4b6a4bc3
  Author: Etienne Segonzac <sgz at apple.com>
  Date:   2024-02-24 (Sat, 24 Feb 2024)

  Changed paths:
    A LayoutTests/interaction-region/svg-expected.txt
    A LayoutTests/interaction-region/svg.html
    M Source/WebCore/page/InteractionRegion.cpp
    M Source/WebCore/rendering/EventRegion.cpp
    M Source/WebCore/rendering/RenderReplaced.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGContainer.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRoot.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.cpp

  Log Message:
  -----------
  Generate Interaction Regions for SVG shapes
https://bugs.webkit.org/show_bug.cgi?id=269916
<rdar://117642184>

Reviewed by Mike Wyrzykowski.

Enter SVG renderers during the EventRegion paint phase so we can find
Interaction Regions for SVG shapes. Then generate matching clip paths for
the corresponding InteractionRegion layers.

* Source/WebCore/page/InteractionRegion.cpp:
(WebCore::interactionRegionForRenderedRegion):
Generate Interaction Regions with the proper clip path for SVG shapes.

* Source/WebCore/rendering/EventRegion.cpp:
(WebCore::guardRectForRegionBounds):
(WebCore::EventRegionContext::uniteInteractionRegions):
Add a non-inflated guard for complex shapes to make hit-testing more
reliable.

* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::paint):
Detect SVG roots and enter during the EventRegion paint phase.
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGContainer.cpp:
(WebCore::LegacyRenderSVGContainer::paint):
Apply the paint transform to the event region context.
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRoot.cpp:
(WebCore::LegacyRenderSVGRoot::paintReplaced):
Apply the paint transform and viewport clipping to the event region
context.
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.cpp:
(WebCore::LegacyRenderSVGShape::paint):
Check for Interaction Regions using the fill bounding box.

* LayoutTests/interaction-region/svg-expected.txt: Added.
* LayoutTests/interaction-region/svg.html: Added.
Add a new test covering various SVG scenarios (shapes, transforms,
clipping...).

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