зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1581448 - Add support for specifying extra per-primitive flags in WR display lists r=kvark,nical
This patch replaces the is_backface_visible bool in the common per-primitive data in the display list with a PrimitiveFlags enumeration. This will allow Gecko to specify extra information about certain primitive, such as tagging scroll bars. Differential Revision: https://phabricator.services.mozilla.com/D45970 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
db60a948f1
Коммит
ff53edd4e5
|
@ -2357,6 +2357,17 @@ pub extern "C" fn wr_dp_push_iframe(state: &mut WrState,
|
|||
);
|
||||
}
|
||||
|
||||
// A helper fn to construct a PrimitiveFlags
|
||||
fn prim_flags(
|
||||
is_backface_visible: bool,
|
||||
) -> PrimitiveFlags {
|
||||
if is_backface_visible {
|
||||
PrimitiveFlags::IS_BACKFACE_VISIBLE
|
||||
} else {
|
||||
PrimitiveFlags::empty()
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_rect(state: &mut WrState,
|
||||
rect: LayoutRect,
|
||||
|
@ -2376,7 +2387,7 @@ pub extern "C" fn wr_dp_push_rect(state: &mut WrState,
|
|||
clip_rect: clip_rect.unwrap_or(LayoutRect::zero()),
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible,
|
||||
flags: prim_flags(is_backface_visible),
|
||||
hit_info: state.current_tag,
|
||||
};
|
||||
|
||||
|
@ -2406,7 +2417,7 @@ pub extern "C" fn wr_dp_push_rect_with_parent_clip(
|
|||
clip_rect: clip_rect.unwrap(),
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible,
|
||||
flags: prim_flags(is_backface_visible),
|
||||
hit_info: state.current_tag,
|
||||
};
|
||||
|
||||
|
@ -2458,7 +2469,7 @@ pub extern "C" fn wr_dp_push_backdrop_filter_with_parent_clip(
|
|||
clip_rect: clip_rect.unwrap(),
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible,
|
||||
flags: prim_flags(is_backface_visible),
|
||||
hit_info: state.current_tag,
|
||||
};
|
||||
|
||||
|
@ -2486,7 +2497,7 @@ pub extern "C" fn wr_dp_push_clear_rect(state: &mut WrState,
|
|||
clip_rect: clip_rect.unwrap(),
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible: true,
|
||||
flags: prim_flags(true),
|
||||
hit_info: state.current_tag,
|
||||
};
|
||||
|
||||
|
@ -2512,7 +2523,7 @@ pub extern "C" fn wr_dp_push_hit_test(state: &mut WrState,
|
|||
clip_rect: clip_rect.unwrap(),
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible,
|
||||
flags: prim_flags(is_backface_visible),
|
||||
hit_info: state.current_tag,
|
||||
};
|
||||
|
||||
|
@ -2539,7 +2550,7 @@ pub extern "C" fn wr_dp_push_clear_rect_with_parent_clip(
|
|||
clip_rect: clip_rect.unwrap(),
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible: true,
|
||||
flags: prim_flags(true),
|
||||
hit_info: state.current_tag,
|
||||
};
|
||||
|
||||
|
@ -2566,7 +2577,7 @@ pub extern "C" fn wr_dp_push_image(state: &mut WrState,
|
|||
clip_rect: clip,
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible,
|
||||
flags: prim_flags(is_backface_visible),
|
||||
hit_info: state.current_tag,
|
||||
};
|
||||
|
||||
|
@ -2606,7 +2617,7 @@ pub extern "C" fn wr_dp_push_repeating_image(state: &mut WrState,
|
|||
clip_rect: clip,
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible,
|
||||
flags: prim_flags(is_backface_visible),
|
||||
hit_info: state.current_tag,
|
||||
};
|
||||
|
||||
|
@ -2650,7 +2661,7 @@ pub extern "C" fn wr_dp_push_yuv_planar_image(state: &mut WrState,
|
|||
clip_rect: clip,
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible,
|
||||
flags: prim_flags(is_backface_visible),
|
||||
hit_info: state.current_tag,
|
||||
};
|
||||
|
||||
|
@ -2686,7 +2697,7 @@ pub extern "C" fn wr_dp_push_yuv_NV12_image(state: &mut WrState,
|
|||
clip_rect: clip,
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible,
|
||||
flags: prim_flags(is_backface_visible),
|
||||
hit_info: state.current_tag,
|
||||
};
|
||||
|
||||
|
@ -2721,7 +2732,7 @@ pub extern "C" fn wr_dp_push_yuv_interleaved_image(state: &mut WrState,
|
|||
clip_rect: clip,
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible,
|
||||
flags: prim_flags(is_backface_visible),
|
||||
hit_info: state.current_tag,
|
||||
};
|
||||
|
||||
|
@ -2757,7 +2768,7 @@ pub extern "C" fn wr_dp_push_text(state: &mut WrState,
|
|||
clip_rect: clip,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
clip_id: space_and_clip.clip_id,
|
||||
is_backface_visible,
|
||||
flags: prim_flags(is_backface_visible),
|
||||
hit_info: state.current_tag
|
||||
};
|
||||
|
||||
|
@ -2813,7 +2824,7 @@ pub extern "C" fn wr_dp_push_line(state: &mut WrState,
|
|||
clip_rect: *clip,
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible,
|
||||
flags: prim_flags(is_backface_visible),
|
||||
hit_info: state.current_tag,
|
||||
};
|
||||
|
||||
|
@ -2858,7 +2869,7 @@ pub extern "C" fn wr_dp_push_border(state: &mut WrState,
|
|||
clip_rect: clip,
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible,
|
||||
flags: prim_flags(is_backface_visible),
|
||||
hit_info: state.current_tag,
|
||||
};
|
||||
|
||||
|
@ -2907,7 +2918,7 @@ pub extern "C" fn wr_dp_push_border_image(state: &mut WrState,
|
|||
clip_rect: clip,
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible,
|
||||
flags: prim_flags(is_backface_visible),
|
||||
hit_info: state.current_tag,
|
||||
};
|
||||
|
||||
|
@ -2965,7 +2976,7 @@ pub extern "C" fn wr_dp_push_border_gradient(state: &mut WrState,
|
|||
clip_rect: clip,
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible,
|
||||
flags: prim_flags(is_backface_visible),
|
||||
hit_info: state.current_tag,
|
||||
};
|
||||
|
||||
|
@ -3027,7 +3038,7 @@ pub extern "C" fn wr_dp_push_border_radial_gradient(state: &mut WrState,
|
|||
clip_rect: clip,
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible,
|
||||
flags: prim_flags(is_backface_visible),
|
||||
hit_info: state.current_tag,
|
||||
};
|
||||
|
||||
|
@ -3070,7 +3081,7 @@ pub extern "C" fn wr_dp_push_linear_gradient(state: &mut WrState,
|
|||
clip_rect: clip,
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible,
|
||||
flags: prim_flags(is_backface_visible),
|
||||
hit_info: state.current_tag,
|
||||
};
|
||||
|
||||
|
@ -3114,7 +3125,7 @@ pub extern "C" fn wr_dp_push_radial_gradient(state: &mut WrState,
|
|||
clip_rect: clip,
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible,
|
||||
flags: prim_flags(is_backface_visible),
|
||||
hit_info: state.current_tag,
|
||||
};
|
||||
|
||||
|
@ -3147,7 +3158,7 @@ pub extern "C" fn wr_dp_push_box_shadow(state: &mut WrState,
|
|||
clip_rect: clip,
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible,
|
||||
flags: prim_flags(is_backface_visible),
|
||||
hit_info: state.current_tag,
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use api::{BorderRadius, ClipMode, HitTestFlags, HitTestItem, HitTestResult, ItemTag};
|
||||
use api::{BorderRadius, ClipMode, HitTestFlags, HitTestItem, HitTestResult, ItemTag, PrimitiveFlags};
|
||||
use api::PipelineId;
|
||||
use api::units::*;
|
||||
use crate::clip::{ClipChainId, ClipDataStore, ClipNode, ClipItemKind, ClipStore};
|
||||
|
@ -104,7 +104,7 @@ impl HitTestingItem {
|
|||
rect: info.rect,
|
||||
clip_rect: info.clip_rect,
|
||||
tag,
|
||||
is_backface_visible: info.is_backface_visible,
|
||||
is_backface_visible: info.flags.contains(PrimitiveFlags::IS_BACKFACE_VISIBLE),
|
||||
spatial_node_index,
|
||||
clip_chain_range,
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use api::{ColorF, DebugCommand, DocumentId, ExternalImageData, ExternalImageId};
|
||||
use api::{ColorF, DebugCommand, DocumentId, ExternalImageData, ExternalImageId, PrimitiveFlags};
|
||||
use api::{ImageFormat, ItemTag, NotificationRequest, Shadow, FilterOp, MAX_BLUR_RADIUS};
|
||||
use api::units::*;
|
||||
use api;
|
||||
|
@ -554,7 +554,7 @@ pub struct LayoutPrimitiveInfo {
|
|||
/// but that's an ongoing project, so for now it exists and is used :(
|
||||
pub rect: LayoutRect,
|
||||
pub clip_rect: LayoutRect,
|
||||
pub is_backface_visible: bool,
|
||||
pub flags: PrimitiveFlags,
|
||||
pub hit_info: Option<ItemTag>,
|
||||
}
|
||||
|
||||
|
@ -563,7 +563,7 @@ impl LayoutPrimitiveInfo {
|
|||
Self {
|
||||
rect,
|
||||
clip_rect,
|
||||
is_backface_visible: true,
|
||||
flags: PrimitiveFlags::default(),
|
||||
hit_info: None,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use api::{MixBlendMode, PipelineId, PremultipliedColorF, FilterPrimitiveKind};
|
||||
use api::{PropertyBinding, PropertyBindingId, FilterPrimitive, FontRenderMode};
|
||||
use api::{DebugFlags, RasterSpace, ImageKey, ColorF};
|
||||
use api::{DebugFlags, RasterSpace, ImageKey, ColorF, PrimitiveFlags};
|
||||
use api::units::*;
|
||||
use crate::box_shadow::{BLUR_SAMPLE_SCALE};
|
||||
use crate::clip::{ClipStore, ClipChainInstance, ClipDataHandle, ClipChainId};
|
||||
|
@ -2283,7 +2283,7 @@ impl PrimitiveList {
|
|||
prim_instance: PrimitiveInstance,
|
||||
prim_size: LayoutSize,
|
||||
spatial_node_index: SpatialNodeIndex,
|
||||
is_backface_visible: bool,
|
||||
prim_flags: PrimitiveFlags,
|
||||
insert_position: PrimitiveListPosition,
|
||||
) {
|
||||
let mut flags = ClusterFlags::empty();
|
||||
|
@ -2300,7 +2300,7 @@ impl PrimitiveList {
|
|||
_ => {}
|
||||
}
|
||||
|
||||
if is_backface_visible {
|
||||
if prim_flags.contains(PrimitiveFlags::IS_BACKFACE_VISIBLE) {
|
||||
flags.insert(ClusterFlags::IS_BACKFACE_VISIBLE);
|
||||
}
|
||||
|
||||
|
@ -2345,13 +2345,13 @@ impl PrimitiveList {
|
|||
prim_instance: PrimitiveInstance,
|
||||
prim_size: LayoutSize,
|
||||
spatial_node_index: SpatialNodeIndex,
|
||||
is_backface_visible: bool,
|
||||
flags: PrimitiveFlags,
|
||||
) {
|
||||
self.push(
|
||||
prim_instance,
|
||||
prim_size,
|
||||
spatial_node_index,
|
||||
is_backface_visible,
|
||||
flags,
|
||||
PrimitiveListPosition::Begin,
|
||||
)
|
||||
}
|
||||
|
@ -2362,13 +2362,13 @@ impl PrimitiveList {
|
|||
prim_instance: PrimitiveInstance,
|
||||
prim_size: LayoutSize,
|
||||
spatial_node_index: SpatialNodeIndex,
|
||||
is_backface_visible: bool,
|
||||
flags: PrimitiveFlags,
|
||||
) {
|
||||
self.push(
|
||||
prim_instance,
|
||||
prim_size,
|
||||
spatial_node_index,
|
||||
is_backface_visible,
|
||||
flags,
|
||||
PrimitiveListPosition::End,
|
||||
)
|
||||
}
|
||||
|
@ -2583,7 +2583,7 @@ impl PicturePrimitive {
|
|||
context_3d: Picture3DContext<OrderedPictureChild>,
|
||||
frame_output_pipeline_id: Option<PipelineId>,
|
||||
apply_local_clip_rect: bool,
|
||||
is_backface_visible: bool,
|
||||
flags: PrimitiveFlags,
|
||||
requested_raster_space: RasterSpace,
|
||||
prim_list: PrimitiveList,
|
||||
spatial_node_index: SpatialNodeIndex,
|
||||
|
@ -2600,7 +2600,7 @@ impl PicturePrimitive {
|
|||
frame_output_pipeline_id,
|
||||
extra_gpu_data_handles: SmallVec::new(),
|
||||
apply_local_clip_rect,
|
||||
is_backface_visible,
|
||||
is_backface_visible: flags.contains(PrimitiveFlags::IS_BACKFACE_VISIBLE),
|
||||
requested_raster_space,
|
||||
spatial_node_index,
|
||||
local_rect: LayoutRect::zero(),
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use api::PrimitiveFlags;
|
||||
use api::units::*;
|
||||
use crate::clip_scroll_tree::SpatialNodeIndex;
|
||||
use crate::intern::{Internable, InternDebug, Handle as InternHandle};
|
||||
|
@ -34,13 +35,13 @@ pub type BackdropKey = PrimKey<Backdrop>;
|
|||
|
||||
impl BackdropKey {
|
||||
pub fn new(
|
||||
is_backface_visible: bool,
|
||||
flags: PrimitiveFlags,
|
||||
prim_size: LayoutSize,
|
||||
backdrop: Backdrop,
|
||||
) -> Self {
|
||||
BackdropKey {
|
||||
common: PrimKeyCommonData {
|
||||
is_backface_visible,
|
||||
flags,
|
||||
prim_size: prim_size.into(),
|
||||
},
|
||||
kind: backdrop,
|
||||
|
@ -86,7 +87,7 @@ impl InternablePrimitive for Backdrop {
|
|||
info: &LayoutPrimitiveInfo,
|
||||
) -> BackdropKey {
|
||||
BackdropKey::new(
|
||||
info.is_backface_visible,
|
||||
info.flags,
|
||||
info.rect.size,
|
||||
self
|
||||
)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use api::{
|
||||
ColorF, ColorU, ExtendMode, GradientStop,
|
||||
PremultipliedColorF, LineOrientation,
|
||||
PremultipliedColorF, LineOrientation, PrimitiveFlags,
|
||||
};
|
||||
use api::units::{LayoutPoint, LayoutSize, LayoutVector2D};
|
||||
use crate::scene_building::IsVisible;
|
||||
|
@ -78,13 +78,13 @@ pub struct LinearGradientKey {
|
|||
|
||||
impl LinearGradientKey {
|
||||
pub fn new(
|
||||
is_backface_visible: bool,
|
||||
flags: PrimitiveFlags,
|
||||
prim_size: LayoutSize,
|
||||
linear_grad: LinearGradient,
|
||||
) -> Self {
|
||||
LinearGradientKey {
|
||||
common: PrimKeyCommonData {
|
||||
is_backface_visible,
|
||||
flags,
|
||||
prim_size: prim_size.into(),
|
||||
},
|
||||
extend_mode: linear_grad.extend_mode,
|
||||
|
@ -308,7 +308,7 @@ impl InternablePrimitive for LinearGradient {
|
|||
info: &LayoutPrimitiveInfo,
|
||||
) -> LinearGradientKey {
|
||||
LinearGradientKey::new(
|
||||
info.is_backface_visible,
|
||||
info.flags,
|
||||
info.rect.size,
|
||||
self
|
||||
)
|
||||
|
@ -384,13 +384,13 @@ pub struct RadialGradientKey {
|
|||
|
||||
impl RadialGradientKey {
|
||||
pub fn new(
|
||||
is_backface_visible: bool,
|
||||
flags: PrimitiveFlags,
|
||||
prim_size: LayoutSize,
|
||||
radial_grad: RadialGradient,
|
||||
) -> Self {
|
||||
RadialGradientKey {
|
||||
common: PrimKeyCommonData {
|
||||
is_backface_visible,
|
||||
flags,
|
||||
prim_size: prim_size.into(),
|
||||
},
|
||||
extend_mode: radial_grad.extend_mode,
|
||||
|
@ -538,7 +538,7 @@ impl InternablePrimitive for RadialGradient {
|
|||
info: &LayoutPrimitiveInfo,
|
||||
) -> RadialGradientKey {
|
||||
RadialGradientKey::new(
|
||||
info.is_backface_visible,
|
||||
info.flags,
|
||||
info.rect.size,
|
||||
self,
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use api::{
|
||||
AlphaType, ColorDepth, ColorF, ColorU,
|
||||
AlphaType, ColorDepth, ColorF, ColorU, PrimitiveFlags,
|
||||
ImageKey as ApiImageKey, ImageRendering,
|
||||
PremultipliedColorF, Shadow, YuvColorSpace, ColorRange, YuvFormat,
|
||||
};
|
||||
|
@ -85,13 +85,13 @@ pub type ImageKey = PrimKey<Image>;
|
|||
|
||||
impl ImageKey {
|
||||
pub fn new(
|
||||
is_backface_visible: bool,
|
||||
flags: PrimitiveFlags,
|
||||
prim_size: LayoutSize,
|
||||
image: Image,
|
||||
) -> Self {
|
||||
ImageKey {
|
||||
common: PrimKeyCommonData {
|
||||
is_backface_visible,
|
||||
flags,
|
||||
prim_size: prim_size.into(),
|
||||
},
|
||||
kind: image,
|
||||
|
@ -327,7 +327,7 @@ impl InternablePrimitive for Image {
|
|||
info: &LayoutPrimitiveInfo,
|
||||
) -> ImageKey {
|
||||
ImageKey::new(
|
||||
info.is_backface_visible,
|
||||
info.flags,
|
||||
info.rect.size,
|
||||
self
|
||||
)
|
||||
|
@ -393,14 +393,14 @@ pub type YuvImageKey = PrimKey<YuvImage>;
|
|||
|
||||
impl YuvImageKey {
|
||||
pub fn new(
|
||||
is_backface_visible: bool,
|
||||
flags: PrimitiveFlags,
|
||||
prim_size: LayoutSize,
|
||||
yuv_image: YuvImage,
|
||||
) -> Self {
|
||||
|
||||
YuvImageKey {
|
||||
common: PrimKeyCommonData {
|
||||
is_backface_visible,
|
||||
flags,
|
||||
prim_size: prim_size.into(),
|
||||
},
|
||||
kind: yuv_image,
|
||||
|
@ -509,7 +509,7 @@ impl InternablePrimitive for YuvImage {
|
|||
info: &LayoutPrimitiveInfo,
|
||||
) -> YuvImageKey {
|
||||
YuvImageKey::new(
|
||||
info.is_backface_visible,
|
||||
info.flags,
|
||||
info.rect.size,
|
||||
self,
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use api::{BorderRadius, ClipMode, ColorF};
|
||||
use api::{ImageRendering, RepeatMode};
|
||||
use api::{ImageRendering, RepeatMode, PrimitiveFlags};
|
||||
use api::{PremultipliedColorF, PropertyBinding, Shadow, GradientStop};
|
||||
use api::{BoxShadowClipMode, LineStyle, LineOrientation, BorderStyle};
|
||||
use api::{PrimitiveKeyKind};
|
||||
|
@ -389,7 +389,7 @@ impl GpuCacheAddress {
|
|||
#[derive(MallocSizeOf)]
|
||||
pub struct PrimitiveSceneData {
|
||||
pub prim_size: LayoutSize,
|
||||
pub is_backface_visible: bool,
|
||||
pub flags: PrimitiveFlags,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "capture", derive(Serialize))]
|
||||
|
@ -653,7 +653,7 @@ impl From<WorldPoint> for PointKey {
|
|||
#[cfg_attr(feature = "replay", derive(Deserialize))]
|
||||
#[derive(Debug, Clone, Eq, MallocSizeOf, PartialEq, Hash)]
|
||||
pub struct PrimKeyCommonData {
|
||||
pub is_backface_visible: bool,
|
||||
pub flags: PrimitiveFlags,
|
||||
pub prim_size: SizeKey,
|
||||
}
|
||||
|
||||
|
@ -662,7 +662,7 @@ impl PrimKeyCommonData {
|
|||
info: &LayoutPrimitiveInfo,
|
||||
) -> Self {
|
||||
PrimKeyCommonData {
|
||||
is_backface_visible: info.is_backface_visible,
|
||||
flags: info.flags,
|
||||
prim_size: info.rect.size.into(),
|
||||
}
|
||||
}
|
||||
|
@ -686,13 +686,13 @@ pub struct PrimitiveKey {
|
|||
|
||||
impl PrimitiveKey {
|
||||
pub fn new(
|
||||
is_backface_visible: bool,
|
||||
flags: PrimitiveFlags,
|
||||
prim_size: LayoutSize,
|
||||
kind: PrimitiveKeyKind,
|
||||
) -> Self {
|
||||
PrimitiveKey {
|
||||
common: PrimKeyCommonData {
|
||||
is_backface_visible,
|
||||
flags,
|
||||
prim_size: prim_size.into(),
|
||||
},
|
||||
kind,
|
||||
|
@ -736,7 +736,7 @@ impl From<PrimitiveKeyKind> for PrimitiveTemplateKind {
|
|||
#[cfg_attr(feature = "replay", derive(Deserialize))]
|
||||
#[derive(MallocSizeOf)]
|
||||
pub struct PrimTemplateCommonData {
|
||||
pub is_backface_visible: bool,
|
||||
pub flags: PrimitiveFlags,
|
||||
pub may_need_repetition: bool,
|
||||
pub prim_size: LayoutSize,
|
||||
pub opacity: PrimitiveOpacity,
|
||||
|
@ -750,7 +750,7 @@ pub struct PrimTemplateCommonData {
|
|||
impl PrimTemplateCommonData {
|
||||
pub fn with_key_common(common: PrimKeyCommonData) -> Self {
|
||||
PrimTemplateCommonData {
|
||||
is_backface_visible: common.is_backface_visible,
|
||||
flags: common.flags,
|
||||
may_need_repetition: true,
|
||||
prim_size: common.prim_size.into(),
|
||||
gpu_cache_handle: GpuCacheHandle::new(),
|
||||
|
@ -853,7 +853,7 @@ impl InternablePrimitive for PrimitiveKeyKind {
|
|||
info: &LayoutPrimitiveInfo,
|
||||
) -> PrimitiveKey {
|
||||
PrimitiveKey::new(
|
||||
info.is_backface_visible,
|
||||
info.flags,
|
||||
info.rect.size,
|
||||
self,
|
||||
)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use api::{
|
||||
ColorU, MixBlendMode, FilterPrimitiveInput, FilterPrimitiveKind, ColorSpace,
|
||||
PropertyBinding, PropertyBindingId, CompositeOperator,
|
||||
PropertyBinding, PropertyBindingId, CompositeOperator, PrimitiveFlags,
|
||||
};
|
||||
use api::units::{Au, LayoutSize, LayoutVector2D};
|
||||
use crate::scene_building::IsVisible;
|
||||
|
@ -239,14 +239,14 @@ pub type PictureKey = PrimKey<Picture>;
|
|||
|
||||
impl PictureKey {
|
||||
pub fn new(
|
||||
is_backface_visible: bool,
|
||||
flags: PrimitiveFlags,
|
||||
prim_size: LayoutSize,
|
||||
pic: Picture,
|
||||
) -> Self {
|
||||
|
||||
PictureKey {
|
||||
common: PrimKeyCommonData {
|
||||
is_backface_visible,
|
||||
flags,
|
||||
prim_size: prim_size.into(),
|
||||
},
|
||||
kind: pic,
|
||||
|
@ -288,7 +288,7 @@ impl InternablePrimitive for Picture {
|
|||
info: &LayoutPrimitiveInfo,
|
||||
) -> PictureKey {
|
||||
PictureKey::new(
|
||||
info.is_backface_visible,
|
||||
info.flags,
|
||||
info.rect.size,
|
||||
self,
|
||||
)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use api::{AlphaType, BorderDetails, BorderDisplayItem, BuiltDisplayListIter};
|
||||
use api::{AlphaType, BorderDetails, BorderDisplayItem, BuiltDisplayListIter, PrimitiveFlags};
|
||||
use api::{ClipId, ColorF, CommonItemProperties, ComplexClipRegion, ComponentTransferFuncType, RasterSpace};
|
||||
use api::{DisplayItem, DisplayItemRef, ExtendMode, ExternalScrollId, FilterData};
|
||||
use api::{FilterOp, FilterPrimitive, FontInstanceKey, GlyphInstance, GlyphOptions, GradientStop};
|
||||
|
@ -668,7 +668,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
),
|
||||
LayoutSize::zero(),
|
||||
clip_chain_instance.spatial_node_index,
|
||||
true,
|
||||
PrimitiveFlags::IS_BACKFACE_VISIBLE,
|
||||
);
|
||||
|
||||
remaining_prims.add_prim_to_start(
|
||||
|
@ -678,7 +678,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
),
|
||||
LayoutSize::zero(),
|
||||
clip_chain_instance.spatial_node_index,
|
||||
true,
|
||||
PrimitiveFlags::IS_BACKFACE_VISIBLE,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -688,7 +688,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
// Now, create a picture with tile caching enabled that will hold all
|
||||
// of the primitives selected as belonging to the main scroll root.
|
||||
let pic_key = PictureKey::new(
|
||||
true,
|
||||
PrimitiveFlags::IS_BACKFACE_VISIBLE,
|
||||
LayoutSize::zero(),
|
||||
Picture {
|
||||
composite_mode_key: PictureCompositeKey::Identity,
|
||||
|
@ -700,7 +700,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
.intern(&pic_key, || {
|
||||
PrimitiveSceneData {
|
||||
prim_size: LayoutSize::zero(),
|
||||
is_backface_visible: true,
|
||||
flags: PrimitiveFlags::IS_BACKFACE_VISIBLE,
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -732,7 +732,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
Picture3DContext::Out,
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
PrimitiveFlags::IS_BACKFACE_VISIBLE,
|
||||
RasterSpace::Screen,
|
||||
prim_list,
|
||||
main_scroll_root,
|
||||
|
@ -758,7 +758,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
instance,
|
||||
LayoutSize::zero(),
|
||||
main_scroll_root,
|
||||
true,
|
||||
PrimitiveFlags::IS_BACKFACE_VISIBLE,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1110,7 +1110,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
let layout = LayoutPrimitiveInfo {
|
||||
rect: snap_to_device.snap_rect(&rect),
|
||||
clip_rect: snap_to_device.snap_rect(&clip_rect),
|
||||
is_backface_visible: common.is_backface_visible,
|
||||
flags: common.flags,
|
||||
hit_info: common.hit_info,
|
||||
};
|
||||
|
||||
|
@ -1594,7 +1594,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
.intern(&prim_key, || {
|
||||
PrimitiveSceneData {
|
||||
prim_size: info.rect.size,
|
||||
is_backface_visible: info.is_backface_visible,
|
||||
flags: info.flags,
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1659,7 +1659,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
prim_instance: PrimitiveInstance,
|
||||
prim_size: LayoutSize,
|
||||
spatial_node_index: SpatialNodeIndex,
|
||||
is_backface_visible: bool,
|
||||
flags: PrimitiveFlags,
|
||||
) {
|
||||
// Add primitive to the top-most stacking context on the stack.
|
||||
if prim_instance.is_chased() {
|
||||
|
@ -1671,7 +1671,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
prim_instance,
|
||||
prim_size,
|
||||
spatial_node_index,
|
||||
is_backface_visible,
|
||||
flags,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1762,7 +1762,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
prim_instance,
|
||||
info.rect.size,
|
||||
clip_and_scroll.spatial_node_index,
|
||||
info.is_backface_visible,
|
||||
info.flags,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1821,7 +1821,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
ExtendedPrimitiveInstance {
|
||||
instance,
|
||||
spatial_node_index: sc.spatial_node_index,
|
||||
is_backface_visible: sc.is_backface_visible,
|
||||
flags: sc.prim_flags,
|
||||
}
|
||||
});
|
||||
(true, extra_instance)
|
||||
|
@ -1895,12 +1895,18 @@ 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 {
|
||||
prim_list: PrimitiveList::empty(),
|
||||
pipeline_id,
|
||||
is_backface_visible,
|
||||
prim_flags,
|
||||
requested_raster_space,
|
||||
spatial_node_index,
|
||||
clip_chain_id,
|
||||
|
@ -1939,7 +1945,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
prim,
|
||||
LayoutSize::zero(),
|
||||
stacking_context.spatial_node_index,
|
||||
true,
|
||||
PrimitiveFlags::IS_BACKFACE_VISIBLE,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1961,7 +1967,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
prim,
|
||||
LayoutSize::zero(),
|
||||
stacking_context.spatial_node_index,
|
||||
true,
|
||||
PrimitiveFlags::IS_BACKFACE_VISIBLE,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2018,7 +2024,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
// Now, create a picture with tile caching enabled that will hold all
|
||||
// of the primitives selected as belonging to the main scroll root.
|
||||
let pic_key = PictureKey::new(
|
||||
true,
|
||||
PrimitiveFlags::IS_BACKFACE_VISIBLE,
|
||||
LayoutSize::zero(),
|
||||
Picture {
|
||||
composite_mode_key: PictureCompositeKey::Identity,
|
||||
|
@ -2030,7 +2036,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
.intern(&pic_key, || {
|
||||
PrimitiveSceneData {
|
||||
prim_size: LayoutSize::zero(),
|
||||
is_backface_visible: true,
|
||||
flags: PrimitiveFlags::IS_BACKFACE_VISIBLE,
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -2054,7 +2060,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
Picture3DContext::Out,
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
PrimitiveFlags::IS_BACKFACE_VISIBLE,
|
||||
RasterSpace::Screen,
|
||||
stacking_context.prim_list,
|
||||
scroll_root,
|
||||
|
@ -2078,7 +2084,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
instance,
|
||||
LayoutSize::zero(),
|
||||
scroll_root,
|
||||
true,
|
||||
PrimitiveFlags::IS_BACKFACE_VISIBLE,
|
||||
);
|
||||
stacking_context.prim_list = prim_list;
|
||||
}
|
||||
|
@ -2091,7 +2097,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
leaf_context_3d,
|
||||
leaf_output_pipeline_id,
|
||||
true,
|
||||
stacking_context.is_backface_visible,
|
||||
stacking_context.prim_flags,
|
||||
stacking_context.requested_raster_space,
|
||||
stacking_context.prim_list,
|
||||
stacking_context.spatial_node_index,
|
||||
|
@ -2107,7 +2113,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
let mut cur_instance = create_prim_instance(
|
||||
leaf_pic_index,
|
||||
leaf_composite_mode.into(),
|
||||
stacking_context.is_backface_visible,
|
||||
stacking_context.prim_flags,
|
||||
ClipChainId::NONE,
|
||||
&mut self.interners,
|
||||
);
|
||||
|
@ -2123,7 +2129,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
prims.push(ExtendedPrimitiveInstance {
|
||||
instance: cur_instance,
|
||||
spatial_node_index: stacking_context.spatial_node_index,
|
||||
is_backface_visible: stacking_context.is_backface_visible,
|
||||
flags: stacking_context.prim_flags,
|
||||
});
|
||||
|
||||
let mut prim_list = PrimitiveList::empty();
|
||||
|
@ -2132,7 +2138,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
ext_prim.instance,
|
||||
LayoutSize::zero(),
|
||||
ext_prim.spatial_node_index,
|
||||
ext_prim.is_backface_visible,
|
||||
ext_prim.flags,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2147,7 +2153,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
},
|
||||
stacking_context.frame_output_pipeline_id,
|
||||
true,
|
||||
stacking_context.is_backface_visible,
|
||||
stacking_context.prim_flags,
|
||||
stacking_context.requested_raster_space,
|
||||
prim_list,
|
||||
stacking_context.spatial_node_index,
|
||||
|
@ -2159,7 +2165,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
cur_instance = create_prim_instance(
|
||||
current_pic_index,
|
||||
PictureCompositeKey::Identity,
|
||||
stacking_context.is_backface_visible,
|
||||
stacking_context.prim_flags,
|
||||
ClipChainId::NONE,
|
||||
&mut self.interners,
|
||||
);
|
||||
|
@ -2171,7 +2177,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
stacking_context.composite_ops.filters,
|
||||
stacking_context.composite_ops.filter_primitives,
|
||||
stacking_context.composite_ops.filter_datas,
|
||||
stacking_context.is_backface_visible,
|
||||
stacking_context.prim_flags,
|
||||
stacking_context.requested_raster_space,
|
||||
stacking_context.spatial_node_index,
|
||||
true,
|
||||
|
@ -2200,7 +2206,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
cur_instance.clone(),
|
||||
LayoutSize::zero(),
|
||||
stacking_context.spatial_node_index,
|
||||
stacking_context.is_backface_visible,
|
||||
stacking_context.prim_flags,
|
||||
);
|
||||
|
||||
let blend_pic_index = PictureIndex(self.prim_store.pictures
|
||||
|
@ -2210,7 +2216,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
Picture3DContext::Out,
|
||||
None,
|
||||
true,
|
||||
stacking_context.is_backface_visible,
|
||||
stacking_context.prim_flags,
|
||||
stacking_context.requested_raster_space,
|
||||
prim_list,
|
||||
stacking_context.spatial_node_index,
|
||||
|
@ -2223,7 +2229,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
cur_instance = create_prim_instance(
|
||||
blend_pic_index,
|
||||
composite_mode.into(),
|
||||
stacking_context.is_backface_visible,
|
||||
stacking_context.prim_flags,
|
||||
ClipChainId::NONE,
|
||||
&mut self.interners,
|
||||
);
|
||||
|
@ -2260,7 +2266,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
cur_instance,
|
||||
LayoutSize::zero(),
|
||||
stacking_context.spatial_node_index,
|
||||
stacking_context.is_backface_visible,
|
||||
stacking_context.prim_flags,
|
||||
);
|
||||
None
|
||||
}
|
||||
|
@ -2277,7 +2283,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
self.add_primitive_instance_to_3d_root(ExtendedPrimitiveInstance {
|
||||
instance,
|
||||
spatial_node_index: stacking_context.spatial_node_index,
|
||||
is_backface_visible: stacking_context.is_backface_visible,
|
||||
flags: stacking_context.prim_flags,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2606,7 +2612,6 @@ impl<'a> SceneBuilder<'a> {
|
|||
blur_filter.sanitize();
|
||||
let composite_mode = PictureCompositeMode::Filter(blur_filter);
|
||||
let composite_mode_key = Some(composite_mode.clone()).into();
|
||||
let is_backface_visible = true; //TODO: double check this
|
||||
|
||||
// Pass through configuration information about whether WR should
|
||||
// do the bounding rect inflation for text shadows.
|
||||
|
@ -2622,7 +2627,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
Picture3DContext::Out,
|
||||
None,
|
||||
is_passthrough,
|
||||
is_backface_visible,
|
||||
PrimitiveFlags::IS_BACKFACE_VISIBLE,
|
||||
raster_space,
|
||||
prim_list,
|
||||
pending_shadow.clip_and_scroll.spatial_node_index,
|
||||
|
@ -2632,7 +2637,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
);
|
||||
|
||||
let shadow_pic_key = PictureKey::new(
|
||||
true,
|
||||
PrimitiveFlags::IS_BACKFACE_VISIBLE,
|
||||
LayoutSize::zero(),
|
||||
Picture { composite_mode_key },
|
||||
);
|
||||
|
@ -2642,7 +2647,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
.intern(&shadow_pic_key, || {
|
||||
PrimitiveSceneData {
|
||||
prim_size: LayoutSize::zero(),
|
||||
is_backface_visible: true,
|
||||
flags: PrimitiveFlags::IS_BACKFACE_VISIBLE,
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -2664,7 +2669,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
shadow_prim_instance,
|
||||
LayoutSize::zero(),
|
||||
pending_shadow.clip_and_scroll.spatial_node_index,
|
||||
true,
|
||||
PrimitiveFlags::IS_BACKFACE_VISIBLE,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2742,7 +2747,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
shadow_prim_instance,
|
||||
info.rect.size,
|
||||
pending_primitive.clip_and_scroll.spatial_node_index,
|
||||
info.is_backface_visible,
|
||||
info.flags,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -3298,7 +3303,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
// a clip for each stacking context.
|
||||
for stacking_context in self.sc_stack.iter().rev().take_while(|sc| !sc.is_backdrop_root) {
|
||||
let clip_chain_id = stacking_context.clip_chain_id;
|
||||
let is_backface_visible = stacking_context.is_backface_visible;
|
||||
let prim_flags = stacking_context.prim_flags;
|
||||
let composite_mode = None;
|
||||
|
||||
let mut prim_list = PrimitiveList::empty();
|
||||
|
@ -3306,7 +3311,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
instance,
|
||||
LayoutSize::zero(),
|
||||
backdrop_spatial_node_index,
|
||||
is_backface_visible,
|
||||
prim_flags,
|
||||
);
|
||||
|
||||
backdrop_pic_index = PictureIndex(self.prim_store.pictures
|
||||
|
@ -3316,7 +3321,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
Picture3DContext::Out,
|
||||
None,
|
||||
true,
|
||||
is_backface_visible,
|
||||
prim_flags,
|
||||
requested_raster_space,
|
||||
prim_list,
|
||||
backdrop_spatial_node_index,
|
||||
|
@ -3330,7 +3335,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
instance = create_prim_instance(
|
||||
backdrop_pic_index,
|
||||
composite_mode.into(),
|
||||
is_backface_visible,
|
||||
prim_flags,
|
||||
clip_chain_id,
|
||||
&mut self.interners,
|
||||
);
|
||||
|
@ -3342,7 +3347,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
filters,
|
||||
filter_primitives,
|
||||
filter_datas,
|
||||
info.is_backface_visible,
|
||||
info.flags,
|
||||
requested_raster_space,
|
||||
backdrop_spatial_node_index,
|
||||
false,
|
||||
|
@ -3365,7 +3370,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
filters,
|
||||
filter_primitives,
|
||||
filter_datas,
|
||||
info.is_backface_visible,
|
||||
info.flags,
|
||||
requested_raster_space,
|
||||
backdrop_spatial_node_index,
|
||||
false,
|
||||
|
@ -3387,7 +3392,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
filtered_instance,
|
||||
LayoutSize::zero(),
|
||||
backdrop_spatial_node_index,
|
||||
info.is_backface_visible,
|
||||
info.flags,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -3395,7 +3400,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
let mut flattened_items = None;
|
||||
let mut backdrop_root = None;
|
||||
let mut spatial_node_index = SpatialNodeIndex::INVALID;
|
||||
let mut is_backface_visible = true;
|
||||
let mut prim_flags = PrimitiveFlags::default();
|
||||
for sc in self.sc_stack.iter_mut().rev() {
|
||||
// Add child contents to parent stacking context
|
||||
if let Some((_, flattened_instance)) = flattened_items.take() {
|
||||
|
@ -3403,7 +3408,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
flattened_instance,
|
||||
LayoutSize::zero(),
|
||||
spatial_node_index,
|
||||
is_backface_visible,
|
||||
prim_flags,
|
||||
);
|
||||
}
|
||||
flattened_items = sc.cut_item_sequence(
|
||||
|
@ -3413,7 +3418,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
Picture3DContext::Out,
|
||||
);
|
||||
spatial_node_index = sc.spatial_node_index;
|
||||
is_backface_visible = sc.is_backface_visible;
|
||||
prim_flags = sc.prim_flags;
|
||||
if sc.is_backdrop_root {
|
||||
backdrop_root = Some(sc);
|
||||
break;
|
||||
|
@ -3428,7 +3433,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
instance,
|
||||
LayoutSize::zero(),
|
||||
spatial_node_index,
|
||||
is_backface_visible,
|
||||
prim_flags,
|
||||
);
|
||||
|
||||
Some(pic_index)
|
||||
|
@ -3441,7 +3446,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
mut filter_ops: Vec<Filter>,
|
||||
mut filter_primitives: Vec<FilterPrimitive>,
|
||||
filter_datas: Vec<FilterData>,
|
||||
is_backface_visible: bool,
|
||||
flags: PrimitiveFlags,
|
||||
requested_raster_space: RasterSpace,
|
||||
spatial_node_index: SpatialNodeIndex,
|
||||
inflate_if_required: bool,
|
||||
|
@ -3494,7 +3499,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
cur_instance.clone(),
|
||||
LayoutSize::zero(),
|
||||
spatial_node_index,
|
||||
is_backface_visible,
|
||||
flags,
|
||||
);
|
||||
|
||||
let filter_pic_index = PictureIndex(self.prim_store.pictures
|
||||
|
@ -3504,7 +3509,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
Picture3DContext::Out,
|
||||
None,
|
||||
true,
|
||||
is_backface_visible,
|
||||
flags,
|
||||
requested_raster_space,
|
||||
prim_list,
|
||||
spatial_node_index,
|
||||
|
@ -3519,7 +3524,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
cur_instance = create_prim_instance(
|
||||
current_pic_index,
|
||||
composite_mode.into(),
|
||||
is_backface_visible,
|
||||
flags,
|
||||
ClipChainId::NONE,
|
||||
&mut self.interners,
|
||||
);
|
||||
|
@ -3565,7 +3570,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
cur_instance.clone(),
|
||||
LayoutSize::zero(),
|
||||
spatial_node_index,
|
||||
is_backface_visible,
|
||||
flags,
|
||||
);
|
||||
|
||||
let filter_pic_index = PictureIndex(self.prim_store.pictures
|
||||
|
@ -3575,7 +3580,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
Picture3DContext::Out,
|
||||
None,
|
||||
true,
|
||||
is_backface_visible,
|
||||
flags,
|
||||
requested_raster_space,
|
||||
prim_list,
|
||||
spatial_node_index,
|
||||
|
@ -3590,7 +3595,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
cur_instance = create_prim_instance(
|
||||
current_pic_index,
|
||||
Some(composite_mode).into(),
|
||||
is_backface_visible,
|
||||
flags,
|
||||
ClipChainId::NONE,
|
||||
&mut self.interners,
|
||||
);
|
||||
|
@ -3622,7 +3627,7 @@ pub trait IsVisible {
|
|||
struct ExtendedPrimitiveInstance {
|
||||
instance: PrimitiveInstance,
|
||||
spatial_node_index: SpatialNodeIndex,
|
||||
is_backface_visible: bool,
|
||||
flags: PrimitiveFlags,
|
||||
}
|
||||
|
||||
/// Properties of a stacking context that are maintained
|
||||
|
@ -3632,8 +3637,8 @@ struct FlattenedStackingContext {
|
|||
/// The list of primitive instances added to this stacking context.
|
||||
prim_list: PrimitiveList,
|
||||
|
||||
/// Whether this stacking context is visible when backfacing
|
||||
is_backface_visible: bool,
|
||||
/// Primitive instance flags for compositing this stacking context
|
||||
prim_flags: PrimitiveFlags,
|
||||
|
||||
/// Whether or not the caller wants this drawn in
|
||||
/// screen space (quality) or local space (performance)
|
||||
|
@ -3714,7 +3719,7 @@ impl FlattenedStackingContext {
|
|||
}
|
||||
|
||||
// If backface visibility is explicitly set.
|
||||
if !self.is_backface_visible {
|
||||
if !self.prim_flags.contains(PrimitiveFlags::IS_BACKFACE_VISIBLE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3756,7 +3761,7 @@ impl FlattenedStackingContext {
|
|||
flat_items_context_3d,
|
||||
None,
|
||||
true,
|
||||
self.is_backface_visible,
|
||||
self.prim_flags,
|
||||
self.requested_raster_space,
|
||||
mem::replace(&mut self.prim_list, PrimitiveList::empty()),
|
||||
self.spatial_node_index,
|
||||
|
@ -3768,7 +3773,7 @@ impl FlattenedStackingContext {
|
|||
let prim_instance = create_prim_instance(
|
||||
pic_index,
|
||||
composite_mode.into(),
|
||||
self.is_backface_visible,
|
||||
self.prim_flags,
|
||||
self.clip_chain_id,
|
||||
interners,
|
||||
);
|
||||
|
@ -3836,12 +3841,12 @@ impl From<PendingPrimitive<TextRun>> for ShadowItem {
|
|||
fn create_prim_instance(
|
||||
pic_index: PictureIndex,
|
||||
composite_mode_key: PictureCompositeKey,
|
||||
is_backface_visible: bool,
|
||||
flags: PrimitiveFlags,
|
||||
clip_chain_id: ClipChainId,
|
||||
interners: &mut Interners,
|
||||
) -> PrimitiveInstance {
|
||||
let pic_key = PictureKey::new(
|
||||
is_backface_visible,
|
||||
flags,
|
||||
LayoutSize::zero(),
|
||||
Picture { composite_mode_key },
|
||||
);
|
||||
|
@ -3851,7 +3856,7 @@ fn create_prim_instance(
|
|||
.intern(&pic_key, || {
|
||||
PrimitiveSceneData {
|
||||
prim_size: LayoutSize::zero(),
|
||||
is_backface_visible,
|
||||
flags,
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -33,6 +33,22 @@ pub const MAX_BLUR_RADIUS: f32 = 300.;
|
|||
/// events.
|
||||
pub type ItemTag = (u64, u16);
|
||||
|
||||
bitflags! {
|
||||
#[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;
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for PrimitiveFlags {
|
||||
fn default() -> Self {
|
||||
PrimitiveFlags::IS_BACKFACE_VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
/// A grouping of fields a lot of display items need, just to avoid
|
||||
/// repeating these over and over in this file.
|
||||
#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)]
|
||||
|
@ -49,19 +65,22 @@ pub struct CommonItemProperties {
|
|||
/// dubious "common" field, but because it's an Option, it usually only
|
||||
/// wastes a single byte (for None).
|
||||
pub hit_info: Option<ItemTag>,
|
||||
/// The CSS backface-visibility property (yes, it can be really granular)
|
||||
pub is_backface_visible: bool,
|
||||
/// Various flags describing properties of this primitive.
|
||||
pub flags: PrimitiveFlags,
|
||||
}
|
||||
|
||||
impl CommonItemProperties {
|
||||
/// Convenience for tests.
|
||||
pub fn new(clip_rect: LayoutRect, space_and_clip: SpaceAndClipInfo) -> Self {
|
||||
pub fn new(
|
||||
clip_rect: LayoutRect,
|
||||
space_and_clip: SpaceAndClipInfo,
|
||||
) -> Self {
|
||||
Self {
|
||||
clip_rect,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
clip_id: space_and_clip.clip_id,
|
||||
hit_info: None,
|
||||
is_backface_visible: true,
|
||||
flags: PrimitiveFlags::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ impl<'a> RawtestHarness<'a> {
|
|||
clip_rect,
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible: true,
|
||||
flags: PrimitiveFlags::default(),
|
||||
hit_info: None,
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ impl<'a> RawtestHarness<'a> {
|
|||
clip_rect,
|
||||
clip_id,
|
||||
spatial_id,
|
||||
is_backface_visible: true,
|
||||
flags: PrimitiveFlags::default(),
|
||||
hit_info: None,
|
||||
}
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ impl<'a> RawtestHarness<'a> {
|
|||
clip_rect: rect(0.0, 0.0, 800.0, 800.0),
|
||||
clip_id,
|
||||
spatial_id: root_space_and_clip.spatial_id,
|
||||
is_backface_visible: true,
|
||||
flags: PrimitiveFlags::default(),
|
||||
hit_info: None,
|
||||
};
|
||||
|
||||
|
@ -954,7 +954,7 @@ impl<'a> RawtestHarness<'a> {
|
|||
clip_rect: rect(110., 110., 50., 2.),
|
||||
clip_id,
|
||||
spatial_id,
|
||||
is_backface_visible: true,
|
||||
flags: PrimitiveFlags::default(),
|
||||
hit_info: None,
|
||||
};
|
||||
builder.push_line(
|
||||
|
@ -1209,7 +1209,7 @@ impl<'a> RawtestHarness<'a> {
|
|||
clip_rect: rect,
|
||||
clip_id: temp_clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible: true,
|
||||
flags: PrimitiveFlags::default(),
|
||||
},
|
||||
ColorF::new(1.0, 1.0, 1.0, 1.0),
|
||||
);
|
||||
|
@ -1229,7 +1229,7 @@ impl<'a> RawtestHarness<'a> {
|
|||
clip_rect: rect,
|
||||
clip_id: ClipId::ClipChain(clip_chain_id),
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
is_backface_visible: true,
|
||||
flags: PrimitiveFlags::default(),
|
||||
},
|
||||
ColorF::new(1.0, 1.0, 1.0, 1.0),
|
||||
);
|
||||
|
|
|
@ -464,7 +464,7 @@ impl YamlFrameReader {
|
|||
clip_rect: LayoutRect::zero(),
|
||||
clip_id: ClipId::invalid(),
|
||||
spatial_id: SpatialId::new(0, PipelineId::dummy()),
|
||||
is_backface_visible: true,
|
||||
flags: PrimitiveFlags::default(),
|
||||
hit_info: None,
|
||||
};
|
||||
self.add_stacking_context_from_yaml(&mut builder, wrench, yaml, true, &mut info);
|
||||
|
@ -1643,12 +1643,21 @@ impl YamlFrameReader {
|
|||
}
|
||||
|
||||
let space_and_clip = self.top_space_and_clip();
|
||||
let mut flags = PrimitiveFlags::default();
|
||||
if let Some(is_backface_visible) = item["backface-visible"].as_bool() {
|
||||
if is_backface_visible {
|
||||
flags.insert(PrimitiveFlags::IS_BACKFACE_VISIBLE);
|
||||
} else {
|
||||
flags.remove(PrimitiveFlags::IS_BACKFACE_VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
let mut info = CommonItemProperties {
|
||||
clip_rect,
|
||||
clip_id: space_and_clip.clip_id,
|
||||
spatial_id: space_and_clip.spatial_id,
|
||||
hit_info: self.to_hit_testing_tag(&item["hit-testing-tag"]),
|
||||
is_backface_visible: item["backface-visible"].as_bool().unwrap_or(true),
|
||||
flags,
|
||||
};
|
||||
|
||||
match item_type {
|
||||
|
@ -2026,7 +2035,7 @@ impl YamlFrameReader {
|
|||
dl.push_stacking_context(
|
||||
bounds.origin,
|
||||
*self.spatial_id_stack.last().unwrap(),
|
||||
info.is_backface_visible,
|
||||
info.flags.contains(PrimitiveFlags::IS_BACKFACE_VISIBLE),
|
||||
clip_node_id,
|
||||
transform_style,
|
||||
mix_blend_mode,
|
||||
|
|
|
@ -203,7 +203,7 @@ fn maybe_radius_yaml(radius: &BorderRadius) -> Option<Yaml> {
|
|||
|
||||
fn common_node(v: &mut Table, clip_id_mapper: &mut ClipIdMapper, info: &CommonItemProperties) {
|
||||
rect_node(v, "clip-rect", &info.clip_rect);
|
||||
bool_node(v, "backface-visible", info.is_backface_visible);
|
||||
bool_node(v, "backface-visible", info.flags.contains(PrimitiveFlags::IS_BACKFACE_VISIBLE));
|
||||
|
||||
clip_and_scroll_node(v, clip_id_mapper, info.clip_id, info.spatial_id);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче