Check for fluid continuations up the parent chain and make them non-fluid. Bug 818454, r=roc
authorSimon Montagu <smontagu@smontagu.org>
Mon, 11 Feb 2013 23:45:55 -0800
changeset 121582 d48d6344a9bd5dcb6da5ccc7a12510b60fe5fdb4
parent 121581 5446bea9ddf67188a4c327ca6b799456b16ad011
child 121583 a81411f6ee6f3d29c3fc120bd391867afd13f327
child 121613 860d7a47b675b212f98ccbc2cfe6a242ec0c377c
push id22811
push usersmontagu@mozilla.com
push dateTue, 12 Feb 2013 07:46:21 +0000
treeherdermozilla-inbound@d48d6344a9bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs818454
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Check for fluid continuations up the parent chain and make them non-fluid. Bug 818454, r=roc
layout/base/nsBidiPresUtils.cpp
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -798,22 +798,36 @@ nsBidiPresUtils::ResolveParagraph(nsBloc
                      aBpd->FrameAt(newIndex) == NS_BIDI_CONTROL_FRAME);
             if (newIndex < frameCount) {
               RemoveBidiContinuation(aBpd, frame,
                                      frameIndex, newIndex, lineOffset);
             }
           } else if (runLength == fragmentLength) {
             /*
              * If the directional run ends at the end of the frame, make sure
-             * that any continuation is non-fluid
+             * that any continuation is non-fluid, and do the same up the
+             * parent chain
              */
             nsIFrame* next = frame->GetNextInFlow();
             if (next) {
-              frame->SetNextContinuation(next);
-              next->SetPrevContinuation(frame);
+              nsIFrame* parent = frame;
+              nsIFrame* nextParent = next;
+              while (parent && nextParent) {
+                if (parent == nextParent ||
+                    nextParent != parent->GetNextInFlow() ||
+                    !parent->IsFrameOfType(nsIFrame::eLineParticipant) ||
+                    !nextParent->IsFrameOfType(nsIFrame::eLineParticipant)) {
+                  break;
+                }
+                parent->SetNextContinuation(nextParent);
+                nextParent->SetPrevContinuation(parent);
+
+                parent = parent->GetParent();
+                nextParent = nextParent->GetParent();
+              }
             }
           }
           frame->AdjustOffsetsForBidi(contentOffset, contentOffset + fragmentLength);
           currentLine->MarkDirty();
         }
       } // isTextFrame
       else {
         ++lineOffset;