InteractionRegion for wrapped text has multiple rects instead of one
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 May 2022 19:26:27 +0000 (19:26 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 May 2022 19:26:27 +0000 (19:26 +0000)
commit1e60ec00af3c661db59977fc2af167b4ed006781
treefa790bd22f4875fd004685b6792db9dec0f40cb7
parentc88a7cbbd18ed88fc7ff6b70b2643e4ebdd5b250
InteractionRegion for wrapped text has multiple rects instead of one
https://bugs.webkit.org/show_bug.cgi?id=240748

Reviewed by Wenson Hsieh.

* Source/WebCore/page/InteractionRegion.h:
(WebCore::operator==):
(WebCore::InteractionRegion::encode const):
(WebCore::InteractionRegion::decode):
* Source/WebCore/rendering/EventRegion.cpp:
(WebCore::EventRegion::translate):
(WebCore::EventRegion::dump const):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm:
(WebKit::updateLayersForInteractionRegions):
* Source/WebCore/page/DebugPageOverlays.cpp:
(WebCore::pathsForRegion):
(WebCore::InteractionRegionOverlay::activeRegion):
(WebCore::InteractionRegionOverlay::drawRect):
* Source/WebCore/page/InteractionRegion.cpp:
(WebCore::regionForElement):
Maintain InteractionRegion geometry as a Region instead of a vector of rects,
so that we can smush overlapping rectangles together on a per-InteractionRegion basis.

(WebCore::operator<<):
Add dumping code for InteractionRegion (and adopt it in EventRegion).

* LayoutTests/TestExpectations:
* LayoutTests/interaction-region/click-handler-expected.txt: Added.
* LayoutTests/interaction-region/click-handler.html: Added.
* LayoutTests/interaction-region/inline-link-dark-background-expected.txt: Added.
* LayoutTests/interaction-region/inline-link-dark-background.html: Added.
* LayoutTests/interaction-region/inline-link-expected.txt: Added.
* LayoutTests/interaction-region/inline-link.html: Added.
* LayoutTests/interaction-region/split-inline-link-expected.txt: Added.
* LayoutTests/interaction-region/split-inline-link.html: Added.
* LayoutTests/interaction-region/wrapped-inline-link-expected.txt: Added.
* LayoutTests/interaction-region/wrapped-inline-link.html: Added.
Add some basic interaction region tests, currently disabled by default
because they can only be run if you turn on the build-time flag.

"wrapped-inline-link.html" covers the case we are fixing by adopting Region;
the others are more generic tests that we should have had before.

link: https://commits.webkit.org/250840@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294614 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
LayoutTests/TestExpectations
LayoutTests/interaction-region/click-handler-expected.txt [new file with mode: 0644]
LayoutTests/interaction-region/click-handler.html [new file with mode: 0644]
LayoutTests/interaction-region/inline-link-dark-background-expected.txt [new file with mode: 0644]
LayoutTests/interaction-region/inline-link-dark-background.html [new file with mode: 0644]
LayoutTests/interaction-region/inline-link-expected.txt [new file with mode: 0644]
LayoutTests/interaction-region/inline-link.html [new file with mode: 0644]
LayoutTests/interaction-region/split-inline-link-expected.txt [new file with mode: 0644]
LayoutTests/interaction-region/split-inline-link.html [new file with mode: 0644]
LayoutTests/interaction-region/wrapped-inline-link-expected.txt [new file with mode: 0644]
LayoutTests/interaction-region/wrapped-inline-link.html [new file with mode: 0644]
Source/WebCore/page/DebugPageOverlays.cpp
Source/WebCore/page/InteractionRegion.cpp
Source/WebCore/page/InteractionRegion.h
Source/WebCore/rendering/EventRegion.cpp
Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm