Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f3c76a7cf2ec4544d2d496403a3a6b3c13a75daa
      
https://github.com/WebKit/WebKit/commit/f3c76a7cf2ec4544d2d496403a3a6b3c13a75daa
  Author: Etienne Segonzac <[email protected]>
  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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to