Bug 1544895 - when suspending ClipLeafMerging, parent to the clip_chain and not the clip. r=kats
authorAlexis Beingessner <a.beingessner@gmail.com>
Thu, 18 Apr 2019 13:03:26 +0000
changeset 470162 f1e0b621963c9ecae6e9b070da972d3ecd970c68
parent 470161 23ff9cd1a1a43d794dad766662530471b31a121f
child 470163 580a7e38c60491123f3e7bba82904008ab0262d1
push id35888
push useraiakab@mozilla.com
push dateFri, 19 Apr 2019 09:47:45 +0000
treeherdermozilla-central@0160424142d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1544895
milestone68.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 1544895 - when suspending ClipLeafMerging, parent to the clip_chain and not the clip. r=kats Differential Revision: https://phabricator.services.mozilla.com/D27819
gfx/webrender_bindings/WebRenderAPI.cpp
gfx/webrender_bindings/WebRenderAPI.h
layout/reftests/bugs/1544895-ref.html
layout/reftests/bugs/1544895.html
layout/reftests/bugs/reftest.list
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -797,19 +797,23 @@ Maybe<wr::WrSpatialId> DisplayListBuilde
 }
 
 void DisplayListBuilder::PopStackingContext(bool aIsReferenceFrame) {
   WRDL_LOG("PopStackingContext\n", mWrState);
   wr_dp_pop_stacking_context(mWrState, aIsReferenceFrame);
 }
 
 wr::WrClipChainId DisplayListBuilder::DefineClipChain(
-    const nsTArray<wr::WrClipId>& aClips) {
+    const nsTArray<wr::WrClipId>& aClips, const wr::WrClipChainId* aParent) {
+  const uint64_t* parent = nullptr;
+  if (aParent && aParent->id != wr::ROOT_CLIP_CHAIN) {
+    parent = &aParent->id;
+  }
   uint64_t clipchainId = wr_dp_define_clipchain(
-      mWrState, nullptr, aClips.Elements(), aClips.Length());
+      mWrState, parent, aClips.Elements(), aClips.Length());
   WRDL_LOG("DefineClipChain id=%" PRIu64 " clips=%zu\n", mWrState, clipchainId,
            aClips.Length());
   return wr::WrClipChainId{clipchainId};
 }
 
 wr::WrClipId DisplayListBuilder::DefineClip(
     const Maybe<wr::WrSpaceAndClip>& aParent, const wr::LayoutRect& aClipRect,
     const nsTArray<wr::ComplexClipRegion>* aComplex,
@@ -1146,19 +1150,19 @@ void DisplayListBuilder::PopAllShadows()
 void DisplayListBuilder::SuspendClipLeafMerging() {
   if (mClipChainLeaf) {
     // No one should reinitialize mClipChainLeaf while we're suspended
     MOZ_ASSERT(!mSuspendedClipChainLeaf);
 
     mSuspendedClipChainLeaf = mClipChainLeaf;
     mSuspendedSpaceAndClipChain = Some(mCurrentSpaceAndClipChain);
 
-    // Clip is implicitly parented by mCurrentSpaceAndClipChain
+    wr::WrClipChainId currentClipChainId{mCurrentSpaceAndClipChain.clip_chain};
     auto clipId = DefineClip(Nothing(), *mClipChainLeaf);
-    auto clipChainId = DefineClipChain({ clipId });
+    auto clipChainId = DefineClipChain({clipId}, &currentClipChainId);
 
     mCurrentSpaceAndClipChain.clip_chain = clipChainId.id;
     mClipChainLeaf = Nothing();
   }
 }
 
 void DisplayListBuilder::ResumeClipLeafMerging() {
   if (mSuspendedClipChainLeaf) {
--- a/gfx/webrender_bindings/WebRenderAPI.h
+++ b/gfx/webrender_bindings/WebRenderAPI.h
@@ -387,17 +387,18 @@ class DisplayListBuilder final {
     mSubBuilders[aRenderRoot]->mSendSubBuilderDisplayList = true;
   }
 
   Maybe<wr::WrSpatialId> PushStackingContext(
       const StackingContextParams& aParams, const wr::LayoutRect& aBounds,
       const wr::RasterSpace& aRasterSpace);
   void PopStackingContext(bool aIsReferenceFrame);
 
-  wr::WrClipChainId DefineClipChain(const nsTArray<wr::WrClipId>& aClips);
+  wr::WrClipChainId DefineClipChain(const nsTArray<wr::WrClipId>& aClips,
+                                    const wr::WrClipChainId* aParent = nullptr);
 
   wr::WrClipId DefineClip(
       const Maybe<wr::WrSpaceAndClip>& aParent, const wr::LayoutRect& aClipRect,
       const nsTArray<wr::ComplexClipRegion>* aComplex = nullptr,
       const wr::ImageMask* aMask = nullptr);
 
   wr::WrSpatialId DefineStickyFrame(const wr::LayoutRect& aContentRect,
                                     const float* aTopMargin,
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1544895-ref.html
@@ -0,0 +1,42 @@
+<html reftest-async-scroll>
+<head>
+<style>
+body {
+    display: flex;
+    flex-direction: column;
+    width: 100%;
+    height: 100%;
+}
+.header {
+    background-color: white;
+    flex: none;
+}
+.content {
+    flex: auto;
+    overflow-y: scroll;
+}
+.inner-content {
+    height: 2000px;
+}
+.shadowy {
+    text-shadow: 0px 0px 1px green;
+}
+.hidden {
+    visibility: hidden;
+}
+</style>
+</head>
+<body>
+<div class="header"> Wow, This is a Great Header! </div>
+<div class="content"
+     reftest-displayport-x="0" reftest-displayport-y="0"
+     reftest-displayport-w="800" reftest-displayport-h="1075"
+     reftest-async-scroll-y="75">
+    <div class="inner-content">
+        <p class="hidden">Wow, This is Great Hidden Content!</p>
+        <p class="hidden">Wow, This is Great Hidden Content!</p>
+        <p>Wow, This is Great Visible Content!</p>
+    </div>
+</div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1544895.html
@@ -0,0 +1,39 @@
+<html reftest-async-scroll>
+<head>
+<style>
+body {
+    display: flex;
+    flex-direction: column;
+    width: 100%;
+    height: 100%;
+}
+.header {
+    background-color: white;
+    flex: none;
+}
+.content {
+    flex: auto;
+    overflow-y: scroll;
+}
+.inner-content {
+    height: 2000px;
+}
+.shadowy {
+    text-shadow: 0px 0px 1px green;
+}
+</style>
+</head>
+<body>
+<div class="header"> Wow, This is a Great Header! </div>
+<div class="content"
+     reftest-displayport-x="0" reftest-displayport-y="0"
+     reftest-displayport-w="800" reftest-displayport-h="1075"
+     reftest-async-scroll-y="75">
+    <div class="inner-content">
+        <p>Wow, This is Great Content!</p>
+        <p class="shadowy">Wow, This is Great Shadowy Content!</p>
+        <p>Wow, This is Great Visible Content!</p>
+    </div>
+</div>
+</body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -2102,8 +2102,9 @@ test-pref(layout.css.visited_links_enabl
 == 1492660-1.html 1492660-1-ref.html
 pref(layout.css.supports-selector.enabled,true) == 1499386.html 1499386-ref.html
 pref(layout.css.supports-selector.enabled,false) != 1499386.html 1499386-ref.html
 == 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
+skip-if(!asyncPan) == 1544895.html 1544895-ref.html