pub struct SceneBuilder<'a> {
Show 26 fields scene: &'a Scene, fonts: SharedFontResources, id_to_index_mapper_stack: Vec<NodeIdToIndexMapper>, sc_stack: Vec<FlattenedStackingContext>, containing_block_stack: Vec<SpatialNodeIndex>, raster_space_stack: Vec<RasterSpace>, pending_shadow_items: VecDeque<ShadowItem>, pub spatial_tree: &'a mut SceneSpatialTree, pub prim_store: PrimitiveStore, pub hit_testing_scene: HitTestingScene, pub clip_store: ClipStore, pub config: FrameBuilderConfig, interners: &'a mut Interners, rf_mapper: ReferenceFrameMapper, external_scroll_mapper: ScrollOffsetMapper, iframe_size: Vec<LayoutSize>, root_iframe_clip: Option<ClipId>, quality_settings: QualitySettings, tile_cache_builder: TileCacheBuilder, snap_to_device: SpaceSnapper, picture_graph: PictureGraph, next_plane_splitter_index: usize, prim_instances: Vec<PrimitiveInstance>, pipeline_instance_ids: FastHashMap<PipelineId, u32>, surfaces: Vec<SurfaceInfo>, clip_tree_builder: ClipTreeBuilder,
}
Expand description

A structure that converts a serialized display list into a form that WebRender can use to later build a frame. This structure produces a BuiltScene. Public members are typically those that are destructured into the BuiltScene.

Fields§

§scene: &'a Scene

The scene that we are currently building.

§fonts: SharedFontResources

The map of all font instances.

§id_to_index_mapper_stack: Vec<NodeIdToIndexMapper>

The data structure that converts between ClipId/SpatialId and the various index types that the SpatialTree uses.

§sc_stack: Vec<FlattenedStackingContext>

A stack of stacking context properties.

§containing_block_stack: Vec<SpatialNodeIndex>

Stack of spatial node indices forming containing block for 3d contexts

§raster_space_stack: Vec<RasterSpace>

Stack of requested raster spaces for stacking contexts

§pending_shadow_items: VecDeque<ShadowItem>

Maintains state for any currently active shadows

§spatial_tree: &'a mut SceneSpatialTree

The SpatialTree that we are currently building during building.

§prim_store: PrimitiveStore

The store of primitives.

§hit_testing_scene: HitTestingScene

Information about all primitives involved in hit testing.

§clip_store: ClipStore

The store which holds all complex clipping information.

§config: FrameBuilderConfig

The configuration to use for the FrameBuilder. We consult this in order to determine the default font.

§interners: &'a mut Interners

Reference to the set of data that is interned across display lists.

§rf_mapper: ReferenceFrameMapper

Helper struct to map stacking context coords <-> reference frame coords.

§external_scroll_mapper: ScrollOffsetMapper

Helper struct to map spatial nodes to external scroll offsets.

§iframe_size: Vec<LayoutSize>

The current recursion depth of iframes encountered. Used to restrict picture caching slices to only the top-level content frame.

§root_iframe_clip: Option<ClipId>

Clip-chain for root iframes applied to any tile caches created within this iframe

§quality_settings: QualitySettings

The current quality / performance settings for this scene.

§tile_cache_builder: TileCacheBuilder

Maintains state about the list of tile caches being built for this scene.

§snap_to_device: SpaceSnapper

A helper struct to snap local rects in device space. During frame building we may establish new raster roots, however typically that is in cases where we won’t be applying snapping (e.g. has perspective), or in edge cases (e.g. SVG filter) where we can accept slightly incorrect behaviour in favour of getting the common case right.

§picture_graph: PictureGraph

A DAG that represents dependencies between picture primitives. This builds a set of passes to run various picture processing passes in during frame building, in a way that pictures are processed before (or after) their dependencies, without relying on recursion for those passes.

§next_plane_splitter_index: usize

Keep track of allocated plane splitters for this scene. A plane splitter is allocated whenever we encounter a new 3d rendering context. They are stored outside the picture since it makes it easier for them to be referenced by both the owning 3d rendering context and the child pictures that contribute to the splitter. During scene building “allocating” a splitter is just incrementing an index. Splitter objects themselves are allocated and recycled in the frame builder.

§prim_instances: Vec<PrimitiveInstance>

A list of all primitive instances in the scene. We store them as a single array so that multiple different systems (e.g. tile-cache, visibility, property animation bindings) can store index buffers to prim instances.

§pipeline_instance_ids: FastHashMap<PipelineId, u32>

A map of pipeline ids encountered during scene build - used to create unique pipeline instance ids as they are encountered.

§surfaces: Vec<SurfaceInfo>

A list of surfaces (backing textures) that are relevant for this scene. Every picture is assigned to a surface (either a new surface if the picture has a composite mode, or the parent surface if it’s a pass-through).

§clip_tree_builder: ClipTreeBuilder

Used to build a ClipTree from the clip-chains, clips and state during scene building.

Implementations§

source§

impl<'a> SceneBuilder<'a>

source

pub fn add_normal_border( &mut self, info: &LayoutPrimitiveInfo, border: &ApiNormalBorder, widths: LayoutSideOffsets, spatial_node_index: SpatialNodeIndex, clip_node_id: ClipNodeId )

source§

impl<'a> SceneBuilder<'a>

source

pub fn add_box_shadow( &mut self, spatial_node_index: SpatialNodeIndex, clip_node_id: ClipNodeId, prim_info: &LayoutPrimitiveInfo, box_offset: &LayoutVector2D, color: ColorF, blur_radius: f32, spread_radius: f32, border_radius: BorderRadius, clip_mode: BoxShadowClipMode )

source§

impl<'a> SceneBuilder<'a>

source

pub fn build( scene: &Scene, fonts: SharedFontResources, view: &SceneView, frame_builder_config: &FrameBuilderConfig, interners: &mut Interners, spatial_tree: &mut SceneSpatialTree, stats: &SceneStats ) -> BuiltScene

source

fn finalize_picture( pic_index: PictureIndex, prim_index: Option<usize>, pictures: &mut [PicturePrimitive], parent_spatial_node_index: Option<SpatialNodeIndex>, clip_tree_builder: &ClipTreeBuilder, prim_instances: &[PrimitiveInstance], clip_interner: &Interner<ClipIntern> )

Traverse the picture prim list and update any late-set spatial nodes. Also, for each picture primitive, store the lowest-common-ancestor of all of the contained primitives’ clips.

source

fn current_offset( &mut self, spatial_node_index: SpatialNodeIndex ) -> LayoutVector2D

Retrieve the current offset to allow converting a stacking context relative coordinate to be relative to the owing reference frame, also considering any external scroll offset on the provided spatial node.

source

fn build_spatial_tree_for_display_list( &mut self, dl: &BuiltDisplayList, pipeline_id: PipelineId, instance_id: PipelineInstanceId )

source

fn build_all( &mut self, root_pipeline_id: PipelineId, root_pipeline: &ScenePipeline )

source

fn build_sticky_frame( &mut self, info: &StickyFrameDescriptor, parent_node_index: SpatialNodeIndex, instance_id: PipelineInstanceId )

source

fn build_reference_frame( &mut self, info: &ReferenceFrameDescriptor, parent_space: SpatialNodeIndex, pipeline_id: PipelineId, instance_id: PipelineInstanceId )

source

fn build_scroll_frame( &mut self, info: &ScrollFrameDescriptor, parent_node_index: SpatialNodeIndex, pipeline_id: PipelineId, instance_id: PipelineInstanceId )

source

fn get_next_instance_id_for_pipeline( &mut self, pipeline_id: PipelineId ) -> PipelineInstanceId

Advance and return the next instance id for a given pipeline id

source

fn push_iframe( &mut self, info: &IframeDisplayItem, spatial_node_index: SpatialNodeIndex ) -> Option<BuiltDisplayListIter<'a>>

source

fn get_space(&self, spatial_id: SpatialId) -> SpatialNodeIndex

source

fn get_clip_node(&mut self, clip_chain_id: ClipChainId) -> ClipNodeId

source

fn process_common_properties( &mut self, common: &CommonItemProperties, bounds: Option<&LayoutRect> ) -> (LayoutPrimitiveInfo, LayoutRect, SpatialNodeIndex, ClipNodeId)

source

fn process_common_properties_with_bounds( &mut self, common: &CommonItemProperties, bounds: &LayoutRect ) -> (LayoutPrimitiveInfo, LayoutRect, SpatialNodeIndex, ClipNodeId)

source

pub fn snap_rect( &mut self, rect: &LayoutRect, target_spatial_node: SpatialNodeIndex ) -> LayoutRect

source

fn build_item<'b>(&'b mut self, item: DisplayItemRef<'_, '_>)

source

fn create_primitive<P>( &mut self, info: &LayoutPrimitiveInfo, spatial_node_index: SpatialNodeIndex, clip_leaf_id: ClipLeafId, prim: P ) -> PrimitiveInstancewhere P: InternablePrimitive, Interners: AsMut<Interner<P>>,

Create a primitive and add it to the prim store. This method doesn’t add the primitive to the draw list, so can be used for creating sub-primitives.

TODO(djg): Can this inline into add_interned_prim_to_draw_list

source

fn add_primitive_to_hit_testing_list( &mut self, info: &LayoutPrimitiveInfo, spatial_node_index: SpatialNodeIndex, clip_node_id: ClipNodeId, tag: ItemTag, anim_id: u64 )

source

pub fn add_primitive_to_draw_list( &mut self, prim_instance: PrimitiveInstance, prim_rect: LayoutRect, spatial_node_index: SpatialNodeIndex, flags: PrimitiveFlags )

Add an already created primitive to the draw lists.

source

fn add_nonshadowable_primitive<P>( &mut self, spatial_node_index: SpatialNodeIndex, clip_node_id: ClipNodeId, info: &LayoutPrimitiveInfo, clip_items: Vec<ClipItemKey>, prim: P )where P: InternablePrimitive + IsVisible, Interners: AsMut<Interner<P>>,

Convenience interface that creates a primitive entry and adds it to the draw list.

source

pub fn add_primitive<P>( &mut self, spatial_node_index: SpatialNodeIndex, clip_node_id: ClipNodeId, info: &LayoutPrimitiveInfo, clip_items: Vec<ClipItemKey>, prim: P )where P: InternablePrimitive + IsVisible, Interners: AsMut<Interner<P>>, ShadowItem: From<PendingPrimitive<P>>,

source

fn add_prim_to_draw_list<P>( &mut self, info: &LayoutPrimitiveInfo, spatial_node_index: SpatialNodeIndex, clip_leaf_id: ClipLeafId, prim: P )where P: InternablePrimitive, Interners: AsMut<Interner<P>>,

source

fn make_current_slice_atomic_if_required(&mut self)

source

fn add_tile_cache_barrier_if_needed(&mut self, slice_flags: SliceFlags)

If no stacking contexts are present (i.e. we are adding prims to a tile cache), set a barrier to force creation of a slice before the next prim

source

fn push_stacking_context( &mut self, composite_ops: CompositeOps, transform_style: TransformStyle, prim_flags: PrimitiveFlags, spatial_node_index: SpatialNodeIndex, clip_chain_id: Option<ClipChainId>, requested_raster_space: RasterSpace, flags: StackingContextFlags ) -> StackingContextInfo

Push a new stacking context. Returns context that must be passed to pop_stacking_context().

source

fn pop_stacking_context(&mut self, info: StackingContextInfo)

source

pub fn push_reference_frame( &mut self, reference_frame_id: SpatialId, parent_index: SpatialNodeIndex, pipeline_id: PipelineId, transform_style: TransformStyle, source_transform: PropertyBinding<LayoutTransform>, kind: ReferenceFrameKind, origin_in_parent_reference_frame: LayoutVector2D, uid: SpatialNodeUid ) -> SpatialNodeIndex

source

fn push_root(&mut self, pipeline_id: PipelineId, instance: PipelineInstanceId)

source

fn add_image_mask_clip_node( &mut self, new_node_id: ClipId, spatial_id: SpatialId, image_mask: &ImageMask, fill_rule: FillRule, points_range: ItemRange<'_, LayoutPoint> )

source

fn add_rect_clip_node( &mut self, new_node_id: ClipId, spatial_id: SpatialId, clip_rect: &LayoutRect )

Add a new rectangle clip, positioned by the spatial node in the space_and_clip.

source

fn add_rounded_rect_clip_node( &mut self, new_node_id: ClipId, spatial_id: SpatialId, clip: &ComplexClipRegion )

source

pub fn add_scroll_frame( &mut self, new_node_id: SpatialId, parent_node_index: SpatialNodeIndex, external_id: ExternalScrollId, pipeline_id: PipelineId, frame_rect: &LayoutRect, content_size: &LayoutSize, frame_kind: ScrollFrameKind, external_scroll_offset: LayoutVector2D, scroll_offset_generation: APZScrollGeneration, has_scroll_linked_effect: HasScrollLinkedEffect, uid: SpatialNodeUid ) -> SpatialNodeIndex

source

pub fn push_shadow( &mut self, shadow: Shadow, spatial_node_index: SpatialNodeIndex, clip_chain_id: ClipChainId, should_inflate: bool )

source

pub fn pop_all_shadows(&mut self)

source

fn create_shadow_prim<P>( &mut self, pending_shadow: &PendingShadow, pending_primitive: &PendingPrimitive<P>, blur_is_noop: bool ) -> (PrimitiveInstance, LayoutPrimitiveInfo, SpatialNodeIndex)where P: InternablePrimitive + CreateShadow, Interners: AsMut<Interner<P>>,

source

fn add_shadow_prim_to_draw_list<P>( &mut self, pending_primitive: PendingPrimitive<P> )where P: InternablePrimitive + IsVisible, Interners: AsMut<Interner<P>>,

source

pub fn add_clear_rectangle( &mut self, spatial_node_index: SpatialNodeIndex, clip_node_id: ClipNodeId, info: &LayoutPrimitiveInfo )

source

pub fn add_line( &mut self, spatial_node_index: SpatialNodeIndex, clip_node_id: ClipNodeId, info: &LayoutPrimitiveInfo, wavy_line_thickness: f32, orientation: LineOrientation, color: ColorF, style: LineStyle )

source

pub fn add_border( &mut self, spatial_node_index: SpatialNodeIndex, clip_node_id: ClipNodeId, info: &LayoutPrimitiveInfo, border_item: &BorderDisplayItem, gradient_stops: ItemRange<'_, GradientStop> )

source

pub fn create_linear_gradient_prim( &mut self, info: &LayoutPrimitiveInfo, start_point: LayoutPoint, end_point: LayoutPoint, stops: Vec<GradientStopKey>, extend_mode: ExtendMode, stretch_size: LayoutSize, tile_spacing: LayoutSize, nine_patch: Option<Box<NinePatchDescriptor>>, edge_aa_mask: EdgeAaSegmentMask ) -> Option<LinearGradient>

source

pub fn create_radial_gradient_prim( &mut self, info: &LayoutPrimitiveInfo, center: LayoutPoint, start_radius: f32, end_radius: f32, ratio_xy: f32, stops: Vec<GradientStopKey>, extend_mode: ExtendMode, stretch_size: LayoutSize, tile_spacing: LayoutSize, nine_patch: Option<Box<NinePatchDescriptor>> ) -> RadialGradient

source

pub fn create_conic_gradient_prim( &mut self, info: &LayoutPrimitiveInfo, center: LayoutPoint, angle: f32, start_offset: f32, end_offset: f32, stops: ItemRange<'_, GradientStop>, extend_mode: ExtendMode, stretch_size: LayoutSize, tile_spacing: LayoutSize, nine_patch: Option<Box<NinePatchDescriptor>> ) -> ConicGradient

source

pub fn add_text( &mut self, spatial_node_index: SpatialNodeIndex, clip_node_id: ClipNodeId, prim_info: &LayoutPrimitiveInfo, font_instance_key: &FontInstanceKey, text_color: &ColorF, glyph_range: ItemRange<'_, GlyphInstance>, glyph_options: Option<GlyphOptions> )

source

pub fn add_image( &mut self, spatial_node_index: SpatialNodeIndex, clip_node_id: ClipNodeId, info: &LayoutPrimitiveInfo, stretch_size: LayoutSize, tile_spacing: LayoutSize, image_key: ImageKey, image_rendering: ImageRendering, alpha_type: AlphaType, color: ColorF )

source

pub fn add_yuv_image( &mut self, spatial_node_index: SpatialNodeIndex, clip_node_id: ClipNodeId, info: &LayoutPrimitiveInfo, yuv_data: YuvData, color_depth: ColorDepth, color_space: YuvColorSpace, color_range: ColorRange, image_rendering: ImageRendering )

source

fn add_primitive_instance_to_3d_root(&mut self, prim: ExtendedPrimitiveInstance)

source

pub fn add_backdrop_filter( &mut self, spatial_node_index: SpatialNodeIndex, clip_node_id: ClipNodeId, info: &LayoutPrimitiveInfo, filters: Vec<Filter>, filter_datas: Vec<FilterData>, filter_primitives: Vec<FilterPrimitive> )

source

fn wrap_prim_with_filters( &mut self, source: PictureChainBuilder, clip_node_id: ClipNodeId, filter_ops: Vec<Filter>, filter_primitives: Vec<FilterPrimitive>, filter_datas: Vec<FilterData>, should_inflate_override: Option<bool> ) -> PictureChainBuilder

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for SceneBuilder<'a>

§

impl<'a> Send for SceneBuilder<'a>

§

impl<'a> Sync for SceneBuilder<'a>

§

impl<'a> Unpin for SceneBuilder<'a>

§

impl<'a> !UnwindSafe for SceneBuilder<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.