Bug 1552789 - Check NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO flag for every line r=mattwoodrow
authorMiko Mynttinen <mikokm@gmail.com>
Mon, 20 May 2019 22:54:18 +0000
changeset 474710 979750dd65da33eebd25999f286b98914639a735
parent 474709 07ce2dd7db9d0ff8f68e5ab8d913aa75fe463399
child 474711 28504d015b50e07394582a0b7a166e9a98d5e6a5
push id36044
push userrmaries@mozilla.com
push dateTue, 21 May 2019 15:45:34 +0000
treeherdermozilla-central@78571bb1f20e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1552789
milestone69.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 1552789 - Check NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO flag for every line r=mattwoodrow Differential Revision: https://phabricator.services.mozilla.com/D31865
layout/generic/nsBlockFrame.cpp
layout/reftests/bugs/1552789-1.html
layout/reftests/bugs/1552789-ref-1.html
layout/reftests/bugs/reftest.list
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -1175,19 +1175,17 @@ static bool ClearLineClampEllipsis(nsBlo
     }
     ++line;
   }
 
   MOZ_ASSERT_UNREACHABLE("expected to find a line with HasLineClampEllipsis");
   return true;
 }
 
-void nsBlockFrame::ClearLineClampEllipsis() {
-  ::ClearLineClampEllipsis(this);
-}
+void nsBlockFrame::ClearLineClampEllipsis() { ::ClearLineClampEllipsis(this); }
 
 static bool IsLineClampItem(const ReflowInput& aReflowInput) {
   return aReflowInput.mFlags.mApplyLineClamp ||
          (aReflowInput.mParentReflowInput &&
           aReflowInput.mParentReflowInput->mFrame->IsScrollFrame() &&
           aReflowInput.mParentReflowInput->mFlags.mApplyLineClamp);
 }
 
@@ -6725,25 +6723,30 @@ void nsBlockFrame::BuildDisplayList(nsDi
   }
 
   aBuilder->MarkFramesForDisplayList(this, mFloats);
 
   // Prepare for text-overflow processing.
   Maybe<TextOverflow> textOverflow =
       TextOverflow::WillProcessLines(aBuilder, this);
 
-  const bool descendAlways =
+  const bool hasDescendantPlaceHolders =
       (GetStateBits() & NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO) ||
-      aBuilder->GetIncludeAllOutOfFlows();
-  const bool descendIfVisible = ForceDescendIntoIfVisible();
-  const bool hasDescendantPlaceHolders = descendAlways || descendIfVisible;
+      ForceDescendIntoIfVisible() || aBuilder->GetIncludeAllOutOfFlows();
 
   const auto ShouldDescendIntoLine = [&](const nsRect& aLineArea) -> bool {
+    // TODO(miko): Unfortunately |descendAlways| cannot be cached, because with
+    // some frame trees, building display list for child lines can change it.
+    // See bug 1552789.
+    const bool descendAlways =
+        (GetStateBits() & NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO) ||
+        aBuilder->GetIncludeAllOutOfFlows();
+
     return descendAlways || aLineArea.Intersects(aBuilder->GetDirtyRect()) ||
-           (descendIfVisible &&
+           (ForceDescendIntoIfVisible() &&
             aLineArea.Intersects(aBuilder->GetVisibleRect()));
   };
 
   // Don't use the line cursor if we might have a descendant placeholder ...
   // it might skip lines that contain placeholders but don't themselves
   // intersect with the dirty area.
   // In particular, we really want to check ShouldDescendIntoFrame()
   // on all our child frames, but that might be expensive.  So we
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1552789-1.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+    <meta charset="utf-8">
+    <style>
+    .outer {
+        display: inline;
+        position: relative;
+    }
+
+    .inner {
+        position: absolute;
+        top: 100%;
+    }
+    </style>
+</head>
+
+<body>
+    <div class="outer">
+        <div>You can see me.</div>
+        <div class="inner">But you can't see me!</div>
+    </div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1552789-ref-1.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+    <meta charset="utf-8">
+    <style>
+    .outer {
+        display: inline;
+        position: relative;
+    }
+    </style>
+</head>
+
+<body>
+    <div class="outer">
+        <div>You can see me.</div>
+    </div>
+</body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -2103,8 +2103,9 @@ pref(layout.css.supports-selector.enable
 == 1509425-1.html 1509425-1-ref.html
 == 1511570.html 1511570-ref.html
 fuzzy-if(!webrender,1-5,66-547) == 1529992-1.html 1529992-1-ref.html
 fuzzy-if(!webrender,0-6,0-34) fails-if(webrender) == 1529992-2.html 1529992-2-ref.html
 == 1535040-1.html 1535040-1-ref.html
 == 1545360-1.xhtml 1545360-1-ref.xhtml
 skip-if(!asyncPan) == 1544895.html 1544895-ref.html
 == 1548809.html 1548809-ref.html
+!= 1552789-1.html 1552789-ref-1.html