Skip to content

Commit

Permalink
REGRESSION(264990@main) some occlusion regions are incorrect
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=259402
<rdar://112668310>

Reviewed by Tim Horton.

We already only looked at ancestors with the same absolute content box
during the `position: fixed` search. But we also need to make sure we
won't occlude siblings.

* Source/WebCore/page/InteractionRegion.cpp:
(WebCore::isOverlay):
Update the overlay detection logic.

* LayoutTests/interaction-region/overlay-expected.txt:
* LayoutTests/interaction-region/overlay.html:
Add a test covering the change.

Canonical link: https://commits.webkit.org/266227@main
  • Loading branch information
etiennesegonzac committed Jul 22, 2023
1 parent cb0fa67 commit c73297d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
17 changes: 16 additions & 1 deletion LayoutTests/interaction-region/overlay-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
(occlusion (0,200) width=200 height=100)
(borderRadius 0.00)])
)
(children 2
(children 3
(GraphicsLayer
(position 0.00 400.00)
(preserves3D 1)
(children 1
(GraphicsLayer
(bounds 200.00 200.00)
(contentsOpaque 1)
(drawsContent 1)
(event region
(rect (0,0) width=200 height=200)
Expand All @@ -34,6 +35,20 @@
)
)
)
(GraphicsLayer
(position 600.00 400.00)
(preserves3D 1)
(children 1
(GraphicsLayer
(bounds 200.00 200.00)
(contentsOpaque 1)
(drawsContent 1)
(event region
(rect (0,0) width=200 height=200)
)
)
)
)
(GraphicsLayer
(position 600.00 0.00)
(preserves3D 1)
Expand Down
18 changes: 16 additions & 2 deletions LayoutTests/interaction-region/overlay.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,26 @@
pointer-events: none;
background-color: red;
}
#fixed-container {
.fixed-container {
position: fixed;
width: 200px;
height: 200px;
left: 0;
bottom: 0;
pointer-events: none;
}
.fixed-container.no-occlusion {
left: unset;
right: 0;
}
#fixed {
position: fixed;
right: 0;
top: 0;
}
.paints {
position: absolute;
top: 0;
width: 200px;
height: 200px;
background: blue;
Expand All @@ -40,12 +48,18 @@
<div class="overlay"></div>
<div class="overlay" id="not-occlusion"></div>
<div class="overlay" onclick="click()"></div>
<div id="fixed-container">
<div class="fixed-container">
<div class="paints">
<div class="child"></div>
<div class="child"></div>
</div>
</div>
<div class="fixed-container no-occlusion">
<div class="child"></div>
<div class="paints">
<div class="child"></div>
</div>
</div>
<div id="fixed" class="paints"></div>

<pre id="results"></pre>
Expand Down
5 changes: 5 additions & 0 deletions Source/WebCore/page/InteractionRegion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,12 @@ static bool isOverlay(const RenderElement& renderer)

if (auto* renderBox = dynamicDowncast<RenderBox>(renderer)) {
auto refContentBox = renderBox->absoluteContentBox();
auto lastRenderer = renderBox;
for (auto& ancestor : ancestorsOfType<RenderBox>(renderer)) {
// We don't want to occlude any previous siblings.
if (ancestor.firstChildBox() != lastRenderer)
return false;
lastRenderer = &ancestor;
if (ancestor.absoluteContentBox() != refContentBox)
return false;
if (ancestor.isFixedPositioned())
Expand Down

0 comments on commit c73297d

Please sign in to comment.