Changeset 248528 in webkit
- Timestamp:
- Aug 12, 2019 8:31:34 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r248527 r248528 1 2019-08-12 Antti Koivisto <antti@apple.com> 2 3 Only construct ComplexLineLayout when needed 4 https://bugs.webkit.org/show_bug.cgi?id=200625 5 6 Reviewed by Zalan Bujtas. 7 8 * rendering/ComplexLineLayout.cpp: 9 (WebCore::ComplexLineLayout::createInlineBoxForRenderer): 10 (WebCore::ComplexLineLayout::createLineBoxes): 11 (WebCore::ComplexLineLayout::constructLine): 12 (WebCore::ComplexLineLayout::updateLogicalWidthForAlignment): 13 14 Make static so this can be invoked without constructing complex line layout (from startAlignedOffsetForLine). 15 16 (WebCore::ComplexLineLayout::computeInlineDirectionPositionsForSegment): 17 (WebCore::ComplexLineLayout::deleteEllipsisLineBoxes): 18 (WebCore::ComplexLineLayout::checkLinesForTextOverflow): 19 (WebCore::ComplexLineLayout::startAlignedOffsetForLine): Deleted. 20 21 This is also used in block layout to set static positions of positioned objects. 22 Move to RenderBlockFlow where its only caller is. 23 24 * rendering/ComplexLineLayout.h: 25 * rendering/RenderBlockFlow.cpp: 26 (WebCore::RenderBlockFlow::RenderBlockFlow): 27 (WebCore::RenderBlockFlow::willBeDestroyed): 28 (WebCore::RenderBlockFlow::layoutInlineChildren): 29 (WebCore::RenderBlockFlow::updateStaticInlinePositionForChild): 30 (WebCore::RenderBlockFlow::startAlignedOffsetForLine): 31 (WebCore::RenderBlockFlow::deleteLines): 32 (WebCore::RenderBlockFlow::hitTestInlineChildren): 33 (WebCore::RenderBlockFlow::addOverflowFromInlineChildren): 34 (WebCore::RenderBlockFlow::paintInlineChildren): 35 (WebCore::RenderBlockFlow::hasLines const): 36 (WebCore::RenderBlockFlow::layoutSimpleLines): 37 (WebCore::RenderBlockFlow::deleteLineBoxesBeforeSimpleLineLayout): 38 (WebCore::RenderBlockFlow::ensureLineBoxes): 39 * rendering/RenderBlockFlow.h: 40 (WebCore::RenderBlockFlow::firstRootBox const): 41 (WebCore::RenderBlockFlow::lastRootBox const): 42 (WebCore::RenderBlockFlow::complexLineLayout): 43 (WebCore::RenderBlockFlow::lineBoxes): Deleted. 44 (WebCore::RenderBlockFlow::lineBoxes const): Deleted. 45 * rendering/RootInlineBox.cpp: 46 (WebCore::RootInlineBox::removeLineBoxFromRenderObject): 47 (WebCore::RootInlineBox::extractLineBoxFromRenderObject): 48 (WebCore::RootInlineBox::attachLineBoxToRenderObject): 49 * rendering/SimpleLineLayoutFunctions.cpp: 50 (WebCore::SimpleLineLayout::generateLineBoxTree): 51 1 52 2019-08-12 Youenn Fablet <youenn@apple.com> 2 53 -
trunk/Source/WebCore/rendering/ComplexLineLayout.cpp
r248517 r248528 153 153 } 154 154 155 inline InlineBox* ComplexLineLayout::createInlineBoxForRenderer(RenderObject* renderer, bool isRootLineBox, bool isOnlyRun)156 { 157 if ( isRootLineBox)158 return downcast<RenderBlockFlow>(*renderer).complexLineLayout().createAndAppendRootInlineBox();155 InlineBox* ComplexLineLayout::createInlineBoxForRenderer(RenderObject* renderer, bool isOnlyRun) 156 { 157 if (renderer == &m_flow) 158 return createAndAppendRootInlineBox(); 159 159 160 160 if (is<RenderText>(*renderer)) … … 227 227 // We need to make a new box for this render object. Once 228 228 // made, we need to place it at the end of the current line. 229 InlineBox* newBox = createInlineBoxForRenderer(obj , obj == &m_flow);229 InlineBox* newBox = createInlineBoxForRenderer(obj); 230 230 parentBox = downcast<InlineFlowBox>(newBox); 231 231 parentBox->setIsFirstLine(lineInfo.isFirstLine()); … … 302 302 continue; 303 303 304 InlineBox* box = createInlineBoxForRenderer(&r->renderer(), false,isOnlyRun);304 InlineBox* box = createInlineBoxForRenderer(&r->renderer(), isOnlyRun); 305 305 r->setBox(box); 306 306 … … 632 632 } 633 633 634 void ComplexLineLayout::updateLogicalWidthForAlignment( const TextAlignMode& textAlign, const RootInlineBox* rootInlineBox, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpportunityCount)634 void ComplexLineLayout::updateLogicalWidthForAlignment(RenderBlockFlow& flow, const TextAlignMode& textAlign, const RootInlineBox* rootInlineBox, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpportunityCount) 635 635 { 636 636 TextDirection direction; 637 if (rootInlineBox && style().unicodeBidi() == Plaintext)637 if (rootInlineBox && flow.style().unicodeBidi() == Plaintext) 638 638 direction = rootInlineBox->direction(); 639 639 else 640 direction = style().direction(); 640 direction = flow.style().direction(); 641 642 bool isLeftToRightDirection = flow.style().isLeftToRightDirection(); 641 643 642 644 // Armed with the total width of the line (without justification), … … 647 649 case TextAlignMode::Left: 648 650 case TextAlignMode::WebKitLeft: 649 updateLogicalWidthForLeftAlignedBlock( style().isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);651 updateLogicalWidthForLeftAlignedBlock(isLeftToRightDirection, trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); 650 652 break; 651 653 case TextAlignMode::Right: 652 654 case TextAlignMode::WebKitRight: 653 updateLogicalWidthForRightAlignedBlock( style().isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);655 updateLogicalWidthForRightAlignedBlock(isLeftToRightDirection, trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); 654 656 break; 655 657 case TextAlignMode::Center: 656 658 case TextAlignMode::WebKitCenter: 657 updateLogicalWidthForCenterAlignedBlock( style().isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);659 updateLogicalWidthForCenterAlignedBlock(isLeftToRightDirection, trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); 658 660 break; 659 661 case TextAlignMode::Justify: 660 m_flow.adjustInlineDirectionLineBounds(expansionOpportunityCount, logicalLeft, availableLogicalWidth);662 flow.adjustInlineDirectionLineBounds(expansionOpportunityCount, logicalLeft, availableLogicalWidth); 661 663 if (expansionOpportunityCount) { 662 664 if (trailingSpaceRun) { … … 669 671 case TextAlignMode::Start: 670 672 if (direction == TextDirection::LTR) 671 updateLogicalWidthForLeftAlignedBlock( style().isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);673 updateLogicalWidthForLeftAlignedBlock(isLeftToRightDirection, trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); 672 674 else 673 updateLogicalWidthForRightAlignedBlock( style().isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);675 updateLogicalWidthForRightAlignedBlock(isLeftToRightDirection, trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); 674 676 break; 675 677 case TextAlignMode::End: 676 678 if (direction == TextDirection::LTR) 677 updateLogicalWidthForRightAlignedBlock( style().isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);679 updateLogicalWidthForRightAlignedBlock(isLeftToRightDirection, trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); 678 680 else 679 updateLogicalWidthForLeftAlignedBlock( style().isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);681 updateLogicalWidthForLeftAlignedBlock(isLeftToRightDirection, trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); 680 682 break; 681 683 } … … 960 962 textAlign = TextAlignMode::Center; 961 963 962 updateLogicalWidthForAlignment( textAlign, lineBox, trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth, expansionOpportunityCount);964 updateLogicalWidthForAlignment(m_flow, textAlign, lineBox, trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth, expansionOpportunityCount); 963 965 964 966 computeExpansionForJustifiedText(firstRun, trailingSpaceRun, expansionOpportunities, expansionOpportunityCount, totalLogicalWidth, availableLogicalWidth); … … 2114 2116 float availableLogicalWidth = m_flow.logicalRightOffsetForLine(curr->lineTop(), DoNotIndentText) - logicalLeft; 2115 2117 float totalLogicalWidth = curr->logicalWidth(); 2116 updateLogicalWidthForAlignment( textAlign, curr, 0, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0);2118 updateLogicalWidthForAlignment(m_flow, textAlign, curr, 0, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0); 2117 2119 2118 2120 if (ltr) … … 2159 2161 float logicalLeft = 0; // We are only interested in the delta from the base position. 2160 2162 float truncatedWidth = m_flow.availableLogicalWidthForLine(curr->lineTop(), shouldIndentText); 2161 updateLogicalWidthForAlignment( textAlign, curr, nullptr, logicalLeft, totalLogicalWidth, truncatedWidth, 0);2163 updateLogicalWidthForAlignment(m_flow, textAlign, curr, nullptr, logicalLeft, totalLogicalWidth, truncatedWidth, 0); 2162 2164 if (ltr) 2163 2165 curr->adjustLogicalPosition(logicalLeft, 0); … … 2226 2228 } 2227 2229 2228 LayoutUnit ComplexLineLayout::startAlignedOffsetForLine(LayoutUnit position, IndentTextOrNot shouldIndentText)2229 {2230 TextAlignMode textAlign = style().textAlign();2231 bool shouldApplyIndentText = false;2232 switch (textAlign) {2233 case TextAlignMode::Left:2234 case TextAlignMode::WebKitLeft:2235 shouldApplyIndentText = style().isLeftToRightDirection();2236 break;2237 case TextAlignMode::Right:2238 case TextAlignMode::WebKitRight:2239 shouldApplyIndentText = !style().isLeftToRightDirection();2240 break;2241 case TextAlignMode::Start:2242 shouldApplyIndentText = true;2243 break;2244 default:2245 shouldApplyIndentText = false;2246 }2247 // <rdar://problem/15427571>2248 // https://bugs.webkit.org/show_bug.cgi?id=1245222249 // This quirk is for legacy content that doesn't work properly with the center positioning scheme2250 // being honored (e.g., epubs).2251 if (shouldApplyIndentText || m_flow.settings().useLegacyTextAlignPositionedElementBehavior()) // FIXME: Handle TextAlignMode::End here2252 return m_flow.startOffsetForLine(position, shouldIndentText);2253 2254 // updateLogicalWidthForAlignment() handles the direction of the block so no need to consider it here2255 float totalLogicalWidth = 0;2256 float logicalLeft = m_flow.logicalLeftOffsetForLine(m_flow.logicalHeight(), DoNotIndentText);2257 float availableLogicalWidth = m_flow.logicalRightOffsetForLine(m_flow.logicalHeight(), DoNotIndentText) - logicalLeft;2258 2259 // FIXME: Bug 129311: We need to pass a valid RootInlineBox here, considering the bidi level used to construct the line.2260 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0);2261 2262 if (!style().isLeftToRightDirection())2263 return LayoutUnit(m_flow.logicalWidth() - logicalLeft);2264 return LayoutUnit(logicalLeft);2265 }2266 2267 2230 void ComplexLineLayout::updateFragmentForLine(RootInlineBox* lineBox) const 2268 2231 { -
trunk/Source/WebCore/rendering/ComplexLineLayout.h
r248517 r248528 67 67 void layoutLineBoxes(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom); 68 68 69 LayoutUnit startAlignedOffsetForLine(LayoutUnit position, IndentTextOrNot shouldIndentText);70 69 RootInlineBox* constructLine(BidiRunList<BidiRun>&, const LineInfo&); 71 70 bool positionNewFloatOnLine(const FloatingObject& newFloat, FloatingObject* lastFloatFromPreviousLine, LineInfo&, LineWidth&); … … 73 72 74 73 static void appendRunsForObject(BidiRunList<BidiRun>*, int start, int end, RenderObject&, InlineBidiResolver&); 74 static void updateLogicalWidthForAlignment(RenderBlockFlow&, const TextAlignMode&, const RootInlineBox*, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpportunityCount); 75 75 76 76 private: 77 77 std::unique_ptr<RootInlineBox> createRootInlineBox(); 78 78 RootInlineBox* createAndAppendRootInlineBox(); 79 static InlineBox* createInlineBoxForRenderer(RenderObject*, bool isRootLineBox, bool isOnlyRun = false);79 InlineBox* createInlineBoxForRenderer(RenderObject*, bool isOnlyRun = false); 80 80 InlineFlowBox* createLineBoxes(RenderObject*, const LineInfo&, InlineBox*); 81 81 TextAlignMode textAlignmentForLine(bool endsWithSoftBreak) const; … … 83 83 void updateRubyForJustifiedText(RenderRubyRun&, BidiRun&, const Vector<unsigned, 16>& expansionOpportunities, unsigned& expansionOpportunityCount, float& totalLogicalWidth, float availableLogicalWidth, size_t&); 84 84 void computeExpansionForJustifiedText(BidiRun* firstRun, BidiRun* trailingSpaceRun, const Vector<unsigned, 16>& expansionOpportunities, unsigned expansionOpportunityCount, float totalLogicalWidth, float availableLogicalWidth); 85 void updateLogicalWidthForAlignment(const TextAlignMode&, const RootInlineBox*, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpportunityCount);86 85 void computeInlineDirectionPositionsForLine(RootInlineBox*, const LineInfo&, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&, WordMeasurements&); 87 86 BidiRun* computeInlineDirectionPositionsForSegment(RootInlineBox*, const LineInfo&, TextAlignMode, float& logicalLeft, float& availableLogicalWidth, BidiRun* firstRun, BidiRun* trailingSpaceRun, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&, WordMeasurements&); -
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp
r248517 r248528 112 112 , m_lineCountForTextAutosizing(NOT_SET) 113 113 #endif 114 , m_complexLineLayout(*this)115 114 { 116 115 setChildrenInline(true); … … 123 122 , m_lineCountForTextAutosizing(NOT_SET) 124 123 #endif 125 , m_complexLineLayout(*this)126 124 { 127 125 setChildrenInline(true); … … 155 153 } 156 154 157 lineBoxes().deleteLineBoxes(); 155 if (m_complexLineLayout) 156 m_complexLineLayout->lineBoxes().deleteLineBoxes(); 158 157 159 158 blockWillBeDestroyed(); … … 678 677 679 678 m_simpleLineLayout = nullptr; 680 complexLineLayout().layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom); 679 680 if (!m_complexLineLayout) 681 m_complexLineLayout = std::make_unique<ComplexLineLayout>(*this); 682 683 m_complexLineLayout->layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom); 681 684 } 682 685 … … 900 903 { 901 904 if (child.style().isOriginalDisplayInlineType()) 902 setStaticInlinePositionForChild(child, logicalTop, complexLineLayout().startAlignedOffsetForLine(logicalTop, shouldIndentText));905 setStaticInlinePositionForChild(child, logicalTop, startAlignedOffsetForLine(logicalTop, shouldIndentText)); 903 906 else 904 907 setStaticInlinePositionForChild(child, logicalTop, startOffsetForContent(logicalTop)); … … 912 915 } 913 916 child.layer()->setStaticInlinePosition(inlinePosition); 917 } 918 919 LayoutUnit RenderBlockFlow::startAlignedOffsetForLine(LayoutUnit position, IndentTextOrNot shouldIndentText) 920 { 921 TextAlignMode textAlign = style().textAlign(); 922 bool shouldApplyIndentText = false; 923 switch (textAlign) { 924 case TextAlignMode::Left: 925 case TextAlignMode::WebKitLeft: 926 shouldApplyIndentText = style().isLeftToRightDirection(); 927 break; 928 case TextAlignMode::Right: 929 case TextAlignMode::WebKitRight: 930 shouldApplyIndentText = !style().isLeftToRightDirection(); 931 break; 932 case TextAlignMode::Start: 933 shouldApplyIndentText = true; 934 break; 935 default: 936 shouldApplyIndentText = false; 937 } 938 // <rdar://problem/15427571> 939 // https://bugs.webkit.org/show_bug.cgi?id=124522 940 // This quirk is for legacy content that doesn't work properly with the center positioning scheme 941 // being honored (e.g., epubs). 942 if (shouldApplyIndentText || settings().useLegacyTextAlignPositionedElementBehavior()) // FIXME: Handle TextAlignMode::End here 943 return startOffsetForLine(position, shouldIndentText); 944 945 // updateLogicalWidthForAlignment() handles the direction of the block so no need to consider it here 946 float totalLogicalWidth = 0; 947 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), DoNotIndentText); 948 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), DoNotIndentText) - logicalLeft; 949 950 ComplexLineLayout::updateLogicalWidthForAlignment(*this, textAlign, nullptr, nullptr, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0); 951 952 if (!style().isLeftToRightDirection()) 953 return LayoutUnit(logicalWidth() - logicalLeft); 954 955 return LayoutUnit(logicalLeft); 914 956 } 915 957 … … 2068 2110 2069 2111 if (m_simpleLineLayout) { 2070 ASSERT(! lineBoxes().firstLineBox());2112 ASSERT(!m_complexLineLayout); 2071 2113 m_simpleLineLayout = nullptr; 2072 } else 2073 lineBoxes().deleteLineBoxTree();2114 } else if (m_complexLineLayout) 2115 m_complexLineLayout->lineBoxes().deleteLineBoxTree(); 2074 2116 2075 2117 RenderBlock::deleteLines(); … … 2908 2950 return SimpleLineLayout::hitTestFlow(*this, *simpleLineLayout, request, result, locationInContainer, accumulatedOffset, hitTestAction); 2909 2951 2910 return lineBoxes().hitTest(this, request, result, locationInContainer, accumulatedOffset, hitTestAction);2952 return m_complexLineLayout && m_complexLineLayout->lineBoxes().hitTest(this, request, result, locationInContainer, accumulatedOffset, hitTestAction); 2911 2953 } 2912 2954 … … 2919 2961 } 2920 2962 2921 complexLineLayout().addOverflowFromInlineChildren();2963 m_complexLineLayout->addOverflowFromInlineChildren(); 2922 2964 } 2923 2965 … … 3501 3543 return; 3502 3544 } 3503 lineBoxes().paint(this, paintInfo, paintOffset); 3545 3546 if (m_complexLineLayout) 3547 m_complexLineLayout->lineBoxes().paint(this, paintInfo, paintOffset); 3504 3548 } 3505 3549 … … 3556 3600 return simpleLineLayout->lineCount(); 3557 3601 3558 return lineBoxes().firstLineBox();3602 return m_complexLineLayout && m_complexLineLayout->lineBoxes().firstLineBox(); 3559 3603 } 3560 3604 … … 3596 3640 for (auto& renderer : childrenOfType<RenderObject>(*this)) 3597 3641 renderer.clearNeedsLayout(); 3598 ASSERT(! lineBoxes().firstLineBox());3642 ASSERT(!m_complexLineLayout); 3599 3643 LayoutUnit lineLayoutHeight = SimpleLineLayout::computeFlowHeight(*this, *m_simpleLineLayout); 3600 3644 LayoutUnit lineLayoutTop = borderAndPaddingBefore(); … … 3607 3651 { 3608 3652 ASSERT(lineLayoutPath() == SimpleLinesPath); 3609 lineBoxes().deleteLineBoxes(); 3653 3654 if (m_complexLineLayout) 3655 m_complexLineLayout->lineBoxes().deleteLineBoxes(); 3656 3610 3657 for (auto& renderer : childrenOfType<RenderObject>(*this)) { 3611 3658 if (is<RenderText>(renderer)) … … 3616 3663 ASSERT_NOT_REACHED(); 3617 3664 } 3665 3666 m_complexLineLayout = nullptr; 3618 3667 } 3619 3668 3620 3669 void RenderBlockFlow::ensureLineBoxes() 3621 3670 { 3671 if (!childrenInline()) 3672 return; 3673 3622 3674 setLineLayoutPath(ForceLineBoxesPath); 3675 3623 3676 if (!m_simpleLineLayout) 3624 3677 return; 3678 3679 ASSERT(!m_complexLineLayout); 3680 m_complexLineLayout = std::make_unique<ComplexLineLayout>(*this); 3625 3681 3626 3682 if (SimpleLineLayout::canUseForLineBoxTree(*this, *m_simpleLineLayout)) { … … 3642 3698 if (isPaginated) { 3643 3699 PaginatedLayoutStateMaintainer state(*this); 3644 complexLineLayout().layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);3700 m_complexLineLayout->layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom); 3645 3701 // This matches relayoutToAvoidWidows. 3646 3702 if (shouldBreakAtLineToAvoidWidow()) 3647 complexLineLayout().layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);3703 m_complexLineLayout->layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom); 3648 3704 // FIXME: This is needed as long as simple and normal line layout produce different line breakings. 3649 3705 repaint(); 3650 3706 } else 3651 complexLineLayout().layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);3707 m_complexLineLayout->layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom); 3652 3708 3653 3709 updateLogicalHeight(); -
trunk/Source/WebCore/rendering/RenderBlockFlow.h
r248517 r248528 71 71 LayoutUnit collapsedMarginAfter() const final { return maxPositiveMarginAfter() - maxNegativeMarginAfter(); } 72 72 73 void dirtyLinesFromChangedChild(RenderObject& child) final { lineBoxes().dirtyLinesFromChangedChild(*this, child); } 73 void dirtyLinesFromChangedChild(RenderObject& child) final 74 { 75 if (m_complexLineLayout) 76 m_complexLineLayout->lineBoxes().dirtyLinesFromChangedChild(*this, child); 77 } 74 78 75 79 void paintColumnRules(PaintInfo&, const LayoutPoint&) override; … … 232 236 void updateStaticInlinePositionForChild(RenderBox& child, LayoutUnit logicalTop, IndentTextOrNot shouldIndentText); 233 237 238 LayoutUnit startAlignedOffsetForLine(LayoutUnit position, IndentTextOrNot); 239 234 240 LayoutUnit collapseMargins(RenderBox& child, MarginInfo&); 235 241 LayoutUnit collapseMarginsWithChildInfo(RenderBox* child, RenderObject* prevSibling, MarginInfo&); … … 327 333 LayoutPoint flipFloatForWritingModeForChild(const FloatingObject&, const LayoutPoint&) const; 328 334 329 RenderLineBoxList& lineBoxes() { return m_complexLineLayout.lineBoxes(); } 330 const RenderLineBoxList& lineBoxes() const { return m_complexLineLayout.lineBoxes(); } 331 332 RootInlineBox* firstRootBox() const { return m_complexLineLayout.firstRootBox(); } 333 RootInlineBox* lastRootBox() const { return m_complexLineLayout.lastRootBox(); } 335 RootInlineBox* firstRootBox() const { return m_complexLineLayout ? m_complexLineLayout->firstRootBox() : nullptr; } 336 RootInlineBox* lastRootBox() const { return m_complexLineLayout ? m_complexLineLayout->lastRootBox() : nullptr; } 334 337 335 338 bool hasLines() const; … … 519 522 520 523 public: 521 ComplexLineLayout & complexLineLayout() { return m_complexLineLayout; }524 ComplexLineLayout* complexLineLayout() { return m_complexLineLayout.get(); } 522 525 523 526 virtual Optional<TextAlignMode> overrideTextAlignmentForLine(bool /* endsWithSoftBreak */) const { return { }; } … … 564 567 565 568 // FIXME: Only one of these should be needed at any given time. 566 ComplexLineLayoutm_complexLineLayout;569 std::unique_ptr<ComplexLineLayout> m_complexLineLayout; 567 570 std::unique_ptr<SimpleLineLayout::Layout> m_simpleLineLayout; 568 571 -
trunk/Source/WebCore/rendering/RootInlineBox.cpp
r246490 r248528 829 829 void RootInlineBox::removeLineBoxFromRenderObject() 830 830 { 831 blockFlow(). lineBoxes().removeLineBox(this);831 blockFlow().complexLineLayout()->lineBoxes().removeLineBox(this); 832 832 } 833 833 834 834 void RootInlineBox::extractLineBoxFromRenderObject() 835 835 { 836 blockFlow(). lineBoxes().extractLineBox(this);836 blockFlow().complexLineLayout()->lineBoxes().extractLineBox(this); 837 837 } 838 838 839 839 void RootInlineBox::attachLineBoxToRenderObject() 840 840 { 841 blockFlow(). lineBoxes().attachLineBox(this);841 blockFlow().complexLineLayout()->lineBoxes().attachLineBox(this); 842 842 } 843 843 -
trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp
r248517 r248528 332 332 void generateLineBoxTree(RenderBlockFlow& flow, const Layout& layout) 333 333 { 334 ASSERT(!flow. lineBoxes().firstLineBox());334 ASSERT(!flow.complexLineLayout()->lineBoxes().firstLineBox()); 335 335 if (!layout.runCount()) 336 336 return; … … 352 352 353 353 LineInfo lineInfo; 354 lineInfo.setFirstLine(!flow. lineBoxes().firstLineBox());354 lineInfo.setFirstLine(!flow.complexLineLayout()->lineBoxes().firstLineBox()); 355 355 // FIXME: This is needed for flow boxes -but we don't have them yet. 356 356 // lineInfo.setLastLine(lastLine); 357 357 lineInfo.setEmpty(!bidiRuns.runCount()); 358 358 bidiRuns.setLogicallyLastRun(bidiRuns.lastRun()); 359 auto* root = flow.complexLineLayout() .constructLine(bidiRuns, lineInfo);359 auto* root = flow.complexLineLayout()->constructLine(bidiRuns, lineInfo); 360 360 bidiRuns.clear(); 361 361 if (!root) -
trunk/Source/WebCore/rendering/line/LineBreaker.cpp
r248517 r248528 67 67 } 68 68 } else if (object.isFloating()) 69 m_block.complexLineLayout() .positionNewFloatOnLine(*m_block.insertFloatingObject(downcast<RenderBox>(object)), lastFloatFromPreviousLine, lineInfo, width);69 m_block.complexLineLayout()->positionNewFloatOnLine(*m_block.insertFloatingObject(downcast<RenderBox>(object)), lastFloatFromPreviousLine, lineInfo, width); 70 70 else if (object.style().hasTextCombine() && is<RenderCombineText>(object)) { 71 71 downcast<RenderCombineText>(object).combineTextIfNeeded(); -
trunk/Source/WebCore/rendering/line/LineBreaker.h
r248517 r248528 67 67 bool positionNewFloatOnLine(const FloatingObject& newFloat, FloatingObject* lastFloatFromPreviousLine, LineInfo& lineInfo, LineWidth& width) 68 68 { 69 return m_block.complexLineLayout() .positionNewFloatOnLine(newFloat, lastFloatFromPreviousLine, lineInfo, width);69 return m_block.complexLineLayout()->positionNewFloatOnLine(newFloat, lastFloatFromPreviousLine, lineInfo, width); 70 70 } 71 71 -
trunk/Source/WebCore/rendering/line/LineInlineHeaders.h
r248517 r248528 131 131 // position as though we were an inline. Set |staticInlinePosition| and |staticBlockPosition| on the relative positioned 132 132 // inline so that we can obtain the value later. 133 downcast<RenderInline>(*containerBlock).layer()->setStaticInlinePosition(block. complexLineLayout().startAlignedOffsetForLine(blockHeight, DoNotIndentText));133 downcast<RenderInline>(*containerBlock).layer()->setStaticInlinePosition(block.startAlignedOffsetForLine(blockHeight, DoNotIndentText)); 134 134 downcast<RenderInline>(*containerBlock).layer()->setStaticBlockPosition(blockHeight); 135 135 }
Note: See TracChangeset
for help on using the changeset viewer.