Struct layout_thread_2013::LayoutThread

source ·
pub struct LayoutThread {
Show 25 fields pub(crate) id: PipelineId, pub(crate) url: ServoUrl, pub(crate) stylist: Stylist, pub(crate) is_iframe: bool, pub(crate) constellation_chan: IpcSender<LayoutMsg>, pub(crate) script_chan: IpcSender<ConstellationControlMsg>, pub(crate) time_profiler_chan: ProfilerChan, pub(crate) image_cache: Arc<dyn ImageCache>, pub(crate) font_context: Arc<FontContext>, pub(crate) first_reflow: Cell<bool>, pub(crate) parallel_flag: bool, pub(crate) generation: Cell<u32>, pub(crate) root_flow: RefCell<Option<FlowRef>>, pub(crate) epoch: Cell<Epoch>, pub(crate) viewport_size: Size2D<Au>, pub(crate) display_list: RefCell<Option<DisplayList>>, pub(crate) indexable_text: RefCell<IndexableText>, pub(crate) scroll_offsets: RefCell<ScrollOffsetMap>, pub(crate) webrender_image_cache: Arc<RwLock<FnvHashMap<(ServoUrl, UsePlaceholder), WebRenderImageInfo>>>, pub(crate) registered_painters: RegisteredPaintersImpl, pub(crate) compositor_api: CrossProcessCompositorApi, pub(crate) paint_time_metrics: PaintTimeMetrics, pub(crate) last_iframe_sizes: RefCell<FnvHashMap<BrowsingContextId, Size2D<f32, CSSPixel>>>, pub(crate) debug: DebugOptions, pub(crate) nonincremental_layout: bool,
}
Expand description

Information needed by layout.

Fields§

§id: PipelineId

The ID of the pipeline that we belong to.

§url: ServoUrl

The URL of the pipeline that we belong to.

§stylist: Stylist

Performs CSS selector matching and style resolution.

§is_iframe: bool

Is the current reflow of an iframe, as opposed to a root window?

§constellation_chan: IpcSender<LayoutMsg>

The channel on which messages can be sent to the constellation.

§script_chan: IpcSender<ConstellationControlMsg>

The channel on which messages can be sent to the script thread.

§time_profiler_chan: ProfilerChan

The channel on which messages can be sent to the time profiler.

§image_cache: Arc<dyn ImageCache>

Reference to the script thread image cache.

§font_context: Arc<FontContext>

A per-layout FontContext managing font access.

§first_reflow: Cell<bool>

Is this the first reflow in this layout?

§parallel_flag: bool

Flag to indicate whether to use parallel operations

§generation: Cell<u32>

Starts at zero, and increased by one every time a layout completes. This can be used to easily check for invalid stale data.

§root_flow: RefCell<Option<FlowRef>>

The root of the flow tree.

§epoch: Cell<Epoch>

A counter for epoch messages

§viewport_size: Size2D<Au>

The size of the viewport. This may be different from the size of the screen due to viewport constraints.

§display_list: RefCell<Option<DisplayList>>

The root stacking context.

§indexable_text: RefCell<IndexableText>

A map that stores all of the indexable text in this layout.

§scroll_offsets: RefCell<ScrollOffsetMap>

Scroll offsets of scrolling regions.

§webrender_image_cache: Arc<RwLock<FnvHashMap<(ServoUrl, UsePlaceholder), WebRenderImageInfo>>>§registered_painters: RegisteredPaintersImpl

The executors for paint worklets.

§compositor_api: CrossProcessCompositorApi

Cross-process access to the compositor API.

§paint_time_metrics: PaintTimeMetrics

Paint time metrics.

§last_iframe_sizes: RefCell<FnvHashMap<BrowsingContextId, Size2D<f32, CSSPixel>>>

The sizes of all iframes encountered during the last layout operation.

§debug: DebugOptions

Debug options, copied from configuration to this LayoutThread in order to avoid having to constantly access the thread-safe global options.

§nonincremental_layout: bool

True to turn off incremental layout.

Implementations§

source§

impl LayoutThread

source

pub(crate) fn root_flow_for_query(&self) -> Option<FlowRef>

source

pub(crate) fn new( id: PipelineId, url: ServoUrl, is_iframe: bool, constellation_chan: IpcSender<ConstellationMsg>, script_chan: IpcSender<ConstellationControlMsg>, image_cache: Arc<dyn ImageCache>, resource_threads: ResourceThreads, system_font_service: Arc<SystemFontServiceProxy>, time_profiler_chan: ProfilerChan, compositor_api: CrossProcessCompositorApi, paint_time_metrics: PaintTimeMetrics, window_size: WindowSizeData, ) -> LayoutThread

source

pub(crate) fn build_shared_style_context<'a>( &'a self, guards: StylesheetGuards<'a>, snapshot_map: &'a SnapshotMap, animation_timeline_value: f64, animations: &DocumentAnimationSet, traversal_flags: TraversalFlags, ) -> SharedStyleContext<'a>

source

pub(crate) fn build_layout_context<'a>( &'a self, guards: StylesheetGuards<'a>, snapshot_map: &'a SnapshotMap, origin: ImmutableOrigin, animation_timeline_value: f64, animations: &DocumentAnimationSet, stylesheets_changed: bool, ) -> LayoutContext<'a>

source

pub(crate) fn load_all_web_fonts_from_stylesheet_with_guard( &self, stylesheet: &DocumentStyleSheet, guard: &SharedRwLockReadGuard<'_>, )

source

pub(crate) fn try_get_layout_root<'dom>( &self, node: impl LayoutNode<'dom>, ) -> Option<FlowRef>

source

pub(crate) fn solve_constraints( layout_root: &mut dyn Flow, layout_context: &LayoutContext<'_>, )

Performs layout constraint solving.

This corresponds to Reflow() in Gecko and layout() in WebKit/Blink and should be benchmarked against those two. It is marked #[inline(never)] to aid profiling.

source

pub(crate) fn solve_constraints_parallel( traversal: &ThreadPool, layout_root: &mut dyn Flow, profiler_metadata: Option<TimerMetadata>, time_profiler_chan: ProfilerChan, layout_context: &LayoutContext<'_>, )

Performs layout constraint solving in parallel.

This corresponds to Reflow() in Gecko and layout() in WebKit/Blink and should be benchmarked against those two. It is marked #[inline(never)] to aid profiling.

source

pub(crate) fn update_iframe_sizes( &self, new_iframe_sizes: FnvHashMap<BrowsingContextId, Size2D<f32, CSSPixel>>, )

Update the recorded iframe sizes of the contents of layout and when these sizes changes, send a message to the constellation informing it of the new sizes.

source

pub(crate) fn compute_abs_pos_and_build_display_list( &self, data: &Reflow, reflow_goal: &ReflowGoal, document: Option<&ServoLayoutDocument<'_>>, layout_root: &mut dyn Flow, layout_context: &mut LayoutContext<'_>, )

Computes the stacking-relative positions of all flows and, if the painting is dirty and the reflow type need it, builds the display list.

source

pub(crate) fn handle_reflow(&mut self, data: &mut ScriptReflowResult)

The high-level routine that performs layout.

source

pub(crate) fn update_scroll_node_state(&self, state: &ScrollState)

source

pub(crate) fn cancel_animations_for_nodes_not_in_flow_tree( animations: &mut FxHashMap<AnimationSetKey, ElementAnimationSet>, root_flow: &mut dyn Flow, )

Cancel animations for any nodes which have been removed from flow tree. TODO(mrobinson): We should look into a way of doing this during flow tree construction. This also doesn’t yet handles nodes that have been reparented.

source

pub(crate) fn perform_post_style_recalc_layout_passes( &self, root_flow: &mut FlowRef, data: &Reflow, reflow_goal: &ReflowGoal, document: Option<&ServoLayoutDocument<'_>>, context: &mut LayoutContext<'_>, thread_pool: Option<&ThreadPool>, )

source

pub(crate) fn perform_post_main_layout_passes( &self, data: &Reflow, root_flow: &mut FlowRef, reflow_goal: &ReflowGoal, document: Option<&ServoLayoutDocument<'_>>, layout_context: &mut LayoutContext<'_>, )

source

pub(crate) fn reflow_all_nodes(flow: &mut dyn Flow)

source

pub(crate) fn profiler_metadata(&self) -> Option<TimerMetadata>

Returns profiling information which is passed to the time profiler.

source

pub(crate) fn handle_viewport_change( &mut self, window_size_data: WindowSizeData, guards: &StylesheetGuards<'_>, ) -> bool

Update layout given a new viewport. Returns true if the viewport changed or false if it didn’t.

Trait Implementations§

source§

impl Drop for LayoutThread

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Layout for LayoutThread

source§

fn device(&self) -> &Device

Get a reference to this Layout’s Stylo Device used to handle media queries and resolve font metrics.
source§

fn waiting_for_web_fonts_to_load(&self) -> bool

Whether or not this layout is waiting for fonts from loaded stylesheets to finish loading.
source§

fn current_epoch(&self) -> Epoch

The currently laid out Epoch that this Layout has finished.
source§

fn load_web_fonts_from_stylesheet(&self, stylesheet: ServoArc<Stylesheet>)

Load all fonts from the given stylesheet, returning the number of fonts that need to be loaded.
source§

fn add_stylesheet( &mut self, stylesheet: ServoArc<Stylesheet>, before_stylesheet: Option<ServoArc<Stylesheet>>, )

Add a stylesheet to this Layout. This will add it to the Layout’s Stylist as well as loading all web fonts defined in the stylesheet. The second stylesheet is the insertion point (if it exists, the sheet needs to be inserted before it).
source§

fn remove_stylesheet(&mut self, stylesheet: ServoArc<Stylesheet>)

Removes a stylesheet from the Layout.
source§

fn query_content_box(&self, node: OpaqueNode) -> Option<UntypedRect<Au>>

source§

fn query_content_boxes(&self, node: OpaqueNode) -> Vec<UntypedRect<Au>>

source§

fn query_client_rect(&self, node: OpaqueNode) -> UntypedRect<i32>

source§

fn query_element_inner_outer_text(&self, node: TrustedNodeAddress) -> String

source§

fn query_inner_window_dimension( &self, browsing_context_id: BrowsingContextId, ) -> Option<Size2D<f32, CSSPixel>>

source§

fn query_nodes_from_point( &self, point: UntypedPoint2D<f32>, query_type: NodesFromPointQueryType, ) -> Vec<UntrustedNodeAddress>

source§

fn query_offset_parent(&self, node: OpaqueNode) -> OffsetParentResponse

source§

fn query_resolved_style( &self, node: TrustedNodeAddress, pseudo: Option<PseudoElement>, property_id: PropertyId, animations: DocumentAnimationSet, animation_timeline_value: f64, ) -> String

source§

fn query_resolved_font_style( &self, node: TrustedNodeAddress, value: &str, animations: DocumentAnimationSet, animation_timeline_value: f64, ) -> Option<ServoArc<Font>>

source§

fn query_scrolling_area(&self, node: Option<OpaqueNode>) -> UntypedRect<i32>

source§

fn query_text_indext( &self, node: OpaqueNode, point_in_node: UntypedPoint2D<f32>, ) -> Option<usize>

source§

fn exit_now(&mut self)

Inform the layout that its ScriptThread is about to exit.
source§

fn set_quirks_mode(&mut self, quirks_mode: QuirksMode)

Sets quirks mode for the document, causing the quirks mode stylesheet to be used.
source§

fn register_paint_worklet_modules( &mut self, name: Atom, properties: Vec<Atom>, painter: Box<dyn Painter>, )

Tells layout that script has added some paint worklet modules.
source§

fn collect_reports(&self, reports: &mut Vec<Report>)

Requests that layout measure its memory usage. The resulting reports are sent back via the supplied channel.
source§

fn reflow(&mut self, script_reflow: ScriptReflow)

Requests a reflow.
source§

fn set_scroll_states(&mut self, scroll_states: &[ScrollState])

Set the scroll states of this layout after a compositor scroll.
source§

fn set_epoch_paint_time( &mut self, epoch: Epoch, paint_time: CrossProcessInstant, )

Set the paint time for a specific epoch.
source§

impl ProfilerMetadataFactory for LayoutThread

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> Downcast<T> for T

source§

fn downcast(&self) -> &T

source§

impl<T> Filterable for T

source§

fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where 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> MaybeBoxed<Box<T>> for T

source§

fn maybe_boxed(self) -> Box<T>

Convert
source§

impl<T> MaybeBoxed<T> for T

source§

fn maybe_boxed(self) -> T

Convert
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> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.
source§

impl<T> Upcast<T> for T

source§

fn upcast(&self) -> Option<&T>

source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T