[webkit-changes] [WebKit/WebKit] f3c76a: Consolidate nested Interaction Regions where it ma...

Commit Queue noreply at github.com
Thu Mar 16 13:12:12 PDT 2023


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

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

  Log Message:
  -----------
  Consolidate nested Interaction Regions where it makes sense
https://bugs.webkit.org/show_bug.cgi?id=253899
<rdar://103458420>

Reviewed by Tim Horton.

Keep track of discovered interaction region rects on the `EventRegionContext`
to find opportunities for consolidation.

* Source/WebCore/rendering/EventRegion.h:
Add an <ElementIdentifier, IntRect>  HashMap to the context.
* Source/WebCore/rendering/EventRegion.cpp:
(WebCore::EventRegionContext::uniteInteractionRegions):
Check if the candidate region should be consolidated before adding it.
(WebCore::EventRegionContext::shouldConsolidateInteractionRegion):
Walk up the RenderTree looking for existing Interaction Regions containing
the candidate one. If there's too much margin exposed between the 2 rects
we'll keep the regions distinct. We also stop the search on elements that are
"visually delimited" (with a border / background style).

* LayoutTests/interaction-region/consolidated-nested-regions-expected.txt: Added.
* LayoutTests/interaction-region/consolidated-nested-regions.html: Added.
Add test covering cases where we should and shouldn't consolidate.

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




More information about the webkit-changes mailing list