Ensure that continuation frames after the end of a directional run are non-fluid. Bug 490559, r+sr=roc, a1.9.1.5=dveditz
authorSimon Montagu <smontagu@smontagu.org>
Sun, 25 Oct 2009 00:43:31 -0700
changeset 26495 07ff9d432dacf14819572fc8b4469086b5a895a5
parent 26494 0be7c0bfe443fcb9e29a5a43d7585472f94f87a9
child 26497 5cf93cb87229ca7c96254f156e655c9f2a4b9ed8
push id2062
push usersmontagu@mozilla.com
push dateSun, 25 Oct 2009 07:52:39 +0000
bugs490559
milestone1.9.1.5pre
Ensure that continuation frames after the end of a directional run are non-fluid. Bug 490559, r+sr=roc, a1.9.1.5=dveditz
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
@@ -220,10 +220,11 @@ load 468491-1.html
 # browser does when setting up print preview, but adding them anyway.
 load 468645-1.xhtml
 load 468645-2.xhtml
 load 468645-3.xhtml
 skip load 477333-1.xhtml
 load 488390-1.xhtml
 load 489691.html
 load 490376-1.xhtml
+load 490559-1.html
 load 490747.html
 load 492014.xhtml
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -504,16 +504,26 @@ nsBidiPresUtils::Resolve(nsBlockFrame*  
              * multi-directional text and need to be split
              */
             PRInt32 newIndex = frameIndex;
             nsIFrame* f;
             do {
               f = (nsIFrame*) (mLogicalFrames[++newIndex]);
             } while (f->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();
         }