Bug 1465058 - Update for API change in WR PR 2756. r=kats

MozReview-Commit-ID: 6Vg0bTpBYVh

--HG--
extra : rebase_source : f9b4f5cdb26d268d7804afb827c7710a05bc56d9
This commit is contained in:
Martin Robinson 2018-05-16 16:47:08 +02:00
parent ea2d83d47e
commit 46bd5d1cf4
6 changed files with 46 additions and 29 deletions

View File

@ -320,18 +320,19 @@ AsyncImagePipelineManager::ApplyAsyncImages(wr::TransactionBuilder& aTxn)
wr::DisplayListBuilder builder(pipelineId, contentSize); wr::DisplayListBuilder builder(pipelineId, contentSize);
float opacity = 1.0f; float opacity = 1.0f;
builder.PushStackingContext(wr::ToLayoutRect(pipeline->mScBounds), Maybe<wr::WrClipId> referenceFrameId = builder.PushStackingContext(
nullptr, wr::ToLayoutRect(pipeline->mScBounds),
nullptr, nullptr,
&opacity, nullptr,
pipeline->mScTransform.IsIdentity() ? nullptr : &pipeline->mScTransform, &opacity,
wr::TransformStyle::Flat, pipeline->mScTransform.IsIdentity() ? nullptr : &pipeline->mScTransform,
nullptr, wr::TransformStyle::Flat,
pipeline->mMixBlendMode, nullptr,
nsTArray<wr::WrFilterOp>(), pipeline->mMixBlendMode,
true, nsTArray<wr::WrFilterOp>(),
// This is fine to do unconditionally because we only push images here. true,
wr::GlyphRasterSpace::Screen()); // This is fine to do unconditionally because we only push images here.
wr::GlyphRasterSpace::Screen());
if (pipeline->mCurrentTexture && !keys.IsEmpty()) { if (pipeline->mCurrentTexture && !keys.IsEmpty()) {
LayoutDeviceRect rect(0, 0, pipeline->mCurrentTexture->GetSize().width, pipeline->mCurrentTexture->GetSize().height); LayoutDeviceRect rect(0, 0, pipeline->mCurrentTexture->GetSize().width, pipeline->mCurrentTexture->GetSize().height);
@ -358,7 +359,7 @@ AsyncImagePipelineManager::ApplyAsyncImages(wr::TransactionBuilder& aTxn)
} }
} }
builder.PopStackingContext(); builder.PopStackingContext(referenceFrameId.isSome());
wr::BuiltDisplayList dl; wr::BuiltDisplayList dl;
wr::LayoutSize builderContentSize; wr::LayoutSize builderContentSize;

View File

@ -85,7 +85,7 @@ StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParen
StackingContextHelper::~StackingContextHelper() StackingContextHelper::~StackingContextHelper()
{ {
if (mBuilder) { if (mBuilder) {
mBuilder->PopStackingContext(); mBuilder->PopStackingContext(mReferenceFrameId.isSome());
} }
} }

View File

@ -786,10 +786,10 @@ DisplayListBuilder::PushStackingContext(const wr::LayoutRect& aBounds,
} }
void void
DisplayListBuilder::PopStackingContext() DisplayListBuilder::PopStackingContext(bool aIsReferenceFrame)
{ {
WRDL_LOG("PopStackingContext\n", mWrState); WRDL_LOG("PopStackingContext\n", mWrState);
wr_dp_pop_stacking_context(mWrState); wr_dp_pop_stacking_context(mWrState, aIsReferenceFrame);
} }
wr::WrClipChainId wr::WrClipChainId

View File

@ -290,7 +290,7 @@ public:
const nsTArray<wr::WrFilterOp>& aFilters, const nsTArray<wr::WrFilterOp>& aFilters,
bool aIsBackfaceVisible, bool aIsBackfaceVisible,
const wr::GlyphRasterSpace& aRasterSpace); const wr::GlyphRasterSpace& aRasterSpace);
void PopStackingContext(); void PopStackingContext(bool aIsReferenceFrame);
wr::WrClipChainId DefineClipChain(const Maybe<wr::WrClipChainId>& aParent, wr::WrClipChainId DefineClipChain(const Maybe<wr::WrClipChainId>& aParent,
const nsTArray<wr::WrClipId>& aClips); const nsTArray<wr::WrClipId>& aClips);

View File

@ -1661,32 +1661,47 @@ pub extern "C" fn wr_dp_push_stacking_context(state: &mut WrState,
}; };
let mut prim_info = LayoutPrimitiveInfo::new(bounds); 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.is_backface_visible = is_backface_visible;
prim_info.tag = state.current_tag; prim_info.tag = state.current_tag;
let ref_frame_id = state.frame_builder state.frame_builder
.dl_builder .dl_builder
.push_stacking_context(&prim_info, .push_stacking_context(&prim_info,
clip_node_id, clip_node_id,
transform_binding,
transform_style, transform_style,
perspective,
mix_blend_mode, mix_blend_mode,
filters, filters,
glyph_raster_space); 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] #[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() }); debug_assert!(unsafe { !is_in_render_thread() });
state.frame_builder.dl_builder.pop_stacking_context(); 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] #[no_mangle]

View File

@ -1145,7 +1145,8 @@ void wr_dp_pop_scroll_layer(WrState *aState)
WR_FUNC; WR_FUNC;
WR_INLINE WR_INLINE
void wr_dp_pop_stacking_context(WrState *aState) void wr_dp_pop_stacking_context(WrState *aState,
bool aIsReferenceFrame)
WR_FUNC; WR_FUNC;
WR_INLINE WR_INLINE