Bug 1177505 - Make all continuations fluid within non-bidi paragraphs. r=smontagu
authorTed Clancy <tclancy@mozilla.com>
Thu, 30 Jul 2015 13:47:08 -0700
changeset 255594 efd26ea929a0c6e70ea070fc7dcad2d3ae29a868
parent 255593 7edc58c272f1b386e0352a83bae4671e7a94aed8
child 255595 b18caf96c537efee8271b2e05bf94280c912238c
push id63096
push usercbook@mozilla.com
push dateFri, 31 Jul 2015 10:04:45 +0000
treeherdermozilla-inbound@be21dfb89dc7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmontagu
bugs1177505
milestone42.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
Bug 1177505 - Make all continuations fluid within non-bidi paragraphs. r=smontagu
layout/base/nsBidiPresUtils.cpp
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -729,47 +729,45 @@ nsBidiPresUtils::ResolveParagraph(nsBloc
          (void*)aBlockFrame, NS_ConvertUTF16toUTF8(aBpd->mBuffer).get(), frameCount, runCount);
 #ifdef REALLY_NOISY_BIDI
   printf(" block frame tree=:\n");
   aBlockFrame->List(stdout, 0);
 #endif
 #endif
 #endif
 
-  bool isNonBidi = false;
-
   nsIFrame* frame0 = frameCount > 0 ? aBpd->FrameAt(0) : nullptr;
-  nsIFrame* frame1 = frameCount > 1 ? aBpd->FrameAt(1) : nullptr;
 
   // Non-bidi frames
-  if (runCount == 1 && (frameCount == 1 || frameCount == 2) &&
+  if (runCount == 1 &&
       aBpd->mParagraphDepth == 0 && aBpd->GetDirection() == NSBIDI_LTR &&
       aBpd->GetParaLevel() == 0 &&
-      frame0 != NS_BIDI_CONTROL_FRAME &&
+      frame0 && frame0 != NS_BIDI_CONTROL_FRAME &&
       !frame0->Properties().Get(nsIFrame::EmbeddingLevelProperty()) &&
       !frame0->Properties().Get(nsIFrame::BaseLevelProperty())) {
     // We have a left-to-right frame in a left-to-right paragraph,
     // without bidi isolation from the surrounding text.
     // The embedding level and base level frame properties aren't
     // set (because if they are this frame used to have some other direction,
     // so we can't do this optimization)
-    // As long as this is the only frame, or it's followed by a linebreak,
-    // this is a non-bidi paragraph.
-    if (!frame1 || (frame1 != NS_BIDI_CONTROL_FRAME &&
-                    frame1->GetType() == nsGkAtoms::brFrame)) {
-      isNonBidi = true;
+
+    // Make all continuations fluid within this run
+    for (int i = 0; i < frameCount; ++i) {
+      nsIFrame* frame = aBpd->FrameAt(i);
+      if (frame && frame != NS_BIDI_CONTROL_FRAME) {
+        JoinInlineAncestors(frame);
+      }
     }
-  }
 
-  if (isNonBidi) {
 #ifdef DEBUG
 #ifdef NOISY_BIDI
     printf("early return for single direction frame %p\n", (void*)frame);
 #endif
 #endif
+
     return NS_OK;
   }
 
   nsIFrame* firstFrame = nullptr;
   nsIFrame* lastFrame = nullptr;
 
   // Bidi frames
   for (; ;) {