Bug 1440664 - Update gecko WR bindings for API changes in WR PR 2449. r?kats draft
authorMartin Robinson <mrobinson@igalia.com>
Thu, 01 Mar 2018 16:49:54 -0500
changeset 762188 1919b2917e689277e62bde942b366531558b5117
parent 762187 372d5302ecd8875ed55483c2b25bf06d222934ec
child 762189 63bc628cf9c891c7b18bee794f8a2bf8f17308c6
push id101098
push userkgupta@mozilla.com
push dateThu, 01 Mar 2018 21:59:32 +0000
reviewerskats
bugs1440664
milestone60.0a1
Bug 1440664 - Update gecko WR bindings for API changes in WR PR 2449. r?kats MozReview-Commit-ID: AUTNkZ36p8b
gfx/webrender_bindings/WebRenderAPI.cpp
gfx/webrender_bindings/WebRenderTypes.h
gfx/webrender_bindings/src/bindings.rs
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -782,46 +782,46 @@ DisplayListBuilder::PopStackingContext()
 
 wr::WrClipId
 DisplayListBuilder::DefineClip(const Maybe<wr::WrScrollId>& aAncestorScrollId,
                                const Maybe<wr::WrClipId>& aAncestorClipId,
                                const wr::LayoutRect& aClipRect,
                                const nsTArray<wr::ComplexClipRegion>* aComplex,
                                const wr::WrImageMask* aMask)
 {
-  const uint64_t* ancestorScrollId = nullptr;
+  const size_t* ancestorScrollId = nullptr;
   if (aAncestorScrollId) {
     ancestorScrollId = &(aAncestorScrollId.ref().id);
   }
-  const uint64_t* ancestorClipId = nullptr;
+  const size_t* ancestorClipId = nullptr;
   if (aAncestorClipId) {
     ancestorClipId = &(aAncestorClipId.ref().id);
   }
-  uint64_t clip_id = wr_dp_define_clip(mWrState,
+  size_t clip_id = wr_dp_define_clip(mWrState,
       ancestorScrollId, ancestorClipId,
       aClipRect,
       aComplex ? aComplex->Elements() : nullptr,
       aComplex ? aComplex->Length() : 0,
       aMask);
-  WRDL_LOG("DefineClip id=%" PRIu64 " as=%s ac=%s r=%s m=%p b=%s complex=%zu\n", mWrState,
+  WRDL_LOG("DefineClip id=%zu as=%s ac=%s r=%s m=%p b=%s complex=%zu\n", mWrState,
       clip_id,
       aAncestorScrollId ? Stringify(aAncestorScrollId.ref().id).c_str() : "(nil)",
       aAncestorClipId ? Stringify(aAncestorClipId.ref().id).c_str() : "(nil)",
       Stringify(aClipRect).c_str(), aMask,
       aMask ? Stringify(aMask->rect).c_str() : "none",
       aComplex ? aComplex->Length() : 0);
   return wr::WrClipId { clip_id };
 }
 
 void
 DisplayListBuilder::PushClip(const wr::WrClipId& aClipId,
                              const DisplayItemClipChain* aParent)
 {
   wr_dp_push_clip(mWrState, aClipId.id);
-  WRDL_LOG("PushClip id=%" PRIu64 "\n", mWrState, aClipId.id);
+  WRDL_LOG("PushClip id=%zu\n", mWrState, aClipId.id);
   if (!aParent) {
     mClipStack.push_back(wr::ScrollOrClipId(aClipId));
   } else {
     PushCacheOverride(aParent, aClipId);
   }
 }
 
 void
@@ -856,28 +856,28 @@ DisplayListBuilder::PushCacheOverride(co
   // of any of those clips directly, then we end up losing the sticky clip from
   // the WR clip chain of the nested item. This is why we install cache
   // overrides for all of them so that when we walk the nested item's clip chain
   // from E to B we discover that really we want to use the sticky clip as E's
   // parent.
   for (const DisplayItemClipChain* i = aParent; i; i = i->mParent) {
     auto it = mCacheOverride.insert({ i, std::vector<wr::WrClipId>() });
     it.first->second.push_back(aClipId);
-    WRDL_LOG("Pushing override %p -> %" PRIu64 "\n", mWrState, i, aClipId.id);
+    WRDL_LOG("Pushing override %p -> %zu\n", mWrState, i, aClipId.id);
   }
 }
 
 void
 DisplayListBuilder::PopCacheOverride(const DisplayItemClipChain* aParent)
 {
   for (const DisplayItemClipChain* i = aParent; i; i = i->mParent) {
     auto it = mCacheOverride.find(i);
     MOZ_ASSERT(it != mCacheOverride.end());
     MOZ_ASSERT(!(it->second.empty()));
-    WRDL_LOG("Popping override %p -> %" PRIu64 "\n", mWrState, i, it->second.back().id);
+    WRDL_LOG("Popping override %p -> %zu\n", mWrState, i, it->second.back().id);
     it->second.pop_back();
     if (it->second.empty()) {
       mCacheOverride.erase(it);
     }
   }
 }
 
 Maybe<wr::WrClipId>
@@ -892,20 +892,20 @@ DisplayListBuilder::DefineStickyFrame(co
                                       const float* aTopMargin,
                                       const float* aRightMargin,
                                       const float* aBottomMargin,
                                       const float* aLeftMargin,
                                       const StickyOffsetBounds& aVerticalBounds,
                                       const StickyOffsetBounds& aHorizontalBounds,
                                       const wr::LayoutVector2D& aAppliedOffset)
 {
-  uint64_t id = wr_dp_define_sticky_frame(mWrState, aContentRect, aTopMargin,
+  size_t id = wr_dp_define_sticky_frame(mWrState, aContentRect, aTopMargin,
       aRightMargin, aBottomMargin, aLeftMargin, aVerticalBounds, aHorizontalBounds,
       aAppliedOffset);
-  WRDL_LOG("DefineSticky id=%" PRIu64 " c=%s t=%s r=%s b=%s l=%s v=%s h=%s a=%s\n",
+  WRDL_LOG("DefineSticky id=%zu c=%s t=%s r=%s b=%s l=%s v=%s h=%s a=%s\n",
       mWrState, id,
       Stringify(aContentRect).c_str(),
       aTopMargin ? Stringify(*aTopMargin).c_str() : "none",
       aRightMargin ? Stringify(*aRightMargin).c_str() : "none",
       aBottomMargin ? Stringify(*aBottomMargin).c_str() : "none",
       aLeftMargin ? Stringify(*aLeftMargin).c_str() : "none",
       Stringify(aVerticalBounds).c_str(),
       Stringify(aHorizontalBounds).c_str(),
@@ -913,17 +913,17 @@ DisplayListBuilder::DefineStickyFrame(co
   return wr::WrStickyId { id };
 }
 
 void
 DisplayListBuilder::PushStickyFrame(const wr::WrStickyId& aStickyId,
                                     const DisplayItemClipChain* aParent)
 {
   wr_dp_push_clip(mWrState, aStickyId.id);
-  WRDL_LOG("PushSticky id=%" PRIu64 "\n", mWrState, aStickyId.id);
+  WRDL_LOG("PushSticky id=%zu\n", mWrState, aStickyId.id);
   // inside WR, a sticky id is just a regular clip id. so we can do some
   // handwaving here and turn the WrStickyId into a WrclipId and treat it
   // like any other out-of-band clip.
   wr::WrClipId stickyIdAsClipId;
   stickyIdAsClipId.id = aStickyId.id;
   PushCacheOverride(aParent, stickyIdAsClipId);
 }
 
@@ -964,51 +964,51 @@ DisplayListBuilder::DefineScrollLayer(co
       Stringify(aContentRect).c_str(), Stringify(aClipRect).c_str());
 
   auto it = mScrollIds.find(aViewId);
   if (it != mScrollIds.end()) {
     return it->second;
   }
 
   // We haven't defined aViewId before, so let's define it now.
-  uint64_t numericScrollId = wr_dp_define_scroll_layer(
+  size_t numericScrollId = wr_dp_define_scroll_layer(
       mWrState,
       aViewId,
       aAncestorScrollId ? &(aAncestorScrollId->id) : nullptr,
       aAncestorClipId ? &(aAncestorClipId->id) : nullptr,
       aContentRect,
       aClipRect);
    auto wrScrollId = wr::WrScrollId { numericScrollId };
    mScrollIds[aViewId] = wrScrollId;
    return wrScrollId;
 }
 
 void
 DisplayListBuilder::PushScrollLayer(const wr::WrScrollId& aScrollId)
 {
-  WRDL_LOG("PushScrollLayer id=%" PRIu64 "\n", mWrState, aScrollId.id);
+  WRDL_LOG("PushScrollLayer id=%zu\n", mWrState, aScrollId.id);
   wr_dp_push_scroll_layer(mWrState, aScrollId.id);
   mClipStack.push_back(wr::ScrollOrClipId(aScrollId));
 }
 
 void
 DisplayListBuilder::PopScrollLayer()
 {
   MOZ_ASSERT(mClipStack.back().is<wr::WrScrollId>());
-  WRDL_LOG("PopScrollLayer id=%" PRIu64 "\n", mWrState,
+  WRDL_LOG("PopScrollLayer id=%zu\n", mWrState,
       mClipStack.back().as<wr::WrScrollId>().id);
   mClipStack.pop_back();
   wr_dp_pop_scroll_layer(mWrState);
 }
 
 void
 DisplayListBuilder::PushClipAndScrollInfo(const wr::WrScrollId& aScrollId,
                                           const wr::WrClipId* aClipId)
 {
-  WRDL_LOG("PushClipAndScroll s=%" PRIu64 " c=%s\n", mWrState, aScrollId.id,
+  WRDL_LOG("PushClipAndScroll s=%zu c=%s\n", mWrState, aScrollId.id,
       aClipId ? Stringify(aClipId->id).c_str() : "none");
   wr_dp_push_clip_and_scroll_info(mWrState, aScrollId.id,
       aClipId ? &(aClipId->id) : nullptr);
   mClipStack.push_back(wr::ScrollOrClipId(aScrollId));
 }
 
 void
 DisplayListBuilder::PopClipAndScrollInfo()
--- a/gfx/webrender_bindings/WebRenderTypes.h
+++ b/gfx/webrender_bindings/WebRenderTypes.h
@@ -751,41 +751,41 @@ static inline wr::WrFilterOpType ToWrFil
 }
 
 // Corresponds to an "internal" webrender clip id. That is, a
 // ClipId::Clip(x,pipeline_id) maps to a WrClipId{x}. We use a struct wrapper
 // instead of a typedef so that this is a distinct type from ids generated
 // by scroll and position:sticky nodes  and the compiler will catch accidental
 // conversions between them.
 struct WrClipId {
-  uint64_t id;
+  size_t id;
 
   bool operator==(const WrClipId& other) const {
     return id == other.id;
   }
 };
 
 // Corresponds to a clip id for for a scroll frame in webrender. Similar
 // to WrClipId but a separate struct so we don't get them mixed up in C++.
 struct WrScrollId {
-  uint64_t id;
+  size_t id;
 
   bool operator==(const WrScrollId& other) const {
     return id == other.id;
   }
 
   bool operator!=(const WrScrollId& other) const {
     return id != other.id;
   }
 };
 
 // Corresponds to a clip id for a position:sticky clip in webrender. Similar
 // to WrClipId but a separate struct so we don't get them mixed up in C++.
 struct WrStickyId {
-  uint64_t id;
+  size_t id;
 
   bool operator==(const WrStickyId& other) const {
     return id == other.id;
   }
 };
 
 typedef Variant<WrScrollId, WrClipId> ScrollOrClipId;
 
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -1475,74 +1475,74 @@ pub extern "C" fn wr_dp_push_stacking_co
 
 #[no_mangle]
 pub extern "C" fn wr_dp_pop_stacking_context(state: &mut WrState) {
     debug_assert!(unsafe { !is_in_render_thread() });
     state.frame_builder.dl_builder.pop_stacking_context();
 }
 
 fn make_scroll_info(state: &mut WrState,
-                    scroll_id: Option<&u64>,
-                    clip_id: Option<&u64>)
+                    scroll_id: Option<&usize>,
+                    clip_id: Option<&usize>)
                     -> Option<ClipAndScrollInfo> {
     if let Some(&sid) = scroll_id {
         if let Some(&cid) = clip_id {
             Some(ClipAndScrollInfo::new(
-                ClipId::Clip(sid, state.pipeline_id),
+                ClipId::Clip(sid , state.pipeline_id),
                 ClipId::Clip(cid, state.pipeline_id)))
         } else {
             Some(ClipAndScrollInfo::simple(
                 ClipId::Clip(sid, state.pipeline_id)))
         }
     } else if let Some(&cid) = clip_id {
         Some(ClipAndScrollInfo::simple(
             ClipId::Clip(cid, state.pipeline_id)))
     } else {
         None
     }
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_define_clip(state: &mut WrState,
-                                    ancestor_scroll_id: *const u64,
-                                    ancestor_clip_id: *const u64,
+                                    ancestor_scroll_id: *const usize,
+                                    ancestor_clip_id: *const usize,
                                     clip_rect: LayoutRect,
                                     complex: *const ComplexClipRegion,
                                     complex_count: usize,
                                     mask: *const WrImageMask)
-                                    -> u64 {
+                                    -> usize {
     debug_assert!(unsafe { is_in_main_thread() });
 
     let info = make_scroll_info(state,
                                 unsafe { ancestor_scroll_id.as_ref() },
                                 unsafe { ancestor_clip_id.as_ref() });
 
     let complex_slice = make_slice(complex, complex_count);
     let complex_iter = complex_slice.iter().cloned();
     let mask : Option<ImageMask> = unsafe { mask.as_ref() }.map(|x| x.into());
 
     let clip_id = if info.is_some() {
         state.frame_builder.dl_builder.define_clip_with_parent(
             info.unwrap().scroll_node_id, clip_rect, complex_iter, mask)
     } else {
         state.frame_builder.dl_builder.define_clip(clip_rect, complex_iter, mask)
     };
-    // return the u64 id value from inside the ClipId::Clip(..)
+    // return the usize id value from inside the ClipId::Clip(..)
     match clip_id {
         ClipId::Clip(id, pipeline_id) => {
             assert!(pipeline_id == state.pipeline_id);
             id
         },
         _ => panic!("Got unexpected clip id type"),
     }
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_clip(state: &mut WrState,
-                                  clip_id: u64) {
+                                  clip_id: usize) {
     debug_assert!(unsafe { is_in_main_thread() });
     state.frame_builder.dl_builder.push_clip_id(ClipId::Clip(clip_id, state.pipeline_id));
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_pop_clip(state: &mut WrState) {
     debug_assert!(unsafe { !is_in_render_thread() });
     state.frame_builder.dl_builder.pop_clip_id();
@@ -1553,17 +1553,17 @@ pub extern "C" fn wr_dp_define_sticky_fr
                                             content_rect: LayoutRect,
                                             top_margin: *const f32,
                                             right_margin: *const f32,
                                             bottom_margin: *const f32,
                                             left_margin: *const f32,
                                             vertical_bounds: StickyOffsetBounds,
                                             horizontal_bounds: StickyOffsetBounds,
                                             applied_offset: LayoutVector2D)
-                                            -> u64 {
+                                            -> usize {
     assert!(unsafe { is_in_main_thread() });
     let clip_id = state.frame_builder.dl_builder.define_sticky_frame(
         content_rect, SideOffsets2D::new(
             unsafe { top_margin.as_ref() }.cloned(),
             unsafe { right_margin.as_ref() }.cloned(),
             unsafe { bottom_margin.as_ref() }.cloned(),
             unsafe { left_margin.as_ref() }.cloned()
         ),
@@ -1575,21 +1575,21 @@ pub extern "C" fn wr_dp_define_sticky_fr
         },
         _ => panic!("Got unexpected clip id type"),
     }
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_define_scroll_layer(state: &mut WrState,
                                             scroll_id: u64,
-                                            ancestor_scroll_id: *const u64,
-                                            ancestor_clip_id: *const u64,
+                                            ancestor_scroll_id: *const usize,
+                                            ancestor_clip_id: *const usize,
                                             content_rect: LayoutRect,
                                             clip_rect: LayoutRect)
-                                            -> u64 {
+                                            -> usize {
     assert!(unsafe { is_in_main_thread() });
 
     let info = make_scroll_info(state,
                                 unsafe { ancestor_scroll_id.as_ref() },
                                 unsafe { ancestor_clip_id.as_ref() });
 
     let new_id = if info.is_some() {
         state.frame_builder.dl_builder.define_scroll_frame_with_parent(
@@ -1618,32 +1618,32 @@ pub extern "C" fn wr_dp_define_scroll_la
             id
         },
         _ => panic!("Got unexpected clip id type"),
     }
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_scroll_layer(state: &mut WrState,
-                                          scroll_id: u64) {
+                                          scroll_id: usize) {
     debug_assert!(unsafe { is_in_main_thread() });
     let clip_id = ClipId::Clip(scroll_id, state.pipeline_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) {
     debug_assert!(unsafe { is_in_main_thread() });
     state.frame_builder.dl_builder.pop_clip_id();
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_push_clip_and_scroll_info(state: &mut WrState,
-                                                  scroll_id: u64,
-                                                  clip_id: *const u64) {
+                                                  scroll_id: usize,
+                                                  clip_id: *const usize) {
     debug_assert!(unsafe { is_in_main_thread() });
     let info = make_scroll_info(state, Some(&scroll_id), unsafe { clip_id.as_ref() });
     debug_assert!(info.is_some());
     state.frame_builder.dl_builder.push_clip_and_scroll_info(info.unwrap());
 }
 
 #[no_mangle]
 pub extern "C" fn wr_dp_pop_clip_and_scroll_info(state: &mut WrState) {