Bug 1107721 - Add pointer to the base line layout in nsLineLayout. r=dbaron

--HG--
extra : source : 7b1b90d6bba043a68a84bb2faeba95096fa15ca5
This commit is contained in:
Xidorn Quan 2014-12-05 15:05:51 -08:00
Родитель 9d83b26756
Коммит 3ba35be862
5 изменённых файлов: 20 добавлений и 5 удалений

Просмотреть файл

@ -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);

Просмотреть файл

@ -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,

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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;

Просмотреть файл

@ -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