Bug 1546018 - parent the legend clip chains. r=kats
authorAlexis Beingessner <a.beingessner@gmail.com>
Wed, 01 May 2019 17:35:44 +0000
changeset 530955 2fa4f9b9a4c6c39c878fb1848cd8ef468f232287
parent 530954 5cac03a223e560c730e9e1e58ad4a6f93ebba4da
child 530956 9010230aec8a82e3444fa368484b1cb20b76e968
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1546018
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 1546018 - parent the legend clip chains. r=kats Differential Revision: https://phabricator.services.mozilla.com/D29528
gfx/webrender_bindings/WebRenderAPI.cpp
gfx/webrender_bindings/WebRenderAPI.h
layout/forms/nsFieldSetFrame.cpp
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -802,20 +802,21 @@ 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 wr::WrClipChainId* aParent) {
+    const nsTArray<wr::WrClipId>& aClips, bool aParentWithCurrentChain) {
   const uint64_t* parent = nullptr;
-  if (aParent && aParent->id != wr::ROOT_CLIP_CHAIN) {
-    parent = &aParent->id;
+  if (aParentWithCurrentChain &&
+      mCurrentSpaceAndClipChain.clip_chain != wr::ROOT_CLIP_CHAIN) {
+    parent = &mCurrentSpaceAndClipChain.clip_chain;
   }
   uint64_t clipchainId = wr_dp_define_clipchain(
       mWrState, parent, aClips.Elements(), aClips.Length());
   WRDL_LOG("DefineClipChain id=%" PRIu64 " clips=%zu\n", mWrState, clipchainId,
            aClips.Length());
   return wr::WrClipChainId{clipchainId};
 }
 
@@ -1165,19 +1166,18 @@ 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);
 
-    wr::WrClipChainId currentClipChainId{mCurrentSpaceAndClipChain.clip_chain};
     auto clipId = DefineClip(Nothing(), *mClipChainLeaf);
-    auto clipChainId = DefineClipChain({clipId}, &currentClipChainId);
+    auto clipChainId = DefineClipChain({clipId}, true);
 
     mCurrentSpaceAndClipChain.clip_chain = clipChainId.id;
     mClipChainLeaf = Nothing();
   }
 }
 
 void DisplayListBuilder::ResumeClipLeafMerging() {
   if (mSuspendedClipChainLeaf) {
--- a/gfx/webrender_bindings/WebRenderAPI.h
+++ b/gfx/webrender_bindings/WebRenderAPI.h
@@ -389,17 +389,17 @@ class DisplayListBuilder final {
   }
 
   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,
-                                    const wr::WrClipChainId* aParent = nullptr);
+                                    bool aParentWithCurrentChain = false);
 
   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,
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -191,17 +191,17 @@ bool nsDisplayFieldSetBorder::CreateWebR
       wr::ComplexClipRegion region;
       region.rect = wr::ToRoundedLayoutRect(
           LayoutDeviceRect::FromAppUnits(legendRect, appUnitsPerDevPixel));
       region.mode = wr::ClipMode::ClipOut;
       region.radii = wr::EmptyBorderRadius();
       nsTArray<mozilla::wr::ComplexClipRegion> array{region};
 
       auto clip = aBuilder.DefineClip(Nothing(), layoutRect, &array, nullptr);
-      auto clipChain = aBuilder.DefineClipChain({clip});
+      auto clipChain = aBuilder.DefineClipChain({clip}, true);
       clipOut.emplace(aBuilder, clipChain);
     }
   } else {
     rect = nsRect(offset, frame->GetRect().Size());
   }
 
   ImgDrawResult drawResult = nsCSSRendering::CreateWebRenderCommandsForBorder(
       this, mFrame, rect, aBuilder, aResources, aSc, aManager,