Bug 1552789 - Check NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO flag for every line r=mattwoodrow a=jcristau
authorMiko Mynttinen <mikokm@gmail.com>
Mon, 20 May 2019 22:54:18 +0000
changeset 536476 413832ca33c270cc97114acf252dab4ce2ec6d0a
parent 536475 e2e26a62422c58f789934eb79faa6e07d6d3f974
child 536477 dbf2d7493d851d2a1f57b3a9d414ca5bb99ed31f
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, jcristau
bugs1552789
milestone68.0
Bug 1552789 - Check NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO flag for every line r=mattwoodrow a=jcristau 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