Only join ancestor inline frames for frames that are last children. bug=424631, r=smontagu, sr=dbaron, blocking1.9=vladimir
authoruriber@gmail.com
Thu, 27 Mar 2008 12:27:32 -0700
changeset 13639 dd035dc0d4f7f8cd57c4fdee0a3af963f1d6d1b0
parent 13638 5a834c1fafd5f468de01ae508d05ea5cab22cbb9
child 13640 e11bcbd2de7da63274458acc863c185b5234a427
push idunknown
push userunknown
push dateunknown
reviewerssmontagu, dbaron
bugs424631
milestone1.9pre
Only join ancestor inline frames for frames that are last children. bug=424631, r=smontagu, sr=dbaron, blocking1.9=vladimir
layout/base/nsBidiPresUtils.cpp
layout/reftests/bugs/424631-1-ref.html
layout/reftests/bugs/424631-1.html
layout/reftests/bugs/reftest.list
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -170,16 +170,19 @@ JoinInlineAncestors(nsIFrame* aFrame)
       NS_ASSERTION (!frame->GetNextInFlow() || frame->GetNextInFlow() == next, 
                     "next-in-flow is not next continuation!");
       frame->SetNextInFlow(next);
 
       NS_ASSERTION (!next->GetPrevInFlow() || next->GetPrevInFlow() == frame,
                     "prev-in-flow is not prev continuation!");
       next->SetPrevInFlow(frame);
     }
+    // Join the parent only as long as we're its last child.
+    if (frame->GetNextSibling())
+      break;
     frame = frame->GetParent();
   }
 }
 
 static nsresult
 CreateBidiContinuation(nsIFrame*       aFrame,
                        nsIFrame**      aNewFrame)
 {
@@ -497,19 +500,20 @@ nsBidiPresUtils::Resolve(nsBlockFrame*  
                IsBidiSplittable(parent) &&
                !child->GetNextSibling()) {
           child = parent;
           parent = child->GetParent();
         }
         if (parent && IsBidiSplittable(parent))
           SplitInlineAncestors(child);
       }
-      else {
-        // We're not at an end of a run. If this frame's ancestors happen to have 
-        // bidi continuations, convert them into fluid continuations.
+      else if (!frame->GetNextSibling()) {
+        // We're not at an end of a run, and |frame| is the last child of its parent.
+        // If its ancestors happen to have bidi continuations, convert them into
+        // fluid continuations.
         nsIFrame* parent = frame->GetParent();
         JoinInlineAncestors(parent);
       }
     }
   } // for
   return mSuccess;
 }
 
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/424631-1-ref.html
@@ -0,0 +1,10 @@
+<html>
+<head>
+</head>
+
+<body>
+
+<div><span id="o"><span id="a">a</span><span id="b">b&#x202e;</span><span>c</span>d</span></div>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/424631-1.html
@@ -0,0 +1,10 @@
+<html>
+<head>
+</head>
+
+<body onload="document.getElementById('o').appendChild(document.createTextNode('d'));">
+
+<div><span id="o"><span id="a">a</span><span id="b">b&#x202e;</span><span>c</span></span></div>
+
+</body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -777,8 +777,9 @@ fails == 413027-3.html 413027-3-ref.html
 == 422394-1.html 422394-1-ref.html
 == 423130-1.html 423130-1-ref.html
 == 423385-1.html 423385-1-ref.html
 == 423599-1.html 423599-1-ref.html
 == 423676-1.html 423676-1-ref.html
 == 424074-1.xul 424074-1-ref.xul
 != 424074-1.xul 424074-1-ref2.xul
 fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 424074-1-ref2.xul 424074-1-ref3.xul
+== 424631-1.html 424631-1-ref.html