Bug 1574101 - Use the right parent frame for `block ruby` if it's out of flow. r=mats
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 15 Aug 2019 22:21:35 +0000
changeset 488367 9798b876061ebbc28eb23ab5d456c094855a4ce9
parent 488366 3851e6be2a2d6c90448fb7969a1d50460b686ee5
child 488368 759f7dabeddf8e4d78fbc6c8fb29eaab9b88f4b9
push id36440
push userncsoregi@mozilla.com
push dateFri, 16 Aug 2019 03:57:48 +0000
treeherdermozilla-central@a58b7dc85887 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1574101
milestone70.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 1574101 - Use the right parent frame for `block ruby` if it's out of flow. r=mats I should've caught this when reviewing, in fairness. Differential Revision: https://phabricator.services.mozilla.com/D42163
layout/base/crashtests/1574101-1.html
layout/base/crashtests/1574101-2.html
layout/base/crashtests/crashtests.list
layout/base/nsCSSFrameConstructor.cpp
new file mode 100644
--- /dev/null
+++ b/layout/base/crashtests/1574101-1.html
@@ -0,0 +1,16 @@
+<script>
+function start() {
+    document.documentElement.style.transform='scale(0.00001)';
+	o219=document.createElement('hr');
+	o219.style.display='ruby';
+	o637=document.createElement('summary');
+	o637.appendChild(o219);
+	o663=document.createElement('details');
+	o663.appendChild(o637);
+	document.documentElement.appendChild(o663);
+	o219.style.position='absolute';
+	o866=document.documentElement.getBoxQuads();
+	o663.style.position='fixed';
+}
+</script>
+<body onload="start()"></body>
new file mode 100644
--- /dev/null
+++ b/layout/base/crashtests/1574101-2.html
@@ -0,0 +1,10 @@
+<script>
+function go() {
+  a.replaceChild(b, b)
+}
+</script>
+<body onload=go()>
+<p id="a">
+<menuitem id="b">
+<ruby style="position: absolute">
+a
--- a/layout/base/crashtests/crashtests.list
+++ b/layout/base/crashtests/crashtests.list
@@ -571,8 +571,10 @@ load 1539303.html
 pref(layout.css.column-span.enabled,true) load 1541679.html
 load 1547261.html
 pref(layout.css.column-span.enabled,true) load 1547391.html
 pref(layout.css.resizeobserver.enabled,true) load 1548057.html
 pref(layout.css.column-span.enabled,true) load 1549867.html
 load 1553874.html
 load 1560328.html
 asserts(1-1) pref(layout.css.column-span.enabled,true) load 1566672.html # bug 1573759
+load 1574101-1.html
+load 1574101-2.html
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -3170,26 +3170,26 @@ nsIFrame* nsCSSFrameConstructor::Constru
     nsFrameConstructorState& aState, FrameConstructionItem& aItem,
     nsContainerFrame* aParentFrame, const nsStyleDisplay* aStyleDisplay,
     nsFrameList& aFrameList) {
   nsIContent* const content = aItem.mContent;
   ComputedStyle* const computedStyle = aItem.mComputedStyle;
 
   nsBlockFrame* blockFrame = NS_NewBlockFrame(mPresShell, computedStyle);
   nsContainerFrame* newFrame = blockFrame;
+  nsContainerFrame* geometricParent =
+      aState.GetGeometricParent(*aStyleDisplay, aParentFrame);
   if ((aItem.mFCData->mBits & FCDATA_MAY_NEED_SCROLLFRAME) &&
       aStyleDisplay->IsScrollableOverflow()) {
-    nsContainerFrame* geometricParent =
-        aState.GetGeometricParent(*aStyleDisplay, aParentFrame);
     nsContainerFrame* scrollframe = nullptr;
     BuildScrollFrame(aState, content, computedStyle, blockFrame,
                      geometricParent, scrollframe);
     newFrame = scrollframe;
   } else {
-    InitAndRestoreFrame(aState, content, aParentFrame, blockFrame);
+    InitAndRestoreFrame(aState, content, geometricParent, blockFrame);
   }
 
   RefPtr<ComputedStyle> rubyStyle =
       mPresShell->StyleSet()->ResolveInheritingAnonymousBoxStyle(
           PseudoStyleType::blockRubyContent, computedStyle);
   nsContainerFrame* rubyFrame = NS_NewRubyFrame(mPresShell, rubyStyle);
   InitAndRestoreFrame(aState, content, blockFrame, rubyFrame);
   SetInitialSingleChild(blockFrame, rubyFrame);