[webkit-changes] [WebKit/WebKit] 9ac8cd: InteractionRegions: improve region consolidation

Commit Queue noreply at github.com
Thu Jun 15 00:01:42 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9ac8cd985eb6d6e2f366ccd610fbd4d9fc0267b4
      https://github.com/WebKit/WebKit/commit/9ac8cd985eb6d6e2f366ccd610fbd4d9fc0267b4
  Author: Etienne Segonzac <sgz at apple.com>
  Date:   2023-06-14 (Wed, 14 Jun 2023)

  Changed paths:
    M LayoutTests/interaction-region/consolidated-nested-regions-expected.txt
    M LayoutTests/interaction-region/consolidated-nested-regions.html
    M Source/WebCore/rendering/EventRegion.cpp
    M Source/WebCore/rendering/EventRegion.h

  Log Message:
  -----------
  InteractionRegions: improve region consolidation
https://bugs.webkit.org/show_bug.cgi?id=258026
<rdar://110283650>

Reviewed by Megan Gardner.

Introduce a new InteractionRegion consolidation method aimed at removing
superfluous regions generated for structural elements nested in an
interactive container. Typically, when the container and everything
inside has `cursor: pointer`.
This requires looking at the ancestors (are we contained by an existing
region?) and children (do we discover a nested region in the subtree
later on?).

* Source/WebCore/rendering/EventRegion.h:
Add new HashSets for containers removal tracking.
* Source/WebCore/rendering/EventRegion.cpp:
(WebCore::EventRegionContext::uniteInteractionRegions):
Clean-up, don't keep track of rects for interactions we consolidate.
(WebCore::EventRegionContext::shouldConsolidateInteractionRegion):
Add potential containers to the candidates set.
Flag containers for removal if we discover a nested interaction in
their subtree.
Add comments explaining the logic.
(WebCore::EventRegionContext::copyInteractionRegionsToEventRegion):
Filter out the regions flagged for removal before doing the shrink wrap.

* LayoutTests/interaction-region/consolidated-nested-regions-expected.txt:
* LayoutTests/interaction-region/consolidated-nested-regions.html:
Add a new test case for this scenario.

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




More information about the webkit-changes mailing list