Check for orphaned fluid continuations after deleting content. Bug 726460, r=roc
authorSimon Montagu <smontagu@smontagu.org>
Wed, 21 Mar 2012 16:50:37 -0700
changeset 89969 31b7c18df3ca451d059cc942ab8754174b5baea6
parent 89968 23c8ba0260a354d007b1a3a13552d5952b35ac6c
child 89970 a30e6278c122eb5482a6aaa869f4cc202f7e08f5
push id7411
push usersmontagu@mozilla.com
push dateWed, 21 Mar 2012 23:52:37 +0000
treeherdermozilla-inbound@9f0ebe3d07ff [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs726460
milestone14.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 orphaned fluid continuations after deleting content. Bug 726460, r=roc
layout/base/nsBidiPresUtils.cpp
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -788,16 +788,17 @@ nsBidiPresUtils::ResolveParagraph(nsBloc
              * further non-fluid continuations to fluid continuations and advance
              * frameIndex to the last frame in the content node
              */
             PRInt32 newIndex = aBpd->GetLastFrameForContent(content);
             if (newIndex > frameIndex) {
               RemoveBidiContinuation(aBpd, frame,
                                      frameIndex, newIndex, lineOffset);
               frameIndex = newIndex;
+              lastFrame = frame = aBpd->FrameAt(frameIndex);
             }
           } else if (fragmentLength > 0 && runLength > fragmentLength) {
             /*
              * There is more text that belongs to this directional run in the next
              * text frame: make sure it is a fluid continuation of the current frame.
              * Do not advance frameIndex, because the next frame may contain
              * multi-directional text and need to be split
              */
@@ -1582,16 +1583,26 @@ nsBidiPresUtils::RemoveBidiContinuation(
           MakeContinuationFluid(prev, frame);
           frame = frame->GetParent();
         } else {
           break;
         }
       }
     }
   }
+
+  // Make sure that the last continuation we made fluid does not itself have a
+  // fluid continuation (this can happen when re-resolving after dynamic changes
+  // to content)
+  nsIFrame* lastFrame = aBpd->FrameAt(aLastIndex);
+  nsIFrame* next = lastFrame->GetNextInFlow();
+  if (next) {
+    lastFrame->SetNextContinuation(next);
+    next->SetPrevContinuation(lastFrame);
+  }
 }
 
 nsresult
 nsBidiPresUtils::FormatUnicodeText(nsPresContext*  aPresContext,
                                    PRUnichar*       aText,
                                    PRInt32&         aTextLength,
                                    nsCharType       aCharType,
                                    bool             aIsOddLevel)