Bug 1374730 - Update for clip API change in WR cset 0bf6655. r?mrobinson draft
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 10 Jul 2017 07:22:39 -0400
changeset 606129 4caed01263648add29498682207a0cb3dab808cb
parent 606128 c7ccccaad4ee3c4b160e9021c385f889aa452909
child 606130 9a8f235be66ea065ba263b4f7046765ddab7a213
push id67608
push userkgupta@mozilla.com
push dateMon, 10 Jul 2017 11:23:08 +0000
reviewersmrobinson
bugs1374730
milestone56.0a1
Bug 1374730 - Update for clip API change in WR cset 0bf6655. r?mrobinson MozReview-Commit-ID: dEe7yDDZPk
gfx/layers/wr/WebRenderContainerLayer.cpp
gfx/layers/wr/WebRenderImageLayer.cpp
gfx/layers/wr/WebRenderUserData.cpp
gfx/webrender_bindings/WebRenderAPI.cpp
gfx/webrender_bindings/WebRenderAPI.h
gfx/webrender_bindings/src/bindings.rs
gfx/webrender_bindings/webrender_ffi_generated.h
--- a/gfx/layers/wr/WebRenderContainerLayer.cpp
+++ b/gfx/layers/wr/WebRenderContainerLayer.cpp
@@ -146,13 +146,13 @@ WebRenderRefLayer::RenderLayer(wr::Displ
   // 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);
 
   WrRect r = aSc.ToRelativeWrRect(rect);
-  aBuilder.PushIFrame(r, r, wr::AsPipelineId(mId));
+  aBuilder.PushIFrame(r, wr::AsPipelineId(mId));
 }
 
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/wr/WebRenderImageLayer.cpp
+++ b/gfx/layers/wr/WebRenderImageLayer.cpp
@@ -155,17 +155,17 @@ WebRenderImageLayer::RenderLayer(wr::Dis
     // where it will be done when we build the display list for the iframe.
     // That happens in WebRenderCompositableHolder.
 
     LayerRect rect = ViewAs<LayerPixel>(bounds,
         PixelCastJustification::MovingDownToChildren);
     DumpLayerInfo("Image Layer async", rect);
 
     WrRect r = aSc.ToRelativeWrRect(rect);
-    aBuilder.PushIFrame(r, r, mPipelineId.ref());
+    aBuilder.PushIFrame(r, mPipelineId.ref());
 
     gfx::Matrix4x4 scTransform = GetTransform();
     // Translate is applied as part of PushIFrame()
     scTransform.PostTranslate(-rect.x, -rect.y, 0);
     // Adjust transform as to apply origin
     LayerPoint scOrigin = Bounds().TopLeft();
     scTransform.PreTranslate(-scOrigin.x, -scOrigin.y, 0);
 
--- a/gfx/layers/wr/WebRenderUserData.cpp
+++ b/gfx/layers/wr/WebRenderUserData.cpp
@@ -102,17 +102,17 @@ WebRenderImageData::CreateAsyncImageWebR
   //
   // We don't push a stacking context for this async image pipeline here.
   // Instead, we do it inside the iframe that hosts the image. As a result,
   // a bunch of the calculations normally done as part of that stacking
   // context need to be done manually and pushed over to the parent side,
   // where it will be done when we build the display list for the iframe.
   // That happens in WebRenderCompositableHolder.
   WrRect r = aSc.ToRelativeWrRect(aBounds);
-  aBuilder.PushIFrame(r, r, mPipelineId.ref());
+  aBuilder.PushIFrame(r, mPipelineId.ref());
 
   WrBridge()->AddWebRenderParentCommand(OpUpdateAsyncImagePipeline(mPipelineId.value(),
                                                                    aSCBounds,
                                                                    aSCTransform,
                                                                    aScaleToSize,
                                                                    aFilter,
                                                                    aMixBlendMode));
 }
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -579,17 +579,17 @@ DisplayListBuilder::PopStackingContext()
   WRDL_LOG("PopStackingContext\n");
   wr_dp_pop_stacking_context(mWrState);
 }
 
 void
 DisplayListBuilder::PushClip(const WrRect& aClipRect,
                              const WrImageMask* aMask)
 {
-  uint64_t clip_id = wr_dp_push_clip(mWrState, aClipRect, aMask);
+  uint64_t clip_id = wr_dp_push_clip(mWrState, aClipRect, nullptr, 0, aMask);
   WRDL_LOG("PushClip id=%" PRIu64 " r=%s m=%p b=%s\n", clip_id,
       Stringify(aClipRect).c_str(), aMask,
       aMask ? Stringify(aMask->rect).c_str() : "none");
   mClipIdStack.push_back(WrClipId { clip_id });
 }
 
 void
 DisplayListBuilder::PopClip()
@@ -654,52 +654,49 @@ void
 DisplayListBuilder::PushRect(const WrRect& aBounds,
                              const WrRect& aClip,
                              const WrColor& aColor)
 {
   WRDL_LOG("PushRect b=%s cl=%s c=%s\n",
       Stringify(aBounds).c_str(),
       Stringify(aClip).c_str(),
       Stringify(aColor).c_str());
-  WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
-  wr_dp_push_rect(mWrState, aBounds, tok, aColor);
+  wr_dp_push_rect(mWrState, aBounds, aClip, aColor);
 }
 
 void
 DisplayListBuilder::PushLinearGradient(const WrRect& aBounds,
                                        const WrRect& aClip,
                                        const WrPoint& aStartPoint,
                                        const WrPoint& aEndPoint,
                                        const nsTArray<WrGradientStop>& aStops,
                                        wr::GradientExtendMode aExtendMode,
                                        const WrSize aTileSize,
                                        const WrSize aTileSpacing)
 {
-  WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
   wr_dp_push_linear_gradient(mWrState,
-                             aBounds, tok,
+                             aBounds, aClip,
                              aStartPoint, aEndPoint,
                              aStops.Elements(), aStops.Length(),
                              aExtendMode,
                              aTileSize, aTileSpacing);
 }
 
 void
 DisplayListBuilder::PushRadialGradient(const WrRect& aBounds,
                                        const WrRect& aClip,
                                        const WrPoint& aCenter,
                                        const WrSize& aRadius,
                                        const nsTArray<WrGradientStop>& aStops,
                                        wr::GradientExtendMode aExtendMode,
                                        const WrSize aTileSize,
                                        const WrSize aTileSpacing)
 {
-  WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
   wr_dp_push_radial_gradient(mWrState,
-                             aBounds, tok,
+                             aBounds, aClip,
                              aCenter, aRadius,
                              aStops.Elements(), aStops.Length(),
                              aExtendMode,
                              aTileSize, aTileSpacing);
 }
 
 void
 DisplayListBuilder::PushImage(const WrRect& aBounds,
@@ -716,162 +713,151 @@ DisplayListBuilder::PushImage(const WrRe
 void
 DisplayListBuilder::PushImage(const WrRect& aBounds,
                               const WrRect& aClip,
                               const WrSize& aStretchSize,
                               const WrSize& aTileSpacing,
                               wr::ImageRendering aFilter,
                               wr::ImageKey aImage)
 {
-  WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
   WRDL_LOG("PushImage b=%s cl=%s s=%s t=%s\n", Stringify(aBounds).c_str(),
       Stringify(aClip).c_str(), Stringify(aStretchSize).c_str(),
       Stringify(aTileSpacing).c_str());
-  wr_dp_push_image(mWrState, aBounds, tok, aStretchSize, aTileSpacing, aFilter, aImage);
+  wr_dp_push_image(mWrState, aBounds, aClip, aStretchSize, aTileSpacing, aFilter, aImage);
 }
 
 void
 DisplayListBuilder::PushYCbCrPlanarImage(const WrRect& aBounds,
                                          const WrRect& aClip,
                                          wr::ImageKey aImageChannel0,
                                          wr::ImageKey aImageChannel1,
                                          wr::ImageKey aImageChannel2,
                                          WrYuvColorSpace aColorSpace,
                                          wr::ImageRendering aRendering)
 {
-  WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
   wr_dp_push_yuv_planar_image(mWrState,
                               aBounds,
-                              tok,
+                              aClip,
                               aImageChannel0,
                               aImageChannel1,
                               aImageChannel2,
                               aColorSpace,
                               aRendering);
 }
 
 void
 DisplayListBuilder::PushNV12Image(const WrRect& aBounds,
                                   const WrRect& aClip,
                                   wr::ImageKey aImageChannel0,
                                   wr::ImageKey aImageChannel1,
                                   WrYuvColorSpace aColorSpace,
                                   wr::ImageRendering aRendering)
 {
-  WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
   wr_dp_push_yuv_NV12_image(mWrState,
                             aBounds,
-                            tok,
+                            aClip,
                             aImageChannel0,
                             aImageChannel1,
                             aColorSpace,
                             aRendering);
 }
 
 void
 DisplayListBuilder::PushYCbCrInterleavedImage(const WrRect& aBounds,
                                               const WrRect& aClip,
                                               wr::ImageKey aImageChannel0,
                                               WrYuvColorSpace aColorSpace,
                                               wr::ImageRendering aRendering)
 {
-  WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
   wr_dp_push_yuv_interleaved_image(mWrState,
                                    aBounds,
-                                   tok,
+                                   aClip,
                                    aImageChannel0,
                                    aColorSpace,
                                    aRendering);
 }
 
 void
 DisplayListBuilder::PushIFrame(const WrRect& aBounds,
-                               const WrRect& aClip,
                                PipelineId aPipeline)
 {
-  WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
-  wr_dp_push_iframe(mWrState, aBounds, tok, aPipeline);
+  wr_dp_push_iframe(mWrState, aBounds, aPipeline);
 }
 
 void
 DisplayListBuilder::PushBorder(const WrRect& aBounds,
                                const WrRect& aClip,
                                const WrBorderWidths& aWidths,
                                const Range<const WrBorderSide>& aSides,
                                const WrBorderRadius& aRadius)
 {
   MOZ_ASSERT(aSides.length() == 4);
   if (aSides.length() != 4) {
     return;
   }
-  WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
-  wr_dp_push_border(mWrState, aBounds, tok,
+  wr_dp_push_border(mWrState, aBounds, aClip,
                     aWidths, aSides[0], aSides[1], aSides[2], aSides[3], aRadius);
 }
 
 void
 DisplayListBuilder::PushBorderImage(const WrRect& aBounds,
                                     const WrRect& aClip,
                                     const WrBorderWidths& aWidths,
                                     wr::ImageKey aImage,
                                     const WrNinePatchDescriptor& aPatch,
                                     const WrSideOffsets2Df32& aOutset,
                                     const WrRepeatMode& aRepeatHorizontal,
                                     const WrRepeatMode& aRepeatVertical)
 {
-  WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
-  wr_dp_push_border_image(mWrState, aBounds, tok,
+  wr_dp_push_border_image(mWrState, aBounds, aClip,
                           aWidths, aImage, aPatch, aOutset,
                           aRepeatHorizontal, aRepeatVertical);
 }
 
 void
 DisplayListBuilder::PushBorderGradient(const WrRect& aBounds,
                                        const WrRect& aClip,
                                        const WrBorderWidths& aWidths,
                                        const WrPoint& aStartPoint,
                                        const WrPoint& aEndPoint,
                                        const nsTArray<WrGradientStop>& aStops,
                                        wr::GradientExtendMode aExtendMode,
                                        const WrSideOffsets2Df32& aOutset)
 {
-  WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
-  wr_dp_push_border_gradient(mWrState, aBounds, tok,
+  wr_dp_push_border_gradient(mWrState, aBounds, aClip,
                              aWidths, aStartPoint, aEndPoint,
                              aStops.Elements(), aStops.Length(),
                              aExtendMode, aOutset);
 }
 
 void
 DisplayListBuilder::PushBorderRadialGradient(const WrRect& aBounds,
                                              const WrRect& aClip,
                                              const WrBorderWidths& aWidths,
                                              const WrPoint& aCenter,
                                              const WrSize& aRadius,
                                              const nsTArray<WrGradientStop>& aStops,
                                              wr::GradientExtendMode aExtendMode,
                                              const WrSideOffsets2Df32& aOutset)
 {
-  WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
   wr_dp_push_border_radial_gradient(
-    mWrState, aBounds, tok, aWidths, aCenter,
+    mWrState, aBounds, aClip, aWidths, aCenter,
     aRadius, aStops.Elements(), aStops.Length(),
     aExtendMode, aOutset);
 }
 
 void
 DisplayListBuilder::PushText(const WrRect& aBounds,
                              const WrRect& aClip,
                              const gfx::Color& aColor,
                              wr::FontKey aFontKey,
                              Range<const WrGlyphInstance> aGlyphBuffer,
                              float aGlyphSize)
 {
-  WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
-  wr_dp_push_text(mWrState, aBounds, tok,
+  wr_dp_push_text(mWrState, aBounds, aClip,
                   ToWrColor(aColor),
                   aFontKey,
                   &aGlyphBuffer[0], aGlyphBuffer.length(),
                   aGlyphSize);
 }
 
 void
 DisplayListBuilder::PushBoxShadow(const WrRect& aRect,
@@ -879,18 +865,17 @@ DisplayListBuilder::PushBoxShadow(const 
                                   const WrRect& aBoxBounds,
                                   const WrPoint& aOffset,
                                   const WrColor& aColor,
                                   const float& aBlurRadius,
                                   const float& aSpreadRadius,
                                   const float& aBorderRadius,
                                   const WrBoxShadowClipMode& aClipMode)
 {
-  WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
-  wr_dp_push_box_shadow(mWrState, aRect, tok,
+  wr_dp_push_box_shadow(mWrState, aRect, aClip,
                         aBoxBounds, aOffset, aColor,
                         aBlurRadius, aSpreadRadius, aBorderRadius,
                         aClipMode);
 }
 
 Maybe<WrClipId>
 DisplayListBuilder::TopmostClipId()
 {
--- a/gfx/webrender_bindings/WebRenderAPI.h
+++ b/gfx/webrender_bindings/WebRenderAPI.h
@@ -224,17 +224,16 @@ public:
 
   void PushYCbCrInterleavedImage(const WrRect& aBounds,
                                  const WrRect& aClip,
                                  wr::ImageKey aImageChannel0,
                                  WrYuvColorSpace aColorSpace,
                                  wr::ImageRendering aFilter);
 
   void PushIFrame(const WrRect& aBounds,
-                  const WrRect& aClip,
                   wr::PipelineId aPipeline);
 
   // XXX WrBorderSides are passed with Range.
   // It is just to bypass compiler bug. See Bug 1357734.
   void PushBorder(const WrRect& aBounds,
                   const WrRect& aClip,
                   const WrBorderWidths& aWidths,
                   const Range<const WrBorderSide>& aSides,
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -540,35 +540,16 @@ impl From<ClipRegion> for WrClipRegion {
                 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)]
@@ -1275,35 +1256,16 @@ 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_render_thread() });
     state.frame_builder.dl_builder.pop_stacking_context();
 }
 
 #[no_mangle]
-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_render_thread() });
-
-    let main = main.into();
-    let complex_slice = make_slice(complex, complex_count);
-    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.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,
                                               opacity: *const f32,
                                               transform: *const WrMatrix,
                                               transform_style: WrTransformStyle,
                                               mix_blend_mode: WrMixBlendMode,
                                               filters: *const WrFilterOp,
@@ -1360,33 +1322,36 @@ pub extern "C" fn wr_dp_push_stacking_co
 pub extern "C" fn wr_dp_pop_stacking_context(state: &mut WrState) {
     assert!(unsafe { !is_in_render_thread() });
     state.frame_builder.dl_builder.pop_stacking_context();
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_clip(state: &mut WrState,
                                   rect: WrRect,
+                                  complex: *const WrComplexClipRegion,
+                                  complex_count: usize,
                                   mask: *const WrImageMask)
                                   -> u64 {
     assert!(unsafe { is_in_main_thread() });
     let content_rect: LayoutRect = rect.into();
 
     // Both the clip rect and mask rect need to be relative to the
     // content rect when the clip region is being used as part of a clip item.
     // Since the clip_rect is the same as the content_rect we can just set the
     // origin to zero.
     let clip_rect = LayoutRect::new(LayoutPoint::zero(), content_rect.size);
+    let complex_slice = make_slice(complex, complex_count);
+    let complex_iter = complex_slice.iter().map(|x| x.into());
     let mut mask : Option<ImageMask> = unsafe { mask.as_ref() }.map(|x| x.into());
     if let Some(ref mut m) = mask {
         m.rect.origin = m.rect.origin - content_rect.origin.to_vector();
     }
 
-    let clip_region = state.frame_builder.dl_builder.push_clip_region(&clip_rect, vec![], mask);
-    let clip_id = state.frame_builder.dl_builder.define_clip(content_rect, clip_region, None);
+    let clip_id = state.frame_builder.dl_builder.define_clip(None, content_rect, clip_rect, complex_iter, mask);
     state.frame_builder.dl_builder.push_clip_id(clip_id);
     // return the u64 id value from inside the ClipId::Clip(..)
     match clip_id {
         ClipId::Clip(id, nesting_index, pipeline_id) => {
             assert!(pipeline_id == state.pipeline_id);
             assert!(nesting_index == 0);
             id
         },
@@ -1413,18 +1378,17 @@ pub extern "C" fn wr_dp_push_scroll_laye
         let content_rect: LayoutRect = content_rect.into();
 
         // Both the clip rect and mask rect need to be relative to the
         // content_rect when the clip region is being used as part of a clip
         // item. In this case there is no mask rect so that's a no-op.
         let mut clip_rect: LayoutRect = clip_rect.into();
         clip_rect.origin = clip_rect.origin - content_rect.origin.to_vector();
 
-        let clip_region = state.frame_builder.dl_builder.push_clip_region(&clip_rect, vec![], None);
-        state.frame_builder.dl_builder.define_clip(content_rect, clip_region, Some(clip_id));
+        state.frame_builder.dl_builder.define_clip(Some(clip_id), content_rect, clip_rect, vec![], None);
         state.frame_builder.scroll_clips_defined.insert(clip_id);
     }
     state.frame_builder.dl_builder.push_clip_id(clip_id);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_pop_scroll_layer(state: &mut WrState) {
     assert!(unsafe { is_in_main_thread() });
@@ -1461,37 +1425,36 @@ pub extern "C" fn wr_dp_push_clip_and_sc
 pub extern "C" fn wr_dp_pop_clip_and_scroll_info(state: &mut WrState) {
     assert!(unsafe { is_in_main_thread() });
     state.frame_builder.dl_builder.pop_clip_id();
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_iframe(state: &mut WrState,
                                     rect: WrRect,
-                                    clip: WrClipRegionToken,
                                     pipeline_id: WrPipelineId) {
     assert!(unsafe { is_in_main_thread() });
 
-    state.frame_builder.dl_builder.push_iframe(rect.into(), clip.into(), pipeline_id);
+    state.frame_builder.dl_builder.push_iframe(rect.into(), pipeline_id);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_rect(state: &mut WrState,
                                   rect: WrRect,
-                                  clip: WrClipRegionToken,
+                                  clip: WrRect,
                                   color: WrColor) {
     assert!(unsafe { !is_in_render_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: WrClipRegionToken,
+                                   clip: WrRect,
                                    stretch_size: WrSize,
                                    tile_spacing: WrSize,
                                    image_rendering: WrImageRendering,
                                    key: WrImageKey) {
     assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
 
     state.frame_builder
          .dl_builder
@@ -1502,17 +1465,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: WrClipRegionToken,
+                                              clip: WrRect,
                                               image_key_0: WrImageKey,
                                               image_key_1: WrImageKey,
                                               image_key_2: WrImageKey,
                                               color_space: WrYuvColorSpace,
                                               image_rendering: WrImageRendering) {
     assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
 
     state.frame_builder
@@ -1523,17 +1486,17 @@ pub extern "C" fn wr_dp_push_yuv_planar_
                          color_space,
                          image_rendering);
 }
 
 /// Push a 2 planar NV12 image.
 #[no_mangle]
 pub extern "C" fn wr_dp_push_yuv_NV12_image(state: &mut WrState,
                                             bounds: WrRect,
-                                            clip: WrClipRegionToken,
+                                            clip: WrRect,
                                             image_key_0: WrImageKey,
                                             image_key_1: WrImageKey,
                                             color_space: WrYuvColorSpace,
                                             image_rendering: WrImageRendering) {
     assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
 
     state.frame_builder
          .dl_builder
@@ -1543,17 +1506,17 @@ pub extern "C" fn wr_dp_push_yuv_NV12_im
                          color_space,
                          image_rendering);
 }
 
 /// Push a yuv interleaved image.
 #[no_mangle]
 pub extern "C" fn wr_dp_push_yuv_interleaved_image(state: &mut WrState,
                                                    bounds: WrRect,
-                                                   clip: WrClipRegionToken,
+                                                   clip: WrRect,
                                                    image_key_0: WrImageKey,
                                                    color_space: WrYuvColorSpace,
                                                    image_rendering: WrImageRendering) {
     assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
 
     state.frame_builder
          .dl_builder
          .push_yuv_image(bounds.into(),
@@ -1561,17 +1524,17 @@ pub extern "C" fn wr_dp_push_yuv_interle
                          YuvData::InterleavedYCbCr(image_key_0),
                          color_space,
                          image_rendering);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_text(state: &mut WrState,
                                   bounds: WrRect,
-                                  clip: WrClipRegionToken,
+                                  clip: WrRect,
                                   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);
@@ -1590,17 +1553,17 @@ pub extern "C" fn wr_dp_push_text(state:
                     Au::from_f32_px(glyph_size),
                     0.0,
                     glyph_options);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_border(state: &mut WrState,
                                     rect: WrRect,
-                                    clip: WrClipRegionToken,
+                                    clip: WrRect,
                                     widths: WrBorderWidths,
                                     top: WrBorderSide,
                                     right: WrBorderSide,
                                     bottom: WrBorderSide,
                                     left: WrBorderSide,
                                     radius: WrBorderRadius) {
     assert!(unsafe { is_in_main_thread() });
 
@@ -1614,17 +1577,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: WrClipRegionToken,
+                                          clip: WrRect,
                                           widths: WrBorderWidths,
                                           image: WrImageKey,
                                           patch: WrNinePatchDescriptor,
                                           outset: WrSideOffsets2Df32,
                                           repeat_horizontal: WrRepeatMode,
                                           repeat_vertical: WrRepeatMode) {
     assert!(unsafe { is_in_main_thread() });
     let border_details =
@@ -1639,17 +1602,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: WrClipRegionToken,
+                                             clip: WrRect,
                                              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() });
@@ -1670,17 +1633,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: WrClipRegionToken,
+                                                    clip: WrRect,
                                                     widths: WrBorderWidths,
                                                     center: WrPoint,
                                                     radius: WrSize,
                                                     stops: *const WrGradientStop,
                                                     stops_count: usize,
                                                     extend_mode: WrGradientExtendMode,
                                                     outset: WrSideOffsets2Df32) {
     assert!(unsafe { is_in_main_thread() });
@@ -1702,17 +1665,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: WrClipRegionToken,
+                                             clip: WrRect,
                                              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() });
@@ -1732,17 +1695,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: WrClipRegionToken,
+                                             clip: WrRect,
                                              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() });
@@ -1762,17 +1725,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: WrClipRegionToken,
+                                        clip: WrRect,
                                         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() });
--- a/gfx/webrender_bindings/webrender_ffi_generated.h
+++ b/gfx/webrender_bindings/webrender_ffi_generated.h
@@ -315,24 +315,16 @@ struct WrRect {
   bool operator==(const WrRect& aOther) const {
     return x == aOther.x &&
            y == aOther.y &&
            width == aOther.width &&
            height == aOther.height;
   }
 };
 
-struct WrClipRegionToken {
-  bool _dummy;
-
-  bool operator==(const WrClipRegionToken& aOther) const {
-    return _dummy == aOther._dummy;
-  }
-};
-
 struct WrBorderWidths {
   float left;
   float top;
   float right;
   float bottom;
 
   bool operator==(const WrBorderWidths& aOther) const {
     return left == aOther.left &&
@@ -421,38 +413,38 @@ struct WrNinePatchDescriptor {
 
   bool operator==(const WrNinePatchDescriptor& aOther) const {
     return width == aOther.width &&
            height == aOther.height &&
            slice == aOther.slice;
   }
 };
 
+struct WrComplexClipRegion {
+  WrRect rect;
+  WrBorderRadius radii;
+
+  bool operator==(const WrComplexClipRegion& aOther) const {
+    return rect == aOther.rect &&
+           radii == aOther.radii;
+  }
+};
+
 struct WrImageMask {
   WrImageKey image;
   WrRect rect;
   bool repeat;
 
   bool operator==(const WrImageMask& aOther) const {
     return image == aOther.image &&
            rect == aOther.rect &&
            repeat == aOther.repeat;
   }
 };
 
-struct WrComplexClipRegion {
-  WrRect rect;
-  WrBorderRadius radii;
-
-  bool operator==(const WrComplexClipRegion& aOther) const {
-    return rect == aOther.rect &&
-           radii == aOther.radii;
-  }
-};
-
 struct WrFilterOp {
   WrFilterOpType filter_type;
   float argument;
 
   bool operator==(const WrFilterOp& aOther) const {
     return filter_type == aOther.filter_type &&
            argument == aOther.argument;
   }
@@ -678,67 +670,67 @@ WR_FUNC;
 
 WR_INLINE
 void wr_dp_pop_stacking_context(WrState *aState)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_border(WrState *aState,
                        WrRect aRect,
-                       WrClipRegionToken aClip,
+                       WrRect aClip,
                        WrBorderWidths aWidths,
                        WrBorderSide aTop,
                        WrBorderSide aRight,
                        WrBorderSide aBottom,
                        WrBorderSide aLeft,
                        WrBorderRadius aRadius)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_border_gradient(WrState *aState,
                                 WrRect aRect,
-                                WrClipRegionToken aClip,
+                                WrRect aClip,
                                 WrBorderWidths aWidths,
                                 WrPoint aStartPoint,
                                 WrPoint aEndPoint,
                                 const WrGradientStop *aStops,
                                 size_t aStopsCount,
                                 WrGradientExtendMode aExtendMode,
                                 WrSideOffsets2Df32 aOutset)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_border_image(WrState *aState,
                              WrRect aRect,
-                             WrClipRegionToken aClip,
+                             WrRect aClip,
                              WrBorderWidths aWidths,
                              WrImageKey aImage,
                              WrNinePatchDescriptor aPatch,
                              WrSideOffsets2Df32 aOutset,
                              WrRepeatMode aRepeatHorizontal,
                              WrRepeatMode aRepeatVertical)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_border_radial_gradient(WrState *aState,
                                        WrRect aRect,
-                                       WrClipRegionToken aClip,
+                                       WrRect aClip,
                                        WrBorderWidths aWidths,
                                        WrPoint aCenter,
                                        WrSize aRadius,
                                        const WrGradientStop *aStops,
                                        size_t aStopsCount,
                                        WrGradientExtendMode aExtendMode,
                                        WrSideOffsets2Df32 aOutset)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_box_shadow(WrState *aState,
                            WrRect aRect,
-                           WrClipRegionToken aClip,
+                           WrRect aClip,
                            WrRect aBoxBounds,
                            WrPoint aOffset,
                            WrColor aColor,
                            float aBlurRadius,
                            float aSpreadRadius,
                            float aBorderRadius,
                            WrBoxShadowClipMode aClipMode)
 WR_FUNC;
@@ -747,80 +739,73 @@ WR_INLINE
 void wr_dp_push_built_display_list(WrState *aState,
                                    WrBuiltDisplayListDescriptor aDlDescriptor,
                                    WrVecU8 *aDlData)
 WR_FUNC;
 
 WR_INLINE
 uint64_t wr_dp_push_clip(WrState *aState,
                          WrRect aRect,
+                         const WrComplexClipRegion *aComplex,
+                         size_t aComplexCount,
                          const WrImageMask *aMask)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_clip_and_scroll_info(WrState *aState,
                                      uint64_t aScrollId,
                                      const uint64_t *aClipId)
 WR_FUNC;
 
 WR_INLINE
-WrClipRegionToken wr_dp_push_clip_region(WrState *aState,
-                                         WrRect aMain,
-                                         const WrComplexClipRegion *aComplex,
-                                         size_t aComplexCount,
-                                         const WrImageMask *aImageMask)
-WR_FUNC;
-
-WR_INLINE
 void wr_dp_push_iframe(WrState *aState,
                        WrRect aRect,
-                       WrClipRegionToken aClip,
                        WrPipelineId aPipelineId)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_image(WrState *aState,
                       WrRect aBounds,
-                      WrClipRegionToken aClip,
+                      WrRect aClip,
                       WrSize aStretchSize,
                       WrSize aTileSpacing,
                       WrImageRendering aImageRendering,
                       WrImageKey aKey)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_linear_gradient(WrState *aState,
                                 WrRect aRect,
-                                WrClipRegionToken aClip,
+                                WrRect aClip,
                                 WrPoint aStartPoint,
                                 WrPoint aEndPoint,
                                 const WrGradientStop *aStops,
                                 size_t aStopsCount,
                                 WrGradientExtendMode aExtendMode,
                                 WrSize aTileSize,
                                 WrSize aTileSpacing)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_radial_gradient(WrState *aState,
                                 WrRect aRect,
-                                WrClipRegionToken aClip,
+                                WrRect aClip,
                                 WrPoint aCenter,
                                 WrSize aRadius,
                                 const WrGradientStop *aStops,
                                 size_t aStopsCount,
                                 WrGradientExtendMode aExtendMode,
                                 WrSize aTileSize,
                                 WrSize aTileSpacing)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_rect(WrState *aState,
                      WrRect aRect,
-                     WrClipRegionToken aClip,
+                     WrRect aClip,
                      WrColor aColor)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_scroll_layer(WrState *aState,
                              uint64_t aScrollId,
                              WrRect aContentRect,
                              WrRect aClipRect)
@@ -836,47 +821,47 @@ void wr_dp_push_stacking_context(WrState
                                  WrMixBlendMode aMixBlendMode,
                                  const WrFilterOp *aFilters,
                                  size_t aFilterCount)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_text(WrState *aState,
                      WrRect aBounds,
-                     WrClipRegionToken aClip,
+                     WrRect aClip,
                      WrColor aColor,
                      WrFontKey aFontKey,
                      const WrGlyphInstance *aGlyphs,
                      uint32_t aGlyphCount,
                      float aGlyphSize)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_yuv_NV12_image(WrState *aState,
                                WrRect aBounds,
-                               WrClipRegionToken aClip,
+                               WrRect aClip,
                                WrImageKey aImageKey0,
                                WrImageKey aImageKey1,
                                WrYuvColorSpace aColorSpace,
                                WrImageRendering aImageRendering)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_yuv_interleaved_image(WrState *aState,
                                       WrRect aBounds,
-                                      WrClipRegionToken aClip,
+                                      WrRect aClip,
                                       WrImageKey aImageKey0,
                                       WrYuvColorSpace aColorSpace,
                                       WrImageRendering aImageRendering)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_yuv_planar_image(WrState *aState,
                                  WrRect aBounds,
-                                 WrClipRegionToken aClip,
+                                 WrRect aClip,
                                  WrImageKey aImageKey0,
                                  WrImageKey aImageKey1,
                                  WrImageKey aImageKey2,
                                  WrYuvColorSpace aColorSpace,
                                  WrImageRendering aImageRendering)
 WR_FUNC;
 
 WR_INLINE