diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 22d6d0cbf974..438fa7f26d90 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -3546,7 +3546,7 @@ nsBlockFrame::ReflowInlineFrames(nsBlockReflowState& aState, // no longer makes sense. Now we always allocate on the stack. nsLineLayout lineLayout(aState.mPresContext, aState.mReflowState.mFloatManager, - &aState.mReflowState, &aLine); + &aState.mReflowState, &aLine, nullptr); lineLayout.Init(&aState, aState.mMinLineHeight, aState.mLineNumber); if (forceBreakInFrame) { lineLayout.ForceBreakAtPosition(forceBreakInFrame, forceBreakOffset); diff --git a/layout/generic/nsFirstLetterFrame.cpp b/layout/generic/nsFirstLetterFrame.cpp index c0e68ddc87a2..8fa412ea033f 100644 --- a/layout/generic/nsFirstLetterFrame.cpp +++ b/layout/generic/nsFirstLetterFrame.cpp @@ -194,7 +194,7 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext, WritingMode kidWritingMode = GetWritingMode(kid); LogicalSize kidAvailSize = availSize.ConvertTo(kidWritingMode, wm); nsHTMLReflowState rs(aPresContext, aReflowState, kid, kidAvailSize); - nsLineLayout ll(aPresContext, nullptr, &aReflowState, nullptr); + nsLineLayout ll(aPresContext, nullptr, &aReflowState, nullptr, nullptr); ll.BeginLineReflow(bp.IStart(wm), bp.BStart(wm), availSize.ISize(wm), NS_UNCONSTRAINEDSIZE, diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index 404f5a828651..9d252101a005 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -51,10 +51,12 @@ using namespace mozilla; nsLineLayout::nsLineLayout(nsPresContext* aPresContext, nsFloatManager* aFloatManager, const nsHTMLReflowState* aOuterReflowState, - const nsLineList::iterator* aLine) + const nsLineList::iterator* aLine, + nsLineLayout* aBaseLineLayout) : mPresContext(aPresContext), mFloatManager(aFloatManager), mBlockReflowState(aOuterReflowState), + mBaseLineLayout(aBaseLineLayout ? aBaseLineLayout->mBaseLineLayout : this), mLastOptionalBreakFrame(nullptr), mForceBreakFrame(nullptr), mBlockRS(nullptr),/* XXX temporary */ diff --git a/layout/generic/nsLineLayout.h b/layout/generic/nsLineLayout.h index eb89a83931b9..4a8edad644ed 100644 --- a/layout/generic/nsLineLayout.h +++ b/layout/generic/nsLineLayout.h @@ -29,10 +29,15 @@ struct nsStyleText; class nsLineLayout { public: + /** + * @param aBaseLineLayout the nsLineLayout for ruby base, + * nullptr if no separate base nsLineLayout is needed. + */ nsLineLayout(nsPresContext* aPresContext, nsFloatManager* aFloatManager, const nsHTMLReflowState* aOuterReflowState, - const nsLineList::iterator* aLine); + const nsLineList::iterator* aLine, + nsLineLayout* aBaseLineLayout); ~nsLineLayout(); void Init(nsBlockReflowState* aState, nscoord aMinLineBSize, @@ -346,6 +351,14 @@ protected: const nsStyleText* mStyleText; // for the block const nsHTMLReflowState* mBlockReflowState; + // The line layout for the base text. It is usually same as |this|. + // It becomes different when the current line layout is for ruby + // annotations. All line layouts share the same base line layout + // when they are associated. The base line layout is responsible + // for managing the life cycle of per-frame data and per-span data, + // and handling floats. + nsLineLayout* const mBaseLineLayout; + nsIFrame* mLastOptionalBreakFrame; nsIFrame* mForceBreakFrame; diff --git a/layout/generic/nsRubyBaseContainerFrame.cpp b/layout/generic/nsRubyBaseContainerFrame.cpp index 499cf8cda679..765330553698 100644 --- a/layout/generic/nsRubyBaseContainerFrame.cpp +++ b/layout/generic/nsRubyBaseContainerFrame.cpp @@ -319,7 +319,7 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext, reflowStates.AppendElement(reflowState); reflowStateArray->AppendElement(reflowState); nsLineLayout* lineLayout = new nsLineLayout( - aPresContext, reflowState->mFloatManager, reflowState, nullptr); + aPresContext, reflowState->mFloatManager, reflowState, nullptr, nullptr); lineLayouts.AppendElement(lineLayout); // Line number is useless for ruby text