Bug 1361751 - update gecko bindings to webrender to reflect changes r=kats draft
authorAlexis Beingessner <a.beingessner@gmail.com>
Mon, 08 May 2017 13:52:16 -0400
changeset 574455 dffdfe2ec2cd4f1fb24475b8d262374150c954a3
parent 574424 f18b86d87dc5f45125e5c788003e9a3d843a7838
child 627607 3adfb484bf030f84ac0086cbf146a568ca567f0a
push id57721
push userbmo:a.beingessner@gmail.com
push dateMon, 08 May 2017 21:59:59 +0000
reviewerskats
bugs1361751
milestone55.0a1
Bug 1361751 - update gecko bindings to webrender to reflect changes r=kats MozReview-Commit-ID: Fxt4sNm4vxa
gfx/layers/ipc/PWebRenderBridge.ipdl
gfx/layers/wr/WebRenderBridgeChild.cpp
gfx/layers/wr/WebRenderBridgeParent.cpp
gfx/layers/wr/WebRenderBridgeParent.h
gfx/layers/wr/WebRenderCanvasLayer.cpp
gfx/layers/wr/WebRenderColorLayer.cpp
gfx/layers/wr/WebRenderContainerLayer.cpp
gfx/layers/wr/WebRenderDisplayItemLayer.cpp
gfx/layers/wr/WebRenderImageLayer.cpp
gfx/layers/wr/WebRenderMessageUtils.h
gfx/layers/wr/WebRenderPaintedLayer.cpp
gfx/layers/wr/WebRenderPaintedLayerBlob.cpp
gfx/webrender_bindings/WebRenderAPI.cpp
gfx/webrender_bindings/WebRenderAPI.h
gfx/webrender_bindings/WebRenderTypes.h
gfx/webrender_bindings/src/bindings.rs
layout/generic/nsBulletFrame.cpp
layout/generic/nsCanvasFrame.cpp
layout/painting/nsCSSRenderingBorders.cpp
layout/painting/nsCSSRenderingGradients.cpp
layout/painting/nsDisplayList.cpp
layout/painting/nsImageRenderer.cpp
toolkit/library/gtest/rust/Cargo.lock
toolkit/library/rust/Cargo.lock
--- a/gfx/layers/ipc/PWebRenderBridge.ipdl
+++ b/gfx/layers/ipc/PWebRenderBridge.ipdl
@@ -16,17 +16,16 @@ include protocol PTexture;
 
 using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
 using mozilla::layers::CompositableHandle from "mozilla/layers/LayersTypes.h";
 using mozilla::wr::ByteBuffer from "mozilla/webrender/WebRenderTypes.h";
 using mozilla::wr::ExternalImageId from "mozilla/webrender/WebRenderTypes.h";
 using mozilla::wr::ImageKey from "mozilla/webrender/WebRenderTypes.h";
 using mozilla::wr::FontKey from "mozilla/webrender/WebRenderTypes.h";
 using WrBuiltDisplayListDescriptor from "mozilla/webrender/webrender_ffi.h";
-using WrAuxiliaryListsDescriptor from "mozilla/webrender/webrender_ffi.h";
 using mozilla::layers::WebRenderScrollData from "mozilla/layers/WebRenderScrollData.h";
 
 namespace mozilla {
 namespace layers {
 
 sync protocol PWebRenderBridge
 {
   manager PCompositorBridge;
@@ -48,20 +47,20 @@ parent:
   sync UpdateImage(ImageKey aImageKey, IntSize aSize,
                    SurfaceFormat aFormat, ByteBuffer aBytes);
   sync DeleteImage(ImageKey aImageKey);
   async DeleteCompositorAnimations(uint64_t[] aIds);
   async AddRawFont(FontKey aFontKey, ByteBuffer aBytes, uint32_t aFontIndex);
   async DeleteFont(FontKey aFontKey);
   async DPBegin(IntSize aSize);
   async DPEnd(IntSize aSize, WebRenderParentCommand[] commands, OpDestroy[] toDestroy, uint64_t fwdTransactionId, uint64_t transactionId,
-              ByteBuffer aDL, WrBuiltDisplayListDescriptor aDLDesc, ByteBuffer aAux, WrAuxiliaryListsDescriptor aAuxDesc,
+              ByteBuffer aDL, WrBuiltDisplayListDescriptor aDLDesc,
               WebRenderScrollData aScrollData);
   sync DPSyncEnd(IntSize aSize, WebRenderParentCommand[] commands, OpDestroy[] toDestroy, uint64_t fwdTransactionId, uint64_t transactionId,
-                 ByteBuffer aDL, WrBuiltDisplayListDescriptor aDLDesc, ByteBuffer aAux, WrAuxiliaryListsDescriptor aAuxDesc,
+                 ByteBuffer aDL, WrBuiltDisplayListDescriptor aDLDesc,
                  WebRenderScrollData aScrollData);
   sync DPGetSnapshot(PTexture texture);
   async AddExternalImageId(ExternalImageId aImageId, CompositableHandle aHandle);
   async AddExternalImageIdForCompositable(ExternalImageId aImageId, CompositableHandle aHandle);
   async RemoveExternalImageId(ExternalImageId aImageId);
   async SetLayerObserverEpoch(uint64_t layerObserverEpoch);
   async ClearCachedResources();
   // Schedule a composite if one isn't already scheduled.
--- a/gfx/layers/wr/WebRenderBridgeChild.cpp
+++ b/gfx/layers/wr/WebRenderBridgeChild.cpp
@@ -97,24 +97,23 @@ WebRenderBridgeChild::DPEnd(wr::DisplayL
                             uint64_t aTransactionId,
                             const WebRenderScrollData& aScrollData)
 {
   MOZ_ASSERT(!mDestroyed);
   MOZ_ASSERT(mIsInTransaction);
 
   wr::BuiltDisplayList dl = aBuilder.Finalize();
   ByteBuffer dlData(Move(dl.dl));
-  ByteBuffer auxData(Move(dl.aux));
 
   if (aIsSync) {
     this->SendDPSyncEnd(aSize, mParentCommands, mDestroyedActors, GetFwdTransactionId(), aTransactionId,
-                        dlData, dl.dl_desc, auxData, dl.aux_desc, aScrollData);
+                        dlData, dl.dl_desc, aScrollData);
   } else {
     this->SendDPEnd(aSize, mParentCommands, mDestroyedActors, GetFwdTransactionId(), aTransactionId,
-                    dlData, dl.dl_desc, auxData, dl.aux_desc, aScrollData);
+                    dlData, dl.dl_desc, aScrollData);
   }
 
   mParentCommands.Clear();
   mDestroyedActors.Clear();
   mIsInTransaction = false;
 }
 
 wr::ExternalImageId
@@ -183,30 +182,30 @@ WebRenderBridgeChild::PushGlyphs(wr::Dis
                                  const LayerRect& aBounds, const LayerRect& aClip)
 {
   MOZ_ASSERT(aFont);
   MOZ_ASSERT(!aGlyphs.IsEmpty());
 
   WrFontKey key = GetFontKeyForScaledFont(aFont);
   MOZ_ASSERT(key.mNamespace && key.mHandle);
 
-  WrClipRegion clipRegion = aBuilder.BuildClipRegion(aSc.ToRelativeWrRect(aClip));
-
   for (size_t i = 0; i < aGlyphs.Length(); i++) {
     GlyphArray glyph_array = aGlyphs[i];
     nsTArray<gfx::Glyph>& glyphs = glyph_array.glyphs();
 
     nsTArray<WrGlyphInstance> wr_glyph_instances;
     wr_glyph_instances.SetLength(glyphs.Length());
 
     for (size_t j = 0; j < glyphs.Length(); j++) {
       wr_glyph_instances[j].index = glyphs[j].mIndex;
       wr_glyph_instances[j].point = aSc.ToRelativeWrPoint(
               LayerPoint::FromUnknownPoint(glyphs[j].mPosition));
     }
+
+    WrClipRegionToken clipRegion = aBuilder.PushClipRegion(aSc.ToRelativeWrRect(aClip));
     aBuilder.PushText(aSc.ToRelativeWrRect(aBounds),
                       clipRegion,
                       glyph_array.color().value(),
                       key,
                       Range<const WrGlyphInstance>(wr_glyph_instances.Elements(), wr_glyph_instances.Length()),
                       aFont->GetSize());
 
   }
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -301,18 +301,16 @@ WebRenderBridgeParent::RecvDPBegin(const
 void
 WebRenderBridgeParent::HandleDPEnd(const gfx::IntSize& aSize,
                                  InfallibleTArray<WebRenderParentCommand>&& aCommands,
                                  InfallibleTArray<OpDestroy>&& aToDestroy,
                                  const uint64_t& aFwdTransactionId,
                                  const uint64_t& aTransactionId,
                                  const ByteBuffer& dl,
                                  const WrBuiltDisplayListDescriptor& dlDesc,
-                                 const ByteBuffer& aux,
-                                 const WrAuxiliaryListsDescriptor& auxDesc,
                                  const WebRenderScrollData& aScrollData)
 {
   UpdateFwdTransactionId(aFwdTransactionId);
   AutoClearReadLocks clearLocks(mReadLocks);
 
   if (mDestroyed) {
     for (const auto& op : aToDestroy) {
       DestroyActor(op);
@@ -320,17 +318,17 @@ WebRenderBridgeParent::HandleDPEnd(const
     return;
   }
   // This ensures that destroy operations are always processed. It is not safe
   // to early-return from RecvDPEnd without doing so.
   AutoWebRenderBridgeParentAsyncMessageSender autoAsyncMessageSender(this, &aToDestroy);
 
   ++mWrEpoch; // Update webrender epoch
   ProcessWebRenderCommands(aSize, aCommands, wr::NewEpoch(mWrEpoch),
-                           dl, dlDesc, aux, auxDesc);
+                           dl, dlDesc);
   HoldPendingTransactionId(mWrEpoch, aTransactionId);
 
   mScrollData = aScrollData;
   UpdateAPZ();
 }
 
 void
 WebRenderBridgeParent::UpdateAPZ()
@@ -384,49 +382,43 @@ WebRenderBridgeParent::GetScrollData() c
 mozilla::ipc::IPCResult
 WebRenderBridgeParent::RecvDPEnd(const gfx::IntSize& aSize,
                                  InfallibleTArray<WebRenderParentCommand>&& aCommands,
                                  InfallibleTArray<OpDestroy>&& aToDestroy,
                                  const uint64_t& aFwdTransactionId,
                                  const uint64_t& aTransactionId,
                                  const ByteBuffer& dl,
                                  const WrBuiltDisplayListDescriptor& dlDesc,
-                                 const ByteBuffer& aux,
-                                 const WrAuxiliaryListsDescriptor& auxDesc,
                                  const WebRenderScrollData& aScrollData)
 {
   HandleDPEnd(aSize, Move(aCommands), Move(aToDestroy), aFwdTransactionId, aTransactionId,
-              dl, dlDesc, aux, auxDesc, aScrollData);
+              dl, dlDesc, aScrollData);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 WebRenderBridgeParent::RecvDPSyncEnd(const gfx::IntSize &aSize,
                                      InfallibleTArray<WebRenderParentCommand>&& aCommands,
                                      InfallibleTArray<OpDestroy>&& aToDestroy,
                                      const uint64_t& aFwdTransactionId,
                                      const uint64_t& aTransactionId,
                                      const ByteBuffer& dl,
                                      const WrBuiltDisplayListDescriptor& dlDesc,
-                                     const ByteBuffer& aux,
-                                     const WrAuxiliaryListsDescriptor& auxDesc,
                                      const WebRenderScrollData& aScrollData)
 {
   HandleDPEnd(aSize, Move(aCommands), Move(aToDestroy), aFwdTransactionId, aTransactionId,
-              dl, dlDesc, aux, auxDesc, aScrollData);
+              dl, dlDesc, aScrollData);
   return IPC_OK();
 }
 
 void
 WebRenderBridgeParent::ProcessWebRenderCommands(const gfx::IntSize &aSize,
                                                 InfallibleTArray<WebRenderParentCommand>& aCommands, const wr::Epoch& aEpoch,
                                                 const ByteBuffer& dl,
-                                                const WrBuiltDisplayListDescriptor& dlDesc,
-                                                const ByteBuffer& aux,
-                                                const WrAuxiliaryListsDescriptor& auxDesc)
+                                                const WrBuiltDisplayListDescriptor& dlDesc)
 {
   mCompositableHolder->SetCompositionTime(TimeStamp::Now());
 
   for (InfallibleTArray<WebRenderParentCommand>::index_type i = 0; i < aCommands.Length(); ++i) {
     const WebRenderParentCommand& cmd = aCommands[i];
     switch (cmd.type()) {
       case WebRenderParentCommand::TOpAddExternalImage: {
         const OpAddExternalImage& op = cmd.get_OpAddExternalImage();
@@ -522,18 +514,17 @@ WebRenderBridgeParent::ProcessWebRenderC
     }
   }
   if (mWidget) {
     LayoutDeviceIntSize size = mWidget->GetClientSize();
     mApi->SetWindowParameters(size);
   }
   mApi->SetRootDisplayList(gfx::Color(0.3f, 0.f, 0.f, 1.f), aEpoch, LayerSize(aSize.width, aSize.height),
                            mPipelineId,
-                           dlDesc, dl.mData, dl.mLength,
-                           auxDesc, aux.mData, aux.mLength);
+                           dlDesc, dl.mData, dl.mLength);
 
   ScheduleComposition();
   DeleteOldImages();
 
   if (ShouldParentObserveEpoch()) {
     mCompositorBridge->ObserveLayerUpdate(wr::AsUint64(mPipelineId), GetChildLayerObserverEpoch(), true);
   }
 }
--- a/gfx/layers/wr/WebRenderBridgeParent.h
+++ b/gfx/layers/wr/WebRenderBridgeParent.h
@@ -87,28 +87,24 @@ public:
   mozilla::ipc::IPCResult RecvDPBegin(const gfx::IntSize& aSize) override;
   mozilla::ipc::IPCResult RecvDPEnd(const gfx::IntSize& aSize,
                                     InfallibleTArray<WebRenderParentCommand>&& aCommands,
                                     InfallibleTArray<OpDestroy>&& aToDestroy,
                                     const uint64_t& aFwdTransactionId,
                                     const uint64_t& aTransactionId,
                                     const ByteBuffer& dl,
                                     const WrBuiltDisplayListDescriptor& dlDesc,
-                                    const ByteBuffer& aux,
-                                    const WrAuxiliaryListsDescriptor& auxDesc,
                                     const WebRenderScrollData& aScrollData) override;
   mozilla::ipc::IPCResult RecvDPSyncEnd(const gfx::IntSize& aSize,
                                         InfallibleTArray<WebRenderParentCommand>&& aCommands,
                                         InfallibleTArray<OpDestroy>&& aToDestroy,
                                         const uint64_t& aFwdTransactionId,
                                         const uint64_t& aTransactionId,
                                         const ByteBuffer& dl,
                                         const WrBuiltDisplayListDescriptor& dlDesc,
-                                        const ByteBuffer& aux,
-                                        const WrAuxiliaryListsDescriptor& auxDesc,
                                         const WebRenderScrollData& aScrollData) override;
   mozilla::ipc::IPCResult RecvDPGetSnapshot(PTextureParent* aTexture) override;
 
   mozilla::ipc::IPCResult RecvAddExternalImageId(const ExternalImageId& aImageId,
                                                  const CompositableHandle& aHandle) override;
   mozilla::ipc::IPCResult RecvAddExternalImageIdForCompositable(const ExternalImageId& aImageId,
                                                                 const CompositableHandle& aHandle) override;
   mozilla::ipc::IPCResult RecvRemoveExternalImageId(const ExternalImageId& aImageId) override;
@@ -166,32 +162,28 @@ public:
   const WebRenderScrollData& GetScrollData() const;
 
 private:
   virtual ~WebRenderBridgeParent();
 
   void DeleteOldImages();
   void ProcessWebRenderCommands(const gfx::IntSize &aSize, InfallibleTArray<WebRenderParentCommand>& commands, const wr::Epoch& aEpoch,
                                     const ByteBuffer& dl,
-                                    const WrBuiltDisplayListDescriptor& dlDesc,
-                                    const ByteBuffer& aux,
-                                    const WrAuxiliaryListsDescriptor& auxDesc);
+                                    const WrBuiltDisplayListDescriptor& dlDesc);
   void ScheduleComposition();
   void ClearResources();
   uint64_t GetChildLayerObserverEpoch() const { return mChildLayerObserverEpoch; }
   bool ShouldParentObserveEpoch();
   void HandleDPEnd(const gfx::IntSize& aSize,
                    InfallibleTArray<WebRenderParentCommand>&& aCommands,
                    InfallibleTArray<OpDestroy>&& aToDestroy,
                    const uint64_t& aFwdTransactionId,
                    const uint64_t& aTransactionId,
                    const ByteBuffer& dl,
                    const WrBuiltDisplayListDescriptor& dlDesc,
-                   const ByteBuffer& aux,
-                   const WrAuxiliaryListsDescriptor& auxDesc,
                    const WebRenderScrollData& aScrollData);
 
   void SampleAnimations(nsTArray<WrOpacityProperty>& aOpacityArray,
                         nsTArray<WrTransformProperty>& aTransformArray);
 
 private:
   struct PendingTransactionId {
     PendingTransactionId(wr::Epoch aEpoch, uint64_t aId)
--- a/gfx/layers/wr/WebRenderCanvasLayer.cpp
+++ b/gfx/layers/wr/WebRenderCanvasLayer.cpp
@@ -64,17 +64,17 @@ WebRenderCanvasLayer::RenderLayer(wr::Di
 
   StackingContextHelper sc(aSc, aBuilder, this, transform);
 
   LayerRect rect(0, 0, mBounds.width, mBounds.height);
   DumpLayerInfo("CanvasLayer", rect);
 
   LayerRect clipRect = ClipRect().valueOr(rect);
   Maybe<WrImageMask> mask = BuildWrMaskLayer(&sc);
-  WrClipRegion clip = aBuilder.BuildClipRegion(
+  WrClipRegionToken clip = aBuilder.PushClipRegion(
       sc.ToRelativeWrRect(clipRect),
       mask.ptrOr(nullptr));
 
   wr::ImageRendering filter = wr::ToImageRendering(mSamplingFilter);
 
   if (gfxPrefs::LayersDump()) {
     printf_stderr("CanvasLayer %p texture-filter=%s\n",
                   this->GetLayer(),
--- a/gfx/layers/wr/WebRenderColorLayer.cpp
+++ b/gfx/layers/wr/WebRenderColorLayer.cpp
@@ -23,17 +23,17 @@ WebRenderColorLayer::RenderLayer(wr::Dis
 {
   StackingContextHelper sc(aSc, aBuilder, this);
 
   LayerRect rect = Bounds();
   DumpLayerInfo("ColorLayer", rect);
 
   LayerRect clipRect = ClipRect().valueOr(rect);
   Maybe<WrImageMask> mask = BuildWrMaskLayer(&sc);
-  WrClipRegion clip = aBuilder.BuildClipRegion(
+  WrClipRegionToken clip = aBuilder.PushClipRegion(
       sc.ToRelativeWrRect(clipRect),
       mask.ptrOr(nullptr));
 
   aBuilder.PushRect(sc.ToRelativeWrRect(rect), clip, wr::ToWrColor(mColor));
 }
 
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/wr/WebRenderContainerLayer.cpp
+++ b/gfx/layers/wr/WebRenderContainerLayer.cpp
@@ -116,14 +116,14 @@ WebRenderRefLayer::RenderLayer(wr::Displ
   // we need to apply that transform to the bounds before we pass it on to WR.
   // The conversion from ParentLayerPixel to LayerPixel below is a result of
   // changing the reference layer from "this layer" to the "the layer that
   // created aSc".
   LayerRect rect = ViewAs<LayerPixel>(bounds,
       PixelCastJustification::MovingDownToChildren);
   DumpLayerInfo("RefLayer", rect);
 
-  WrClipRegion clipRegion = aBuilder.BuildClipRegion(aSc.ToRelativeWrRect(rect));
+  WrClipRegionToken clipRegion = aBuilder.PushClipRegion(aSc.ToRelativeWrRect(rect));
   aBuilder.PushIFrame(aSc.ToRelativeWrRect(rect), clipRegion, wr::AsPipelineId(mId));
 }
 
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/wr/WebRenderDisplayItemLayer.cpp
+++ b/gfx/layers/wr/WebRenderDisplayItemLayer.cpp
@@ -161,17 +161,17 @@ WebRenderDisplayItemLayer::PushItemAsBlo
   }
 
   wr::ByteBuffer bytes;
   bytes.Allocate(recorder->RecordingSize());
   DebugOnly<bool> ok = recorder->CopyRecording((char*)bytes.AsSlice().begin().get(), bytes.AsSlice().length());
   MOZ_ASSERT(ok);
 
   WrRect dest = aSc.ToRelativeWrRect(imageRect + offset);
-  WrClipRegion clipRegion = aBuilder.BuildClipRegion(dest);
+  WrClipRegionToken clipRegion = aBuilder.PushClipRegion(dest);
   WrImageKey key = GetImageKey();
   WrBridge()->SendAddBlobImage(key, imageSize.ToUnknownSize(), imageSize.width * 4, dt->GetFormat(), bytes);
   WrManager()->AddImageKeyForDiscard(key);
 
   aBuilder.PushImage(dest,
                      clipRegion,
                      wr::ImageRendering::Auto,
                      key);
--- a/gfx/layers/wr/WebRenderImageLayer.cpp
+++ b/gfx/layers/wr/WebRenderImageLayer.cpp
@@ -171,17 +171,17 @@ WebRenderImageLayer::RenderLayer(wr::Dis
   if (mScaleMode != ScaleMode::SCALE_NONE) {
     NS_ASSERTION(mScaleMode == ScaleMode::STRETCH,
                  "No other scalemodes than stretch and none supported yet.");
     rect = LayerRect(0, 0, mScaleToSize.width, mScaleToSize.height);
   }
 
   LayerRect clipRect = ClipRect().valueOr(rect);
   Maybe<WrImageMask> mask = BuildWrMaskLayer(&sc);
-  WrClipRegion clip = aBuilder.BuildClipRegion(
+  WrClipRegionToken clip = aBuilder.PushClipRegion(
       sc.ToRelativeWrRect(clipRect),
       mask.ptrOr(nullptr));
 
   wr::ImageRendering filter = wr::ToImageRendering(mSamplingFilter);
 
   DumpLayerInfo("Image Layer", rect);
   if (gfxPrefs::LayersDump()) {
     printf_stderr("ImageLayer %p texture-filter=%s \n",
--- a/gfx/layers/wr/WebRenderMessageUtils.h
+++ b/gfx/layers/wr/WebRenderMessageUtils.h
@@ -187,33 +187,11 @@ struct ParamTraits<WrBuiltDisplayListDes
   Read(const Message* aMsg, PickleIterator* aIter, WrBuiltDisplayListDescriptor* aResult)
   {
     return ReadParam(aMsg, aIter, &aResult->display_list_items_size)
         && ReadParam(aMsg, aIter, &aResult->builder_start_time)
         && ReadParam(aMsg, aIter, &aResult->builder_finish_time);
   }
 };
 
-template<>
-struct ParamTraits<WrAuxiliaryListsDescriptor>
-{
-  static void
-  Write(Message* aMsg, const WrAuxiliaryListsDescriptor& aParam)
-  {
-    WriteParam(aMsg, aParam.gradient_stops_size);
-    WriteParam(aMsg, aParam.complex_clip_regions_size);
-    WriteParam(aMsg, aParam.filters_size);
-    WriteParam(aMsg, aParam.glyph_instances_size);
-  }
-
-  static bool
-  Read(const Message* aMsg, PickleIterator* aIter, WrAuxiliaryListsDescriptor* aResult)
-  {
-    return ReadParam(aMsg, aIter, &aResult->gradient_stops_size)
-        && ReadParam(aMsg, aIter, &aResult->complex_clip_regions_size)
-        && ReadParam(aMsg, aIter, &aResult->filters_size)
-        && ReadParam(aMsg, aIter, &aResult->glyph_instances_size);
-  }
-};
-
 } // namespace IPC
 
 #endif // GFX_WEBRENDERMESSAGEUTILS_H
--- a/gfx/layers/wr/WebRenderPaintedLayer.cpp
+++ b/gfx/layers/wr/WebRenderPaintedLayer.cpp
@@ -94,17 +94,17 @@ WebRenderPaintedLayer::CreateWebRenderDi
 {
   StackingContextHelper sc(aSc, aBuilder, this);
 
   LayerRect rect = Bounds();
   DumpLayerInfo("PaintedLayer", rect);
 
   LayerRect clipRect = ClipRect().valueOr(rect);
   Maybe<WrImageMask> mask = BuildWrMaskLayer(&sc);
-  WrClipRegion clip = aBuilder.BuildClipRegion(
+  WrClipRegionToken clip = aBuilder.PushClipRegion(
       sc.ToRelativeWrRect(clipRect),
       mask.ptrOr(nullptr));
 
   WrImageKey key = GetImageKey();
   WrBridge()->AddWebRenderParentCommand(OpAddExternalImage(mExternalImageId.value(), key));
   WrManager()->AddImageKeyForDiscard(key);
 
   aBuilder.PushImage(sc.ToRelativeWrRect(rect), clip, wr::ImageRendering::Auto, key);
--- a/gfx/layers/wr/WebRenderPaintedLayerBlob.cpp
+++ b/gfx/layers/wr/WebRenderPaintedLayerBlob.cpp
@@ -79,17 +79,17 @@ WebRenderPaintedLayerBlob::RenderLayer(w
   MOZ_ASSERT(ok);
 
   StackingContextHelper sc(aSc, aBuilder, this);
   LayerRect rect = Bounds();
   DumpLayerInfo("PaintedLayer", rect);
 
   LayerRect clipRect = ClipRect().valueOr(rect);
   Maybe<WrImageMask> mask = BuildWrMaskLayer(&sc);
-  WrClipRegion clip = aBuilder.BuildClipRegion(
+  WrClipRegionToken clip = aBuilder.PushClipRegion(
       sc.ToRelativeWrRect(clipRect),
       mask.ptrOr(nullptr));
 
   WrImageKey key = GetImageKey();
   WrBridge()->SendAddBlobImage(key, imageSize, size.width * 4, dt->GetFormat(), bytes);
   WrManager()->AddImageKeyForDiscard(key);
 
   aBuilder.PushImage(sc.ToRelativeWrRect(rect), clip, wr::ImageRendering::Auto, key);
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -193,31 +193,25 @@ WebRenderAPI::GenerateFrame(const nsTArr
 
 void
 WebRenderAPI::SetRootDisplayList(gfx::Color aBgColor,
                                  Epoch aEpoch,
                                  LayerSize aViewportSize,
 				 WrPipelineId pipeline_id,
 				 WrBuiltDisplayListDescriptor dl_descriptor,
 				 uint8_t *dl_data,
-				 size_t dl_size,
-				 WrAuxiliaryListsDescriptor aux_descriptor,
-				 uint8_t *aux_data,
-				 size_t aux_size)
+				 size_t dl_size)
 {
     wr_api_set_root_display_list(mWrApi,
 				 aEpoch,
 				 aViewportSize.width, aViewportSize.height,
                                  pipeline_id,
                                  dl_descriptor,
                                  dl_data,
-                                 dl_size,
-                                 aux_descriptor,
-                                 aux_data,
-                                 aux_size);
+                                 dl_size);
 }
 
 void
 WebRenderAPI::ClearRootDisplayList(Epoch aEpoch,
                                    WrPipelineId pipeline_id)
 {
   wr_api_clear_root_display_list(mWrApi, aEpoch, pipeline_id);
 }
@@ -526,19 +520,17 @@ DisplayListBuilder::End()
 }
 
 BuiltDisplayList
 DisplayListBuilder::Finalize()
 {
   BuiltDisplayList dl;
   wr_api_finalize_builder(mWrState,
                           &dl.dl_desc,
-                          &dl.dl.inner,
-                          &dl.aux_desc,
-                          &dl.aux.inner);
+                          &dl.dl.inner);
   return dl;
 }
 
 void
 DisplayListBuilder::PushStackingContext(const WrRect& aBounds,
                                         const uint64_t& aAnimationId,
                                         const float* aOpacity,
                                         const gfx::Matrix4x4* aTransform,
@@ -582,19 +574,17 @@ DisplayListBuilder::PopClip()
   wr_dp_pop_scroll_layer(mWrState);
 }
 
 void
 DisplayListBuilder::PushBuiltDisplayList(BuiltDisplayList dl)
 {
   wr_dp_push_built_display_list(mWrState,
                                 dl.dl_desc,
-                                dl.dl.Extract(),
-                                dl.aux_desc,
-                                dl.aux.Extract());
+                                dl.dl.Extract());
 }
 
 void
 DisplayListBuilder::PushScrollLayer(const WrRect& aContentRect,
                                     const WrRect& aClipRect,
                                     const WrImageMask* aMask)
 {
   wr_dp_push_scroll_layer(mWrState, aContentRect, aClipRect, aMask);
@@ -603,25 +593,25 @@ DisplayListBuilder::PushScrollLayer(cons
 void
 DisplayListBuilder::PopScrollLayer()
 {
   wr_dp_pop_scroll_layer(mWrState);
 }
 
 void
 DisplayListBuilder::PushRect(const WrRect& aBounds,
-                             const WrClipRegion& aClip,
+                             const WrClipRegionToken aClip,
                              const WrColor& aColor)
 {
   wr_dp_push_rect(mWrState, aBounds, aClip, aColor);
 }
 
 void
 DisplayListBuilder::PushLinearGradient(const WrRect& aBounds,
-                                       const WrClipRegion& aClip,
+                                       const WrClipRegionToken aClip,
                                        const WrPoint& aStartPoint,
                                        const WrPoint& aEndPoint,
                                        const nsTArray<WrGradientStop>& aStops,
                                        wr::GradientExtendMode aExtendMode,
                                        const WrSize aTileSize,
                                        const WrSize aTileSpacing)
 {
   wr_dp_push_linear_gradient(mWrState,
@@ -629,17 +619,17 @@ DisplayListBuilder::PushLinearGradient(c
                              aStartPoint, aEndPoint,
                              aStops.Elements(), aStops.Length(),
                              aExtendMode,
                              aTileSize, aTileSpacing);
 }
 
 void
 DisplayListBuilder::PushRadialGradient(const WrRect& aBounds,
-                                       const WrClipRegion& aClip,
+                                       const WrClipRegionToken aClip,
                                        const WrPoint& aCenter,
                                        const WrSize& aRadius,
                                        const nsTArray<WrGradientStop>& aStops,
                                        wr::GradientExtendMode aExtendMode,
                                        const WrSize aTileSize,
                                        const WrSize aTileSpacing)
 {
   wr_dp_push_radial_gradient(mWrState,
@@ -647,185 +637,185 @@ DisplayListBuilder::PushRadialGradient(c
                              aCenter, aRadius,
                              aStops.Elements(), aStops.Length(),
                              aExtendMode,
                              aTileSize, aTileSpacing);
 }
 
 void
 DisplayListBuilder::PushImage(const WrRect& aBounds,
-                              const WrClipRegion& aClip,
+                              const WrClipRegionToken aClip,
                               wr::ImageRendering aFilter,
                               wr::ImageKey aImage)
 {
   WrSize size;
   size.width = aBounds.width;
   size.height = aBounds.height;
   PushImage(aBounds, aClip, size, size, aFilter, aImage);
 }
 
 void
 DisplayListBuilder::PushImage(const WrRect& aBounds,
-                              const WrClipRegion& aClip,
+                              const WrClipRegionToken aClip,
                               const WrSize& aStretchSize,
                               const WrSize& aTileSpacing,
                               wr::ImageRendering aFilter,
                               wr::ImageKey aImage)
 {
   wr_dp_push_image(mWrState, aBounds, aClip, aStretchSize, aTileSpacing, aFilter, aImage);
 }
 
 void
 DisplayListBuilder::PushYCbCrPlanarImage(const WrRect& aBounds,
-                                         const WrClipRegion& aClip,
+                                         const WrClipRegionToken aClip,
                                          wr::ImageKey aImageChannel0,
                                          wr::ImageKey aImageChannel1,
                                          wr::ImageKey aImageChannel2,
                                          WrYuvColorSpace aColorSpace)
 {
   wr_dp_push_yuv_planar_image(mWrState,
                               aBounds,
                               aClip,
                               aImageChannel0,
                               aImageChannel1,
                               aImageChannel2,
                               aColorSpace);
 }
 
 void
 DisplayListBuilder::PushNV12Image(const WrRect& aBounds,
-                                  const WrClipRegion& aClip,
+                                  const WrClipRegionToken aClip,
                                   wr::ImageKey aImageChannel0,
                                   wr::ImageKey aImageChannel1,
                                   WrYuvColorSpace aColorSpace)
 {
   wr_dp_push_yuv_NV12_image(mWrState,
                             aBounds,
                             aClip,
                             aImageChannel0,
                             aImageChannel1,
                             aColorSpace);
 }
 
 void
 DisplayListBuilder::PushIFrame(const WrRect& aBounds,
-                               const WrClipRegion& aClip,
+                               const WrClipRegionToken aClip,
                                PipelineId aPipeline)
 {
   wr_dp_push_iframe(mWrState, aBounds, aClip, aPipeline);
 }
 
 void
 DisplayListBuilder::PushBorder(const WrRect& aBounds,
-                               const WrClipRegion& aClip,
+                               const WrClipRegionToken aClip,
                                const WrBorderWidths& aWidths,
                                const WrBorderSide& aTop,
                                const WrBorderSide& aRight,
                                const WrBorderSide& aBottom,
                                const WrBorderSide& aLeft,
                                const WrBorderRadius& aRadius)
 {
   wr_dp_push_border(mWrState, aBounds, aClip,
                     aWidths, aTop, aRight, aBottom, aLeft, aRadius);
 }
 
 void
 DisplayListBuilder::PushBorderImage(const WrRect& aBounds,
-                                    const WrClipRegion& aClip,
+                                    const WrClipRegionToken aClip,
                                     const WrBorderWidths& aWidths,
                                     wr::ImageKey aImage,
                                     const WrNinePatchDescriptor& aPatch,
                                     const WrSideOffsets2Df32& aOutset,
                                     const WrRepeatMode& aRepeatHorizontal,
                                     const WrRepeatMode& aRepeatVertical)
 {
   wr_dp_push_border_image(mWrState, aBounds, aClip,
                           aWidths, aImage, aPatch, aOutset,
                           aRepeatHorizontal, aRepeatVertical);
 }
 
 void
 DisplayListBuilder::PushBorderGradient(const WrRect& aBounds,
-                                       const WrClipRegion& aClip,
+                                       const WrClipRegionToken aClip,
                                        const WrBorderWidths& aWidths,
                                        const WrPoint& aStartPoint,
                                        const WrPoint& aEndPoint,
                                        const nsTArray<WrGradientStop>& aStops,
                                        wr::GradientExtendMode aExtendMode,
                                        const WrSideOffsets2Df32& aOutset)
 {
   wr_dp_push_border_gradient(mWrState, aBounds, aClip,
                              aWidths, aStartPoint, aEndPoint,
                              aStops.Elements(), aStops.Length(),
                              aExtendMode, aOutset);
 }
 
 void
 DisplayListBuilder::PushBorderRadialGradient(const WrRect& aBounds,
-                                             const WrClipRegion& aClip,
+                                             const WrClipRegionToken aClip,
                                              const WrBorderWidths& aWidths,
                                              const WrPoint& aCenter,
                                              const WrSize& aRadius,
                                              const nsTArray<WrGradientStop>& aStops,
                                              wr::GradientExtendMode aExtendMode,
                                              const WrSideOffsets2Df32& aOutset)
 {
   wr_dp_push_border_radial_gradient(
     mWrState, aBounds, aClip, aWidths, aCenter,
     aRadius, aStops.Elements(), aStops.Length(),
     aExtendMode, aOutset);
 }
 
 void
 DisplayListBuilder::PushText(const WrRect& aBounds,
-                             const WrClipRegion& aClip,
+                             const WrClipRegionToken aClip,
                              const gfx::Color& aColor,
                              wr::FontKey aFontKey,
                              Range<const WrGlyphInstance> aGlyphBuffer,
                              float aGlyphSize)
 {
   wr_dp_push_text(mWrState, aBounds, aClip,
                   ToWrColor(aColor),
                   aFontKey,
                   &aGlyphBuffer[0], aGlyphBuffer.length(),
                   aGlyphSize);
 }
 
 void
 DisplayListBuilder::PushBoxShadow(const WrRect& aRect,
-                                  const WrClipRegion& aClip,
+                                  const WrClipRegionToken aClip,
                                   const WrRect& aBoxBounds,
                                   const WrPoint& aOffset,
                                   const WrColor& aColor,
                                   const float& aBlurRadius,
                                   const float& aSpreadRadius,
                                   const float& aBorderRadius,
                                   const WrBoxShadowClipMode& aClipMode)
 {
   wr_dp_push_box_shadow(mWrState, aRect, aClip,
                         aBoxBounds, aOffset, aColor,
                         aBlurRadius, aSpreadRadius, aBorderRadius,
                         aClipMode);
 }
 
-WrClipRegion
-DisplayListBuilder::BuildClipRegion(const WrRect& aMain,
-                                    const WrImageMask* aMask)
+WrClipRegionToken
+DisplayListBuilder::PushClipRegion(const WrRect& aMain,
+                                   const WrImageMask* aMask)
 {
-  return wr_dp_new_clip_region(mWrState,
-                               aMain,
-                               nullptr, 0,
-                               aMask);
+  return wr_dp_push_clip_region(mWrState,
+                                aMain,
+                                nullptr, 0,
+                                aMask);
 }
 
-WrClipRegion
-DisplayListBuilder::BuildClipRegion(const WrRect& aMain,
-                                    const nsTArray<WrComplexClipRegion>& aComplex,
-                                    const WrImageMask* aMask)
+WrClipRegionToken
+DisplayListBuilder::PushClipRegion(const WrRect& aMain,
+                                   const nsTArray<WrComplexClipRegion>& aComplex,
+                                   const WrImageMask* aMask)
 {
-  return wr_dp_new_clip_region(mWrState,
-                               aMain,
-                               aComplex.Elements(), aComplex.Length(),
-                               aMask);
+  return wr_dp_push_clip_region(mWrState,
+                                aMain,
+                                aComplex.Elements(), aComplex.Length(),
+                                aMask);
 }
 
 } // namespace wr
 } // namespace mozilla
--- a/gfx/webrender_bindings/WebRenderAPI.h
+++ b/gfx/webrender_bindings/WebRenderAPI.h
@@ -50,20 +50,17 @@ public:
 
   void SetWindowParameters(LayoutDeviceIntSize size);
   void SetRootDisplayList(gfx::Color aBgColor,
                           Epoch aEpoch,
                           LayerSize aViewportSize,
                           WrPipelineId pipeline_id,
                           WrBuiltDisplayListDescriptor dl_descriptor,
                           uint8_t *dl_data,
-                          size_t dl_size,
-                          WrAuxiliaryListsDescriptor aux_descriptor,
-                          uint8_t *aux_data,
-                          size_t aux_size);
+                          size_t dl_size);
 
   void ClearRootDisplayList(Epoch aEpoch,
                             WrPipelineId pipeline_id);
 
   void SetRootPipeline(wr::PipelineId aPipeline);
 
   void AddImage(wr::ImageKey aKey,
                 const ImageDescriptor& aDescriptor,
@@ -159,124 +156,124 @@ public:
 
   void PushScrollLayer(const WrRect& aContentRect, // TODO: We should work with strongly typed rects
                        const WrRect& aClipRect,
                        const WrImageMask* aMask); // TODO: needs a wrapper.
   void PopScrollLayer();
 
 
   void PushRect(const WrRect& aBounds,
-                const WrClipRegion& aClip,
+                const WrClipRegionToken aClip,
                 const WrColor& aColor);
 
   void PushLinearGradient(const WrRect& aBounds,
-                          const WrClipRegion& aClip,
+                          const WrClipRegionToken aClip,
                           const WrPoint& aStartPoint,
                           const WrPoint& aEndPoint,
                           const nsTArray<WrGradientStop>& aStops,
                           wr::GradientExtendMode aExtendMode,
                           const WrSize aTileSize,
                           const WrSize aTileSpacing);
 
   void PushRadialGradient(const WrRect& aBounds,
-                          const WrClipRegion& aClip,
+                          const WrClipRegionToken aClip,
                           const WrPoint& aCenter,
                           const WrSize& aRadius,
                           const nsTArray<WrGradientStop>& aStops,
                           wr::GradientExtendMode aExtendMode,
                           const WrSize aTileSize,
                           const WrSize aTileSpacing);
 
   void PushImage(const WrRect& aBounds,
-                 const WrClipRegion& aClip,
+                 const WrClipRegionToken aClip,
                  wr::ImageRendering aFilter,
                  wr::ImageKey aImage);
 
   void PushImage(const WrRect& aBounds,
-                 const WrClipRegion& aClip,
+                 const WrClipRegionToken aClip,
                  const WrSize& aStretchSize,
                  const WrSize& aTileSpacing,
                  wr::ImageRendering aFilter,
                  wr::ImageKey aImage);
 
   void PushYCbCrPlanarImage(const WrRect& aBounds,
-                            const WrClipRegion& aClip,
+                            const WrClipRegionToken aClip,
                             wr::ImageKey aImageChannel0,
                             wr::ImageKey aImageChannel1,
                             wr::ImageKey aImageChannel2,
                             WrYuvColorSpace aColorSpace);
 
   void PushNV12Image(const WrRect& aBounds,
-                     const WrClipRegion& aClip,
+                     const WrClipRegionToken aClip,
                      wr::ImageKey aImageChannel0,
                      wr::ImageKey aImageChannel1,
                      WrYuvColorSpace aColorSpace);
 
   void PushIFrame(const WrRect& aBounds,
-                  const WrClipRegion& aClip,
+                  const WrClipRegionToken aClip,
                   wr::PipelineId aPipeline);
 
   void PushBorder(const WrRect& aBounds,
-                  const WrClipRegion& aClip,
+                  const WrClipRegionToken aClip,
                   const WrBorderWidths& aWidths,
                   const WrBorderSide& aTop,
                   const WrBorderSide& aRight,
                   const WrBorderSide& aBbottom,
                   const WrBorderSide& aLeft,
                   const WrBorderRadius& aRadius);
 
   void PushBorderImage(const WrRect& aBounds,
-                       const WrClipRegion& aClip,
+                       const WrClipRegionToken aClip,
                        const WrBorderWidths& aWidths,
                        wr::ImageKey aImage,
                        const WrNinePatchDescriptor& aPatch,
                        const WrSideOffsets2Df32& aOutset,
                        const WrRepeatMode& aRepeatHorizontal,
                        const WrRepeatMode& aRepeatVertical);
 
   void PushBorderGradient(const WrRect& aBounds,
-                          const WrClipRegion& aClip,
+                          const WrClipRegionToken aClip,
                           const WrBorderWidths& aWidths,
                           const WrPoint& aStartPoint,
                           const WrPoint& aEndPoint,
                           const nsTArray<WrGradientStop>& aStops,
                           wr::GradientExtendMode aExtendMode,
                           const WrSideOffsets2Df32& aOutset);
 
   void PushBorderRadialGradient(const WrRect& aBounds,
-                                const WrClipRegion& aClip,
+                                const WrClipRegionToken aClip,
                                 const WrBorderWidths& aWidths,
                                 const WrPoint& aCenter,
                                 const WrSize& aRadius,
                                 const nsTArray<WrGradientStop>& aStops,
                                 wr::GradientExtendMode aExtendMode,
                                 const WrSideOffsets2Df32& aOutset);
 
   void PushText(const WrRect& aBounds,
-                const WrClipRegion& aClip,
+                const WrClipRegionToken aClip,
                 const gfx::Color& aColor,
                 wr::FontKey aFontKey,
                 Range<const WrGlyphInstance> aGlyphBuffer,
                 float aGlyphSize);
 
   void PushBoxShadow(const WrRect& aRect,
-                     const WrClipRegion& aClip,
+                     const WrClipRegionToken aClip,
                      const WrRect& aBoxBounds,
                      const WrPoint& aOffset,
                      const WrColor& aColor,
                      const float& aBlurRadius,
                      const float& aSpreadRadius,
                      const float& aBorderRadius,
                      const WrBoxShadowClipMode& aClipMode);
 
-  WrClipRegion BuildClipRegion(const WrRect& aMain,
-                               const WrImageMask* aMask = nullptr);
-  WrClipRegion BuildClipRegion(const WrRect& aMain,
-                               const nsTArray<WrComplexClipRegion>& aComplex,
-                               const WrImageMask* aMask = nullptr);
+  WrClipRegionToken PushClipRegion(const WrRect& aMain,
+                                   const WrImageMask* aMask = nullptr);
+  WrClipRegionToken PushClipRegion(const WrRect& aMain,
+                                   const nsTArray<WrComplexClipRegion>& aComplex,
+                                   const WrImageMask* aMask = nullptr);
 
   // Try to avoid using this when possible.
   WrState* Raw() { return mWrState; }
 protected:
   WrState* mWrState;
 
   friend class WebRenderAPI;
 };
--- a/gfx/webrender_bindings/WebRenderTypes.h
+++ b/gfx/webrender_bindings/WebRenderTypes.h
@@ -532,16 +532,14 @@ inline mozilla::Range<const uint8_t> Byt
 
 inline mozilla::Range<uint8_t> MutByteSliceToRange(MutByteSlice aWrSlice) {
   return mozilla::Range<uint8_t>(aWrSlice.buffer, aWrSlice.len);
 }
 
 struct BuiltDisplayList {
   VecU8 dl;
   WrBuiltDisplayListDescriptor dl_desc;
-  VecU8 aux;
-  WrAuxiliaryListsDescriptor aux_desc;
 };
 
 } // namespace wr
 } // namespace mozilla
 
 #endif /* GFX_WEBRENDERTYPES_H */
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -17,17 +17,16 @@ extern crate webrender_traits;
 // Enables binary recording that can be used with `wrench replay`
 // Outputs a wr-record-*.bin file for each window that is shown
 // Note: wrench will panic if external images are used, they can
 // be disabled in WebRenderBridgeParent::ProcessWebRenderCommands
 // by commenting out the path that adds an external image ID
 static ENABLE_RECORDING: bool = false;
 
 type WrAPI = RenderApi;
-type WrAuxiliaryListsDescriptor = AuxiliaryListsDescriptor;
 type WrBorderStyle = BorderStyle;
 type WrBoxShadowClipMode = BoxShadowClipMode;
 type WrBuiltDisplayListDescriptor = BuiltDisplayListDescriptor;
 type WrImageFormat = ImageFormat;
 type WrImageRendering = ImageRendering;
 type WrMixBlendMode = MixBlendMode;
 type WrRenderer = Renderer;
 type WrSideOffsets2Du32 = WrSideOffsets2D<u32>;
@@ -144,40 +143,16 @@ impl Into<ExtendMode> for WrGradientExte
             WrGradientExtendMode::Clamp => ExtendMode::Clamp,
             WrGradientExtendMode::Repeat => ExtendMode::Repeat,
         }
     }
 }
 
 #[repr(C)]
 #[derive(Debug, Clone, Copy)]
-struct WrItemRange {
-    start: usize,
-    length: usize,
-}
-
-impl Into<ItemRange> for WrItemRange {
-    fn into(self) -> ItemRange {
-        ItemRange {
-            start: self.start,
-            length: self.length,
-        }
-    }
-}
-impl From<ItemRange> for WrItemRange {
-    fn from(item_range: ItemRange) -> Self {
-        WrItemRange {
-            start: item_range.start,
-            length: item_range.length,
-        }
-    }
-}
-
-#[repr(C)]
-#[derive(Debug, Clone, Copy)]
 pub struct WrPoint {
     x: f32,
     y: f32,
 }
 
 impl<U> Into<TypedPoint2D<f32, U>> for WrPoint {
     fn into(self) -> TypedPoint2D<f32, U> {
         TypedPoint2D::new(self.x, self.y)
@@ -476,40 +451,43 @@ impl<'a> Into<ComplexClipRegion> for &'a
         }
     }
 }
 
 #[repr(C)]
 #[derive(Debug, Clone, Copy)]
 pub struct WrClipRegion {
     main: WrRect,
-    complex: WrItemRange,
+    complex: ItemRange<ComplexClipRegion>,
+    complex_count: usize,
     image_mask: WrImageMask,
     has_image_mask: bool,
 }
 
 impl Into<ClipRegion> for WrClipRegion {
     fn into(self) -> ClipRegion {
         ClipRegion {
             main: self.main.into(),
-            complex: self.complex.into(),
+            complex_clips: self.complex,
+            complex_clip_count: self.complex_count,
             image_mask: if self.has_image_mask {
                 Some(self.image_mask.into())
             } else {
                 None
             },
         }
     }
 }
 impl From<ClipRegion> for WrClipRegion {
     fn from(clip_region: ClipRegion) -> Self {
         if let Some(image_mask) = clip_region.image_mask {
             WrClipRegion {
                 main: clip_region.main.into(),
-                complex: clip_region.complex.into(),
+                complex: clip_region.complex_clips,
+                complex_count: clip_region.complex_clip_count,
                 image_mask: image_mask.into(),
                 has_image_mask: true,
             }
         } else {
             let blank = WrImageMask {
                 image: ImageKey(0, 0),
                 rect: WrRect {
                     x: 0f32,
@@ -517,24 +495,44 @@ impl From<ClipRegion> for WrClipRegion {
                     width: 0f32,
                     height: 0f32,
                 },
                 repeat: false,
             };
 
             WrClipRegion {
                 main: clip_region.main.into(),
-                complex: clip_region.complex.into(),
+                complex: clip_region.complex_clips,
+                complex_count: clip_region.complex_clip_count,
                 image_mask: blank,
                 has_image_mask: false,
             }
         }
     }
 }
 
+#[repr(C)]
+pub struct WrClipRegionToken {
+    _dummy: bool,
+}
+
+impl Into<ClipRegionToken> for WrClipRegionToken {
+    fn into(self) -> ClipRegionToken {
+        // ClipRegionTokens are a zero sized move-only "proof of work"
+        // this doesn't really translate... so uh, pretend it does?
+        unsafe { mem::transmute(()) }
+    }
+}
+
+impl From<ClipRegionToken> for WrClipRegionToken {
+    fn from(_token: ClipRegionToken) -> WrClipRegionToken {
+        WrClipRegionToken { _dummy: true }
+    }
+}
+
 #[repr(u32)]
 #[allow(dead_code)]
 enum WrExternalImageType {
     NativeTexture,
     RawData,
 }
 
 #[repr(C)]
@@ -1011,42 +1009,33 @@ pub extern "C" fn wr_api_set_window_para
 #[no_mangle]
 pub unsafe extern "C" fn wr_api_set_root_display_list(api: &mut WrAPI,
                                                       epoch: WrEpoch,
                                                       viewport_width: f32,
                                                       viewport_height: f32,
                                                       pipeline_id: WrPipelineId,
                                                       dl_descriptor: WrBuiltDisplayListDescriptor,
                                                       dl_data: *mut u8,
-                                                      dl_size: usize,
-                                                      aux_descriptor: WrAuxiliaryListsDescriptor,
-                                                      aux_data: *mut u8,
-                                                      aux_size: usize) {
+                                                      dl_size: usize) {
     let root_background_color = ColorF::new(0.3, 0.0, 0.0, 1.0);
     // See the documentation of set_display_list in api.rs. I don't think
     // it makes a difference in gecko at the moment(until APZ is figured out)
     // but I suppose it is a good default.
     let preserve_frame_state = true;
 
     let dl_slice = make_slice(dl_data, dl_size);
     let mut dl_vec = Vec::new();
     // XXX: see if we can get rid of the copy here
     dl_vec.extend_from_slice(dl_slice);
     let dl = BuiltDisplayList::from_data(dl_vec, dl_descriptor);
 
-    let aux_slice = make_slice(aux_data, aux_size);
-    let mut aux_vec = Vec::new();
-    // XXX: see if we can get rid of the copy here
-    aux_vec.extend_from_slice(aux_slice);
-    let aux = AuxiliaryLists::from_data(aux_vec, aux_descriptor);
-
     api.set_display_list(Some(root_background_color),
                          epoch,
                          LayoutSize::new(viewport_width, viewport_height),
-                         (pipeline_id, dl, aux),
+                         (pipeline_id, dl),
                          preserve_frame_state);
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn wr_api_clear_root_display_list(api: &mut WrAPI,
                                                         epoch: WrEpoch,
                                                         pipeline_id: WrPipelineId) {
     let root_background_color = ColorF::new(0.3, 0.0, 0.0, 1.0);
@@ -1192,17 +1181,17 @@ pub extern "C" fn wr_state_delete(state:
     }
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_begin(state: &mut WrState,
                               width: u32,
                               height: u32) {
     assert!(unsafe { is_in_main_thread() });
-    state.frame_builder.dl_builder.list.clear();
+    state.frame_builder.dl_builder.data.clear();
 
     let bounds = LayoutRect::new(LayoutPoint::new(0.0, 0.0),
                                  LayoutSize::new(width as f32, height as f32));
 
     state.frame_builder
          .dl_builder
          .push_stacking_context(webrender_traits::ScrollPolicy::Scrollable,
                                 bounds,
@@ -1215,30 +1204,30 @@ pub extern "C" fn wr_dp_begin(state: &mu
 
 #[no_mangle]
 pub extern "C" fn wr_dp_end(state: &mut WrState) {
     assert!(unsafe { is_in_main_thread() });
     state.frame_builder.dl_builder.pop_stacking_context();
 }
 
 #[no_mangle]
-pub extern "C" fn wr_dp_new_clip_region(state: &mut WrState,
-                                        main: WrRect,
-                                        complex: *const WrComplexClipRegion,
-                                        complex_count: usize,
-                                        image_mask: *const WrImageMask)
-                                        -> WrClipRegion {
+pub extern "C" fn wr_dp_push_clip_region(state: &mut WrState,
+                                         main: WrRect,
+                                         complex: *const WrComplexClipRegion,
+                                         complex_count: usize,
+                                         image_mask: *const WrImageMask)
+                                         -> WrClipRegionToken {
     assert!(unsafe { is_in_main_thread() });
 
     let main = main.into();
     let complex_slice = make_slice(complex, complex_count);
-    let complex_vector = complex_slice.iter().map(|x| x.into()).collect();
+    let complex_iter = complex_slice.iter().map(|x| x.into());
     let mask = unsafe { image_mask.as_ref() }.map(|x| x.into());
 
-    let clip_region = state.frame_builder.dl_builder.new_clip_region(&main, complex_vector, mask);
+    let clip_region = state.frame_builder.dl_builder.push_clip_region(&main, complex_iter, mask);
 
     clip_region.into()
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_stacking_context(state: &mut WrState,
                                               bounds: WrRect,
                                               animation_id: u64,
@@ -1285,50 +1274,50 @@ pub extern "C" fn wr_dp_pop_stacking_con
 #[no_mangle]
 pub extern "C" fn wr_dp_push_scroll_layer(state: &mut WrState,
                                           content_rect: WrRect,
                                           clip_rect: WrRect,
                                           mask: *const WrImageMask) {
     let content_rect = content_rect.into();
     let clip_rect = clip_rect.into();
     let mask = unsafe { mask.as_ref() }.map(|x| x.into());
-    let clip_region = state.frame_builder.dl_builder.new_clip_region(&clip_rect, vec![], mask);
-    state.frame_builder.dl_builder.push_clip_node(clip_region, content_rect, None);
+    let clip_region = state.frame_builder.dl_builder.push_clip_region(&clip_rect, vec![], mask);
+    state.frame_builder.dl_builder.push_clip_node(content_rect, clip_region, None);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_pop_scroll_layer(state: &mut WrState) {
     assert!(unsafe { is_in_main_thread() });
     state.frame_builder.dl_builder.pop_clip_node();
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_iframe(state: &mut WrState,
                                     rect: WrRect,
-                                    clip: WrClipRegion,
+                                    clip: WrClipRegionToken,
                                     pipeline_id: WrPipelineId) {
     assert!(unsafe { is_in_main_thread() });
 
     state.frame_builder.dl_builder.push_iframe(rect.into(), clip.into(), pipeline_id);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_rect(state: &mut WrState,
                                   rect: WrRect,
-                                  clip: WrClipRegion,
+                                  clip: WrClipRegionToken,
                                   color: WrColor) {
     assert!(unsafe { is_in_main_thread() });
 
     state.frame_builder.dl_builder.push_rect(rect.into(), clip.into(), color.into());
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_image(state: &mut WrState,
                                    bounds: WrRect,
-                                   clip: WrClipRegion,
+                                   clip: WrClipRegionToken,
                                    stretch_size: WrSize,
                                    tile_spacing: WrSize,
                                    image_rendering: WrImageRendering,
                                    key: WrImageKey) {
     assert!(unsafe { is_in_main_thread() });
 
     state.frame_builder
          .dl_builder
@@ -1339,17 +1328,17 @@ pub extern "C" fn wr_dp_push_image(state
                      image_rendering,
                      key);
 }
 
 /// Push a 3 planar yuv image.
 #[no_mangle]
 pub extern "C" fn wr_dp_push_yuv_planar_image(state: &mut WrState,
                                               bounds: WrRect,
-                                              clip: WrClipRegion,
+                                              clip: WrClipRegionToken,
                                               image_key_0: WrImageKey,
                                               image_key_1: WrImageKey,
                                               image_key_2: WrImageKey,
                                               color_space: WrYuvColorSpace) {
     assert!(unsafe { is_in_main_thread() });
 
     state.frame_builder
          .dl_builder
@@ -1358,34 +1347,34 @@ pub extern "C" fn wr_dp_push_yuv_planar_
                          YuvData::PlanarYCbCr(image_key_0, image_key_1, image_key_2),
                          color_space);
 }
 
 /// PUsh a 2 planar NV12 image.
 #[no_mangle]
 pub extern "C" fn wr_dp_push_yuv_NV12_image(state: &mut WrState,
                                             bounds: WrRect,
-                                            clip: WrClipRegion,
+                                            clip: WrClipRegionToken,
                                             image_key_0: WrImageKey,
                                             image_key_1: WrImageKey,
                                             color_space: WrYuvColorSpace) {
     assert!(unsafe { is_in_main_thread() });
 
     state.frame_builder
          .dl_builder
          .push_yuv_image(bounds.into(),
                          clip.into(),
                          YuvData::NV12(image_key_0, image_key_1),
                          color_space);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_text(state: &mut WrState,
                                   bounds: WrRect,
-                                  clip: WrClipRegion,
+                                  clip: WrClipRegionToken,
                                   color: WrColor,
                                   font_key: WrFontKey,
                                   glyphs: *const WrGlyphInstance,
                                   glyph_count: u32,
                                   glyph_size: f32) {
     assert!(unsafe { is_in_main_thread() });
 
     let glyph_slice = make_slice(glyphs, glyph_count as usize);
@@ -1404,17 +1393,17 @@ pub extern "C" fn wr_dp_push_text(state:
                     Au::from_f32_px(glyph_size),
                     Au::from_px(0),
                     glyph_options);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_border(state: &mut WrState,
                                     rect: WrRect,
-                                    clip: WrClipRegion,
+                                    clip: WrClipRegionToken,
                                     widths: WrBorderWidths,
                                     top: WrBorderSide,
                                     right: WrBorderSide,
                                     bottom: WrBorderSide,
                                     left: WrBorderSide,
                                     radius: WrBorderRadius) {
     assert!(unsafe { is_in_main_thread() });
 
@@ -1428,17 +1417,17 @@ pub extern "C" fn wr_dp_push_border(stat
     state.frame_builder
          .dl_builder
          .push_border(rect.into(), clip.into(), widths.into(), border_details);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_border_image(state: &mut WrState,
                                           rect: WrRect,
-                                          clip: WrClipRegion,
+                                          clip: WrClipRegionToken,
                                           widths: WrBorderWidths,
                                           image: WrImageKey,
                                           patch: WrNinePatchDescriptor,
                                           outset: WrSideOffsets2Df32,
                                           repeat_horizontal: WrRepeatMode,
                                           repeat_vertical: WrRepeatMode) {
     assert!(unsafe { is_in_main_thread() });
     let border_details =
@@ -1452,17 +1441,17 @@ pub extern "C" fn wr_dp_push_border_imag
     state.frame_builder
          .dl_builder
          .push_border(rect.into(), clip.into(), widths.into(), border_details);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_border_gradient(state: &mut WrState,
                                              rect: WrRect,
-                                             clip: WrClipRegion,
+                                             clip: WrClipRegionToken,
                                              widths: WrBorderWidths,
                                              start_point: WrPoint,
                                              end_point: WrPoint,
                                              stops: *const WrGradientStop,
                                              stops_count: usize,
                                              extend_mode: WrGradientExtendMode,
                                              outset: WrSideOffsets2Df32) {
     assert!(unsafe { is_in_main_thread() });
@@ -1483,17 +1472,17 @@ pub extern "C" fn wr_dp_push_border_grad
     state.frame_builder
          .dl_builder
          .push_border(rect.into(), clip.into(), widths.into(), border_details);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_border_radial_gradient(state: &mut WrState,
                                                     rect: WrRect,
-                                                    clip: WrClipRegion,
+                                                    clip: WrClipRegionToken,
                                                     widths: WrBorderWidths,
                                                     center: WrPoint,
                                                     radius: WrSize,
                                                     stops: *const WrGradientStop,
                                                     stops_count: usize,
                                                     extend_mode: WrGradientExtendMode,
                                                     outset: WrSideOffsets2Df32) {
     assert!(unsafe { is_in_main_thread() });
@@ -1515,17 +1504,17 @@ pub extern "C" fn wr_dp_push_border_radi
     state.frame_builder
          .dl_builder
          .push_border(rect.into(), clip.into(), widths.into(), border_details);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_linear_gradient(state: &mut WrState,
                                              rect: WrRect,
-                                             clip: WrClipRegion,
+                                             clip: WrClipRegionToken,
                                              start_point: WrPoint,
                                              end_point: WrPoint,
                                              stops: *const WrGradientStop,
                                              stops_count: usize,
                                              extend_mode: WrGradientExtendMode,
                                              tile_size: WrSize,
                                              tile_spacing: WrSize) {
     assert!(unsafe { is_in_main_thread() });
@@ -1545,17 +1534,17 @@ pub extern "C" fn wr_dp_push_linear_grad
     state.frame_builder
          .dl_builder
          .push_gradient(rect, clip.into(), gradient, tile_size, tile_spacing);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_radial_gradient(state: &mut WrState,
                                              rect: WrRect,
-                                             clip: WrClipRegion,
+                                             clip: WrClipRegionToken,
                                              center: WrPoint,
                                              radius: WrSize,
                                              stops: *const WrGradientStop,
                                              stops_count: usize,
                                              extend_mode: WrGradientExtendMode,
                                              tile_size: WrSize,
                                              tile_spacing: WrSize) {
     assert!(unsafe { is_in_main_thread() });
@@ -1575,17 +1564,17 @@ pub extern "C" fn wr_dp_push_radial_grad
     state.frame_builder
          .dl_builder
          .push_radial_gradient(rect, clip.into(), gradient, tile_size, tile_spacing);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_box_shadow(state: &mut WrState,
                                         rect: WrRect,
-                                        clip: WrClipRegion,
+                                        clip: WrClipRegionToken,
                                         box_bounds: WrRect,
                                         offset: WrPoint,
                                         color: WrColor,
                                         blur_radius: f32,
                                         spread_radius: f32,
                                         border_radius: f32,
                                         clip_mode: WrBoxShadowClipMode) {
     assert!(unsafe { is_in_main_thread() });
@@ -1601,44 +1590,34 @@ pub extern "C" fn wr_dp_push_box_shadow(
                           spread_radius,
                           border_radius,
                           clip_mode);
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn wr_api_finalize_builder(state: &mut WrState,
                                                  dl_descriptor: &mut WrBuiltDisplayListDescriptor,
-                                                 dl_data: &mut WrVecU8,
-                                                 aux_descriptor: &mut WrAuxiliaryListsDescriptor,
-                                                 aux_data: &mut WrVecU8) {
+                                                 dl_data: &mut WrVecU8) {
     let frame_builder = mem::replace(&mut state.frame_builder,
                                      WebRenderFrameBuilder::new(state.pipeline_id));
-    let (_, dl, aux) = frame_builder.dl_builder.finalize();
+    let (_, dl) = frame_builder.dl_builder.finalize();
     let (data, descriptor) = dl.into_data();
     *dl_data = WrVecU8::from_vec(data);
     *dl_descriptor = descriptor;
-
-    let (data, descriptor) = aux.into_data();
-    *aux_data = WrVecU8::from_vec(data);
-    *aux_descriptor = descriptor;
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn wr_dp_push_built_display_list(state: &mut WrState,
                                                        dl_descriptor: WrBuiltDisplayListDescriptor,
-                                                       dl_data: WrVecU8,
-                                                       aux_descriptor: WrAuxiliaryListsDescriptor,
-                                                       aux_data: WrVecU8) {
+                                                       dl_data: WrVecU8) {
     let dl_vec = dl_data.to_vec();
-    let aux_vec = aux_data.to_vec();
 
     let dl = BuiltDisplayList::from_data(dl_vec, dl_descriptor);
-    let aux = AuxiliaryLists::from_data(aux_vec, aux_descriptor);
 
-    state.frame_builder.dl_builder.push_built_display_list(dl, aux);
+    state.frame_builder.dl_builder.push_built_display_list(dl);
 }
 
 struct Moz2dImageRenderer {
     images: HashMap<ImageKey, BlobImageData>,
 
     // The images rendered in the current frame (not kept here between frames)
     rendered_images: HashMap<BlobImageRequest, BlobImageResult>,
 }
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -463,17 +463,17 @@ BulletRenderer::CreateWebRenderCommandsF
   if (key.isNothing()) {
     return;
   }
 
   const int32_t appUnitsPerDevPixel = aItem->Frame()->PresContext()->AppUnitsPerDevPixel();
   LayoutDeviceRect destRect = LayoutDeviceRect::FromAppUnits(mDest, appUnitsPerDevPixel);
   WrRect dest = aSc.ToRelativeWrRectRounded(destRect);
 
-  WrClipRegion clipRegion = aBuilder.BuildClipRegion(dest);
+  WrClipRegionToken clipRegion = aBuilder.PushClipRegion(dest);
 
   aBuilder.PushImage(dest,
                      clipRegion,
                      WrImageRendering::Auto,
                      key.value());
 }
 
 void
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -314,17 +314,17 @@ nsDisplayCanvasBackgroundColor::CreateWe
   nsRect bgClipRect = frame->CanvasArea() + offset;
   int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
 
   LayoutDeviceRect rect = LayoutDeviceRect::FromAppUnits(
           bgClipRect, appUnitsPerDevPixel);
 
   WrRect transformedRect = aSc.ToRelativeWrRect(rect);
   aBuilder.PushRect(transformedRect,
-                    aBuilder.BuildClipRegion(transformedRect),
+                    aBuilder.PushClipRegion(transformedRect),
                     wr::ToWrColor(ToDeviceColor(mColor)));
 }
 
 #ifdef MOZ_DUMP_PAINTING
 void
 nsDisplayCanvasBackgroundColor::WriteDebugInfo(std::stringstream& aStream)
 {
   aStream << " (rgba "
--- a/layout/painting/nsCSSRenderingBorders.cpp
+++ b/layout/painting/nsCSSRenderingBorders.cpp
@@ -3558,19 +3558,21 @@ nsCSSBorderRenderer::CreateWebRenderComm
 {
   LayoutDeviceRect outerRect = LayoutDeviceRect::FromUnknownRect(mOuterRect);
   WrRect transformedRect = aSc.ToRelativeWrRect(outerRect);
   WrBorderSide side[4];
   NS_FOR_CSS_SIDES(i) {
     side[i] = wr::ToWrBorderSide(ToDeviceColor(mBorderColors[i]), mBorderStyles[i]);
   }
 
-  WrClipRegion clipRegion = aBuilder.BuildClipRegion(transformedRect);
+  WrClipRegionToken clipRegion;
   if (!aClipRect.IsEmpty()) {
-    clipRegion = aBuilder.BuildClipRegion(wr::ToWrRect(aClipRect));
+    clipRegion = aBuilder.PushClipRegion(wr::ToWrRect(aClipRect));
+  } else {
+    clipRegion = aBuilder.PushClipRegion(transformedRect);
   }
   WrBorderRadius borderRadius = wr::ToWrBorderRadius(LayerSize(mBorderRadii[0].width, mBorderRadii[0].height),
                                                      LayerSize(mBorderRadii[1].width, mBorderRadii[1].height),
                                                      LayerSize(mBorderRadii[3].width, mBorderRadii[3].height),
                                                      LayerSize(mBorderRadii[2].width, mBorderRadii[2].height));
   aBuilder.PushBorder(transformedRect,
                       clipRegion,
                       wr::ToWrBorderWidths(mBorderWidths[0], mBorderWidths[1], mBorderWidths[2], mBorderWidths[3]),
--- a/layout/painting/nsCSSRenderingGradients.cpp
+++ b/layout/painting/nsCSSRenderingGradients.cpp
@@ -1082,30 +1082,30 @@ nsCSSGradientRenderer::BuildWebRenderDis
   lineStart.y = (lineStart.y - srcTransform.y) * srcTransform.height;
 
   if (mGradient->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR) {
     lineEnd.x = (lineEnd.x - srcTransform.x) * srcTransform.width;
     lineEnd.y = (lineEnd.y - srcTransform.y) * srcTransform.height;
 
     aBuilder.PushLinearGradient(
       wrGradientBounds,
-      aBuilder.BuildClipRegion(wrClipBounds),
+      aBuilder.PushClipRegion(wrClipBounds),
       mozilla::wr::ToWrPoint(lineStart),
       mozilla::wr::ToWrPoint(lineEnd),
       stops,
       extendMode,
       mozilla::wr::ToWrSize(layerFirstTileSize),
       mozilla::wr::ToWrSize(tileSpacing));
   } else {
     gradientRadius.width *= srcTransform.width;
     gradientRadius.height *= srcTransform.height;
 
     aBuilder.PushRadialGradient(
       wrGradientBounds,
-      aBuilder.BuildClipRegion(wrClipBounds),
+      aBuilder.PushClipRegion(wrClipBounds),
       mozilla::wr::ToWrPoint(lineStart),
       mozilla::wr::ToWrSize(gradientRadius),
       stops,
       extendMode,
       mozilla::wr::ToWrSize(layerFirstTileSize),
       mozilla::wr::ToWrSize(tileSpacing));
   }
 }
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -4601,22 +4601,22 @@ nsDisplayCaret::CreateWebRenderCommands(
   LayoutDeviceRect devHookRect = LayoutDeviceRect::FromAppUnits(
     hookRect + ToReferenceFrame(), appUnitsPerDevPixel);
 
   WrRect caret = aSc.ToRelativeWrRectRounded(devCaretRect);
   WrRect hook = aSc.ToRelativeWrRectRounded(devHookRect);
 
   // Note, WR will pixel snap anything that is layout aligned.
   aBuilder.PushRect(caret,
-                    aBuilder.BuildClipRegion(caret),
+                    aBuilder.PushClipRegion(caret),
                     wr::ToWrColor(color));
 
   if (!devHookRect.IsEmpty()) {
     aBuilder.PushRect(hook,
-                      aBuilder.BuildClipRegion(hook),
+                      aBuilder.PushClipRegion(hook),
                       wr::ToWrColor(color));
   }
 }
 
 LayerState
 nsDisplayCaret::GetLayerState(nsDisplayListBuilder* aBuilder,
                               LayerManager* aManager,
                               const ContainerLayerParameters& aParameters)
@@ -4878,17 +4878,17 @@ nsDisplayBorder::CreateBorderImageWebRen
       }
 
       Maybe<wr::ImageKey> key = aLayer->SendImageContainer(container, aParentCommands);
       if (key.isNothing()) {
         return;
       }
 
       aBuilder.PushBorderImage(dest,
-                               aBuilder.BuildClipRegion(clip),
+                               aBuilder.PushClipRegion(clip),
                                wr::ToWrBorderWidths(widths[0], widths[1], widths[2], widths[3]),
                                key.value(),
                                wr::ToWrNinePatchDescriptor(
                                  (float)(mBorderImageRenderer->mImageSize.width) / appUnitsPerDevPixel,
                                  (float)(mBorderImageRenderer->mImageSize.height) / appUnitsPerDevPixel,
                                  wr::ToWrSideOffsets2Du32(slice[0], slice[1], slice[2], slice[3])),
                                wr::ToWrSideOffsets2Df32(outset[0], outset[1], outset[2], outset[3]),
                                wr::ToWrRepeatMode(mBorderImageRenderer->mRepeatModeHorizontal),
@@ -4911,26 +4911,26 @@ nsDisplayBorder::CreateBorderImageWebRen
 
       if (gradientData->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR) {
         LayerPoint startPoint = LayerPoint(dest.x, dest.y);
         startPoint = startPoint + ViewAs<LayerPixel>(lineStart, PixelCastJustification::WebRenderHasUnitResolution);
         LayerPoint endPoint = LayerPoint(dest.x, dest.y);
         endPoint = endPoint + ViewAs<LayerPixel>(lineEnd, PixelCastJustification::WebRenderHasUnitResolution);
 
         aBuilder.PushBorderGradient(dest,
-                                    aBuilder.BuildClipRegion(clip),
+                                    aBuilder.PushClipRegion(clip),
                                     wr::ToWrBorderWidths(widths[0], widths[1], widths[2], widths[3]),
                                     wr::ToWrPoint(startPoint),
                                     wr::ToWrPoint(endPoint),
                                     stops,
                                     extendMode,
                                     wr::ToWrSideOffsets2Df32(outset[0], outset[1], outset[2], outset[3]));
       } else {
         aBuilder.PushBorderRadialGradient(dest,
-                                          aBuilder.BuildClipRegion(clip),
+                                          aBuilder.PushClipRegion(clip),
                                           wr::ToWrBorderWidths(widths[0], widths[1], widths[2], widths[3]),
                                           wr::ToWrPoint(lineStart),
                                           wr::ToWrSize(gradientRadius),
                                           stops,
                                           extendMode,
                                           wr::ToWrSideOffsets2Df32(outset[0], outset[1], outset[2], outset[3]));
       }
       break;
@@ -5275,27 +5275,27 @@ nsDisplayBoxShadowOuter::CreateWebRender
         if (hasBorderRadius) {
           LayerSize borderRadiusSize(borderRadius, borderRadius);
           WrComplexClipRegion roundedRect =
                                   wr::ToWrComplexClipRegion(deviceBoxRect,
                                                             borderRadiusSize);
           nsTArray<WrComplexClipRegion> clips;
           clips.AppendElement(roundedRect);
           aBuilder.PushRect(deviceBoxRect,
-                            aBuilder.BuildClipRegion(deviceClipRect,
+                            aBuilder.PushClipRegion(deviceClipRect,
                                                      clips),
                             wr::ToWrColor(shadowColor));
         } else {
           aBuilder.PushRect(deviceBoxRect,
-                            aBuilder.BuildClipRegion(deviceClipRect),
+                            aBuilder.PushClipRegion(deviceClipRect),
                             wr::ToWrColor(shadowColor));
         }
       } else {
         aBuilder.PushBoxShadow(deviceBoxRect,
-                              aBuilder.BuildClipRegion(deviceClipRect),
+                              aBuilder.PushClipRegion(deviceClipRect),
                               deviceBoxRect,
                               wr::ToWrPoint(shadowOffset),
                               wr::ToWrColor(shadowColor),
                               blurRadius,
                               spreadRadius,
                               borderRadius,
                               WrBoxShadowClipMode::Outset);
       }
@@ -5456,17 +5456,17 @@ nsDisplayBoxShadowInner::CreateInsetBoxS
 
       float blurRadius = float(shadowItem->mRadius) / float(appUnitsPerDevPixel);
       // TODO: WR doesn't support non-uniform border radii
       float borderRadius = innerRadii.TopLeft().width;
       // NOTE: Any spread radius > 0 will render nothing. WR Bug.
       float spreadRadius = float(shadowItem->mSpread) / float(appUnitsPerDevPixel);
 
       aBuilder.PushBoxShadow(wr::ToWrRect(deviceBoxRect),
-                             aBuilder.BuildClipRegion(deviceClipRect),
+                             aBuilder.PushClipRegion(deviceClipRect),
                              wr::ToWrRect(deviceBoxRect),
                              wr::ToWrPoint(shadowOffset),
                              wr::ToWrColor(shadowColor),
                              blurRadius,
                              spreadRadius,
                              borderRadius,
                              WrBoxShadowClipMode::Inset
                              );
--- a/layout/painting/nsImageRenderer.cpp
+++ b/layout/painting/nsImageRenderer.cpp
@@ -634,17 +634,17 @@ nsImageRenderer::BuildWebRenderDisplayIt
                  aFill.XMost() - firstTilePos.x, aFill.YMost() - firstTilePos.y),
           appUnitsPerDevPixel);
       WrRect fill = aSc.ToRelativeWrRect(fillRect);
       WrRect clip = aSc.ToRelativeWrRect(
           LayoutDeviceRect::FromAppUnits(aFill, appUnitsPerDevPixel));
 
       LayoutDeviceSize gapSize = LayoutDeviceSize::FromAppUnits(
           aRepeatSize - aDest.Size(), appUnitsPerDevPixel);
-      aBuilder.PushImage(fill, aBuilder.BuildClipRegion(clip),
+      aBuilder.PushImage(fill, aBuilder.PushClipRegion(clip),
                          wr::ToWrSize(destRect.Size()), wr::ToWrSize(gapSize),
                          wr::ImageRendering::Auto, key.value());
       break;
     }
     default:
       break;
   }
 
--- a/toolkit/library/gtest/rust/Cargo.lock
+++ b/toolkit/library/gtest/rust/Cargo.lock
@@ -1056,16 +1056,17 @@ dependencies = [
  "webrender_traits 0.36.0",
 ]
 
 [[package]]
 name = "webrender_traits"
 version = "0.36.0"
 dependencies = [
  "app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "bincode 1.0.0-alpha6 (registry+https://github.com/rust-lang/crates.io-index)",
  "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-foundation 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-graphics 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "dwrote 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "euclid 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "gleam 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)",
--- a/toolkit/library/rust/Cargo.lock
+++ b/toolkit/library/rust/Cargo.lock
@@ -1043,16 +1043,17 @@ dependencies = [
  "webrender_traits 0.36.0",
 ]
 
 [[package]]
 name = "webrender_traits"
 version = "0.36.0"
 dependencies = [
  "app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "bincode 1.0.0-alpha6 (registry+https://github.com/rust-lang/crates.io-index)",
  "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-foundation 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-graphics 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "dwrote 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "euclid 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "gleam 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)",