Call AdjustOffsetsForBidi on a new continuation frame immediately after creating it. Bug 536963, r=roc
authorSimon Montagu <smontagu@smontagu.org>
Sun, 03 Jan 2010 00:46:19 -0800
changeset 36825 cf7c0f378068eb022775bc03a8601ba82dea7f84
parent 36824 a0044e7e0228bff83e58355823ca2beadb30ddeb
child 36826 1b0db40fe73ba603e0d10a90cea69e8579269d91
push id11000
push usersmontagu@mozilla.com
push dateSun, 03 Jan 2010 08:53:48 +0000
treeherdermozilla-central@26672e99e008 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs536963
milestone1.9.3a1pre
Call AdjustOffsetsForBidi on a new continuation frame immediately after creating it. Bug 536963, r=roc
layout/base/nsBidiPresUtils.cpp
layout/reftests/bidi/536963-1-ref.html
layout/reftests/bidi/536963-1.html
layout/reftests/bidi/reftest.list
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -508,24 +508,27 @@ nsBidiPresUtils::Resolve(nsBlockFrame*  
            * Create a non-fluid continuation frame for the next directional run.
            */
           if (lineNeedsUpdate) {
             AdvanceLineIteratorToFrame(frame, &lineIter, prevFrame);
             lineNeedsUpdate = PR_FALSE;
           }
           lineIter.GetLine()->MarkDirty();
           nsIFrame* nextBidi;
+          PRInt32 runEnd = contentOffset + runLength;
           EnsureBidiContinuation(frame, &nextBidi, frameIndex,
                                  contentOffset,
-                                 contentOffset + runLength);
+                                 runEnd);
           if (NS_FAILED(mSuccess)) {
             break;
           }
+          nextBidi->AdjustOffsetsForBidi(runEnd,
+                                         contentOffset + fragmentLength);
           frame = nextBidi;
-          contentOffset += runLength;
+          contentOffset = runEnd;
         } // if (runLength < fragmentLength)
         else {
           if (contentOffset + fragmentLength == contentTextLength) {
             /* 
              * We have finished all the text in this content node. Convert any
              * further non-fluid continuations to fluid continuations and advance
              * frameIndex to the last frame in the content node
              */
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bidi/536963-1-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+  <title>Dynamic bidi bug</title>
+  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+  <style type="text/css">
+  p { width: 3ch;}
+  </style>
+ </head>
+ <body>
+  <p dir="rtl">0 123 4</p>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bidi/536963-1.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+  <title>Dynamic bidi bug</title>
+  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+  <style type="text/css">
+  p { width: 3ch;}
+  </style>
+  <script type="text/javascript">
+function flip()
+{
+    var flipped= document.getElementById('flipped');
+    flipped.dir = "rtl";
+}
+  </script>
+ </head>
+ <body onload="flip()">
+  <p id="flipped">0 123 4</p>
+ </body>
+</html>
--- a/layout/reftests/bidi/reftest.list
+++ b/layout/reftests/bidi/reftest.list
@@ -39,8 +39,9 @@ random-if(MOZ_WIDGET_TOOLKIT=="gtk2") ==
 == 425338-1b.html 425338-1-ref.html
 == 489517-1.html 489517-1-ref.html
 == 489887-1.html 489887-1-ref.html
 == 492231-1.html 492231-1-ref.html
 == 496006-1.html 496006-1-ref.html
 == 503269-1.html 503269-1-ref.html
 == 503957-1.html 503957-1-ref.html
 == 525740-1.html 525740-1-ref.html
+== 536963-1.html 536963-1-ref.html