Test for next-continuations before doing bidi resolution. Bug 704837, r=roc, a=asa
authorSimon Montagu <smontagu@smontagu.org>
Thu, 24 Nov 2011 16:16:42 +0200
changeset 81420 b15a4f5e9359df81bef18eaedcdcb027fd9eb262
parent 81419 10717d94e083e60596f3134c56cf2a56498bd53d
child 81421 9f949dee7853296c8f8f9eae92e1b66fa0a8fac5
push id434
push userclegnitto@mozilla.com
push dateWed, 21 Dec 2011 12:10:54 +0000
treeherdermozilla-beta@bddb6ed8dd47 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, asa
bugs704837
milestone10.0a2
Test for next-continuations before doing bidi resolution. Bug 704837, r=roc, a=asa
layout/base/nsBidiPresUtils.cpp
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -1102,21 +1102,31 @@ nsBidiPresUtils::TraverseFrames(nsBlockF
       // For a non-leaf frame, recurse into TraverseFrames
       nsIFrame* kid = frame->GetFirstPrincipalChild();
       if (kid) {
         const nsStyleTextReset* text = frame->GetStyleTextReset();
         if (text->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_ISOLATE) {
           // css "unicode-bidi: isolate" and html5 bdi: 
           //  resolve the element as a separate paragraph
           BidiParagraphData* subParagraph = aBpd->GetSubParagraph();
+
+          /*
+           * As at the beginning of the loop, it's important to check for
+           * next-continuations before handling the frame. If we do
+           * TraverseFrames and *then* do GetNextContinuation on the original
+           * first frame, it could return a bidi continuation that had only
+           * just been created, and we would skip doing bidi resolution on the
+           * last part of the sub-paragraph.
+           */
+          bool isLastContinuation = !frame->GetNextContinuation();
           if (!frame->GetPrevContinuation()) {
             subParagraph->Reset(kid, aBpd);
           }
           TraverseFrames(aBlockFrame, aLineIter, kid, subParagraph);
-          if (!frame->GetNextContinuation()) {
+          if (isLastContinuation) {
             ResolveParagraph(aBlockFrame, subParagraph);
           }
 
           // Treat the element as a neutral character within its containing
           //  paragraph.
           aBpd->AppendControlChar(kObjectSubstitute);
         } else {
           TraverseFrames(aBlockFrame, aLineIter, kid, aBpd);