[webkit-changes] [WebKit/WebKit] a349ab: Add masked corners support to InteractionRegions

Commit Queue noreply at github.com
Fri Mar 31 04:23:44 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a349ab55bc80966ce153a39824796e5341d7ce71
      https://github.com/WebKit/WebKit/commit/a349ab55bc80966ce153a39824796e5341d7ce71
  Author: Etienne Segonzac <sgz at apple.com>
  Date:   2023-03-31 (Fri, 31 Mar 2023)

  Changed paths:
    A LayoutTests/interaction-region/border-radii-expected.txt
    A LayoutTests/interaction-region/border-radii.html
    M Source/WebCore/page/InteractionRegion.cpp
    M Source/WebCore/page/InteractionRegion.h
    M Source/WebCore/platform/graphics/RoundedRect.h
    M Source/WebCore/rendering/EventRegion.cpp
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm

  Log Message:
  -----------
  Add masked corners support to InteractionRegions
https://bugs.webkit.org/show_bug.cgi?id=254775
<rdar://104098230>

Reviewed by Tim Horton.

Use the `CALayer#maskedCorners` property to refine Interaction layers.

* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebCore/page/InteractionRegion.h:
(WebCore::operator==):
Add a new `maskedCorners` OptionSet to the InteractionRegion struct.
Re-order the members to keep the optional values at the end.

* Source/WebCore/page/InteractionRegion.cpp:
(WebCore::interactionRegionForRenderedRegion):
When a `border-radius` is partially applied to the element, use a
CornerMask to indicate which corners it applies to.
(WebCore::operator<<):
Reflect the corner mask in the test dumps.

* Source/WebCore/platform/graphics/RoundedRect.h:
(WebCore::RoundedRect::Radii::maximumRadius const):
Add a maximum radius method to easily detect cases where a corner mask
is necessary.

* Source/WebCore/rendering/EventRegion.cpp:
(WebCore::EventRegionContext::uniteInteractionRegions):
Relay the `maskedCorners` value when an InteractionRegion's rect gets split
by the subtraction. We could refine this in the future once we have
better shape support.

* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm:
(WebKit::convertToCACornerMask):
(WebKit::updateLayersForInteractionRegions):
Apply the corner mask to the Interaction CALayer.

* LayoutTests/interaction-region/border-radii-expected.txt: Added.
* LayoutTests/interaction-region/border-radii.html: Added.
Add a new test file covering many `border-radius` scenarios.

Canonical link: https://commits.webkit.org/262397@main




More information about the webkit-changes mailing list