Bug 1177505 - Make all continuations fluid within non-bidi paragraphs. r=smontagu, a=ritu
authorTed Clancy <tclancy@mozilla.com>
Thu, 30 Jul 2015 13:47:08 -0700
changeset 282057 c325c1a91cd6d216282a0668b8ff6e19448a8559
parent 282056 45ad2e46fb41efe8f21f4f5276e79a39dcb0a662
child 282058 efc43d513eee78e1e74a7643cfec362bf56c2119
push id4997
push userryanvm@gmail.com
push dateThu, 27 Aug 2015 01:22:46 +0000
treeherdermozilla-beta@5faa1eae6f68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmontagu, ritu
bugs1177505
milestone41.0
Bug 1177505 - Make all continuations fluid within non-bidi paragraphs. r=smontagu, a=ritu
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 (; ;) {