-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
InteractionRegions: guards should not interfere with other regions
https://bugs.webkit.org/show_bug.cgi?id=265200 <rdar://115893635> Reviewed by Tim Horton. When multiple small links are laid out in close proximity, the "guards" regions we generate end up hurting more than they help. At the end of the InteractionRegion generation process, filter out guards that overlap with other regions too much. * Source/WebCore/rendering/EventRegion.h: * Source/WebCore/rendering/EventRegion.cpp: (WebCore::EventRegionContext::copyInteractionRegionsToEventRegion): (WebCore::EventRegionContext::removeSuperfluousInteractionRegions): Extract the final `removeAllMatching` pass on InteractionRegions to its own method and add the guards filtering logic. A guard shouldn't overlap with any interaction too much except: - the interaction it is guarding - any container interaction that fully contains the guard itself. (WebCore::EventRegionContext::uniteInteractionRegions): Stop adding guards for multi-rect regions. They are easily targetable as a whole. * LayoutTests/interaction-region/wrapped-inline-link-expected.txt: Update expectations now that multi-rect regions don't get guards. * LayoutTests/interaction-region/guard-overlap-expected.txt: Added. * LayoutTests/interaction-region/guard-overlap.html: Added. Add a new test covering the guards filtering logic. Canonical link: https://commits.webkit.org/271269@main
- Loading branch information
1 parent
7687d03
commit 3991417
Showing
5 changed files
with
104 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
(GraphicsLayer | ||
(anchor 0.00 0.00) | ||
(bounds 800.00 600.00) | ||
(children 1 | ||
(GraphicsLayer | ||
(bounds 800.00 600.00) | ||
(contentsOpaque 1) | ||
(drawsContent 1) | ||
(backgroundColor #FFFFFF) | ||
(event region | ||
(rect (0,0) width=800 height=600) | ||
|
||
(interaction regions [ | ||
(interaction (0,0) width=100 height=10) | ||
(borderRadius 0.00), | ||
(interaction (0,10) width=50 height=10) | ||
(borderRadius 0.00), | ||
(interaction (0,40) width=100 height=25) | ||
(borderRadius 0.00), | ||
(guard (-10,55) width=30 height=30) | ||
(borderRadius 0.00), | ||
(interaction (0,65) width=10 height=10) | ||
(borderRadius 0.00)]) | ||
) | ||
) | ||
) | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<style> | ||
body { margin: 0; } | ||
|
||
.interaction { | ||
height: 10px; | ||
background-color: green; | ||
|
||
cursor: pointer; | ||
} | ||
</style> | ||
<body> | ||
<div class="interaction" style="width: 100px" onclick="click()"></div> | ||
<div class="interaction" style="width: 50px" onclick="click()"></div> | ||
|
||
<br /> | ||
|
||
<div class="interaction" style="height: 25px; width: 100px" onclick="click()"></div> | ||
<div class="interaction" style="width: 10px" onclick="click()"></div> | ||
|
||
<pre id="results"></pre> | ||
<script> | ||
if (window.testRunner) | ||
testRunner.dumpAsText(); | ||
|
||
window.onload = function () { | ||
if (window.internals) | ||
results.textContent = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_EVENT_REGION | internals.LAYER_TREE_INCLUDES_ROOT_LAYER_PROPERTIES); | ||
}; | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters