Bug 1116037 part 12 - Move mLineSize to RubyReflowState. r=dbaron

--HG--
extra : source : 17ad55f13af3e96df7649f968c838bc48b323c68
This commit is contained in:
Xidorn Quan 2014-12-30 11:20:10 +11:00
parent 7f2739eedc
commit fe93816785
6 changed files with 16 additions and 16 deletions

View File

@ -11,12 +11,14 @@
using namespace mozilla;
RubyReflowState::RubyReflowState(
WritingMode aLineWM,
const nsTArray<nsRubyTextContainerFrame*>& aTextContainers)
: mCurrentContainerIndex(kBaseContainerIndex)
{
uint32_t rtcCount = aTextContainers.Length();
mTextContainers.SetCapacity(rtcCount);
for (uint32_t i = 0; i < rtcCount; i++) {
mTextContainers.AppendElement(TextContainerInfo(aTextContainers[i]));
mTextContainers.AppendElement(
TextContainerInfo(aLineWM, aTextContainers[i]));
}
}

View File

@ -23,22 +23,27 @@ class MOZ_STACK_CLASS RubyReflowState MOZ_FINAL
{
public:
explicit RubyReflowState(
WritingMode aLineWM,
const nsTArray<nsRubyTextContainerFrame*>& aTextContainers);
struct TextContainerInfo
{
nsRubyTextContainerFrame* mFrame;
LogicalSize mLineSize;
TextContainerInfo(nsRubyTextContainerFrame* aFrame)
: mFrame(aFrame) { }
TextContainerInfo(WritingMode aLineWM, nsRubyTextContainerFrame* aFrame)
: mFrame(aFrame)
, mLineSize(aLineWM) { }
};
void AdvanceCurrentContainerIndex() { mCurrentContainerIndex++; }
void SetTextContainerInfo(int32_t aIndex,
nsRubyTextContainerFrame* aContainer)
nsRubyTextContainerFrame* aContainer,
const LogicalSize& aLineSize)
{
MOZ_ASSERT(mTextContainers[aIndex].mFrame == aContainer);
mTextContainers[aIndex].mLineSize = aLineSize;
}
const TextContainerInfo&

View File

@ -430,8 +430,7 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
lineLayout->VerticalAlignLine();
LogicalSize lineSize(lineWM, isize, lineLayout->GetFinalLineBSize());
textContainer->SetLineSize(lineSize);
aReflowState.mRubyReflowState->SetTextContainerInfo(i, textContainer);
aReflowState.mRubyReflowState->SetTextContainerInfo(i, textContainer, lineSize);
lineLayout->EndLineReflow();
}

View File

@ -238,7 +238,7 @@ nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
textContainers.AppendElement(iter.GetTextContainer());
}
const uint32_t rtcCount = textContainers.Length();
RubyReflowState rubyReflowState(textContainers);
RubyReflowState rubyReflowState(lineWM, textContainers);
nsHTMLReflowMetrics baseMetrics(aReflowState);
bool pushedFrame;

View File

@ -139,5 +139,5 @@ nsRubyTextContainerFrame::Reflow(nsPresContext* aPresContext,
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
const RubyReflowState::TextContainerInfo& info =
aReflowState.mRubyReflowState->GetCurrentTextContainerInfo(this);
aDesiredSize.SetSize(lineWM, mLineSize);
aDesiredSize.SetSize(lineWM, info.mLineSize);
}

View File

@ -62,18 +62,12 @@ protected:
NS_NewRubyTextContainerFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
explicit nsRubyTextContainerFrame(nsStyleContext* aContext)
: nsRubyTextContainerFrameSuper(aContext)
, mLineSize(mozilla::WritingMode(aContext)) {}
: nsRubyTextContainerFrameSuper(aContext) {}
void UpdateSpanFlag();
// For MoveOverflowToChildList
friend class nsRubyBaseContainerFrame;
void SetLineSize(const mozilla::LogicalSize& aSize) { mLineSize = aSize; }
// The intended dimensions of the ruby text container. It is set by
// the corresponding ruby base container when the segment is reflowed,
// and used when the ruby text container is reflowed by its parent.
mozilla::LogicalSize mLineSize;
};
#endif /* nsRubyTextContainerFrame_h___ */