Skip to content

Commit cab087e

Browse files
committed
Stale float state caused by 'content visibility' may lead to ASSERT in addFloatsToNewParent
https://bugs.webkit.org/show_bug.cgi?id=290898 <rdar://143296265> Reviewed by Antti Koivisto. In this patch 1. we let m_floatingObjects go stale on the skipped root (we already do that for the skipped subtree by not running layout) 2. we descend into skipped subtrees while cleaning up floats even when m_floatingObjects is stale/empty Having up-to-date m_floatingObjects on the skipped root, while stale m_floatingObjects on the skipped subtree can lead to issues when (#1) a previously intrusive float (#2) becomes non-intrusive and (#3) eventually gets deleted prevents us from being able to cleanup m_floatingObjects in skipped subtree(s). at #1 m_floatingObjects is populated with the intrusive float (both skipped root and renderers in skipped subtree) and at #2 since we only run layout on the skipped root, m_floatingObjects gets updated by removing this previously intrusive float (skipped subtree becomes stale) and at #3 we don't descend into the skipped subtree to cleanup m_floatingObjects since the skipped root does not have this float anymore (removed at #2). * Source/WebCore/rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::markSiblingsWithFloatsForLayout): Canonical link: https://commits.webkit.org/293119@main
1 parent 5ed0c54 commit cab087e

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
undefined
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<style>
2+
:not(marker) {
3+
background: url(#svgvar00007) repeat-x scroll top left;
4+
zoom: 50%;
5+
}
6+
details {
7+
font: 1pt monospace;
8+
}
9+
</style>
10+
11+
<script>
12+
window.testRunner?.dumpAsText();
13+
14+
function testRun() {
15+
buttonID.outerHTML = "undefined";
16+
}
17+
18+
function eventhandler3() {
19+
detailsID.open = false;
20+
21+
document.body.offsetHeight;
22+
tableID.deleteRow(1);
23+
}
24+
</script>
25+
26+
<body onload=testRun()>
27+
<button id=buttonID>
28+
<details id=detailsID ontoggle="eventhandler3()" open="true">
29+
<summary>
30+
<table id=tableID align="right">
31+
<tr></tr>
32+
<tfoot><th></th></tfoot>
33+
<th>PASS if no crash or assert</th>
34+
</table>
35+
<iframe srcdoc="">content</iframe>
36+
</summary>
37+
<span>
38+
<li><embed><ol>

Source/WebCore/rendering/RenderBlockFlow.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ RenderBlockFlow* RenderBlockFlow::previousSiblingWithOverhangingFloats(bool& par
205205

206206
void RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats()
207207
{
208+
if (isSkippedContentRoot(*this))
209+
return;
210+
208211
UncheckedKeyHashSet<CheckedPtr<RenderBox>> oldIntrudingFloatSet;
209212

210213
if (m_floatingObjects) {
@@ -3076,7 +3079,8 @@ void RenderBlockFlow::markSiblingsWithFloatsForLayout(RenderBox* floatToRemove)
30763079
CheckedPtr nextSiblingBlockFlow = dynamicDowncast<RenderBlockFlow>(*nextSibling);
30773080
if (!nextSiblingBlockFlow)
30783081
continue;
3079-
if (nextSiblingBlockFlow->containsFloat(floatBoxToRemove))
3082+
auto shouldCheckSubtree = isSkippedContentRoot(*nextSiblingBlockFlow) || nextSiblingBlockFlow->isSkippedContent() || nextSiblingBlockFlow->containsFloat(floatBoxToRemove);
3083+
if (shouldCheckSubtree)
30803084
nextSiblingBlockFlow->markAllDescendantsWithFloatsForLayout(&floatBoxToRemove);
30813085
}
30823086
};

0 commit comments

Comments
 (0)