Bug 471594. In ContentInserted, when we have an insertionPoint and we take the isAppend path, use the insertionPoint's last continuation as the place to append so we don't insert the new frames in the middle of some other content's continuation chain. r+sr=bzbarsky
authorRobert O'Callahan <robert@ocallahan.org>
Fri, 16 Jan 2009 21:25:04 +1300
changeset 23861 7af1fe6b7ab40e7bace195703eb4a239f9c62c20
parent 23860 fba21452603e63336ca4bd89f1b186cce116956e
child 23862 7e0d34e958e66bc3c8ae582657080886d1a6d6d6
push id4759
push userrocallahan@mozilla.com
push dateSat, 17 Jan 2009 09:14:36 +0000
treeherdermozilla-central@7e0d34e958e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs471594
milestone1.9.2a1pre
Bug 471594. In ContentInserted, when we have an insertionPoint and we take the isAppend path, use the insertionPoint's last continuation as the place to append so we don't insert the new frames in the middle of some other content's continuation chain. r+sr=bzbarsky
layout/base/nsCSSFrameConstructor.cpp
layout/reftests/bugs/471594-1-ref.html
layout/reftests/bugs/471594-1.xhtml
layout/reftests/bugs/reftest.list
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -8711,16 +8711,18 @@ nsCSSFrameConstructor::ContentInserted(n
     parentFrame = prevSibling->GetParent()->GetContentInsertionFrame();
   }
   else if (nextSibling) {
     parentFrame = nextSibling->GetParent()->GetContentInsertionFrame();
   }
   else {
     // No previous or next sibling, so treat this like an appended frame.
     isAppend = PR_TRUE;
+    // Get continuation that parents the last child
+    parentFrame = nsLayoutUtils::GetLastContinuationWithChild(parentFrame);
     // Deal with fieldsets
     parentFrame = ::GetAdjustedParentFrame(parentFrame, parentFrame->GetType(),
                                            aContainer, aIndexInContainer);
     parentFrame =
       ::AdjustAppendParentForAfterContent(mPresShell->GetPresContext(),
                                           aContainer, parentFrame,
                                           &appendAfterFrame);
   }
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/471594-1-ref.html
@@ -0,0 +1,5 @@
+<!DOCTYPE HTML>
+<html>
+<body style="white-space:pre;">a
+bs</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/471594-1.xhtml
@@ -0,0 +1,26 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<bindings xmlns="http://www.mozilla.org/xbl">
+  <binding id="x"><content><span>a
+b<children xmlns="http://www.mozilla.org/xbl"/></span></content></binding>
+</bindings>
+<style>
+  div#d {
+    white-space: pre;
+    -moz-binding: url(#x);
+  }
+  span#s {
+    display: inline-block;
+  }
+</style>
+<script>
+function boom()
+{
+  document.getElementById("s").style.display = "inline";
+}
+</script>
+</head>
+<body onload="boom();">
+  <div id="d"><span id="s">s</span></div>
+</body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1020,9 +1020,10 @@ fails == 461512-1.html 461512-1-ref.html
 == 466258-1.html 466258-1-ref.html
 == 466395-1.html 466395-1-ref.html
 == 466395-2.html 466395-2-ref.html
 == 467084-1.html 467084-1-ref.html
 == 467084-2.html 467084-2-ref.html
 == 467460-1.html 467460-1-ref.html
 == 468473-1.xul 468473-1-ref.xul
 == 471356-1.html 471356-1-ref.html
+== 471594-1.xhtml 471594-1-ref.html
 == 472500-1.xul 472500-1-ref.xul