Follow up the parent chain when making continuations non-fluid at the end of a directional run. Bug 989994, r=roc

This commit is contained in:
Simon Montagu 2014-04-25 00:01:24 -07:00
parent fc4e4ef699
commit dd8aa347c7

View File

@ -485,6 +485,23 @@ MakeContinuationFluid(nsIFrame* aFrame, nsIFrame* aNext)
aNext->SetPrevInFlow(aFrame);
}
static void
MakeContinuationsNonFluidUpParentChain(nsIFrame* aFrame, nsIFrame* aNext)
{
nsIFrame* frame;
nsIFrame* next;
for (frame = aFrame, next = aNext;
frame && next &&
next != frame && next == frame->GetNextInFlow() &&
IsBidiSplittable(frame);
frame = frame->GetParent(), next = next->GetParent()) {
frame->SetNextContinuation(next);
next->SetPrevContinuation(frame);
}
}
// If aFrame is the last child of its parent, convert bidi continuations to
// fluid continuations for all of its inline ancestors.
// If it isn't the last child, make sure that its continuation is fluid.
@ -841,20 +858,7 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame,
nsIFrame* next = frame->GetNextInFlow();
if (next) {
currentLine->MarkDirty();
nsIFrame* parent = frame;
nsIFrame* nextParent = next;
while (parent && nextParent) {
if (parent == nextParent ||
nextParent != parent->GetNextInFlow() ||
!IsBidiSplittable(parent)) {
break;
}
parent->SetNextContinuation(nextParent);
nextParent->SetPrevContinuation(parent);
parent = parent->GetParent();
nextParent = nextParent->GetParent();
}
MakeContinuationsNonFluidUpParentChain(frame, next);
}
}
frame->AdjustOffsetsForBidi(contentOffset, contentOffset + fragmentLength);
@ -1660,11 +1664,7 @@ nsBidiPresUtils::RemoveBidiContinuation(BidiParagraphData *aBpd,
// fluid continuation (this can happen when re-resolving after dynamic changes
// to content)
nsIFrame* lastFrame = aBpd->FrameAt(aLastIndex);
nsIFrame* next = lastFrame->GetNextInFlow();
if (next && IsBidiSplittable(lastFrame)) {
lastFrame->SetNextContinuation(next);
next->SetPrevContinuation(lastFrame);
}
MakeContinuationsNonFluidUpParentChain(lastFrame, lastFrame->GetNextInFlow());
}
nsresult