Bug 1507140 - Gecko changes for WebRender PR #3291. r=kats
authorNicolas Silva <nsilva@mozilla.com>
Fri, 16 Nov 2018 17:13:26 +0000
changeset 446793 59d8473f176488a5e8aa95b8ca34d0ac4f0e0840
parent 446792 efa160d5e7d6a69c69815903c137039a50a96fd0
child 446794 e97253b0e95c20792e31a72a435be3f1c50195f4
push id35052
push userapavel@mozilla.com
push dateSat, 17 Nov 2018 11:25:40 +0000
treeherdermozilla-central@efc1da42132b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1507140
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1507140 - Gecko changes for WebRender PR #3291. r=kats Move wr::DeviceUint* to wr::DeviceInt*. Differential Revision: https://phabricator.services.mozilla.com/D12150
gfx/layers/wr/WebRenderBridgeParent.cpp
gfx/webrender_bindings/Moz2DImageRenderer.cpp
gfx/webrender_bindings/WebRenderAPI.cpp
gfx/webrender_bindings/WebRenderAPI.h
gfx/webrender_bindings/WebRenderTypes.h
gfx/webrender_bindings/src/bindings.rs
gfx/webrender_bindings/src/moz2d_renderer.rs
gfx/webrender_bindings/webrender_ffi_generated.h
layout/painting/nsCSSRenderingBorders.cpp
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -440,22 +440,22 @@ WebRenderBridgeParent::UpdateResources(c
         break;
       }
       case OpUpdateResource::TOpUpdateBlobImage: {
         const auto& op = cmd.get_OpUpdateBlobImage();
         wr::Vec<uint8_t> bytes;
         if (!reader.Read(op.bytes(), bytes)) {
           return false;
         }
-        aUpdates.UpdateBlobImage(op.key(), op.descriptor(), bytes, wr::ToDeviceUintRect(op.dirtyRect()));
+        aUpdates.UpdateBlobImage(op.key(), op.descriptor(), bytes, wr::ToDeviceIntRect(op.dirtyRect()));
         break;
       }
       case OpUpdateResource::TOpSetImageVisibleArea: {
         const auto& op = cmd.get_OpSetImageVisibleArea();
-        wr::DeviceUintRect area;
+        wr::DeviceIntRect area;
         area.origin.x = op.area().x;
         area.origin.y = op.area().y;
         area.size.width = op.area().width;
         area.size.height = op.area().height;
         aUpdates.SetImageVisibleArea(op.key(), area);
         break;
       }
       case OpUpdateResource::TOpAddExternalImage: {
@@ -694,17 +694,17 @@ WebRenderBridgeParent::UpdateExternalIma
     it->second = aExtId;
   }
 
   if (!gfxEnv::EnableWebRenderRecording()) {
     wr::ImageDescriptor descriptor(dSurf->GetSize(), dSurf->Stride(),
                                    dSurf->GetFormat());
     aResources.UpdateExternalImageWithDirtyRect(aKey, descriptor, aExtId,
                                                 wr::WrExternalImageBufferType::ExternalBuffer,
-                                                wr::ToDeviceUintRect(aDirtyRect),
+                                                wr::ToDeviceIntRect(aDirtyRect),
                                                 0);
     return true;
   }
 
   DataSourceSurface::ScopedMap map(dSurf, DataSourceSurface::READ);
   if (!map.IsMapped()) {
     gfxCriticalNote << "DataSourceSurface failed to map for Image for extId:" << wr::AsUint64(aExtId);
     return false;
--- a/gfx/webrender_bindings/Moz2DImageRenderer.cpp
+++ b/gfx/webrender_bindings/Moz2DImageRenderer.cpp
@@ -318,17 +318,17 @@ GetScaledFont(Translator* aTranslator, W
   return data.mScaledFont;
 }
 
 static bool Moz2DRenderCallback(const Range<const uint8_t> aBlob,
                                 gfx::IntSize aSize,
                                 gfx::SurfaceFormat aFormat,
                                 const uint16_t *aTileSize,
                                 const mozilla::wr::TileOffset *aTileOffset,
-                                const mozilla::wr::DeviceUintRect *aDirtyRect,
+                                const mozilla::wr::DeviceIntRect *aDirtyRect,
                                 Range<uint8_t> aOutput)
 {
   AUTO_PROFILER_TRACING("WebRender", "RasterizeSingleBlob");
   MOZ_ASSERT(aSize.width > 0 && aSize.height > 0);
   if (aSize.width <= 0 || aSize.height <= 0) {
     return false;
   }
 
@@ -477,21 +477,21 @@ static bool Moz2DRenderCallback(const Ra
 }
 
 } // namespace
 } // namespace
 
 extern "C" {
 
 bool wr_moz2d_render_cb(const mozilla::wr::ByteSlice blob,
-                        uint32_t width, uint32_t height,
+                        int32_t width, int32_t height,
                         mozilla::wr::ImageFormat aFormat,
                         const uint16_t *aTileSize,
                         const mozilla::wr::TileOffset *aTileOffset,
-                        const mozilla::wr::DeviceUintRect *aDirtyRect,
+                        const mozilla::wr::DeviceIntRect *aDirtyRect,
                         mozilla::wr::MutByteSlice output)
 {
   return mozilla::wr::Moz2DRenderCallback(mozilla::wr::ByteSliceToRange(blob),
                                           mozilla::gfx::IntSize(width, height),
                                           mozilla::wr::ImageFormatToSurfaceFormat(aFormat),
                                           aTileSize,
                                           aTileOffset,
                                           aDirtyRect,
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -26,17 +26,17 @@ using layers::Stringify;
 
 MOZ_DEFINE_MALLOC_SIZE_OF(WebRenderMallocSizeOf)
 
 class NewRenderer : public RendererEvent
 {
 public:
   NewRenderer(wr::DocumentHandle** aDocHandle,
               layers::CompositorBridgeParent* aBridge,
-              uint32_t* aMaxTextureSize,
+              int32_t* aMaxTextureSize,
               bool* aUseANGLE,
               bool* aUseDComp,
               bool* aUseTripleBuffering,
               RefPtr<widget::CompositorWidget>&& aWidget,
               layers::SynchronousTask* aTask,
               LayoutDeviceIntSize aSize,
               layers::SyncHandle* aHandle)
     : mDocHandle(aDocHandle)
@@ -105,17 +105,17 @@ public:
       }
     }
 
     aRenderThread.AddRenderer(aWindowId, std::move(renderer));
   }
 
 private:
   wr::DocumentHandle** mDocHandle;
-  uint32_t* mMaxTextureSize;
+  int32_t* mMaxTextureSize;
   bool* mUseANGLE;
   bool* mUseDComp;
   bool* mUseTripleBuffering;
   layers::CompositorBridgeParent* mBridge;
   RefPtr<widget::CompositorWidget> mCompositorWidget;
   layers::SynchronousTask* mTask;
   LayoutDeviceIntSize mSize;
   layers::SyncHandle* mSyncHandle;
@@ -235,20 +235,20 @@ TransactionBuilder::IsEmpty() const
 {
   return wr_transaction_is_empty(mTxn);
 }
 
 void
 TransactionBuilder::SetWindowParameters(const LayoutDeviceIntSize& aWindowSize,
                                         const LayoutDeviceIntRect& aDocumentRect)
 {
-  wr::DeviceUintSize wrWindowSize;
+  wr::DeviceIntSize wrWindowSize;
   wrWindowSize.width = aWindowSize.width;
   wrWindowSize.height = aWindowSize.height;
-  wr::DeviceUintRect wrDocRect;
+  wr::DeviceIntRect wrDocRect;
   wrDocRect.origin.x = aDocumentRect.x;
   wrDocRect.origin.y = aDocumentRect.y;
   wrDocRect.size.width = aDocumentRect.width;
   wrDocRect.size.height = aDocumentRect.height;
   wr_transaction_set_window_parameters(mTxn, &wrWindowSize, &wrDocRect);
 }
 
 void
@@ -294,17 +294,17 @@ WebRenderAPI::Create(layers::CompositorB
                      LayoutDeviceIntSize aSize)
 {
   MOZ_ASSERT(aBridge);
   MOZ_ASSERT(aWidget);
   static_assert(sizeof(size_t) == sizeof(uintptr_t),
       "The FFI bindings assume size_t is the same size as uintptr_t!");
 
   wr::DocumentHandle* docHandle = nullptr;
-  uint32_t maxTextureSize = 0;
+  int32_t maxTextureSize = 0;
   bool useANGLE = false;
   bool useDComp = false;
   bool useTripleBuffering = false;
   layers::SyncHandle syncHandle = 0;
 
   // Dispatch a synchronous task because the DocumentHandle object needs to be created
   // on the render thread. If need be we could delay waiting on this task until
   // the next time we need to access the DocumentHandle object.
@@ -333,17 +333,17 @@ WebRenderAPI::Clone()
   renderApi->mRootApi = this; // Hold root api
   renderApi->mRootDocumentApi = this;
   return renderApi.forget();
 }
 
 already_AddRefed<WebRenderAPI>
 WebRenderAPI::CreateDocument(LayoutDeviceIntSize aSize, int8_t aLayerIndex)
 {
-  wr::DeviceUintSize wrSize;
+  wr::DeviceIntSize wrSize;
   wrSize.width = aSize.width;
   wrSize.height = aSize.height;
   wr::DocumentHandle* newDoc;
 
   wr_api_create_document(mDocHandle, &newDoc, wrSize, aLayerIndex);
 
   RefPtr<WebRenderAPI> api(new WebRenderAPI(newDoc, mId,
                                             mMaxTextureSize,
@@ -666,17 +666,17 @@ TransactionBuilder::UpdateImageBuffer(Im
                                    &aDescriptor,
                                    &aBytes.inner);
 }
 
 void
 TransactionBuilder::UpdateBlobImage(ImageKey aKey,
                                     const ImageDescriptor& aDescriptor,
                                     wr::Vec<uint8_t>& aBytes,
-                                    const wr::DeviceUintRect& aDirtyRect)
+                                    const wr::DeviceIntRect& aDirtyRect)
 {
   wr_resource_updates_update_blob_image(mTxn,
                                         aKey,
                                         &aDescriptor,
                                         &aBytes.inner,
                                         aDirtyRect);
 }
 
@@ -695,31 +695,31 @@ TransactionBuilder::UpdateExternalImage(
                                             aChannelIndex);
 }
 
 void
 TransactionBuilder::UpdateExternalImageWithDirtyRect(ImageKey aKey,
                                                      const ImageDescriptor& aDescriptor,
                                                      ExternalImageId aExtID,
                                                      wr::WrExternalImageBufferType aBufferType,
-                                                     const wr::DeviceUintRect& aDirtyRect,
+                                                     const wr::DeviceIntRect& aDirtyRect,
                                                      uint8_t aChannelIndex)
 {
   wr_resource_updates_update_external_image_with_dirty_rect(mTxn,
                                                             aKey,
                                                             &aDescriptor,
                                                             aExtID,
                                                             aBufferType,
                                                             aChannelIndex,
                                                             aDirtyRect);
 }
 
 void
 TransactionBuilder::SetImageVisibleArea(ImageKey aKey,
-                                        const wr::DeviceUintRect& aArea)
+                                        const wr::DeviceIntRect& aArea)
 {
   wr_resource_updates_set_image_visible_area(mTxn, aKey, &aArea);
 }
 
 void
 TransactionBuilder::DeleteImage(ImageKey aKey)
 {
   wr_resource_updates_delete_image(mTxn, aKey);
@@ -1226,36 +1226,36 @@ DisplayListBuilder::PushBorder(const wr:
 }
 
 void
 DisplayListBuilder::PushBorderImage(const wr::LayoutRect& aBounds,
                                     const wr::LayoutRect& aClip,
                                     bool aIsBackfaceVisible,
                                     const wr::LayoutSideOffsets& aWidths,
                                     wr::ImageKey aImage,
-                                    const uint32_t aWidth,
-                                    const uint32_t aHeight,
-                                    const wr::SideOffsets2D<uint32_t>& aSlice,
+                                    const int32_t aWidth,
+                                    const int32_t aHeight,
+                                    const wr::SideOffsets2D<int32_t>& aSlice,
                                     const wr::SideOffsets2D<float>& aOutset,
                                     const wr::RepeatMode& aRepeatHorizontal,
                                     const wr::RepeatMode& aRepeatVertical)
 {
   wr_dp_push_border_image(mWrState, aBounds, MergeClipLeaf(aClip),
                           aIsBackfaceVisible, aWidths, aImage, aWidth, aHeight,
                           aSlice, aOutset, aRepeatHorizontal, aRepeatVertical);
 }
 
 void
 DisplayListBuilder::PushBorderGradient(const wr::LayoutRect& aBounds,
                                        const wr::LayoutRect& aClip,
                                        bool aIsBackfaceVisible,
                                        const wr::LayoutSideOffsets& aWidths,
-                                       const uint32_t aWidth,
-                                       const uint32_t aHeight,
-                                       const wr::SideOffsets2D<uint32_t>& aSlice,
+                                       const int32_t aWidth,
+                                       const int32_t aHeight,
+                                       const wr::SideOffsets2D<int32_t>& aSlice,
                                        const wr::LayoutPoint& aStartPoint,
                                        const wr::LayoutPoint& aEndPoint,
                                        const nsTArray<wr::GradientStop>& aStops,
                                        wr::ExtendMode aExtendMode,
                                        const wr::SideOffsets2D<float>& aOutset)
 {
   wr_dp_push_border_gradient(mWrState, aBounds, MergeClipLeaf(aClip),
                              aIsBackfaceVisible, aWidths, aWidth, aHeight,
--- a/gfx/webrender_bindings/WebRenderAPI.h
+++ b/gfx/webrender_bindings/WebRenderAPI.h
@@ -123,32 +123,32 @@ public:
 
   void UpdateImageBuffer(wr::ImageKey aKey,
                          const ImageDescriptor& aDescriptor,
                          wr::Vec<uint8_t>& aBytes);
 
   void UpdateBlobImage(wr::ImageKey aKey,
                        const ImageDescriptor& aDescriptor,
                        wr::Vec<uint8_t>& aBytes,
-                       const wr::DeviceUintRect& aDirtyRect);
+                       const wr::DeviceIntRect& aDirtyRect);
 
   void UpdateExternalImage(ImageKey aKey,
                            const ImageDescriptor& aDescriptor,
                            ExternalImageId aExtID,
                            wr::WrExternalImageBufferType aBufferType,
                            uint8_t aChannelIndex = 0);
 
   void UpdateExternalImageWithDirtyRect(ImageKey aKey,
                                         const ImageDescriptor& aDescriptor,
                                         ExternalImageId aExtID,
                                         wr::WrExternalImageBufferType aBufferType,
-                                        const wr::DeviceUintRect& aDirtyRect,
+                                        const wr::DeviceIntRect& aDirtyRect,
                                         uint8_t aChannelIndex = 0);
 
-  void SetImageVisibleArea(ImageKey aKey, const wr::DeviceUintRect& aArea);
+  void SetImageVisibleArea(ImageKey aKey, const wr::DeviceIntRect& aArea);
 
   void DeleteImage(wr::ImageKey aKey);
 
   void AddRawFont(wr::FontKey aKey, wr::Vec<uint8_t>& aBytes, uint32_t aIndex);
 
   void AddFontDescriptor(wr::FontKey aKey, wr::Vec<uint8_t>& aBytes, uint32_t aIndex);
 
   void DeleteFont(wr::FontKey aKey);
@@ -233,33 +233,33 @@ public:
   bool GetUseANGLE() const { return mUseANGLE; }
   bool GetUseDComp() const { return mUseDComp; }
   bool GetUseTripleBuffering() const { return mUseTripleBuffering; }
   layers::SyncHandle GetSyncHandle() const { return mSyncHandle; }
 
   void Capture();
 
 protected:
-  WebRenderAPI(wr::DocumentHandle* aHandle, wr::WindowId aId, uint32_t aMaxTextureSize, bool aUseANGLE, bool aUseDComp, bool aUseTripleBuffering, layers::SyncHandle aSyncHandle)
+  WebRenderAPI(wr::DocumentHandle* aHandle, wr::WindowId aId, int32_t aMaxTextureSize, bool aUseANGLE, bool aUseDComp, bool aUseTripleBuffering, layers::SyncHandle aSyncHandle)
     : mDocHandle(aHandle)
     , mId(aId)
     , mMaxTextureSize(aMaxTextureSize)
     , mUseANGLE(aUseANGLE)
     , mUseDComp(aUseDComp)
     , mUseTripleBuffering(aUseTripleBuffering)
     , mSyncHandle(aSyncHandle)
   {}
 
   ~WebRenderAPI();
   // Should be used only for shutdown handling
   void WaitFlushed();
 
   wr::DocumentHandle* mDocHandle;
   wr::WindowId mId;
-  uint32_t mMaxTextureSize;
+  int32_t mMaxTextureSize;
   bool mUseANGLE;
   bool mUseDComp;
   bool mUseTripleBuffering;
   layers::SyncHandle mSyncHandle;
 
   // We maintain alive the root api to know when to shut the render backend down,
   // and the root api for the document to know when to delete the document.
   // mRootApi is null for the api object that owns the channel (and is responsible
@@ -450,30 +450,30 @@ public:
                   const wr::BorderRadius& aRadius,
                   wr::AntialiasBorder = wr::AntialiasBorder::Yes);
 
   void PushBorderImage(const wr::LayoutRect& aBounds,
                        const wr::LayoutRect& aClip,
                        bool aIsBackfaceVisible,
                        const wr::LayoutSideOffsets& aWidths,
                        wr::ImageKey aImage,
-                       const uint32_t aWidth,
-                       const uint32_t aHeight,
-                       const wr::SideOffsets2D<uint32_t>& aSlice,
+                       const int32_t aWidth,
+                       const int32_t aHeight,
+                       const wr::SideOffsets2D<int32_t>& aSlice,
                        const wr::SideOffsets2D<float>& aOutset,
                        const wr::RepeatMode& aRepeatHorizontal,
                        const wr::RepeatMode& aRepeatVertical);
 
   void PushBorderGradient(const wr::LayoutRect& aBounds,
                           const wr::LayoutRect& aClip,
                           bool aIsBackfaceVisible,
                           const wr::LayoutSideOffsets& aWidths,
-                          const uint32_t aWidth,
-                          const uint32_t aHeight,
-                          const wr::SideOffsets2D<uint32_t>& aSlice,
+                          const int32_t aWidth,
+                          const int32_t aHeight,
+                          const wr::SideOffsets2D<int32_t>& aSlice,
                           const wr::LayoutPoint& aStartPoint,
                           const wr::LayoutPoint& aEndPoint,
                           const nsTArray<wr::GradientStop>& aStops,
                           wr::ExtendMode aExtendMode,
                           const wr::SideOffsets2D<float>& aOutset);
 
   void PushBorderRadialGradient(const wr::LayoutRect& aBounds,
                                 const wr::LayoutRect& aClip,
--- a/gfx/webrender_bindings/WebRenderTypes.h
+++ b/gfx/webrender_bindings/WebRenderTypes.h
@@ -342,19 +342,19 @@ static inline wr::LayoutRect ToLayoutRec
   wr::LayoutRect r;
   r.origin.x = rect.X();
   r.origin.y = rect.Y();
   r.size.width = rect.Width();
   r.size.height = rect.Height();
   return r;
 }
 
-static inline wr::DeviceUintRect ToDeviceUintRect(const mozilla::ImageIntRect& rect)
+static inline wr::DeviceIntRect ToDeviceIntRect(const mozilla::ImageIntRect& rect)
 {
-  wr::DeviceUintRect r;
+  wr::DeviceIntRect r;
   r.origin.x = rect.X();
   r.origin.y = rect.Y();
   r.size.width = rect.Width();
   r.size.height = rect.Height();
   return r;
 }
 
 static inline wr::LayoutRect ToLayoutRect(const mozilla::LayoutDeviceIntRect& rect)
@@ -533,19 +533,19 @@ static inline wr::LayoutSideOffsets ToBo
   wr::LayoutSideOffsets bw;
   bw.top = top;
   bw.right = right;
   bw.bottom = bottom;
   bw.left = left;
   return bw;
 }
 
-static inline wr::SideOffsets2D<uint32_t> ToSideOffsets2D_u32(uint32_t top, uint32_t right, uint32_t bottom, uint32_t left)
+static inline wr::SideOffsets2D<int32_t> ToSideOffsets2D_i32(int32_t top, int32_t right, int32_t bottom, int32_t left)
 {
-  SideOffsets2D<uint32_t> offset;
+  SideOffsets2D<int32_t> offset;
   offset.top = top;
   offset.right = right;
   offset.bottom = bottom;
   offset.left = left;
   return offset;
 }
 
 static inline wr::SideOffsets2D<float> ToSideOffsets2D_f32(float top, float right, float bottom, float left)
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -131,17 +131,17 @@ fn make_slice_mut<'a, T>(ptr: *mut T, le
 }
 
 pub struct DocumentHandle {
     api: RenderApi,
     document_id: DocumentId,
 }
 
 impl DocumentHandle {
-    pub fn new(api: RenderApi, size: DeviceUintSize, layer: i8) -> DocumentHandle {
+    pub fn new(api: RenderApi, size: DeviceIntSize, layer: i8) -> DocumentHandle {
         let doc = api.add_document(size, layer);
         DocumentHandle {
             api: api,
             document_id: doc
         }
     }
 }
 
@@ -312,26 +312,26 @@ impl From<ImageMask> for WrImageMask {
         }
     }
 }
 
 #[repr(C)]
 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
 pub struct WrImageDescriptor {
     pub format: ImageFormat,
-    pub width: u32,
-    pub height: u32,
-    pub stride: u32,
+    pub width: i32,
+    pub height: i32,
+    pub stride: i32,
     pub opacity: OpacityType,
 }
 
 impl<'a> Into<ImageDescriptor> for &'a WrImageDescriptor {
     fn into(self) -> ImageDescriptor {
         ImageDescriptor {
-            size: DeviceUintSize::new(self.width, self.height),
+            size: DeviceIntSize::new(self.width, self.height),
             stride: if self.stride != 0 {
                 Some(self.stride)
             } else {
                 None
             },
             format: self.format,
             is_opaque: self.opacity == OpacityType::Opaque,
             offset: 0,
@@ -602,24 +602,24 @@ pub extern "C" fn wr_renderer_set_extern
 
 #[no_mangle]
 pub extern "C" fn wr_renderer_update(renderer: &mut Renderer) {
     renderer.update();
 }
 
 #[no_mangle]
 pub extern "C" fn wr_renderer_render(renderer: &mut Renderer,
-                                     width: u32,
-                                     height: u32,
+                                     width: i32,
+                                     height: i32,
                                      had_slow_frame: bool,
                                      out_stats: &mut RendererStats) -> bool {
     if had_slow_frame {
       renderer.notify_slow_frame();
     }
-    match renderer.render(DeviceUintSize::new(width, height)) {
+    match renderer.render(DeviceIntSize::new(width, height)) {
         Ok(stats) => {
             *out_stats = stats;
             true
         }
         Err(errors) => {
             for e in errors {
                 warn!(" Failed to render: {:?}", e);
                 let msg = CString::new(format!("wr_renderer_render: {:?}", e)).unwrap();
@@ -630,26 +630,26 @@ pub extern "C" fn wr_renderer_render(ren
             false
         },
     }
 }
 
 // Call wr_renderer_render() before calling this function.
 #[no_mangle]
 pub unsafe extern "C" fn wr_renderer_readback(renderer: &mut Renderer,
-                                              width: u32,
-                                              height: u32,
+                                              width: i32,
+                                              height: i32,
                                               dst_buffer: *mut u8,
                                               buffer_size: usize) {
     assert!(is_in_render_thread());
 
     let mut slice = make_slice_mut(dst_buffer, buffer_size);
-    renderer.read_pixels_into(DeviceUintRect::new(
-                                DeviceUintPoint::new(0, 0),
-                                DeviceUintSize::new(width, height)),
+    renderer.read_pixels_into(DeviceIntRect::new(
+                                DeviceIntPoint::new(0, 0),
+                                DeviceIntSize::new(width, height)),
                               ReadPixelsFormat::Standard(ImageFormat::BGRA8),
                               &mut slice);
 }
 
 /// cbindgen:field-names=[mBits]
 #[repr(C)]
 pub struct WrDebugFlags {
     bits: u32,
@@ -1005,27 +1005,27 @@ fn wr_device_new(gl_context: *mut c_void
     };
 
     Device::new(gl, resource_override_path, upload_method, cached_programs)
 }
 
 // Call MakeCurrent before this.
 #[no_mangle]
 pub extern "C" fn wr_window_new(window_id: WrWindowId,
-                                window_width: u32,
-                                window_height: u32,
+                                window_width: i32,
+                                window_height: i32,
                                 support_low_priority_transactions: bool,
                                 gl_context: *mut c_void,
                                 program_cache: Option<&mut WrProgramCache>,
                                 shaders: Option<&mut WrShaders>,
                                 thread_pool: *mut WrThreadPool,
                                 size_of_op: VoidPtrToSizeFn,
                                 out_handle: &mut *mut DocumentHandle,
                                 out_renderer: &mut *mut Renderer,
-                                out_max_texture_size: *mut u32)
+                                out_max_texture_size: *mut i32)
                                 -> bool {
     assert!(unsafe { is_in_render_thread() });
 
     let recorder: Option<Box<ApiRecordingReceiver>> = if unsafe { gfx_use_wrench() } {
         let name = format!("wr-record-{}.bin", window_id.0);
         Some(Box::new(BinaryRecorder::new(&PathBuf::from(name))))
     } else {
         None
@@ -1109,30 +1109,30 @@ pub extern "C" fn wr_window_new(window_i
             }
             return false;
         },
     };
 
     unsafe {
         *out_max_texture_size = renderer.get_max_texture_size();
     }
-    let window_size = DeviceUintSize::new(window_width, window_height);
+    let window_size = DeviceIntSize::new(window_width, window_height);
     let layer = 0;
     *out_handle = Box::into_raw(Box::new(
             DocumentHandle::new(sender.create_api_by_client(next_namespace_id()), window_size, layer)));
     *out_renderer = Box::into_raw(Box::new(renderer));
 
     return true;
 }
 
 #[no_mangle]
 pub extern "C" fn wr_api_create_document(
     root_dh: &mut DocumentHandle,
     out_handle: &mut *mut DocumentHandle,
-    doc_size: DeviceUintSize,
+    doc_size: DeviceIntSize,
     layer: i8,
 ) {
     assert!(unsafe { is_in_compositor_thread() });
 
     *out_handle = Box::into_raw(Box::new(DocumentHandle::new(
         root_dh.api.clone_sender().create_api_by_client(next_namespace_id()),
         doc_size,
         layer
@@ -1293,18 +1293,18 @@ pub extern "C" fn wr_transaction_set_dis
         (pipeline_id, content_size, dl),
         preserve_frame_state,
     );
 }
 
 #[no_mangle]
 pub extern "C" fn wr_transaction_set_window_parameters(
     txn: &mut Transaction,
-    window_size: &DeviceUintSize,
-    doc_rect: &DeviceUintRect,
+    window_size: &DeviceIntSize,
+    doc_rect: &DeviceIntRect,
 ) {
     txn.set_window_parameters(
         *window_size,
         *doc_rect,
         1.0,
     );
 }
 
@@ -1474,17 +1474,17 @@ pub extern "C" fn wr_resource_updates_up
         None
     );
 }
 
 #[no_mangle]
 pub extern "C" fn wr_resource_updates_set_image_visible_area(
     txn: &mut Transaction,
     key: WrImageKey,
-    area: &DeviceUintRect,
+    area: &DeviceIntRect,
 ) {
     txn.set_image_visible_area(key, *area);
 }
 
 #[no_mangle]
 pub extern "C" fn wr_resource_updates_update_external_image(
     txn: &mut Transaction,
     key: WrImageKey,
@@ -1510,17 +1510,17 @@ pub extern "C" fn wr_resource_updates_up
 #[no_mangle]
 pub extern "C" fn wr_resource_updates_update_external_image_with_dirty_rect(
     txn: &mut Transaction,
     key: WrImageKey,
     descriptor: &WrImageDescriptor,
     external_image_id: WrExternalImageId,
     image_type: WrExternalImageBufferType,
     channel_index: u8,
-    dirty_rect: DeviceUintRect,
+    dirty_rect: DeviceIntRect,
 ) {
     txn.update_image(
         key,
         descriptor.into(),
         ImageData::External(
             ExternalImageData {
                 id: external_image_id.into(),
                 channel_index,
@@ -1532,17 +1532,17 @@ pub extern "C" fn wr_resource_updates_up
 }
 
 #[no_mangle]
 pub extern "C" fn wr_resource_updates_update_blob_image(
     txn: &mut Transaction,
     image_key: WrImageKey,
     descriptor: &WrImageDescriptor,
     bytes: &mut WrVecU8,
-    dirty_rect: DeviceUintRect,
+    dirty_rect: DeviceIntRect,
 ) {
     txn.update_image(
         image_key,
         descriptor.into(),
         ImageData::new_blob_image(bytes.flush_into_vec()),
         Some(dirty_rect)
     );
 }
@@ -2363,19 +2363,19 @@ pub extern "C" fn wr_dp_push_border(stat
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_border_image(state: &mut WrState,
                                           rect: LayoutRect,
                                           clip: LayoutRect,
                                           is_backface_visible: bool,
                                           widths: LayoutSideOffsets,
                                           image: WrImageKey,
-                                          width: u32,
-                                          height: u32,
-                                          slice: SideOffsets2D<u32>,
+                                          width: i32,
+                                          height: i32,
+                                          slice: SideOffsets2D<i32>,
                                           outset: SideOffsets2D<f32>,
                                           repeat_horizontal: RepeatMode,
                                           repeat_vertical: RepeatMode) {
     debug_assert!(unsafe { is_in_main_thread() });
     let border_details = BorderDetails::NinePatch(NinePatchBorder {
         source: NinePatchBorderSource::Image(image),
         width,
         height,
@@ -2393,19 +2393,19 @@ pub extern "C" fn wr_dp_push_border_imag
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_border_gradient(state: &mut WrState,
                                              rect: LayoutRect,
                                              clip: LayoutRect,
                                              is_backface_visible: bool,
                                              widths: LayoutSideOffsets,
-                                             width: u32,
-                                             height: u32,
-                                             slice: SideOffsets2D<u32>,
+                                             width: i32,
+                                             height: i32,
+                                             slice: SideOffsets2D<i32>,
                                              start_point: LayoutPoint,
                                              end_point: LayoutPoint,
                                              stops: *const GradientStop,
                                              stops_count: usize,
                                              extend_mode: ExtendMode,
                                              outset: SideOffsets2D<f32>) {
     debug_assert!(unsafe { is_in_main_thread() });
 
@@ -2451,33 +2451,33 @@ pub extern "C" fn wr_dp_push_border_radi
                                                     extend_mode: ExtendMode,
                                                     outset: SideOffsets2D<f32>) {
     debug_assert!(unsafe { is_in_main_thread() });
 
     let stops_slice = make_slice(stops, stops_count);
     let stops_vector = stops_slice.to_owned();
 
     let slice = SideOffsets2D::new(
-        widths.top as u32,
-        widths.right as u32,
-        widths.bottom as u32,
-        widths.left as u32,
+        widths.top as i32,
+        widths.right as i32,
+        widths.bottom as i32,
+        widths.left as i32,
     );
 
     let gradient = state.frame_builder.dl_builder.create_radial_gradient(
         center.into(),
         radius.into(),
         stops_vector,
         extend_mode.into()
     );
 
     let border_details = BorderDetails::NinePatch(NinePatchBorder {
         source: NinePatchBorderSource::RadialGradient(gradient),
-        width: rect.size.width as u32,
-        height: rect.size.height as u32,
+        width: rect.size.width as i32,
+        height: rect.size.height as i32,
         slice,
         fill: false,
         outset: outset.into(),
         repeat_horizontal: RepeatMode::Stretch,
         repeat_vertical: RepeatMode::Stretch,
     });
     let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(rect, clip.into());
     prim_info.is_backface_visible = is_backface_visible;
@@ -2675,22 +2675,22 @@ pub unsafe extern "C" fn wr_dec_ref_arc(
 }
 
 // TODO: nical
 // Update for the new blob image interface changes.
 //
 extern "C" {
      // TODO: figure out the API for tiled blob images.
      pub fn wr_moz2d_render_cb(blob: ByteSlice,
-                               width: u32,
-                               height: u32,
+                               width: i32,
+                               height: i32,
                                format: ImageFormat,
                                tile_size: Option<&u16>,
                                tile_offset: Option<&TileOffset>,
-                               dirty_rect: Option<&DeviceUintRect>,
+                               dirty_rect: Option<&DeviceIntRect>,
                                output: MutByteSlice)
                                -> bool;
 }
 
 #[no_mangle]
 pub extern "C" fn wr_root_scroll_node_id() -> usize {
     // The PipelineId doesn't matter here, since we just want the numeric part of the id
     // produced for any given root reference frame.
--- a/gfx/webrender_bindings/src/moz2d_renderer.rs
+++ b/gfx/webrender_bindings/src/moz2d_renderer.rs
@@ -247,37 +247,37 @@ impl BlobWriter {
     }
 }
 
 #[derive(Debug, Eq, PartialEq, Clone, Copy, Ord, PartialOrd)]
 #[repr(C)]
 /// A two-points representation of a rectangle.
 struct Box2d {
     /// Top-left x
-    x1: u32,
+    x1: i32,
     /// Top-left y
-    y1: u32,
+    y1: i32,
     /// Bottom-right x
-    x2: u32,
+    x2: i32,
     /// Bottom-right y
-    y2: u32
+    y2: i32
 }
 
 impl Box2d {
     /// Returns whether `self` is contained by `other` (inclusive).
     fn contained_by(&self, other: &Box2d) -> bool {
         self.x1 >= other.x1 &&
         self.x2 <= other.x2 &&
         self.y1 >= other.y1 &&
         self.y2 <= other.y2
     }
 }
 
-impl From<DeviceUintRect> for Box2d {
-    fn from(rect: DeviceUintRect) -> Self {
+impl From<DeviceIntRect> for Box2d {
+    fn from(rect: DeviceIntRect) -> Self {
         Box2d{ x1: rect.min_x(), y1: rect.min_y(), x2: rect.max_x(), y2: rect.max_y() }
     }
 }
 
 /// Provides an API for looking up the display items in a blob image by bounds, yielding items
 /// with equal bounds in their original relative ordering.
 ///
 /// This is used to implement `merge_blobs_images`.
@@ -436,17 +436,17 @@ struct BlobCommand {
     /// The size of the tiles to use in rasterization, if tiling should be used.
     tile_size: Option<TileSize>,
 }
 
  struct Job {
     request: BlobImageRequest,
     descriptor: BlobImageDescriptor,
     commands: Arc<BlobImageData>,
-    dirty_rect: Option<DeviceUintRect>,
+    dirty_rect: Option<DeviceIntRect>,
     tile_size: Option<TileSize>,
 }
 
 /// Rasterizes gecko blob images.
 struct Moz2dBlobRasterizer {
     /// Pool of rasterizers.
     workers: Arc<ThreadPool>,
     /// Blobs to rasterize.
@@ -528,18 +528,18 @@ fn rasterize_blob(job: Job) -> (BlobImag
             descriptor.format,
             job.tile_size.as_ref(),
             job.request.tile.as_ref(),
             job.dirty_rect.as_ref(),
             MutByteSlice::new(output.as_mut_slice()),
         ) {
             Ok(RasterizedBlobImage {
                 rasterized_rect: job.dirty_rect.unwrap_or(
-                    DeviceUintRect {
-                        origin: DeviceUintPoint::origin(),
+                    DeviceIntRect {
+                        origin: DeviceIntPoint::origin(),
                         size: descriptor.size,
                     }
                 ),
                 data: Arc::new(output),
             })
         } else {
             panic!("Moz2D replay problem");
         }
@@ -552,17 +552,17 @@ impl BlobImageHandler for Moz2dBlobImage
     fn add(&mut self, key: ImageKey, data: Arc<BlobImageData>, tile_size: Option<TileSize>) {
         {
             let index = BlobReader::new(&data);
             assert!(index.reader.has_more());
         }
         self.blob_commands.insert(key, BlobCommand { data: Arc::clone(&data), tile_size });
     }
 
-    fn update(&mut self, key: ImageKey, data: Arc<BlobImageData>, dirty_rect: Option<DeviceUintRect>) {
+    fn update(&mut self, key: ImageKey, data: Arc<BlobImageData>, dirty_rect: Option<DeviceIntRect>) {
         match self.blob_commands.entry(key) {
             hash_map::Entry::Occupied(mut e) => {
                 let command = e.get_mut();
                 command.data = Arc::new(merge_blob_images(&command.data, &data,
                                                        dirty_rect.unwrap().into()));
             }
             _ => { panic!("missing image key"); }
         }
--- a/gfx/webrender_bindings/webrender_ffi_generated.h
+++ b/gfx/webrender_bindings/webrender_ffi_generated.h
@@ -571,17 +571,17 @@ struct TypedSize2D {
   T height;
 
   bool operator==(const TypedSize2D& aOther) const {
     return width == aOther.width &&
            height == aOther.height;
   }
 };
 
-using DeviceUintSize = TypedSize2D<uint32_t, DevicePixel>;
+using DeviceIntSize = TypedSize2D<int32_t, DevicePixel>;
 
 using LayoutSize = TypedSize2D<float, LayoutPixel>;
 
 // Describes the memory layout of a display list.
 //
 // A display list consists of some number of display list items, followed by a number of display
 // items.
 struct BuiltDisplayListDescriptor {
@@ -974,19 +974,19 @@ struct ByteSlice {
   uintptr_t len;
 
   bool operator==(const ByteSlice& aOther) const {
     return buffer == aOther.buffer &&
            len == aOther.len;
   }
 };
 
-using TileOffset = TypedPoint2D<uint32_t, Tiles>;
+using TileOffset = TypedPoint2D<int32_t, Tiles>;
 
-using DeviceUintRect = TypedRect<uint32_t, DevicePixel>;
+using DeviceIntRect = TypedRect<int32_t, DevicePixel>;
 
 struct MutByteSlice {
   uint8_t *buffer;
   uintptr_t len;
 
   bool operator==(const MutByteSlice& aOther) const {
     return buffer == aOther.buffer &&
            len == aOther.len;
@@ -1062,19 +1062,19 @@ struct WrExternalImageHandler {
     return external_image_obj == aOther.external_image_obj &&
            lock_func == aOther.lock_func &&
            unlock_func == aOther.unlock_func;
   }
 };
 
 struct WrImageDescriptor {
   ImageFormat format;
-  uint32_t width;
-  uint32_t height;
-  uint32_t stride;
+  int32_t width;
+  int32_t height;
+  int32_t stride;
   OpacityType opacity;
 
   bool operator==(const WrImageDescriptor& aOther) const {
     return format == aOther.format &&
            width == aOther.width &&
            height == aOther.height &&
            stride == aOther.stride &&
            opacity == aOther.opacity;
@@ -1207,17 +1207,17 @@ WR_DESTRUCTOR_SAFE_FUNC;
 WR_INLINE
 void wr_api_clone(DocumentHandle *aDh,
                   DocumentHandle **aOutHandle)
 WR_FUNC;
 
 WR_INLINE
 void wr_api_create_document(DocumentHandle *aRootDh,
                             DocumentHandle **aOutHandle,
-                            DeviceUintSize aDocSize,
+                            DeviceIntSize aDocSize,
                             int8_t aLayer)
 WR_FUNC;
 
 WR_INLINE
 void wr_api_delete(DocumentHandle *aDh)
 WR_DESTRUCTOR_SAFE_FUNC;
 
 WR_INLINE
@@ -1358,37 +1358,37 @@ void wr_dp_push_border(WrState *aState,
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_border_gradient(WrState *aState,
                                 LayoutRect aRect,
                                 LayoutRect aClip,
                                 bool aIsBackfaceVisible,
                                 LayoutSideOffsets aWidths,
-                                uint32_t aWidth,
-                                uint32_t aHeight,
-                                SideOffsets2D<uint32_t> aSlice,
+                                int32_t aWidth,
+                                int32_t aHeight,
+                                SideOffsets2D<int32_t> aSlice,
                                 LayoutPoint aStartPoint,
                                 LayoutPoint aEndPoint,
                                 const GradientStop *aStops,
                                 uintptr_t aStopsCount,
                                 ExtendMode aExtendMode,
                                 SideOffsets2D<float> aOutset)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_border_image(WrState *aState,
                              LayoutRect aRect,
                              LayoutRect aClip,
                              bool aIsBackfaceVisible,
                              LayoutSideOffsets aWidths,
                              WrImageKey aImage,
-                             uint32_t aWidth,
-                             uint32_t aHeight,
-                             SideOffsets2D<uint32_t> aSlice,
+                             int32_t aWidth,
+                             int32_t aHeight,
+                             SideOffsets2D<int32_t> aSlice,
                              SideOffsets2D<float> aOutset,
                              RepeatMode aRepeatHorizontal,
                              RepeatMode aRepeatVertical)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_border_radial_gradient(WrState *aState,
                                        LayoutRect aRect,
@@ -1596,22 +1596,22 @@ WR_FUNC;
 WR_INLINE
 uintptr_t wr_dump_display_list(WrState *aState,
                                uintptr_t aIndent,
                                const uintptr_t *aStart,
                                const uintptr_t *aEnd)
 WR_FUNC;
 
 extern bool wr_moz2d_render_cb(ByteSlice aBlob,
-                               uint32_t aWidth,
-                               uint32_t aHeight,
+                               int32_t aWidth,
+                               int32_t aHeight,
                                ImageFormat aFormat,
                                const uint16_t *aTileSize,
                                const TileOffset *aTileOffset,
-                               const DeviceUintRect *aDirtyRect,
+                               const DeviceIntRect *aDirtyRect,
                                MutByteSlice aOutput);
 
 extern void wr_notifier_external_event(WrWindowId aWindowId,
                                        uintptr_t aRawEvent);
 
 extern void wr_notifier_new_frame_ready(WrWindowId aWindowId);
 
 extern void wr_notifier_nop_frame_done(WrWindowId aWindowId);
@@ -1651,26 +1651,26 @@ WrPipelineInfo wr_renderer_flush_pipelin
 WR_FUNC;
 
 WR_INLINE
 WrDebugFlags wr_renderer_get_debug_flags(Renderer *aRenderer)
 WR_FUNC;
 
 WR_INLINE
 void wr_renderer_readback(Renderer *aRenderer,
-                          uint32_t aWidth,
-                          uint32_t aHeight,
+                          int32_t aWidth,
+                          int32_t aHeight,
                           uint8_t *aDstBuffer,
                           uintptr_t aBufferSize)
 WR_FUNC;
 
 WR_INLINE
 bool wr_renderer_render(Renderer *aRenderer,
-                        uint32_t aWidth,
-                        uint32_t aHeight,
+                        int32_t aWidth,
+                        int32_t aHeight,
                         bool aHadSlowFrame,
                         RendererStats *aOutStats)
 WR_FUNC;
 
 WR_INLINE
 void wr_renderer_set_debug_flags(Renderer *aRenderer,
                                  WrDebugFlags aFlags)
 WR_FUNC;
@@ -1753,25 +1753,25 @@ WR_FUNC;
 WR_INLINE
 void wr_resource_updates_delete_image(Transaction *aTxn,
                                       WrImageKey aKey)
 WR_FUNC;
 
 WR_INLINE
 void wr_resource_updates_set_image_visible_area(Transaction *aTxn,
                                                 WrImageKey aKey,
-                                                const DeviceUintRect *aArea)
+                                                const DeviceIntRect *aArea)
 WR_FUNC;
 
 WR_INLINE
 void wr_resource_updates_update_blob_image(Transaction *aTxn,
                                            WrImageKey aImageKey,
                                            const WrImageDescriptor *aDescriptor,
                                            WrVecU8 *aBytes,
-                                           DeviceUintRect aDirtyRect)
+                                           DeviceIntRect aDirtyRect)
 WR_FUNC;
 
 WR_INLINE
 void wr_resource_updates_update_external_image(Transaction *aTxn,
                                                WrImageKey aKey,
                                                const WrImageDescriptor *aDescriptor,
                                                WrExternalImageId aExternalImageId,
                                                WrExternalImageBufferType aImageType,
@@ -1780,17 +1780,17 @@ WR_FUNC;
 
 WR_INLINE
 void wr_resource_updates_update_external_image_with_dirty_rect(Transaction *aTxn,
                                                                WrImageKey aKey,
                                                                const WrImageDescriptor *aDescriptor,
                                                                WrExternalImageId aExternalImageId,
                                                                WrExternalImageBufferType aImageType,
                                                                uint8_t aChannelIndex,
-                                                               DeviceUintRect aDirtyRect)
+                                                               DeviceIntRect aDirtyRect)
 WR_FUNC;
 
 WR_INLINE
 void wr_resource_updates_update_image(Transaction *aTxn,
                                       WrImageKey aKey,
                                       const WrImageDescriptor *aDescriptor,
                                       WrVecU8 *aBytes)
 WR_FUNC;
@@ -1916,18 +1916,18 @@ WR_FUNC;
 
 WR_INLINE
 void wr_transaction_set_root_pipeline(Transaction *aTxn,
                                       WrPipelineId aPipelineId)
 WR_FUNC;
 
 WR_INLINE
 void wr_transaction_set_window_parameters(Transaction *aTxn,
-                                          const DeviceUintSize *aWindowSize,
-                                          const DeviceUintRect *aDocRect)
+                                          const DeviceIntSize *aWindowSize,
+                                          const DeviceIntRect *aDocRect)
 WR_FUNC;
 
 WR_INLINE
 void wr_transaction_update_dynamic_properties(Transaction *aTxn,
                                               const WrOpacityProperty *aOpacityArray,
                                               uintptr_t aOpacityCount,
                                               const WrTransformProperty *aTransformArray,
                                               uintptr_t aTransformCount)
@@ -1949,25 +1949,25 @@ WR_FUNC;
 
 WR_INLINE
 void wr_vec_u8_push_bytes(WrVecU8 *aV,
                           ByteSlice aBytes)
 WR_FUNC;
 
 WR_INLINE
 bool wr_window_new(WrWindowId aWindowId,
-                   uint32_t aWindowWidth,
-                   uint32_t aWindowHeight,
+                   int32_t aWindowWidth,
+                   int32_t aWindowHeight,
                    bool aSupportLowPriorityTransactions,
                    void *aGlContext,
                    WrProgramCache *aProgramCache,
                    WrShaders *aShaders,
                    WrThreadPool *aThreadPool,
                    VoidPtrToSizeFn aSizeOfOp,
                    DocumentHandle **aOutHandle,
                    Renderer **aOutRenderer,
-                   uint32_t *aOutMaxTextureSize)
+                   int32_t *aOutMaxTextureSize)
 WR_FUNC;
 
 } // extern "C"
 
 } // namespace wr
 } // namespace mozilla
--- a/layout/painting/nsCSSRenderingBorders.cpp
+++ b/layout/painting/nsCSSRenderingBorders.cpp
@@ -3871,17 +3871,17 @@ nsCSSBorderImageRenderer::CreateWebRende
       aBuilder.PushBorderImage(
         dest,
         clip,
         !aItem->BackfaceIsHidden(),
         wr::ToBorderWidths(widths[0], widths[1], widths[2], widths[3]),
         key.value(),
         (float)(mImageSize.width) / appUnitsPerDevPixel,
         (float)(mImageSize.height) / appUnitsPerDevPixel,
-        wr::ToSideOffsets2D_u32(slice[0], slice[1], slice[2], slice[3]),
+        wr::ToSideOffsets2D_i32(slice[0], slice[1], slice[2], slice[3]),
         wr::ToSideOffsets2D_f32(outset[0], outset[1], outset[2], outset[3]),
         wr::ToRepeatMode(mRepeatModeHorizontal),
         wr::ToRepeatMode(mRepeatModeVertical));
       break;
     }
     case eStyleImageType_Gradient: {
       RefPtr<nsStyleGradient> gradientData = mImageRenderer.GetGradientData();
       nsCSSGradientRenderer renderer = nsCSSGradientRenderer::Create(
@@ -3903,17 +3903,17 @@ nsCSSBorderImageRenderer::CreateWebRende
 
         aBuilder.PushBorderGradient(
           dest,
           clip,
           !aItem->BackfaceIsHidden(),
           wr::ToBorderWidths(widths[0], widths[1], widths[2], widths[3]),
           (float)(mImageSize.width) / appUnitsPerDevPixel,
           (float)(mImageSize.height) / appUnitsPerDevPixel,
-          wr::ToSideOffsets2D_u32(slice[0], slice[1], slice[2], slice[3]),
+          wr::ToSideOffsets2D_i32(slice[0], slice[1], slice[2], slice[3]),
           wr::ToLayoutPoint(startPoint),
           wr::ToLayoutPoint(endPoint),
           stops,
           extendMode,
           wr::ToSideOffsets2D_f32(outset[0], outset[1], outset[2], outset[3]));
       } else {
         aBuilder.PushBorderRadialGradient(
           dest,