Struct layout_thread_2020::LayoutThread

source ·
pub struct LayoutThread {
Show 22 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<FontCacheThread>>, pub(crate) first_reflow: Cell<bool>, pub(crate) generation: Cell<u32>, pub(crate) box_tree: RefCell<Option<Arc<BoxTree>>>, pub(crate) fragment_tree: RefCell<Option<Arc<FragmentTree>>>, pub(crate) epoch: Cell<Epoch>, pub(crate) viewport_size: Size2D<Au>, pub(crate) scroll_offsets: RefCell<HashMap<ExternalScrollId, Vector2D<f32, LayoutPixel>>>, pub(crate) webrender_image_cache: Arc<RwLock<FnvHashMap<(ServoUrl, UsePlaceholder), WebRenderImageInfo>>>, pub(crate) registered_painters: RegisteredPaintersImpl, pub(crate) webrender_api: WebRenderScriptApi, pub(crate) paint_time_metrics: PaintTimeMetrics, pub(crate) last_iframe_sizes: RefCell<FnvHashMap<BrowsingContextId, Size2D<f32, CSSPixel>>>, pub(crate) debug: DebugOptions,
}
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<FontCacheThread>>

A FontContext to be used during layout.

§first_reflow: Cell<bool>

Is this the first reflow in this LayoutThread?

§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.

§box_tree: RefCell<Option<Arc<BoxTree>>>

The box tree.

§fragment_tree: RefCell<Option<Arc<FragmentTree>>>

The fragment 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.

§scroll_offsets: RefCell<HashMap<ExternalScrollId, Vector2D<f32, LayoutPixel>>>

Scroll offsets of nodes that scroll.

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

The executors for paint worklets.

§webrender_api: WebRenderScriptApi

Webrender interface.

§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.

Implementations§

source§

impl LayoutThread

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, font_cache_thread: FontCacheThread, time_profiler_chan: ProfilerChan, webrender_api_sender: WebRenderScriptApi, 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, use_rayon: bool, ) -> LayoutContext<'a>

source

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

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 perform_post_style_recalc_layout_passes( &self, fragment_tree: Arc<FragmentTree>, reflow_goal: &ReflowGoal, document: Option<&ServoLayoutDocument<'_>>, context: &mut LayoutContext<'_>, )

source

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

Returns profiling information which is passed to the time profiler.

source

pub(crate) fn cancel_animations_for_nodes_not_in_fragment_tree( animations: &DocumentAnimationSet, root: &FragmentTree, )

Cancel animations for any nodes which have been removed from fragment 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 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 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_text(&self, node: TrustedNodeAddress) -> String

source§

fn query_inner_window_dimension( &self, _context: 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 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 set_quirks_mode(&mut self, quirks_mode: QuirksMode)

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

fn reflow(&mut self, script_reflow: ScriptReflow)

Requests a reflow.
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 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