mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 410857 part 4 - Stop passing around aBlockFrame just for DEBUG purposes. Introduce BidiParagraphData::mCurrentBlock for that purpose and set it to the right block continuation this time. r=jfkthame
This commit is contained in:
parent
8e10f864fc
commit
ec4f6376fc
@ -140,10 +140,17 @@ struct MOZ_STACK_CLASS BidiParagraphData
|
||||
nsIContent* mPrevContent;
|
||||
nsBidi mBidiEngine;
|
||||
nsIFrame* mPrevFrame;
|
||||
#ifdef DEBUG
|
||||
// Only used for NOISY debug output.
|
||||
nsBlockFrame* mCurrentBlock;
|
||||
#endif
|
||||
|
||||
void Init(nsBlockFrame* aBlockFrame)
|
||||
{
|
||||
mPrevContent = nullptr;
|
||||
#ifdef DEBUG
|
||||
mCurrentBlock = aBlockFrame;
|
||||
#endif
|
||||
|
||||
mParaLevel = nsBidiPresUtils::BidiLevelFromStyle(aBlockFrame->StyleContext());
|
||||
|
||||
@ -345,7 +352,7 @@ struct MOZ_STACK_CLASS BidiParagraphData
|
||||
child = parent;
|
||||
parent = nsLayoutUtils::GetParentOrPlaceholderFor(child);
|
||||
}
|
||||
NS_ASSERTION (parent, "aFrame is not a descendent of aBlockFrame");
|
||||
NS_ASSERTION (parent, "aFrame is not a descendent of a block frame");
|
||||
while (!IsFrameInCurrentLine(aLineIter, aPrevFrame, child)) {
|
||||
#ifdef DEBUG
|
||||
bool hasNext =
|
||||
@ -694,14 +701,17 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame)
|
||||
}
|
||||
for (nsBlockFrame* block = aBlockFrame; block;
|
||||
block = static_cast<nsBlockFrame*>(block->GetNextContinuation())) {
|
||||
#ifdef DEBUG
|
||||
bpd.mCurrentBlock = block;
|
||||
#endif
|
||||
block->RemoveStateBits(NS_BLOCK_NEEDS_BIDI_RESOLUTION);
|
||||
nsBlockInFlowLineIterator lineIter(block, block->LinesBegin());
|
||||
nsBlockInFlowLineIterator it(block, block->LinesBegin());
|
||||
bpd.mPrevFrame = nullptr;
|
||||
TraverseFrames(aBlockFrame, &lineIter, block->PrincipalChildList().FirstChild(), &bpd);
|
||||
TraverseFrames(&it, block->PrincipalChildList().FirstChild(), &bpd);
|
||||
nsBlockFrame::FrameLines* overflowLines = block->GetOverflowLines();
|
||||
if (overflowLines) {
|
||||
nsBlockInFlowLineIterator lineIter(block, overflowLines->mLines.begin(), true);
|
||||
TraverseFrames(aBlockFrame, &lineIter, block->PrincipalChildList().FirstChild(), &bpd);
|
||||
nsBlockInFlowLineIterator it(block, overflowLines->mLines.begin(), true);
|
||||
TraverseFrames(&it, block->PrincipalChildList().FirstChild(), &bpd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -709,12 +719,11 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame)
|
||||
bpd.PopBidiControl(ch);
|
||||
}
|
||||
|
||||
return ResolveParagraph(aBlockFrame, &bpd);
|
||||
return ResolveParagraph(&bpd);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame,
|
||||
BidiParagraphData* aBpd)
|
||||
nsBidiPresUtils::ResolveParagraph(BidiParagraphData* aBpd)
|
||||
{
|
||||
if (aBpd->BufferLength() < 1) {
|
||||
return NS_OK;
|
||||
@ -748,11 +757,11 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame,
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef NOISY_BIDI
|
||||
printf("Before Resolve(), aBlockFrame=0x%p, mBuffer='%s', frameCount=%d, runCount=%d\n",
|
||||
(void*)aBlockFrame, NS_ConvertUTF16toUTF8(aBpd->mBuffer).get(), frameCount, runCount);
|
||||
printf("Before Resolve(), mCurrentBlock=%p, mBuffer='%s', frameCount=%d, runCount=%d\n",
|
||||
(void*)aBpd->mCurrentBlock, NS_ConvertUTF16toUTF8(aBpd->mBuffer).get(), frameCount, runCount);
|
||||
#ifdef REALLY_NOISY_BIDI
|
||||
printf(" block frame tree=:\n");
|
||||
aBlockFrame->List(stdout, 0);
|
||||
aBpd->mCurrentBlock->List(stdout, 0);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
@ -981,7 +990,7 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame,
|
||||
#ifdef DEBUG
|
||||
#ifdef REALLY_NOISY_BIDI
|
||||
printf("---\nAfter Resolve(), frameTree =:\n");
|
||||
aBlockFrame->List(stdout, 0);
|
||||
aBpd->mCurrentBlock->List(stdout, 0);
|
||||
printf("===\n");
|
||||
#endif
|
||||
#endif
|
||||
@ -990,8 +999,7 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame,
|
||||
}
|
||||
|
||||
void
|
||||
nsBidiPresUtils::TraverseFrames(nsBlockFrame* aBlockFrame,
|
||||
nsBlockInFlowLineIterator* aLineIter,
|
||||
nsBidiPresUtils::TraverseFrames(nsBlockInFlowLineIterator* aLineIter,
|
||||
nsIFrame* aCurrentFrame,
|
||||
BidiParagraphData* aBpd)
|
||||
{
|
||||
@ -1158,7 +1166,7 @@ nsBidiPresUtils::TraverseFrames(nsBlockFrame* aBlockFrame,
|
||||
// Mark the line before the newline as dirty.
|
||||
aBpd->GetLineForFrameAt(aBpd->FrameCount() - 1)->MarkDirty();
|
||||
}
|
||||
ResolveParagraphWithinBlock(aBlockFrame, aBpd);
|
||||
ResolveParagraphWithinBlock(aBpd);
|
||||
|
||||
if (!nextSibling && !createdContinuation) {
|
||||
break;
|
||||
@ -1183,7 +1191,7 @@ nsBidiPresUtils::TraverseFrames(nsBlockFrame* aBlockFrame,
|
||||
} else if (nsGkAtoms::brFrame == frameType) {
|
||||
// break frame -- append line separator
|
||||
aBpd->AppendUnichar(kLineSeparator);
|
||||
ResolveParagraphWithinBlock(aBlockFrame, aBpd);
|
||||
ResolveParagraphWithinBlock(aBpd);
|
||||
} else {
|
||||
// other frame type -- see the Unicode Bidi Algorithm:
|
||||
// "...inline objects (such as graphics) are treated as if they are ...
|
||||
@ -1194,7 +1202,7 @@ nsBidiPresUtils::TraverseFrames(nsBlockFrame* aBlockFrame,
|
||||
kZWSP : kObjectSubstitute);
|
||||
if (!frame->IsInlineOutside()) {
|
||||
// if it is not inline, end the paragraph
|
||||
ResolveParagraphWithinBlock(aBlockFrame, aBpd);
|
||||
ResolveParagraphWithinBlock(aBpd);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -1203,7 +1211,7 @@ nsBidiPresUtils::TraverseFrames(nsBlockFrame* aBlockFrame,
|
||||
MOZ_ASSERT(!frame->GetChildList(nsIFrame::kOverflowList).FirstChild(),
|
||||
"should have drained the overflow list above");
|
||||
if (kid) {
|
||||
TraverseFrames(aBlockFrame, aLineIter, kid, aBpd);
|
||||
TraverseFrames(aLineIter, kid, aBpd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1225,11 +1233,10 @@ nsBidiPresUtils::TraverseFrames(nsBlockFrame* aBlockFrame,
|
||||
}
|
||||
|
||||
void
|
||||
nsBidiPresUtils::ResolveParagraphWithinBlock(nsBlockFrame* aBlockFrame,
|
||||
BidiParagraphData* aBpd)
|
||||
nsBidiPresUtils::ResolveParagraphWithinBlock(BidiParagraphData* aBpd)
|
||||
{
|
||||
aBpd->ClearBidiControls();
|
||||
ResolveParagraph(aBlockFrame, aBpd);
|
||||
ResolveParagraph(aBpd);
|
||||
aBpd->ResetData();
|
||||
}
|
||||
|
||||
|
@ -154,10 +154,8 @@ public:
|
||||
* @lina 06/18/2000
|
||||
*/
|
||||
static nsresult Resolve(nsBlockFrame* aBlockFrame);
|
||||
static nsresult ResolveParagraph(nsBlockFrame* aBlockFrame,
|
||||
BidiParagraphData* aBpd);
|
||||
static void ResolveParagraphWithinBlock(nsBlockFrame* aBlockFrame,
|
||||
BidiParagraphData* aBpd);
|
||||
static nsresult ResolveParagraph(BidiParagraphData* aBpd);
|
||||
static void ResolveParagraphWithinBlock(BidiParagraphData* aBpd);
|
||||
|
||||
/**
|
||||
* Reorder this line using Bidi engine.
|
||||
@ -397,8 +395,7 @@ private:
|
||||
* than one paragraph for bidi resolution, resolve the paragraph up to that
|
||||
* point.
|
||||
*/
|
||||
static void TraverseFrames(nsBlockFrame* aBlockFrame,
|
||||
nsBlockInFlowLineIterator* aLineIter,
|
||||
static void TraverseFrames(nsBlockInFlowLineIterator* aLineIter,
|
||||
nsIFrame* aCurrentFrame,
|
||||
BidiParagraphData* aBpd);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user