Ensure that continuation frames after the end of a directional run are non-fluid. Bug 490559, r+sr=roc
authorSimon Montagu <smontagu@smontagu.org>
Wed, 07 Oct 2009 21:53:50 -0700
changeset 33658 fa7cae321effc26689be888273059c07078eaa5b
parent 33657 1a9b6d37e99ab96ffa51522460e9779e665a8c98
child 33659 d8c914dbd3f83ab600415d8d65b8480c8084ca8b
push id9609
push usersmontagu@mozilla.com
push dateThu, 08 Oct 2009 05:00:45 +0000
treeherdermozilla-central@fa7cae321eff [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs490559
milestone1.9.3a1pre
Ensure that continuation frames after the end of a directional run are non-fluid. Bug 490559, r+sr=roc
layout/base/crashtests/490559-1.html
layout/base/crashtests/crashtests.list
layout/base/nsBidiPresUtils.cpp
new file mode 100644
--- /dev/null
+++ b/layout/base/crashtests/490559-1.html
@@ -0,0 +1,16 @@
+<html>
+ <head>
+  <script type="text/javascript">
+function ddoe() {
+  var x=document.getElementById('a');
+  x.parentNode.removeChild(x);
+}
+  </script>
+ </head>
+ <body onload="ddoe()">
+  <div style="width: 1px;">
+   <span id="a">&#68997;</span>
+&#68997;
+  </div>
+ </body>
+</html>
--- a/layout/base/crashtests/crashtests.list
+++ b/layout/base/crashtests/crashtests.list
@@ -241,16 +241,17 @@ load 468645-3.xhtml
 load 471594-1.xhtml
 load 479114-1.html
 load 477333-1.xhtml
 load 481806-1.html
 load 483604-1.xhtml
 load 488390-1.xhtml
 load 489691.html
 load 490376-1.xhtml
+load 490559-1.html
 load 490747.html
 load 492014.xhtml
 load 492112-1.xhtml
 load 492163-1.xhtml
 load 495350-1.html
 load 497519-1.xhtml
 load 497519-2.xhtml
 load 500467-1.html
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -509,16 +509,26 @@ nsBidiPresUtils::Resolve(nsBlockFrame*  
              * 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
              */
             PRInt32 newIndex = frameIndex;
             do {
             } while (mLogicalFrames[++newIndex]->GetType() == nsGkAtoms::directionalFrame);
             RemoveBidiContinuation(frame, frameIndex, newIndex, lineOffset);
+          } else if (runLength == fragmentLength) {
+            /*
+             * The directional run ends at the end of the frame. Make sure that
+             * the next frame is a non-fluid continuation
+             */
+            nsIFrame* next = frame->GetNextInFlow();
+            if (next) {
+              frame->SetNextContinuation(next);
+              next->SetPrevContinuation(frame);
+            }
           }
           frame->AdjustOffsetsForBidi(contentOffset, contentOffset + fragmentLength);
           if (lineNeedsUpdate) {
             AdvanceLineIteratorToFrame(frame, &lineIter, prevFrame);
             lineNeedsUpdate = PR_FALSE;
           }
           lineIter.GetLine()->MarkDirty();
         }