Skip to content

Commit

Permalink
Bug 1465058 - Update for API change in WR PR 2756. r=kats
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 6Vg0bTpBYVh

--HG--
extra : rebase_source : f9b4f5cdb26d268d7804afb827c7710a05bc56d9
  • Loading branch information
mrobinson committed May 16, 2018
1 parent ea2d83d commit 46bd5d1
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 29 deletions.
27 changes: 14 additions & 13 deletions gfx/layers/wr/AsyncImagePipelineManager.cpp
Expand Up @@ -320,18 +320,19 @@ AsyncImagePipelineManager::ApplyAsyncImages(wr::TransactionBuilder& aTxn)
wr::DisplayListBuilder builder(pipelineId, contentSize);

float opacity = 1.0f;
builder.PushStackingContext(wr::ToLayoutRect(pipeline->mScBounds),
nullptr,
nullptr,
&opacity,
pipeline->mScTransform.IsIdentity() ? nullptr : &pipeline->mScTransform,
wr::TransformStyle::Flat,
nullptr,
pipeline->mMixBlendMode,
nsTArray<wr::WrFilterOp>(),
true,
// This is fine to do unconditionally because we only push images here.
wr::GlyphRasterSpace::Screen());
Maybe<wr::WrClipId> referenceFrameId = builder.PushStackingContext(
wr::ToLayoutRect(pipeline->mScBounds),
nullptr,
nullptr,
&opacity,
pipeline->mScTransform.IsIdentity() ? nullptr : &pipeline->mScTransform,
wr::TransformStyle::Flat,
nullptr,
pipeline->mMixBlendMode,
nsTArray<wr::WrFilterOp>(),
true,
// This is fine to do unconditionally because we only push images here.
wr::GlyphRasterSpace::Screen());

if (pipeline->mCurrentTexture && !keys.IsEmpty()) {
LayoutDeviceRect rect(0, 0, pipeline->mCurrentTexture->GetSize().width, pipeline->mCurrentTexture->GetSize().height);
Expand All @@ -358,7 +359,7 @@ AsyncImagePipelineManager::ApplyAsyncImages(wr::TransactionBuilder& aTxn)
}
}

builder.PopStackingContext();
builder.PopStackingContext(referenceFrameId.isSome());

wr::BuiltDisplayList dl;
wr::LayoutSize builderContentSize;
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/wr/StackingContextHelper.cpp
Expand Up @@ -85,7 +85,7 @@ StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParen
StackingContextHelper::~StackingContextHelper()
{
if (mBuilder) {
mBuilder->PopStackingContext();
mBuilder->PopStackingContext(mReferenceFrameId.isSome());
}
}

Expand Down
4 changes: 2 additions & 2 deletions gfx/webrender_bindings/WebRenderAPI.cpp
Expand Up @@ -786,10 +786,10 @@ DisplayListBuilder::PushStackingContext(const wr::LayoutRect& aBounds,
}

void
DisplayListBuilder::PopStackingContext()
DisplayListBuilder::PopStackingContext(bool aIsReferenceFrame)
{
WRDL_LOG("PopStackingContext\n", mWrState);
wr_dp_pop_stacking_context(mWrState);
wr_dp_pop_stacking_context(mWrState, aIsReferenceFrame);
}

wr::WrClipChainId
Expand Down
2 changes: 1 addition & 1 deletion gfx/webrender_bindings/WebRenderAPI.h
Expand Up @@ -290,7 +290,7 @@ class DisplayListBuilder {
const nsTArray<wr::WrFilterOp>& aFilters,
bool aIsBackfaceVisible,
const wr::GlyphRasterSpace& aRasterSpace);
void PopStackingContext();
void PopStackingContext(bool aIsReferenceFrame);

wr::WrClipChainId DefineClipChain(const Maybe<wr::WrClipChainId>& aParent,
const nsTArray<wr::WrClipId>& aClips);
Expand Down
37 changes: 26 additions & 11 deletions gfx/webrender_bindings/src/bindings.rs
Expand Up @@ -1661,32 +1661,47 @@ pub extern "C" fn wr_dp_push_stacking_context(state: &mut WrState,
};

let mut prim_info = LayoutPrimitiveInfo::new(bounds);

*out_is_reference_frame = transform_binding.is_some() || perspective.is_some();
if *out_is_reference_frame {
let ref_frame_id = state.frame_builder
.dl_builder
.push_reference_frame(&prim_info, transform_binding, perspective);
match ref_frame_id {
ClipId::Clip(id, pipeline_id) => {
assert!(pipeline_id == state.pipeline_id);
*out_reference_frame_id = id;
},
_ => panic!("Pushing a reference frame must produce a ClipId::Clip"),
}

prim_info.rect.origin = LayoutPoint::zero();
prim_info.clip_rect.origin = LayoutPoint::zero();
state.frame_builder.dl_builder.push_clip_id(ref_frame_id);
}

prim_info.is_backface_visible = is_backface_visible;
prim_info.tag = state.current_tag;

let ref_frame_id = state.frame_builder
state.frame_builder
.dl_builder
.push_stacking_context(&prim_info,
clip_node_id,
transform_binding,
transform_style,
perspective,
mix_blend_mode,
filters,
glyph_raster_space);
if let Some(ClipId::Clip(id, pipeline_id)) = ref_frame_id {
assert!(pipeline_id == state.pipeline_id);
*out_is_reference_frame = true;
*out_reference_frame_id = id;
} else {
*out_is_reference_frame = false;
}
}

#[no_mangle]
pub extern "C" fn wr_dp_pop_stacking_context(state: &mut WrState) {
pub extern "C" fn wr_dp_pop_stacking_context(state: &mut WrState,
is_reference_frame: bool) {
debug_assert!(unsafe { !is_in_render_thread() });
state.frame_builder.dl_builder.pop_stacking_context();
if is_reference_frame {
state.frame_builder.dl_builder.pop_clip_id();
state.frame_builder.dl_builder.pop_reference_frame();
}
}

#[no_mangle]
Expand Down
3 changes: 2 additions & 1 deletion gfx/webrender_bindings/webrender_ffi_generated.h
Expand Up @@ -1145,7 +1145,8 @@ void wr_dp_pop_scroll_layer(WrState *aState)
WR_FUNC;

WR_INLINE
void wr_dp_pop_stacking_context(WrState *aState)
void wr_dp_pop_stacking_context(WrState *aState,
bool aIsReferenceFrame)
WR_FUNC;

WR_INLINE
Expand Down

0 comments on commit 46bd5d1

Please sign in to comment.