Skip to content

Commit

Permalink
Bug 1440664 - Update gecko WR bindings for API changes in WR PR 2449.…
Browse files Browse the repository at this point in the history
… r=kats

MozReview-Commit-ID: AUTNkZ36p8b
  • Loading branch information
mrobinson committed Mar 1, 2018
1 parent cb7ff5f commit 7891c37
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
28 changes: 14 additions & 14 deletions gfx/webrender_bindings/WebRenderAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,21 +787,21 @@ DisplayListBuilder::DefineClip(const Maybe<wr::WrScrollId>& aAncestorScrollId,
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)",
Expand All @@ -816,7 +816,7 @@ 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 {
Expand Down Expand Up @@ -861,7 +861,7 @@ DisplayListBuilder::PushCacheOverride(const DisplayItemClipChain* aParent,
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);
}
}

Expand All @@ -872,7 +872,7 @@ DisplayListBuilder::PopCacheOverride(const DisplayItemClipChain* aParent)
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);
Expand All @@ -897,10 +897,10 @@ DisplayListBuilder::DefineStickyFrame(const wr::LayoutRect& aContentRect,
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",
Expand All @@ -918,7 +918,7 @@ 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.
Expand Down Expand Up @@ -969,7 +969,7 @@ DisplayListBuilder::DefineScrollLayer(const layers::FrameMetrics::ViewID& aViewI
}

// 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,
Expand All @@ -984,7 +984,7 @@ DisplayListBuilder::DefineScrollLayer(const layers::FrameMetrics::ViewID& aViewI
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));
}
Expand All @@ -993,7 +993,7 @@ 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);
Expand All @@ -1003,7 +1003,7 @@ 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);
Expand Down
6 changes: 3 additions & 3 deletions gfx/webrender_bindings/WebRenderTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ static inline wr::WrFilterOpType ToWrFilterOpType(uint32_t type) {
// 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;
Expand All @@ -766,7 +766,7 @@ struct WrClipId {
// 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;
Expand All @@ -780,7 +780,7 @@ struct WrScrollId {
// 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;
Expand Down
30 changes: 15 additions & 15 deletions gfx/webrender_bindings/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1480,13 +1480,13 @@ pub extern "C" fn wr_dp_pop_stacking_context(state: &mut WrState) {
}

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(
Expand All @@ -1502,13 +1502,13 @@ fn make_scroll_info(state: &mut WrState,

#[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,
Expand All @@ -1525,7 +1525,7 @@ pub extern "C" fn wr_dp_define_clip(state: &mut WrState,
} 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);
Expand All @@ -1537,7 +1537,7 @@ pub extern "C" fn wr_dp_define_clip(state: &mut WrState,

#[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));
}
Expand All @@ -1558,7 +1558,7 @@ pub extern "C" fn wr_dp_define_sticky_frame(state: &mut WrState,
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(
Expand All @@ -1580,11 +1580,11 @@ pub extern "C" fn wr_dp_define_sticky_frame(state: &mut WrState,
#[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,
Expand Down Expand Up @@ -1623,7 +1623,7 @@ pub extern "C" fn wr_dp_define_scroll_layer(state: &mut WrState,

#[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);
Expand All @@ -1637,8 +1637,8 @@ pub extern "C" fn wr_dp_pop_scroll_layer(state: &mut WrState) {

#[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());
Expand Down

0 comments on commit 7891c37

Please sign in to comment.