Bug 1141931 part 3 - Adjust some parameters of functions in nsBidiPresUtils. r=jfkthame

Includes two changes:
* aContainerSize of ReorderFrames, RepositionInlineFrames, RepositionFrame are changed to aContainerISize;
* the type of aContainuationStates in the functions above is changed to const pointer.

--HG--
extra : source : 41336b712d88a843b15015321cae9f878aa08427
This commit is contained in:
Xidorn Quan 2015-04-08 08:40:31 +12:00
Родитель 3d1eed1f20
Коммит 8a3d0926c5
3 изменённых файлов: 42 добавлений и 41 удалений

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

@ -1226,7 +1226,7 @@ void
nsBidiPresUtils::ReorderFrames(nsIFrame* aFirstFrameOnLine, nsBidiPresUtils::ReorderFrames(nsIFrame* aFirstFrameOnLine,
int32_t aNumFramesOnLine, int32_t aNumFramesOnLine,
WritingMode aLineWM, WritingMode aLineWM,
const nsSize& aContainerSize, nscoord aContainerISize,
nscoord aStart) nscoord aStart)
{ {
// If this line consists of a line frame, reorder the line frame's children. // If this line consists of a line frame, reorder the line frame's children.
@ -1241,7 +1241,7 @@ nsBidiPresUtils::ReorderFrames(nsIFrame* aFirstFrameOnLine,
BidiLineData bld(aFirstFrameOnLine, aNumFramesOnLine); BidiLineData bld(aFirstFrameOnLine, aNumFramesOnLine);
RepositionInlineFrames(&bld, aFirstFrameOnLine, aLineWM, RepositionInlineFrames(&bld, aFirstFrameOnLine, aLineWM,
aContainerSize, aStart); aContainerISize, aStart);
} }
nsIFrame* nsIFrame*
@ -1282,7 +1282,7 @@ nsBidiPresUtils::GetFrameBaseLevel(nsIFrame* aFrame)
void void
nsBidiPresUtils::IsFirstOrLast(nsIFrame* aFrame, nsBidiPresUtils::IsFirstOrLast(nsIFrame* aFrame,
nsContinuationStates* aContinuationStates, const nsContinuationStates* aContinuationStates,
bool aSpanDirMatchesLineDir, bool aSpanDirMatchesLineDir,
bool& aIsFirst /* out */, bool& aIsFirst /* out */,
bool& aIsLast /* out */) bool& aIsLast /* out */)
@ -1400,9 +1400,9 @@ void
nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame, nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame,
bool aIsEvenLevel, bool aIsEvenLevel,
nscoord& aStart, nscoord& aStart,
nsContinuationStates* aContinuationStates, const nsContinuationStates* aContinuationStates,
WritingMode aContainerWM, WritingMode aContainerWM,
const nsSize& aContainerSize) nscoord aContainerISize)
{ {
if (!aFrame) if (!aFrame)
return; return;
@ -1467,7 +1467,7 @@ nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame,
iCoord, iCoord,
aContinuationStates, aContinuationStates,
frameWM, frameWM,
aFrame->GetSize()); aFrame->ISize());
index++; index++;
frame = reverseOrder ? frame = reverseOrder ?
childList[childList.Length() - index - 1] : childList[childList.Length() - index - 1] :
@ -1483,12 +1483,11 @@ nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame,
// in vertical writing modes with right-to-left direction (Bug 1131451). // in vertical writing modes with right-to-left direction (Bug 1131451).
// This does the correct calculation ad hoc pending the fix for that. // This does the correct calculation ad hoc pending the fix for that.
nsRect rect = aFrame->GetRect(); nsRect rect = aFrame->GetRect();
nscoord lineSize = aContainerWM.IsVertical() NS_ASSERTION(aContainerWM.IsBidiLTR() || aContainerISize != NS_UNCONSTRAINEDSIZE,
? aContainerSize.height : aContainerSize.width;
NS_ASSERTION(aContainerWM.IsBidiLTR() || lineSize != NS_UNCONSTRAINEDSIZE,
"Unconstrained inline line size in bidi frame reordering"); "Unconstrained inline line size in bidi frame reordering");
nscoord frameIStart = aContainerWM.IsBidiLTR() ? start : lineSize - aStart; nscoord frameIStart =
aContainerWM.IsBidiLTR() ? start : aContainerISize - aStart;
nscoord frameISize = aStart - start; nscoord frameISize = aStart - start;
(aContainerWM.IsVertical() ? rect.y : rect.x) = frameIStart; (aContainerWM.IsVertical() ? rect.y : rect.x) = frameIStart;
@ -1523,7 +1522,7 @@ void
nsBidiPresUtils::RepositionInlineFrames(BidiLineData *aBld, nsBidiPresUtils::RepositionInlineFrames(BidiLineData *aBld,
nsIFrame* aFirstChild, nsIFrame* aFirstChild,
WritingMode aLineWM, WritingMode aLineWM,
const nsSize& aContainerSize, nscoord aContainerISize,
nscoord aStart) nscoord aStart)
{ {
nscoord start = aStart; nscoord start = aStart;
@ -1556,7 +1555,7 @@ nsBidiPresUtils::RepositionInlineFrames(BidiLineData *aBld,
start, start,
&continuationStates, &continuationStates,
aLineWM, aLineWM,
aContainerSize); aContainerISize);
} }
} }

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

@ -162,7 +162,7 @@ public:
static void ReorderFrames(nsIFrame* aFirstFrameOnLine, static void ReorderFrames(nsIFrame* aFirstFrameOnLine,
int32_t aNumFramesOnLine, int32_t aNumFramesOnLine,
mozilla::WritingMode aLineWM, mozilla::WritingMode aLineWM,
const nsSize& aContainerSize, nscoord aContainerISize,
nscoord aStart); nscoord aStart);
/** /**
@ -429,9 +429,9 @@ private:
static void RepositionFrame(nsIFrame* aFrame, static void RepositionFrame(nsIFrame* aFrame,
bool aIsEvenLevel, bool aIsEvenLevel,
nscoord& aStart, nscoord& aStart,
nsContinuationStates* aContinuationStates, const nsContinuationStates* aContinuationStates,
mozilla::WritingMode aContainerWM, mozilla::WritingMode aContainerWM,
const nsSize& aContainerSize); nscoord aContainerISize);
/* /*
* Initialize the continuation state(nsFrameContinuationState) to * Initialize the continuation state(nsFrameContinuationState) to
@ -469,7 +469,7 @@ private:
* or continuation * or continuation
*/ */
static void IsFirstOrLast(nsIFrame* aFrame, static void IsFirstOrLast(nsIFrame* aFrame,
nsContinuationStates* aContinuationStates, const nsContinuationStates* aContinuationStates,
bool aSpanInLineOrder /* in */, bool aSpanInLineOrder /* in */,
bool& aIsFirst /* out */, bool& aIsFirst /* out */,
bool& aIsLast /* out */); bool& aIsLast /* out */);
@ -484,7 +484,7 @@ private:
static void RepositionInlineFrames(BidiLineData* aBld, static void RepositionInlineFrames(BidiLineData* aBld,
nsIFrame* aFirstChild, nsIFrame* aFirstChild,
mozilla::WritingMode aLineWM, mozilla::WritingMode aLineWM,
const nsSize& aContainerSize, nscoord aContainerISize,
nscoord aStart); nscoord aStart);
/** /**

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

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