Bug 1405443 - Don't delete next-in-flows when the state IsInlineBreakBefore. r=dholbert
authorMats Palmgren <mats@mozilla.com>
Fri, 06 Oct 2017 20:59:09 +0200
changeset 384781 fd25b77ff072fccbca48da9699286e663dc9635c
parent 384780 22e994d6668443350e3a743c31a50f62da91ebd3
child 384782 881688d7d7fc04c547840cf75a60235f56ba722e
push id95872
push usermpalmgren@mozilla.com
push dateFri, 06 Oct 2017 18:59:23 +0000
treeherdermozilla-inbound@fd25b77ff072 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1405443
milestone58.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 1405443 - Don't delete next-in-flows when the state IsInlineBreakBefore. r=dholbert MozReview-Commit-ID: vCqhHFsXUO
layout/generic/crashtests/crashtests.list
layout/generic/nsBlockReflowContext.cpp
layout/generic/nsInlineFrame.cpp
layout/reftests/css-break/1405443-ref.html
layout/reftests/css-break/1405443.html
layout/reftests/css-break/reftest.list
--- a/layout/generic/crashtests/crashtests.list
+++ b/layout/generic/crashtests/crashtests.list
@@ -656,9 +656,9 @@ load 1349650.html
 asserts-if(browserIsRemote,0-5) load 1349816-1.html # bug 1350352
 load 1364361-1.html
 load 1367413-1.html
 load 1368617-1.html
 load 1373586.html
 load 1401420-1.html
 load 1401709.html
 load 1401807.html
-asserts(11) load 1405443.html # bug 1405443
+load 1405443.html
--- a/layout/generic/nsBlockReflowContext.cpp
+++ b/layout/generic/nsBlockReflowContext.cpp
@@ -325,33 +325,30 @@ nsBlockReflowContext::ReflowBlock(const 
     }
   }
 #endif
 
   if (!mFrame->HasOverflowAreas()) {
     mMetrics.SetOverflowAreasToDesiredBounds();
   }
 
-  if (!aFrameReflowStatus.IsInlineBreakBefore() ||
-      (mFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
+  if (!aFrameReflowStatus.IsInlineBreakBefore() &&
+      aFrameReflowStatus.IsFullyComplete()) {
     // If frame is complete and has a next-in-flow, we need to delete
     // them now. Do not do this when a break-before is signaled because
-    // the frame is going to get reflowed again (and may end up wanting
-    // a next-in-flow where it ends up), unless it is an out of flow frame.
-    if (aFrameReflowStatus.IsFullyComplete()) {
-      nsIFrame* kidNextInFlow = mFrame->GetNextInFlow();
-      if (nullptr != kidNextInFlow) {
-        // Remove all of the childs next-in-flows. Make sure that we ask
-        // the right parent to do the removal (it's possible that the
-        // parent is not this because we are executing pullup code).
-        // Floats will eventually be removed via nsBlockFrame::RemoveFloat
-        // which detaches the placeholder from the float.
-        nsOverflowContinuationTracker::AutoFinish fini(aState.mOverflowTracker, mFrame);
-        kidNextInFlow->GetParent()->DeleteNextInFlowChild(kidNextInFlow, true);
-      }
+    // the frame is going to get reflowed again (whether the frame is
+    // (in)complete is undefined in that case anyway).
+    if (nsIFrame* kidNextInFlow = mFrame->GetNextInFlow()) {
+      // Remove all of the childs next-in-flows. Make sure that we ask
+      // the right parent to do the removal (it's possible that the
+      // parent is not this because we are executing pullup code).
+      // Floats will eventually be removed via nsBlockFrame::RemoveFloat
+      // which detaches the placeholder from the float.
+      nsOverflowContinuationTracker::AutoFinish fini(aState.mOverflowTracker, mFrame);
+      kidNextInFlow->GetParent()->DeleteNextInFlowChild(kidNextInFlow, true);
     }
   }
 }
 
 /**
  * Attempt to place the block frame within the available space.  If
  * it fits, apply inline-dir ("horizontal") positioning (CSS 10.3.3),
  * collapse margins (CSS2 8.3.1). Also apply relative positioning.
--- a/layout/generic/nsInlineFrame.cpp
+++ b/layout/generic/nsInlineFrame.cpp
@@ -1010,23 +1010,16 @@ nsInlineFrame::UpdateStyleOfOwnedAnonBox
     // We don't want to just walk through using GetNextContinuationWithSameStyle
     // here, because we want to set updated style contexts on both our
     // ib-sibling blocks and inlines.
     for (nsIFrame* cont = blockFrame; cont; cont = cont->GetNextContinuation()) {
       cont->SetStyleContext(newContext);
     }
 
     nsIFrame* nextInline = blockFrame->GetProperty(nsIFrame::IBSplitSibling());
-
-    // This check is here due to bug 1405443.  Please remove it once
-    // that bug is fixed.
-    if (!nextInline) {
-      break;
-    }
-
     MOZ_ASSERT(nextInline, "There is always a trailing inline in an IB split");
 
     for (nsIFrame* cont = nextInline; cont; cont = cont->GetNextContinuation()) {
       cont->SetStyleContext(ourStyle);
     }
     blockFrame = nextInline->GetProperty(nsIFrame::IBSplitSibling());
   }
 }
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-break/1405443-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<style>
+  #block { page-break-inside: avoid; }
+  span { padding-left: 1px; }
+  #columns { columns: 0px; column-gap: 0; )
+</style>
+<body>
+  There word 'Hello' should appear below.
+  <div id="columns">
+    H
+    <div id="block">
+      <span> <!-- Just need an inline with nonzero width -->
+        <div style="padding-left: 1ch">&nbsp;ello</div>
+      </span>
+    </div>
+  </div>
+</body>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-break/1405443.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<style>
+  #float { page-break-inside: avoid; float: left }
+  span { padding-left: 1px; }
+  #columns { columns: 0px; column-gap: 0; )
+</style>
+<body>
+  There word 'Hello' should appear below.
+  <div id="columns">
+    H
+    <div id="float">
+      <span> <!-- Just need an inline with nonzero width -->
+        <div style="padding-left: 1ch">&nbsp;ello</div>
+      </span>
+    </div>
+  </div>
+</body>
--- a/layout/reftests/css-break/reftest.list
+++ b/layout/reftests/css-break/reftest.list
@@ -6,8 +6,9 @@ fuzzy(45,460) fuzzy-if(skiaContent,57,43
 random-if(!gtkWidget) HTTP(..) == box-decoration-break-border-image.html box-decoration-break-border-image-ref.html
 == box-decoration-break-block-border-padding.html box-decoration-break-block-border-padding-ref.html
 == box-decoration-break-block-margin.html box-decoration-break-block-margin-ref.html
 fuzzy-if(!Android,1,62) fuzzy-if(Android,8,6627) == box-decoration-break-first-letter.html box-decoration-break-first-letter-ref.html #Bug 1313773
 == box-decoration-break-with-bidi.html box-decoration-break-with-bidi-ref.html
 == box-decoration-break-bug-1235152.html box-decoration-break-bug-1235152-ref.html
 == box-decoration-break-bug-1249913.html box-decoration-break-bug-1249913-ref.html
 == vertical-wm-001.html vertical-wm-001-ref.html
+random-if(Android) == 1405443.html 1405443-ref.html