Bug 1582273. Pass scrollbar flags from gecko to webrender so it can identify them. r=gw

Differential Revision: https://phabricator.services.mozilla.com/D46587

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Timothy Nikkel 2019-09-23 21:41:18 +00:00
parent 5f56dea240
commit 75996b49cc
6 changed files with 42 additions and 34 deletions

View File

@ -336,16 +336,17 @@ class MOZ_RAII AutoTransactionSender {
*/
struct MOZ_STACK_CLASS StackingContextParams : public WrStackingContextParams {
StackingContextParams()
: WrStackingContextParams{WrStackingContextClip::None(),
nullptr,
nullptr,
wr::TransformStyle::Flat,
wr::WrReferenceFrameKind::Transform,
nullptr,
/* is_backface_visible = */ true,
/* cache_tiles = */ false,
wr::MixBlendMode::Normal,
/* is_backdrop_root = */ false} {}
: WrStackingContextParams{
WrStackingContextClip::None(),
nullptr,
nullptr,
wr::TransformStyle::Flat,
wr::WrReferenceFrameKind::Transform,
nullptr,
/* prim_flags = */ wr::PrimitiveFlags_IS_BACKFACE_VISIBLE,
/* cache_tiles = */ false,
wr::MixBlendMode::Normal,
/* is_backdrop_root = */ false} {}
void SetPreserve3D(bool aPreserve) {
transform_style =

View File

@ -2065,7 +2065,7 @@ pub struct WrStackingContextParams {
pub transform_style: TransformStyle,
pub reference_frame_kind: WrReferenceFrameKind,
pub scrolling_relative_to: *const u64,
pub is_backface_visible: bool,
pub prim_flags: PrimitiveFlags,
/// True if picture caching should be enabled for this stacking context.
pub cache_tiles: bool,
pub mix_blend_mode: MixBlendMode,
@ -2185,7 +2185,7 @@ pub extern "C" fn wr_dp_push_stacking_context(
.dl_builder
.push_stacking_context(bounds.origin,
wr_spatial_id,
params.is_backface_visible,
params.prim_flags,
wr_clip_id,
params.transform_style,
params.mix_blend_mode,

View File

@ -361,7 +361,7 @@ impl<'a> SceneBuilder<'a> {
root_pipeline.pipeline_id,
CompositeOps::default(),
TransformStyle::Flat,
/* is_backface_visible = */ true,
/* prim_flags = */ PrimitiveFlags::IS_BACKFACE_VISIBLE,
/* create_tile_cache = */ false,
ROOT_SPATIAL_NODE_INDEX,
ClipChainId::NONE,
@ -912,7 +912,7 @@ impl<'a> SceneBuilder<'a> {
filters: ItemRange<FilterOp>,
filter_datas: &[TempFilterData],
filter_primitives: ItemRange<FilterPrimitive>,
is_backface_visible: bool,
prim_flags: PrimitiveFlags,
apply_pipeline_clip: bool,
) {
// Avoid doing unnecessary work for empty stacking contexts.
@ -939,7 +939,7 @@ impl<'a> SceneBuilder<'a> {
pipeline_id,
composition_operations,
stacking_context.transform_style,
is_backface_visible,
prim_flags,
stacking_context.cache_tiles,
spatial_node_index,
clip_chain_id,
@ -1373,7 +1373,7 @@ impl<'a> SceneBuilder<'a> {
item.filters(),
item.filter_datas(),
item.filter_primitives(),
info.is_backface_visible,
info.prim_flags,
apply_pipeline_clip,
);
return Some(subtraversal);
@ -1771,7 +1771,7 @@ impl<'a> SceneBuilder<'a> {
pipeline_id: PipelineId,
composite_ops: CompositeOps,
transform_style: TransformStyle,
is_backface_visible: bool,
prim_flags: PrimitiveFlags,
create_tile_cache: bool,
spatial_node_index: SpatialNodeIndex,
clip_chain_id: ClipChainId,
@ -1895,12 +1895,6 @@ impl<'a> SceneBuilder<'a> {
|sc| sc.snap_to_device.clone(),
);
let prim_flags = if is_backface_visible {
PrimitiveFlags::IS_BACKFACE_VISIBLE
} else {
PrimitiveFlags::empty()
};
// Push the SC onto the stack, so we know how to handle things in
// pop_stacking_context.
self.sc_stack.push(FlattenedStackingContext {

View File

@ -34,12 +34,15 @@ pub const MAX_BLUR_RADIUS: f32 = 300.;
pub type ItemTag = (u64, u16);
bitflags! {
#[repr(C)]
#[derive(Deserialize, MallocSizeOf, Serialize, PeekPoke)]
pub struct PrimitiveFlags: u8 {
/// The CSS backface-visibility property (yes, it can be really granular)
const IS_BACKFACE_VISIBLE = 1 << 0;
/// If set, this primitive represents part of a scroll bar
const IS_SCROLL_BAR = 1 << 1;
/// If set, this primitive represents a scroll bar container
const IS_SCROLLBAR_CONTAINER = 1 << 1;
/// If set, this primitive represents a scroll bar thumb
const IS_SCROLLBAR_THUMB = 1 << 2;
}
}
@ -670,7 +673,7 @@ pub struct ReferenceFrame {
pub struct PushStackingContextDisplayItem {
pub origin: LayoutPoint,
pub spatial_id: SpatialId,
pub is_backface_visible: bool,
pub prim_flags: PrimitiveFlags,
pub stacking_context: StackingContext,
}

View File

@ -1254,7 +1254,7 @@ impl DisplayListBuilder {
&mut self,
origin: LayoutPoint,
spatial_id: di::SpatialId,
is_backface_visible: bool,
prim_flags: di::PrimitiveFlags,
clip_id: Option<di::ClipId>,
transform_style: di::TransformStyle,
mix_blend_mode: di::MixBlendMode,
@ -1270,7 +1270,7 @@ impl DisplayListBuilder {
let item = di::DisplayItem::PushStackingContext(di::PushStackingContextDisplayItem {
origin,
spatial_id,
is_backface_visible,
prim_flags,
stacking_context: di::StackingContext {
transform_style,
mix_blend_mode,
@ -1289,12 +1289,12 @@ impl DisplayListBuilder {
&mut self,
origin: LayoutPoint,
spatial_id: di::SpatialId,
is_backface_visible: bool,
prim_flags: di::PrimitiveFlags,
) {
self.push_simple_stacking_context_with_filters(
origin,
spatial_id,
is_backface_visible,
prim_flags,
&[],
&[],
&[],
@ -1306,7 +1306,7 @@ impl DisplayListBuilder {
&mut self,
origin: LayoutPoint,
spatial_id: di::SpatialId,
is_backface_visible: bool,
prim_flags: di::PrimitiveFlags,
filters: &[di::FilterOp],
filter_datas: &[di::FilterData],
filter_primitives: &[di::FilterPrimitive],
@ -1314,7 +1314,7 @@ impl DisplayListBuilder {
self.push_stacking_context(
origin,
spatial_id,
is_backface_visible,
prim_flags,
None,
di::TransformStyle::Flat,
di::MixBlendMode::Normal,

View File

@ -6941,6 +6941,12 @@ bool nsDisplayOwnLayer::CreateWebRenderCommands(
params.animation = prop.ptrOr(nullptr);
params.clip =
wr::WrStackingContextClip::ClipChain(aBuilder.CurrentClipChainId());
if (IsScrollbarContainer()) {
params.prim_flags |= wr::PrimitiveFlags_IS_SCROLLBAR_CONTAINER;
}
if (IsScrollThumbLayer()) {
params.prim_flags |= wr::PrimitiveFlags_IS_SCROLLBAR_THUMB;
}
StackingContextHelper sc(aSc, GetActiveScrolledRoot(), mFrame, this, aBuilder,
params);
@ -8626,7 +8632,9 @@ bool nsDisplayTransform::CreateWebRenderCommands(
params.mBoundTransform = &newTransformMatrix;
params.animation = animationsId ? &prop : nullptr;
params.mTransformPtr = transformForSC;
params.is_backface_visible = !BackfaceIsHidden();
params.prim_flags = !BackfaceIsHidden()
? wr::PrimitiveFlags_IS_BACKFACE_VISIBLE
: wr::PrimitiveFlags{0};
params.mDeferredTransformItem = deferredTransformItem;
params.mAnimated = animated;
// Determine if we would have to rasterize any items in local raster space
@ -9329,7 +9337,9 @@ bool nsDisplayPerspective::CreateWebRenderCommands(
wr::StackingContextParams params;
params.mTransformPtr = &perspectiveMatrix;
params.reference_frame_kind = wr::WrReferenceFrameKind::Perspective;
params.is_backface_visible = !BackfaceIsHidden();
params.prim_flags = !BackfaceIsHidden()
? wr::PrimitiveFlags_IS_BACKFACE_VISIBLE
: wr::PrimitiveFlags{0};
params.SetPreserve3D(preserve3D);
params.clip =
wr::WrStackingContextClip::ClipChain(aBuilder.CurrentClipChainId());