Title: [295477] trunk/Source/WebCore/rendering/LegacyLineLayout.cpp
- Revision
- 295477
- Author
- za...@apple.com
- Date
- 2022-06-11 20:25:59 -0700 (Sat, 11 Jun 2022)
Log Message
Reset the dirty bit on the inline level renderers when counter is present
https://bugs.webkit.org/show_bug.cgi?id=241534
Reviewed by Antti Koivisto.
While the actual line layout happens in layoutRunsAndFloats, we pre-reset the needsLayout flag as we walk the renderers and prepare them for the inline layout.
Normally this simple DOM order walk clears all the layout bits just fine, but counters can re-dirty any "connected" renderer in a seemingly random order.
This patch ensures that all inline level box renders are marked clean before returning from layoutLineBoxes.
* Source/WebCore/rendering/LegacyLineLayout.cpp:
(WebCore::LegacyLineLayout::layoutLineBoxes):
Canonical link: https://commits.webkit.org/251482@main
Modified Paths
Diff
Modified: trunk/Source/WebCore/rendering/LegacyLineLayout.cpp (295476 => 295477)
--- trunk/Source/WebCore/rendering/LegacyLineLayout.cpp 2022-06-11 23:44:42 UTC (rev 295476)
+++ trunk/Source/WebCore/rendering/LegacyLineLayout.cpp 2022-06-12 03:25:59 UTC (rev 295477)
@@ -1746,6 +1746,7 @@
// deleted and only dirtied. In that case, we can layout the replaced
// elements at the same time.
bool hasInlineChild = false;
+ auto hasDirtyRenderCounterWithInlineBoxParent = false;
Vector<RenderBox*> replacedChildren;
for (InlineWalker walker(m_flow); !walker.atEnd(); walker.advance()) {
RenderObject& o = *walker.current();
@@ -1782,8 +1783,10 @@
box.layoutIfNeeded();
}
} else if (o.isTextOrLineBreak() || is<RenderInline>(o)) {
- if (layoutState.isFullLayout() || o.selfNeedsLayout())
+ if (layoutState.isFullLayout() || o.selfNeedsLayout()) {
dirtyLineBoxesForRenderer(o, layoutState.isFullLayout());
+ hasDirtyRenderCounterWithInlineBoxParent = hasDirtyRenderCounterWithInlineBoxParent || (is<RenderCounter>(o) && is<RenderInline>(o.parent()));
+ }
o.clearNeedsLayout();
}
}
@@ -1791,6 +1794,17 @@
for (size_t i = 0; i < replacedChildren.size(); i++)
replacedChildren[i]->layoutIfNeeded();
+ auto clearNeedsLayoutIfNeeded = [&] {
+ if (!hasDirtyRenderCounterWithInlineBoxParent)
+ return;
+ for (InlineWalker walker(m_flow); !walker.atEnd(); walker.advance()) {
+ auto& renderer = *walker.current();
+ if (is<RenderCounter>(renderer) || is<RenderInline>(renderer))
+ renderer.clearNeedsLayout();
+ }
+ };
+ clearNeedsLayoutIfNeeded();
+
layoutRunsAndFloats(layoutState, hasInlineChild);
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes