Bug 1355602 - Decouple pushing scroll layers from pushing stacking contexts. r=jrmuizel

This removes the call to push_scroll_layer in wr_push_stacking_context, so that
it's now possible to push a stacking context without necessarily pushing a
scroll layer. There is already a separate function to push a scroll layer so the
call sites can do that. This patch just changes all the call sites that were
pushing a stacking context to also push a scroll layer, so there should be no
functional change. Future patches can remove the spurious scroll layers.

MozReview-Commit-ID: FtCkc9JQd8l
This commit is contained in:
Kartikaya Gupta 2017-04-11 17:04:59 -04:00
Родитель 728e0fbb28
Коммит 8050498fed
9 изменённых файлов: 21 добавлений и 37 удалений

Просмотреть файл

@ -87,13 +87,15 @@ WebRenderCanvasLayer::RenderLayer(wr::DisplayListBuilder& aBuilder)
WrBridge()->AddWebRenderParentCommand(OpAddExternalImage(mExternalImageId, key));
aBuilder.PushStackingContext(wr::ToWrRect(relBounds),
wr::ToWrRect(overflow),
mask.ptrOr(nullptr),
1.0f,
//GetAnimations(),
transform,
mixBlendMode);
aBuilder.PushScrollLayer(wr::ToWrRect(overflow),
wr::ToWrRect(overflow),
mask.ptrOr(nullptr));
aBuilder.PushImage(wr::ToWrRect(rect), clip, filter, key);
aBuilder.PopScrollLayer();
aBuilder.PopStackingContext();
}

Просмотреть файл

@ -34,13 +34,15 @@ WebRenderColorLayer::RenderLayer(wr::DisplayListBuilder& aBuilder)
DumpLayerInfo("ColorLayer", rect);
aBuilder.PushStackingContext(wr::ToWrRect(relBounds),
wr::ToWrRect(overflow),
mask.ptrOr(nullptr),
1.0f,
//GetAnimations(),
transform,
mixBlendMode);
aBuilder.PushScrollLayer(wr::ToWrRect(overflow),
wr::ToWrRect(overflow),
mask.ptrOr(nullptr));
aBuilder.PushRect(wr::ToWrRect(rect), clip, wr::ToWrColor(mColor));
aBuilder.PopScrollLayer();
aBuilder.PopStackingContext();
}

Просмотреть файл

@ -36,18 +36,20 @@ WebRenderContainerLayer::RenderLayer(wr::DisplayListBuilder& aBuilder)
Stringify(mixBlendMode).c_str());
}
aBuilder.PushStackingContext(wr::ToWrRect(relBounds),
wr::ToWrRect(overflow),
mask.ptrOr(nullptr),
GetLocalOpacity(),
//GetLayer()->GetAnimations(),
transform,
mixBlendMode);
aBuilder.PushScrollLayer(wr::ToWrRect(overflow),
wr::ToWrRect(overflow),
mask.ptrOr(nullptr));
for (LayerPolygon& child : children) {
if (child.layer->IsBackfaceHidden()) {
continue;
}
ToWebRenderLayer(child.layer)->RenderLayer(aBuilder);
}
aBuilder.PopScrollLayer();
aBuilder.PopStackingContext();
}

Просмотреть файл

@ -159,13 +159,15 @@ WebRenderImageLayer::RenderLayer(wr::DisplayListBuilder& aBuilder)
WrBridge()->AddWebRenderParentCommand(OpAddExternalImage(mExternalImageId, key));
aBuilder.PushStackingContext(wr::ToWrRect(relBounds),
wr::ToWrRect(overflow),
mask.ptrOr(nullptr),
1.0f,
//GetAnimations(),
transform,
mixBlendMode);
aBuilder.PushScrollLayer(wr::ToWrRect(overflow),
wr::ToWrRect(overflow),
mask.ptrOr(nullptr));
aBuilder.PushImage(wr::ToWrRect(rect), clip, filter, key);
aBuilder.PopScrollLayer();
aBuilder.PopStackingContext();
//mContainer->SetImageFactory(originalIF);

Просмотреть файл

@ -204,13 +204,15 @@ WebRenderPaintedLayer::RenderLayer(wr::DisplayListBuilder& aBuilder)
WrBridge()->AddWebRenderParentCommand(OpAddExternalImage(mExternalImageId, key));
aBuilder.PushStackingContext(wr::ToWrRect(relBounds),
wr::ToWrRect(overflow),
mask.ptrOr(nullptr),
1.0f,
//GetAnimations(),
transform,
mixBlendMode);
aBuilder.PushScrollLayer(wr::ToWrRect(overflow),
wr::ToWrRect(overflow),
mask.ptrOr(nullptr));
aBuilder.PushImage(wr::ToWrRect(rect), clip, wr::ImageRendering::Auto, key);
aBuilder.PopScrollLayer();
aBuilder.PopStackingContext();
}

Просмотреть файл

@ -526,13 +526,11 @@ DisplayListBuilder::Finalize()
void
DisplayListBuilder::PushStackingContext(const WrRect& aBounds,
const WrRect& aOverflow,
const WrImageMask* aMask,
const float aOpacity,
const gfx::Matrix4x4& aTransform,
const WrMixBlendMode& aMixBlendMode)
{
wr_dp_push_stacking_context(mWrState, aBounds, aOverflow, aMask, aOpacity,
wr_dp_push_stacking_context(mWrState, aBounds, aOpacity,
ToWrMatrix(aTransform), aMixBlendMode);
}

Просмотреть файл

@ -138,8 +138,6 @@ public:
wr::BuiltDisplayList Finalize();
void PushStackingContext(const WrRect& aBounds, // TODO: We should work with strongly typed rects
const WrRect& aOverflow,
const WrImageMask* aMask, // TODO: needs a wrapper.
const float aOpacity,
const gfx::Matrix4x4& aTransform,
const WrMixBlendMode& aMixBlendMode);

Просмотреть файл

@ -1097,8 +1097,6 @@ pub extern "C" fn wr_dp_new_clip_region(state: &mut WrState,
#[no_mangle]
pub extern "C" fn wr_dp_push_stacking_context(state: &mut WrState,
bounds: WrRect,
overflow: WrRect,
mask: *const WrImageMask,
opacity: f32,
transform: WrMatrix,
mix_blend_mode: WrMixBlendMode) {
@ -1106,20 +1104,6 @@ pub extern "C" fn wr_dp_push_stacking_context(state: &mut WrState,
state.z_index += 1;
let bounds = bounds.to_rect();
let overflow = overflow.to_rect();
// convert from the C type to the Rust type
let mask = unsafe {
mask.as_ref().map(|&WrImageMask { image, ref rect, repeat }| {
ImageMask {
image: image,
rect: rect.to_rect(),
repeat: repeat,
}
})
};
let clip_region = state.frame_builder.dl_builder.new_clip_region(&overflow, vec![], mask);
let mut filters: Vec<FilterOp> = Vec::new();
if opacity < 1.0 {
@ -1136,17 +1120,12 @@ pub extern "C" fn wr_dp_push_stacking_context(state: &mut WrState,
None,
mix_blend_mode,
filters);
let clip_bounds = LayoutRect::new(LayoutPoint::new(0.0, 0.0), bounds.size);
state.frame_builder.dl_builder.push_scroll_layer(clip_region, clip_bounds, None);
}
#[no_mangle]
pub extern "C" fn wr_dp_pop_stacking_context(state: &mut WrState) {
assert!(unsafe { is_in_main_thread() });
state.frame_builder.dl_builder.pop_scroll_layer();
state.frame_builder.dl_builder.pop_stacking_context();
//println!("pop_stacking {:?}", state.pipeline_id);
}
#[no_mangle]

Просмотреть файл

@ -634,7 +634,6 @@ WR_FUNC;
WR_INLINE void
wr_dp_push_stacking_context(WrState *wrState, WrRect bounds,
WrRect overflow, const WrImageMask *mask,
float opacity, WrMatrix transform,
WrMixBlendMode mixBlendMode)
WR_FUNC;