[LFC][Render tree] RenderBlockFlow::ensureLineBoxes should work with lfc layout
https://bugs.webkit.org/show_bug.cgi?id=204633
Reviewed by Zalan Bujtas.
We need to be able to switch to linebox layout when needed.
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::deleteLines):
(WebCore::RenderBlockFlow::invalidateLineLayoutPath):
(WebCore::RenderBlockFlow::ensureLineBoxes):
* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::hasLineLayout const):
Also switch to using WTF::Monostate as empty state.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@252906 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/rendering/RenderBlockFlow.cpp b/Source/WebCore/rendering/RenderBlockFlow.cpp
index e61fc26..2ce66f9 100644
--- a/Source/WebCore/rendering/RenderBlockFlow.cpp
+++ b/Source/WebCore/rendering/RenderBlockFlow.cpp
@@ -2121,7 +2121,7 @@
void RenderBlockFlow::deleteLines()
{
- m_lineLayout = nullptr;
+ m_lineLayout = WTF::Monostate();
RenderBlock::deleteLines();
}
@@ -3633,7 +3633,7 @@
return;
case SimpleLinesPath:
// The simple line layout may have become invalid.
- m_lineLayout = nullptr;
+ m_lineLayout = WTF::Monostate();
setLineLayoutPath(UndeterminedPath);
if (needsLayout())
return;
@@ -3695,16 +3695,18 @@
setLineLayoutPath(ForceLineBoxesPath);
- if (!simpleLineLayout())
+ if (complexLineLayout() || !hasLineLayout())
return;
- auto simpleLineLayout = makeRef(*this->simpleLineLayout());
+ auto simpleLineLayout = makeRefPtr(this->simpleLineLayout());
m_lineLayout = makeUnique<ComplexLineLayout>(*this);
- if (SimpleLineLayout::canUseForLineBoxTree(*this, simpleLineLayout.get())) {
- SimpleLineLayout::generateLineBoxTree(*this, simpleLineLayout.get());
- return;
+ if (simpleLineLayout) {
+ if (SimpleLineLayout::canUseForLineBoxTree(*this, *simpleLineLayout)) {
+ SimpleLineLayout::generateLineBoxTree(*this, *simpleLineLayout);
+ return;
+ }
}
auto& complexLineLayout = *this->complexLineLayout();
@@ -3717,7 +3719,7 @@
bool relayoutChildren = false;
LayoutUnit repaintLogicalTop;
LayoutUnit repaintLogicalBottom;
- if (simpleLineLayout->isPaginated()) {
+ if (simpleLineLayout && simpleLineLayout->isPaginated()) {
PaginatedLayoutStateMaintainer state(*this);
complexLineLayout.layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
// This matches relayoutToAvoidWidows.