зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1132008
part 1 - Calculate bsize of rtc according to its children. r=dbaron
--HG-- extra : source : e07fd183c24ea7133faa62bc5837e6d30589f05e
This commit is contained in:
Родитель
e1df1707b5
Коммит
c914c4063c
|
@ -464,8 +464,7 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
lineLayout->VerticalAlignLine();
|
||||
LogicalSize lineSize(lineWM, rtcISize, lineLayout->GetFinalLineBSize());
|
||||
textContainer->SetLineSize(lineSize);
|
||||
textContainer->SetISize(rtcISize);
|
||||
lineLayout->EndLineReflow();
|
||||
}
|
||||
|
||||
|
|
|
@ -130,17 +130,43 @@ nsRubyTextContainerFrame::Reflow(nsPresContext* aPresContext,
|
|||
// will take care of our continuations.
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
|
||||
aDesiredSize.SetSize(lineWM, mLineSize);
|
||||
|
||||
if (lineWM.IsVerticalRL()) {
|
||||
nscoord deltaWidth = -mLineSize.Width(lineWM);
|
||||
LogicalPoint translation(lineWM, 0, deltaWidth);
|
||||
nscoord minBCoord = nscoord_MAX;
|
||||
nscoord maxBCoord = nscoord_MIN;
|
||||
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
|
||||
nsIFrame* child = e.get();
|
||||
MOZ_ASSERT(child->GetType() == nsGkAtoms::rubyTextFrame);
|
||||
// The container width is still unknown yet.
|
||||
LogicalRect rect = child->GetLogicalRect(lineWM, 0);
|
||||
LogicalMargin margin = child->GetLogicalUsedMargin(lineWM);
|
||||
nscoord blockStart = rect.BStart(lineWM) - margin.BStart(lineWM);
|
||||
minBCoord = std::min(minBCoord, blockStart);
|
||||
nscoord blockEnd = rect.BEnd(lineWM) + margin.BEnd(lineWM);
|
||||
maxBCoord = std::max(maxBCoord, blockEnd);
|
||||
}
|
||||
|
||||
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
|
||||
nsIFrame* child = e.get();
|
||||
MOZ_ASSERT(child->GetType() == nsGkAtoms::rubyTextFrame);
|
||||
child->MovePositionBy(lineWM, translation);
|
||||
nsContainerFrame::PlaceFrameView(child);
|
||||
MOZ_ASSERT(minBCoord <= maxBCoord || mFrames.IsEmpty());
|
||||
LogicalSize size(lineWM, mISize, 0);
|
||||
if (!mFrames.IsEmpty()) {
|
||||
size.BSize(lineWM) = maxBCoord - minBCoord;
|
||||
nscoord deltaBCoord = -minBCoord;
|
||||
if (lineWM.IsVerticalRL()) {
|
||||
deltaBCoord -= size.BSize(lineWM);
|
||||
}
|
||||
|
||||
if (deltaBCoord != 0) {
|
||||
nscoord containerWidth = size.Width(lineWM);
|
||||
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
|
||||
nsIFrame* child = e.get();
|
||||
LogicalPoint pos = child->GetLogicalPosition(lineWM, containerWidth);
|
||||
pos.B(lineWM) += deltaBCoord;
|
||||
// Relative positioning hasn't happened yet.
|
||||
// So MovePositionBy should be used here.
|
||||
child->SetPosition(lineWM, pos, containerWidth);
|
||||
nsContainerFrame::PlaceFrameView(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aDesiredSize.SetSize(lineWM, size);
|
||||
}
|
||||
|
|
|
@ -63,17 +63,17 @@ protected:
|
|||
nsStyleContext* aContext);
|
||||
explicit nsRubyTextContainerFrame(nsStyleContext* aContext)
|
||||
: nsRubyTextContainerFrameSuper(aContext)
|
||||
, mLineSize(mozilla::WritingMode(aContext)) {}
|
||||
, mISize(0) {}
|
||||
|
||||
void UpdateSpanFlag();
|
||||
|
||||
friend class nsRubyBaseContainerFrame;
|
||||
void SetLineSize(const mozilla::LogicalSize& aSize) { mLineSize = aSize; }
|
||||
void SetISize(nscoord aISize) { mISize = aISize; }
|
||||
|
||||
// The intended dimensions of the ruby text container. It is set by
|
||||
// The intended inline size 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;
|
||||
nscoord mISize;
|
||||
};
|
||||
|
||||
#endif /* nsRubyTextContainerFrame_h___ */
|
||||
|
|
Загрузка…
Ссылка в новой задаче