Diff
Modified: branches/safari-609-branch/Source/WebCore/ChangeLog (255843 => 255844)
--- branches/safari-609-branch/Source/WebCore/ChangeLog 2020-02-05 20:08:12 UTC (rev 255843)
+++ branches/safari-609-branch/Source/WebCore/ChangeLog 2020-02-05 20:51:39 UTC (rev 255844)
@@ -1,3 +1,7 @@
+2020-02-05 Russell Epstein <[email protected]>
+
+ Revert r255770. rdar://problem/58942734
+
2020-02-04 Russell Epstein <[email protected]>
Cherry-pick r248517. rdar://problem/58942734
Modified: branches/safari-609-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (255843 => 255844)
--- branches/safari-609-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-02-05 20:08:12 UTC (rev 255843)
+++ branches/safari-609-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-02-05 20:51:39 UTC (rev 255844)
@@ -4913,7 +4913,7 @@
E4E8B4EC216B79E500B8834D /* SystemFontDatabaseCoreText.h in Headers */ = {isa = PBXBuildFile; fileRef = E4E8B4EA216B79E500B8834D /* SystemFontDatabaseCoreText.h */; };
E4E8B4F5216B956500B8834D /* FontCascadeDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = E4E8B4F2216B8B6000B8834D /* FontCascadeDescription.h */; settings = {ATTRIBUTES = (Private, ); }; };
E4E94D6122FF158A00DD191F /* ComplexLineLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A1AC7822FAFD500017B75B /* ComplexLineLayout.h */; settings = {ATTRIBUTES = (Private, ); }; };
- E4E9B1191810916F003ACCDF /* SimpleLineLayoutResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = E4E9B1181810916F003ACCDF /* SimpleLineLayoutResolver.h */; };
+ E4E9B1191810916F003ACCDF /* SimpleLineLayoutResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = E4E9B1181810916F003ACCDF /* SimpleLineLayoutResolver.h */; settings = {ATTRIBUTES = (Private, ); }; };
E4E9B11D1814569C003ACCDF /* SimpleLineLayoutFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = E4E9B11C1814569C003ACCDF /* SimpleLineLayoutFunctions.h */; };
E4F9EEF3156DA00700D23E7E /* StyleSheetContents.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F9EEF1156D84C400D23E7E /* StyleSheetContents.h */; settings = {ATTRIBUTES = (Private, ); }; };
E516699120FF9918009D2C27 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = E516698F20FF9916009D2C27 /* [email protected] */; };
@@ -31600,7 +31600,6 @@
1A7FA6190DDA3B3A0028F8A5 /* NetworkStateNotifier.h in Headers */,
E13EF3441684ECF40034C83F /* NetworkStorageSession.h in Headers */,
269397241A4A5B6400E8349D /* NFA.h in Headers */,
- E4E94D6122FF158A00DD191F /* ComplexLineLayout.h in Headers */,
269397221A4A412F00E8349D /* NFANode.h in Headers */,
267726011A5B3AD9003C24DD /* NFAToDFA.h in Headers */,
BCEF43DD0E674012001C1287 /* NinePieceImage.h in Headers */,
Modified: branches/safari-609-branch/Source/WebCore/rendering/ComplexLineLayout.cpp (255843 => 255844)
--- branches/safari-609-branch/Source/WebCore/rendering/ComplexLineLayout.cpp 2020-02-05 20:08:12 UTC (rev 255843)
+++ branches/safari-609-branch/Source/WebCore/rendering/ComplexLineLayout.cpp 2020-02-05 20:51:39 UTC (rev 255844)
@@ -58,8 +58,14 @@
{
}
-ComplexLineLayout::~ComplexLineLayout() = default;
+ComplexLineLayout::~ComplexLineLayout()
+{
+ if (m_flow.containsFloats())
+ m_flow.floatingObjects()->clearLineBoxTreePointers();
+ lineBoxes().deleteLineBoxTree();
+};
+
static void determineDirectionality(TextDirection& dir, InlineIterator iter)
{
while (!iter.atEnd()) {
@@ -130,12 +136,12 @@
std::unique_ptr<RootInlineBox> ComplexLineLayout::createRootInlineBox()
{
if (is<RenderSVGText>(m_flow)) {
- auto box = std::make_unique<SVGRootInlineBox>(downcast<RenderSVGText>(m_flow));
+ auto box = makeUnique<SVGRootInlineBox>(downcast<RenderSVGText>(m_flow));
box->setHasVirtualLogicalHeight();
return box;
}
- return std::make_unique<RootInlineBox>(m_flow);
+ return makeUnique<RootInlineBox>(m_flow);
}
RootInlineBox* ComplexLineLayout::createAndAppendRootInlineBox()
@@ -152,10 +158,10 @@
return rootBox;
}
-inline InlineBox* ComplexLineLayout::createInlineBoxForRenderer(RenderObject* renderer, bool isRootLineBox, bool isOnlyRun)
+InlineBox* ComplexLineLayout::createInlineBoxForRenderer(RenderObject* renderer, bool isOnlyRun)
{
- if (isRootLineBox)
- return downcast<RenderBlockFlow>(*renderer).complexLineLayout().createAndAppendRootInlineBox();
+ if (renderer == &m_flow)
+ return createAndAppendRootInlineBox();
if (is<RenderText>(*renderer))
return downcast<RenderText>(*renderer).createInlineTextBox();
@@ -226,7 +232,7 @@
if (allowedToConstructNewBox && !canUseExistingParentBox) {
// We need to make a new box for this render object. Once
// made, we need to place it at the end of the current line.
- InlineBox* newBox = createInlineBoxForRenderer(obj, obj == &m_flow);
+ InlineBox* newBox = createInlineBoxForRenderer(obj);
parentBox = downcast<InlineFlowBox>(newBox);
parentBox->setIsFirstLine(lineInfo.isFirstLine());
parentBox->setIsHorizontal(m_flow.isHorizontalWritingMode());
@@ -631,7 +637,7 @@
}
}
-void ComplexLineLayout::updateLogicalWidthForAlignment(const TextAlignMode& textAlign, const RootInlineBox* rootInlineBox, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpportunityCount)
+void ComplexLineLayout::updateLogicalWidthForAlignment(RenderBlockFlow& flow, const TextAlignMode& textAlign, const RootInlineBox* rootInlineBox, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpportunityCount)
{
TextDirection direction;
if (rootInlineBox && flow.style().unicodeBidi() == Plaintext)
@@ -659,7 +665,7 @@
updateLogicalWidthForCenterAlignedBlock(isLeftToRightDirection, trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);
break;
case TextAlignMode::Justify:
- m_flow.adjustInlineDirectionLineBounds(expansionOpportunityCount, logicalLeft, availableLogicalWidth);
+ flow.adjustInlineDirectionLineBounds(expansionOpportunityCount, logicalLeft, availableLogicalWidth);
if (expansionOpportunityCount) {
if (trailingSpaceRun) {
totalLogicalWidth -= trailingSpaceRun->box()->logicalWidth();
@@ -1550,7 +1556,7 @@
lineBox = lineBox->prevRootBox();
// We now want to break at this line. Remember for next layout and trigger relayout.
- m_flow.setBreakAtLineToAvoidWidow(m_flow.lineCount(lineBox));
+ m_flow.setBreakAtLineToAvoidWidow(lineCountUntil(lineBox));
m_flow.markLinesDirtyInBlockRange(lastRootBox()->lineBottomWithLeading(), lineBox->lineBottomWithLeading(), lineBox);
}
}
@@ -1617,7 +1623,7 @@
if (layoutState.checkForFloatsFromLastLine()) {
LayoutUnit bottomVisualOverflow = lastRootBox()->logicalBottomVisualOverflow();
LayoutUnit bottomLayoutOverflow = lastRootBox()->logicalBottomLayoutOverflow();
- auto newLineBox = std::make_unique<TrailingFloatsRootInlineBox>(m_flow);
+ auto newLineBox = makeUnique<TrailingFloatsRootInlineBox>(m_flow);
auto trailingFloatsLineBox = newLineBox.get();
m_lineBoxes.appendLineBox(WTFMove(newLineBox));
trailingFloatsLineBox->setConstructed();
@@ -2102,6 +2108,27 @@
}
}
+size_t ComplexLineLayout::lineCount() const
+{
+ size_t count = 0;
+ for (auto* box = firstRootBox(); box; box = box->nextRootBox())
+ ++count;
+
+ return count;
+}
+
+size_t ComplexLineLayout::lineCountUntil(const RootInlineBox* stopRootInlineBox) const
+{
+ size_t count = 0;
+ for (auto* box = firstRootBox(); box; box = box->nextRootBox()) {
+ ++count;
+ if (box == stopRootInlineBox)
+ break;
+ }
+
+ return count;
+}
+
void ComplexLineLayout::deleteEllipsisLineBoxes()
{
TextAlignMode textAlign = style().textAlign();
@@ -2160,7 +2187,7 @@
float logicalLeft = 0; // We are only interested in the delta from the base position.
float truncatedWidth = m_flow.availableLogicalWidthForLine(curr->lineTop(), shouldIndentText);
- updateLogicalWidthForAlignment(textAlign, curr, nullptr, logicalLeft, totalLogicalWidth, truncatedWidth, 0);
+ updateLogicalWidthForAlignment(m_flow, textAlign, curr, nullptr, logicalLeft, totalLogicalWidth, truncatedWidth, 0);
if (ltr)
curr->adjustLogicalPosition(logicalLeft, 0);
else
@@ -2227,45 +2254,6 @@
return true;
}
-LayoutUnit ComplexLineLayout::startAlignedOffsetForLine(LayoutUnit position, IndentTextOrNot shouldIndentText)
-{
- TextAlignMode textAlign = style().textAlign();
- bool shouldApplyIndentText = false;
- switch (textAlign) {
- case TextAlignMode::Left:
- case TextAlignMode::WebKitLeft:
- shouldApplyIndentText = style().isLeftToRightDirection();
- break;
- case TextAlignMode::Right:
- case TextAlignMode::WebKitRight:
- shouldApplyIndentText = !style().isLeftToRightDirection();
- break;
- case TextAlignMode::Start:
- shouldApplyIndentText = true;
- break;
- default:
- shouldApplyIndentText = false;
- }
- // <rdar://problem/15427571>
- // https://bugs.webkit.org/show_bug.cgi?id=124522
- // This quirk is for legacy content that doesn't work properly with the center positioning scheme
- // being honored (e.g., epubs).
- if (shouldApplyIndentText || m_flow.settings().useLegacyTextAlignPositionedElementBehavior()) // FIXME: Handle TextAlignMode::End here
- return m_flow.startOffsetForLine(position, shouldIndentText);
-
- // updateLogicalWidthForAlignment() handles the direction of the block so no need to consider it here
- float totalLogicalWidth = 0;
- float logicalLeft = m_flow.logicalLeftOffsetForLine(m_flow.logicalHeight(), DoNotIndentText);
- float availableLogicalWidth = m_flow.logicalRightOffsetForLine(m_flow.logicalHeight(), DoNotIndentText) - logicalLeft;
-
- // FIXME: Bug 129311: We need to pass a valid RootInlineBox here, considering the bidi level used to construct the line.
- updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0);
-
- if (!style().isLeftToRightDirection())
- return LayoutUnit(m_flow.logicalWidth() - logicalLeft);
- return LayoutUnit(logicalLeft);
-}
-
void ComplexLineLayout::updateFragmentForLine(RootInlineBox* lineBox) const
{
ASSERT(lineBox);
Modified: branches/safari-609-branch/Source/WebCore/rendering/ComplexLineLayout.h (255843 => 255844)
--- branches/safari-609-branch/Source/WebCore/rendering/ComplexLineLayout.h 2020-02-05 20:08:12 UTC (rev 255843)
+++ branches/safari-609-branch/Source/WebCore/rendering/ComplexLineLayout.h 2020-02-05 20:51:39 UTC (rev 255844)
@@ -66,23 +66,25 @@
void layoutLineBoxes(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom);
- LayoutUnit startAlignedOffsetForLine(LayoutUnit position, IndentTextOrNot shouldIndentText);
RootInlineBox* constructLine(BidiRunList<BidiRun>&, const LineInfo&);
bool positionNewFloatOnLine(const FloatingObject& newFloat, FloatingObject* lastFloatFromPreviousLine, LineInfo&, LineWidth&);
void addOverflowFromInlineChildren();
+ size_t lineCount() const;
+ size_t lineCountUntil(const RootInlineBox*) const;
+
static void appendRunsForObject(BidiRunList<BidiRun>*, int start, int end, RenderObject&, InlineBidiResolver&);
+ static void updateLogicalWidthForAlignment(RenderBlockFlow&, const TextAlignMode&, const RootInlineBox*, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpportunityCount);
private:
std::unique_ptr<RootInlineBox> createRootInlineBox();
RootInlineBox* createAndAppendRootInlineBox();
- static InlineBox* createInlineBoxForRenderer(RenderObject*, bool isRootLineBox, bool isOnlyRun = false);
+ InlineBox* createInlineBoxForRenderer(RenderObject*, bool isOnlyRun = false);
InlineFlowBox* createLineBoxes(RenderObject*, const LineInfo&, InlineBox*);
TextAlignMode textAlignmentForLine(bool endsWithSoftBreak) const;
void setMarginsForRubyRun(BidiRun*, RenderRubyRun&, RenderObject* previousObject, const LineInfo&);
void updateRubyForJustifiedText(RenderRubyRun&, BidiRun&, const Vector<unsigned, 16>& expansionOpportunities, unsigned& expansionOpportunityCount, float& totalLogicalWidth, float availableLogicalWidth, size_t&);
void computeExpansionForJustifiedText(BidiRun* firstRun, BidiRun* trailingSpaceRun, const Vector<unsigned, 16>& expansionOpportunities, unsigned expansionOpportunityCount, float totalLogicalWidth, float availableLogicalWidth);
- void updateLogicalWidthForAlignment(const TextAlignMode&, const RootInlineBox*, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpportunityCount);
void computeInlineDirectionPositionsForLine(RootInlineBox*, const LineInfo&, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&, WordMeasurements&);
BidiRun* computeInlineDirectionPositionsForSegment(RootInlineBox*, const LineInfo&, TextAlignMode, float& logicalLeft, float& availableLogicalWidth, BidiRun* firstRun, BidiRun* trailingSpaceRun, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&, WordMeasurements&);
void removeInlineBox(BidiRun&, const RootInlineBox&) const;
Modified: branches/safari-609-branch/Source/WebCore/rendering/RenderBlockFlow.cpp (255843 => 255844)
--- branches/safari-609-branch/Source/WebCore/rendering/RenderBlockFlow.cpp 2020-02-05 20:08:12 UTC (rev 255843)
+++ branches/safari-609-branch/Source/WebCore/rendering/RenderBlockFlow.cpp 2020-02-05 20:51:39 UTC (rev 255844)
@@ -112,7 +112,6 @@
, m_widthForTextAutosizing(-1)
, m_lineCountForTextAutosizing(NOT_SET)
#endif
- , m_complexLineLayout(*this)
{
setChildrenInline(true);
}
@@ -123,7 +122,6 @@
, m_widthForTextAutosizing(-1)
, m_lineCountForTextAutosizing(NOT_SET)
#endif
- , m_complexLineLayout(*this)
{
setChildrenInline(true);
}
@@ -155,7 +153,8 @@
parent()->dirtyLinesFromChangedChild(*this);
}
- lineBoxes().deleteLineBoxes();
+ if (complexLineLayout())
+ complexLineLayout()->lineBoxes().deleteLineBoxes();
blockWillBeDestroyed();
@@ -687,8 +686,17 @@
return;
}
- m_simpleLineLayout = nullptr;
- complexLineLayout().layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+ if (lineLayoutPath() == LayoutFormattingContextPath) {
+ layoutLFCLines(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
+ return;
+ }
+#endif
+
+ if (!complexLineLayout())
+ m_lineLayout = makeUnique<ComplexLineLayout>(*this);
+
+ complexLineLayout()->layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
}
void RenderBlockFlow::layoutBlockChild(RenderBox& child, MarginInfo& marginInfo, LayoutUnit& previousFloatLogicalBottom, LayoutUnit& maxFloatLogicalBottom)
@@ -910,7 +918,7 @@
void RenderBlockFlow::updateStaticInlinePositionForChild(RenderBox& child, LayoutUnit logicalTop, IndentTextOrNot shouldIndentText)
{
if (child.style().isOriginalDisplayInlineType())
- setStaticInlinePositionForChild(child, logicalTop, complexLineLayout().startAlignedOffsetForLine(logicalTop, shouldIndentText));
+ setStaticInlinePositionForChild(child, logicalTop, startAlignedOffsetForLine(logicalTop, shouldIndentText));
else
setStaticInlinePositionForChild(child, logicalTop, startOffsetForContent(logicalTop));
}
@@ -2113,15 +2121,8 @@
void RenderBlockFlow::deleteLines()
{
- if (containsFloats())
- m_floatingObjects->clearLineBoxTreePointers();
+ m_lineLayout = WTF::Monostate();
- if (m_simpleLineLayout) {
- ASSERT(!lineBoxes().firstLineBox());
- m_simpleLineLayout = nullptr;
- } else
- lineBoxes().deleteLineBoxTree();
-
RenderBlock::deleteLines();
}
@@ -2962,7 +2963,7 @@
return layoutFormattingContextLineLayout()->hitTest(request, result, locationInContainer, accumulatedOffset, hitTestAction);
#endif
- return lineBoxes().hitTest(this, request, result, locationInContainer, accumulatedOffset, hitTestAction);
+ return complexLineLayout() && complexLineLayout()->lineBoxes().hitTest(this, request, result, locationInContainer, accumulatedOffset, hitTestAction);
}
void RenderBlockFlow::addOverflowFromInlineChildren()
@@ -2973,7 +2974,15 @@
return;
}
- complexLineLayout().addOverflowFromInlineChildren();
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+ if (layoutFormattingContextLineLayout()) {
+ layoutFormattingContextLineLayout()->collectOverflow(*this);
+ return;
+ }
+#endif
+
+ if (complexLineLayout())
+ complexLineLayout()->addOverflowFromInlineChildren();
}
void RenderBlockFlow::adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutUnit& right) const
@@ -3570,7 +3579,9 @@
SimpleLineLayout::paintFlow(*this, *simpleLineLayout, paintInfo, paintOffset);
return;
}
- lineBoxes().paint(this, paintInfo, paintOffset);
+
+ if (complexLineLayout())
+ complexLineLayout()->lineBoxes().paint(this, paintInfo, paintOffset);
}
bool RenderBlockFlow::relayoutForPagination()
@@ -3672,8 +3683,8 @@
for (auto& renderer : childrenOfType<RenderObject>(*this))
renderer.clearNeedsLayout();
- ASSERT(!lineBoxes().firstLineBox());
- LayoutUnit lineLayoutHeight = SimpleLineLayout::computeFlowHeight(*this, *m_simpleLineLayout);
+
+ LayoutUnit lineLayoutHeight = SimpleLineLayout::computeFlowHeight(*this, simpleLineLayout);
LayoutUnit lineLayoutTop = borderAndPaddingBefore();
repaintLogicalTop = lineLayoutTop;
repaintLogicalBottom = needsLayout ? repaintLogicalTop + lineLayoutHeight + borderAndPaddingAfter() : repaintLogicalTop;
@@ -3738,14 +3749,14 @@
LayoutUnit repaintLogicalBottom;
if (simpleLineLayout && simpleLineLayout->isPaginated()) {
PaginatedLayoutStateMaintainer state(*this);
- complexLineLayout().layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
+ complexLineLayout.layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
// This matches relayoutToAvoidWidows.
if (shouldBreakAtLineToAvoidWidow())
- complexLineLayout().layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
+ complexLineLayout.layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
// FIXME: This is needed as long as simple and normal line layout produce different line breakings.
repaint();
} else
- complexLineLayout().layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
+ complexLineLayout.layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
updateLogicalHeight();
ASSERT(didNeedLayout || logicalHeight() == oldHeight);
Modified: branches/safari-609-branch/Source/WebCore/rendering/RenderBlockFlow.h (255843 => 255844)
--- branches/safari-609-branch/Source/WebCore/rendering/RenderBlockFlow.h 2020-02-05 20:08:12 UTC (rev 255843)
+++ branches/safari-609-branch/Source/WebCore/rendering/RenderBlockFlow.h 2020-02-05 20:51:39 UTC (rev 255844)
@@ -37,6 +37,12 @@
class RenderMultiColumnFlow;
class RenderRubyRun;
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+namespace LayoutIntegration {
+class LineLayout;
+}
+#endif
+
#if ENABLE(TEXT_AUTOSIZING)
enum LineCount {
NOT_SET = 0, NO_LINE = 1, _ONE_LINE_ = 2, MULTI_LINE = 3
@@ -332,12 +338,9 @@
LayoutPoint flipFloatForWritingModeForChild(const FloatingObject&, const LayoutPoint&) const;
- RenderLineBoxList& lineBoxes() { return m_complexLineLayout.lineBoxes(); }
- const RenderLineBoxList& lineBoxes() const { return m_complexLineLayout.lineBoxes(); }
+ RootInlineBox* firstRootBox() const { return complexLineLayout() ? complexLineLayout()->firstRootBox() : nullptr; }
+ RootInlineBox* lastRootBox() const { return complexLineLayout() ? complexLineLayout()->lastRootBox() : nullptr; }
- RootInlineBox* firstRootBox() const { return m_complexLineLayout.firstRootBox(); }
- RootInlineBox* lastRootBox() const { return m_complexLineLayout.lastRootBox(); }
-
bool hasLines() const;
void invalidateLineLayoutPath() final;
@@ -533,14 +536,21 @@
void addFocusRingRectsForInlineChildren(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*) override;
public:
- ComplexLineLayout& complexLineLayout() { return m_complexLineLayout; }
-
virtual Optional<TextAlignMode> overrideTextAlignmentForLine(bool /* endsWithSoftBreak */) const { return { }; }
virtual void adjustInlineDirectionLineBounds(int /* expansionOpportunityCount */, float& /* logicalLeft */, float& /* logicalWidth */) const { }
private:
+ bool hasLineLayout() const;
+ bool hasSimpleLineLayout() const;
+ bool hasComplexLineLayout() const;
+
void layoutSimpleLines(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom);
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+ bool hasLayoutFormattingContextLineLayout() const;
+ void layoutLFCLines(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom);
+#endif
+
void adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const;
void computeInlinePreferredLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const;
void adjustInitialLetterPosition(RenderBox& childBox, LayoutUnit& logicalTopOffset, LayoutUnit& marginBeforeOffset);
@@ -577,9 +587,15 @@
std::unique_ptr<FloatingObjects> m_floatingObjects;
std::unique_ptr<RenderBlockFlowRareData> m_rareBlockFlowData;
- // FIXME: Only one of these should be needed at any given time.
- ComplexLineLayout m_complexLineLayout;
- std::unique_ptr<SimpleLineLayout::Layout> m_simpleLineLayout;
+private:
+ Variant<
+ WTF::Monostate,
+ Ref<SimpleLineLayout::Layout>,
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+ std::unique_ptr<LayoutIntegration::LineLayout>,
+#endif
+ std::unique_ptr<ComplexLineLayout>
+ > m_lineLayout;
friend class LineBreaker;
friend class LineWidth; // Needs to know FloatingObject
Modified: branches/safari-609-branch/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp (255843 => 255844)
--- branches/safari-609-branch/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp 2020-02-05 20:08:12 UTC (rev 255843)
+++ branches/safari-609-branch/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp 2020-02-05 20:51:39 UTC (rev 255844)
@@ -318,7 +318,7 @@
// lineInfo.setLastLine(lastLine);
lineInfo.setEmpty(!bidiRuns.runCount());
bidiRuns.setLogicallyLastRun(bidiRuns.lastRun());
- auto* root = flow.complexLineLayout().constructLine(bidiRuns, lineInfo);
+ auto* root = flow.complexLineLayout()->constructLine(bidiRuns, lineInfo);
bidiRuns.clear();
if (!root)
continue;
Modified: branches/safari-609-branch/Source/WebCore/rendering/line/LineBreaker.cpp (255843 => 255844)
--- branches/safari-609-branch/Source/WebCore/rendering/line/LineBreaker.cpp 2020-02-05 20:08:12 UTC (rev 255843)
+++ branches/safari-609-branch/Source/WebCore/rendering/line/LineBreaker.cpp 2020-02-05 20:51:39 UTC (rev 255844)
@@ -66,7 +66,7 @@
lineInfo.incrementRunsFromLeadingWhitespace();
}
} else if (object.isFloating())
- m_block.complexLineLayout().positionNewFloatOnLine(*m_block.insertFloatingObject(downcast<RenderBox>(object)), lastFloatFromPreviousLine, lineInfo, width);
+ m_block.complexLineLayout()->positionNewFloatOnLine(*m_block.insertFloatingObject(downcast<RenderBox>(object)), lastFloatFromPreviousLine, lineInfo, width);
else if (object.style().hasTextCombine() && is<RenderCombineText>(object)) {
downcast<RenderCombineText>(object).combineTextIfNeeded();
if (downcast<RenderCombineText>(object).isCombined())
Modified: branches/safari-609-branch/Source/WebCore/rendering/line/LineBreaker.h (255843 => 255844)
--- branches/safari-609-branch/Source/WebCore/rendering/line/LineBreaker.h 2020-02-05 20:08:12 UTC (rev 255843)
+++ branches/safari-609-branch/Source/WebCore/rendering/line/LineBreaker.h 2020-02-05 20:51:39 UTC (rev 255844)
@@ -66,7 +66,7 @@
FloatingObject* insertFloatingObject(RenderBox& floatBox) { return m_block.insertFloatingObject(floatBox); }
bool positionNewFloatOnLine(const FloatingObject& newFloat, FloatingObject* lastFloatFromPreviousLine, LineInfo& lineInfo, LineWidth& width)
{
- return m_block.complexLineLayout().positionNewFloatOnLine(newFloat, lastFloatFromPreviousLine, lineInfo, width);
+ return m_block.complexLineLayout()->positionNewFloatOnLine(newFloat, lastFloatFromPreviousLine, lineInfo, width);
}
RenderBlockFlow& m_block;
Modified: branches/safari-609-branch/Source/WebCore/rendering/line/LineInlineHeaders.h (255843 => 255844)
--- branches/safari-609-branch/Source/WebCore/rendering/line/LineInlineHeaders.h 2020-02-05 20:08:12 UTC (rev 255843)
+++ branches/safari-609-branch/Source/WebCore/rendering/line/LineInlineHeaders.h 2020-02-05 20:51:39 UTC (rev 255844)
@@ -130,7 +130,7 @@
// A relative positioned inline encloses us. In this case, we also have to determine our
// position as though we were an inline. Set |staticInlinePosition| and |staticBlockPosition| on the relative positioned
// inline so that we can obtain the value later.
- downcast<RenderInline>(*containerBlock).layer()->setStaticInlinePosition(block.complexLineLayout().startAlignedOffsetForLine(blockHeight, DoNotIndentText));
+ downcast<RenderInline>(*containerBlock).layer()->setStaticInlinePosition(block.startAlignedOffsetForLine(blockHeight, DoNotIndentText));
downcast<RenderInline>(*containerBlock).layer()->setStaticBlockPosition(blockHeight);
}
block.updateStaticInlinePositionForChild(child, blockHeight, shouldIndentText);