Bug 1141931 patch 10 - Revert to pass container size instead of only isize for bidi reordering. r=smontagu

This commit is contained in:
Xidorn Quan 2015-04-08 11:22:34 +12:00
parent 785cacc662
commit 88f7da78ac
3 changed files with 22 additions and 20 deletions

View File

@ -1232,7 +1232,7 @@ void
nsBidiPresUtils::ReorderFrames(nsIFrame* aFirstFrameOnLine,
int32_t aNumFramesOnLine,
WritingMode aLineWM,
nscoord aContainerISize,
const nsSize& aContainerSize,
nscoord aStart)
{
// If this line consists of a line frame, reorder the line frame's children.
@ -1247,7 +1247,7 @@ nsBidiPresUtils::ReorderFrames(nsIFrame* aFirstFrameOnLine,
BidiLineData bld(aFirstFrameOnLine, aNumFramesOnLine);
RepositionInlineFrames(&bld, aFirstFrameOnLine, aLineWM,
aContainerISize, aStart);
aContainerSize, aStart);
}
nsIFrame*
@ -1419,7 +1419,7 @@ nsBidiPresUtils::RepositionRubyFrame(
nscoord icoord = 0;
WritingMode frameWM = aFrame->GetWritingMode();
bool isLTR = frameWM.IsBidiLTR();
nscoord frameISize = aFrame->ISize();
nsSize frameSize = aFrame->GetSize();
if (frameType == nsGkAtoms::rubyFrame) {
icoord += aBorderPadding.IStart(frameWM);
// Reposition ruby segments in a ruby container
@ -1430,10 +1430,10 @@ nsBidiPresUtils::RepositionRubyFrame(
nscoord segmentISize = RepositionFrame(rbc, isLTR, icoord,
aContinuationStates,
frameWM, false, frameISize);
frameWM, false, frameSize);
for (nsRubyTextContainerFrame* rtc : textContainers) {
nscoord isize = RepositionFrame(rtc, isLTR, icoord, aContinuationStates,
frameWM, false, frameISize);
frameWM, false, frameSize);
segmentISize = std::max(segmentISize, isize);
}
icoord += segmentISize;
@ -1450,10 +1450,10 @@ nsBidiPresUtils::RepositionRubyFrame(
nscoord columnISize = RepositionFrame(column.mBaseFrame, isLTR, icoord,
aContinuationStates,
frameWM, false, frameISize);
frameWM, false, frameSize);
for (nsRubyTextFrame* rt : column.mTextFrames) {
nscoord isize = RepositionFrame(rt, isLTR, icoord, aContinuationStates,
frameWM, false, frameISize);
frameWM, false, frameSize);
columnISize = std::max(columnISize, isize);
}
icoord += columnISize;
@ -1467,7 +1467,7 @@ nsBidiPresUtils::RepositionRubyFrame(
const nsFrameList& childList = aFrame->PrincipalChildList();
if (childList.NotEmpty()) {
ReorderFrames(childList.FirstChild(), childList.GetLength(),
frameWM, frameISize, aBorderPadding.IStart(frameWM));
frameWM, frameSize, aBorderPadding.IStart(frameWM));
}
}
// Note that, ruby text container is not present in all conditions
@ -1486,9 +1486,11 @@ nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame,
const nsContinuationStates* aContinuationStates,
WritingMode aContainerWM,
bool aContainerReverseDir,
nscoord aContainerISize)
const nsSize& aContainerSize)
{
NS_ASSERTION(aContainerISize != NS_UNCONSTRAINEDSIZE,
nscoord lineSize = aContainerWM.IsVertical() ?
aContainerSize.height : aContainerSize.width;
NS_ASSERTION(lineSize != NS_UNCONSTRAINEDSIZE,
"Unconstrained inline line size in bidi frame reordering");
if (!aFrame)
return 0;
@ -1538,12 +1540,14 @@ nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame,
bool reverseDir = aIsEvenLevel != frameWM.IsBidiLTR();
icoord += reverseDir ?
borderPadding.IEnd(frameWM) : borderPadding.IStart(frameWM);
LogicalSize logicalSize(frameWM, frameISize, aFrame->BSize());
nsSize frameSize = logicalSize.GetPhysicalSize(frameWM);
// Reposition the child frames
for (nsFrameList::Enumerator e(aFrame->PrincipalChildList());
!e.AtEnd(); e.Next()) {
icoord += RepositionFrame(e.get(), aIsEvenLevel, icoord,
aContinuationStates,
frameWM, reverseDir, frameISize);
frameWM, reverseDir, frameSize);
}
icoord += reverseDir ?
borderPadding.IStart(frameWM) : borderPadding.IEnd(frameWM);
@ -1574,7 +1578,7 @@ nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame,
// actually placed from right to left.
bool orderingRTL = aContainerReverseDir == aContainerWM.IsBidiLTR();
(aContainerWM.IsVertical() ? rect.y : rect.x) = orderingRTL ?
aContainerISize - (frameStartOrEnd + icoord) : frameStartOrEnd;
lineSize - (frameStartOrEnd + icoord) : frameStartOrEnd;
(aContainerWM.IsVertical() ? rect.height : rect.width) = icoord;
aFrame->SetRect(rect);
@ -1606,7 +1610,7 @@ void
nsBidiPresUtils::RepositionInlineFrames(BidiLineData *aBld,
nsIFrame* aFirstChild,
WritingMode aLineWM,
nscoord aContainerISize,
const nsSize& aContainerSize,
nscoord aStart)
{
nscoord start = aStart;
@ -1637,7 +1641,7 @@ nsBidiPresUtils::RepositionInlineFrames(BidiLineData *aBld,
start += RepositionFrame(
frame, !(IS_LEVEL_RTL(aBld->mLevels[aBld->mIndexMap[index]])),
start, &continuationStates,
aLineWM, false, aContainerISize);
aLineWM, false, aContainerSize);
}
}

View File

@ -165,7 +165,7 @@ public:
static void ReorderFrames(nsIFrame* aFirstFrameOnLine,
int32_t aNumFramesOnLine,
mozilla::WritingMode aLineWM,
nscoord aContainerISize,
const nsSize& aContainerSize,
nscoord aStart);
/**
@ -446,7 +446,7 @@ private:
const nsContinuationStates* aContinuationStates,
mozilla::WritingMode aContainerWM,
bool aContainerReverseOrder,
nscoord aContainerISize);
const nsSize& aContainerSize);
/*
* Initialize the continuation state(nsFrameContinuationState) to
@ -499,7 +499,7 @@ private:
static void RepositionInlineFrames(BidiLineData* aBld,
nsIFrame* aFirstChild,
mozilla::WritingMode aLineWM,
nscoord aContainerISize,
const nsSize& aContainerSize,
nscoord aStart);
/**

View File

@ -3173,11 +3173,9 @@ nsLineLayout::TextAlignLine(nsLineBox* aLine,
if (mPresContext->BidiEnabled() &&
(!mPresContext->IsVisualMode() || !lineWM.IsBidiLTR())) {
nscoord containerISize = lineWM.IsVertical() ?
ContainerHeight() : ContainerWidth();
nsBidiPresUtils::ReorderFrames(psd->mFirstFrame->mFrame,
aLine->GetChildCount(),
lineWM, containerISize,
lineWM, mContainerSize,
psd->mIStart + mTextIndent + dx);
if (dx) {
aLine->IndentBy(dx, ContainerWidth());