Bug 1424680: Fix appending in some situations to display: contents stuff. r=bz
I've verified that this asserts without the patch.
MozReview-Commit-ID: 8j6x4xswrCe
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -7558,19 +7558,20 @@ nsCSSFrameConstructor::ContentAppended(n
// contents.
nsIFrame* nextSibling = nullptr;
if (GetDisplayContentsStyleFor(insertion.mContainer) ||
nsLayoutUtils::GetAfterFrame(insertion.mContainer)) {
FlattenedChildIterator iter(insertion.mContainer);
iter.Seek(insertion.mContainer->GetLastChild());
StyleDisplay unused = UNSET_DISPLAY;
nextSibling = FindNextSibling(iter, unused);
- if (nextSibling) {
- parentFrame = nextSibling->GetParent()->GetContentInsertionFrame();
- }
+ }
+
+ if (nextSibling) {
+ parentFrame = nextSibling->GetParent()->GetContentInsertionFrame();
} else {
parentFrame =
::ContinuationToAppendTo(parentFrame);
}
nsContainerFrame* containingBlock = GetFloatContainingBlock(parentFrame);
// See if the containing block has :first-letter style applied.
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1424680-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function boom()
+{
+ var floater = document.createElement("span");
+ floater.style.cssFloat = "right";
+ floater.appendChild(document.createTextNode("float"));
+
+ document.getElementById("s").appendChild(floater);
+}
+</script>
+</head>
+
+<body onload="boom();">
+
+<span><span id="s"><div></div></span></span>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1424680.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function boom()
+{
+ var floater = document.createElement("span");
+ floater.style.cssFloat = "right";
+ floater.appendChild(document.createTextNode("float"));
+
+ document.getElementById("s").appendChild(floater);
+}
+</script>
+</head>
+
+<body onload="boom();">
+ <span><span><div style="display: contents" id="s"><div></div></div></span></span>
+</body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -2046,8 +2046,9 @@ needs-focus != 1377447-1.html 1377447-2.
== 1405878-1.xml 1405878-1-ref.xml
== 1404057.html 1404057-ref.html
!= 1404057.html 1404057-noref.html
== 1406183-1.html 1406183-1-ref.html
== 1410028.html 1410028-ref.html
test-pref(font.size.systemFontScale,200) == 1412743.html 1412743-ref.html
== 1419820-1.html 1419820-1-ref.html
== 1420946-1.html 1420946-1-ref.html
+== 1424680.html 1424680-ref.html