Struct layout_thread_2020::LayoutThread
source · pub struct LayoutThread {Show 20 fields
pub(crate) id: PipelineId,
pub(crate) url: ServoUrl,
pub(crate) stylist: Stylist,
pub(crate) is_iframe: bool,
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) 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) compositor_api: CrossProcessCompositorApi,
pub(crate) paint_time_metrics: PaintTimeMetrics,
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?
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 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.
compositor_api: CrossProcessCompositorApi
Cross-process access to the Compositor API.
paint_time_metrics: PaintTimeMetrics
Paint time metrics.
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
impl LayoutThread
pub(crate) fn new( id: PipelineId, url: ServoUrl, is_iframe: bool, 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
pub(crate) fn build_layout_context<'a>( &'a self, guards: StylesheetGuards<'a>, snapshot_map: &'a SnapshotMap, reflow_request: &ReflowRequest, use_rayon: bool, ) -> LayoutContext<'a>
pub(crate) fn load_all_web_fonts_from_stylesheet_with_guard( &self, stylesheet: &DocumentStyleSheet, guard: &SharedRwLockReadGuard<'_>, )
sourcepub(crate) fn handle_reflow(
&mut self,
reflow_request: ReflowRequest,
) -> Option<ReflowResult>
pub(crate) fn handle_reflow( &mut self, reflow_request: ReflowRequest, ) -> Option<ReflowResult>
The high-level routine that performs layout.
pub(crate) fn update_scroll_node_state(&self, state: &ScrollState)
pub(crate) fn perform_post_style_recalc_layout_passes( &self, fragment_tree: Arc<FragmentTree>, reflow_goal: &ReflowGoal, context: &mut LayoutContext<'_>, )
sourcepub(crate) fn profiler_metadata(&self) -> Option<TimerMetadata>
pub(crate) fn profiler_metadata(&self) -> Option<TimerMetadata>
Returns profiling information which is passed to the time profiler.
sourcepub(crate) fn cancel_animations_for_nodes_not_in_fragment_tree(
animations: &DocumentAnimationSet,
root: &FragmentTree,
)
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.
pub(crate) fn viewport_did_change( &mut self, window_size_data: WindowSizeData, ) -> bool
pub(crate) fn theme_did_change(&self, theme: PrefersColorScheme) -> bool
sourcepub(crate) fn update_device(
&mut self,
window_size_data: WindowSizeData,
theme: PrefersColorScheme,
guards: &StylesheetGuards<'_>,
)
pub(crate) fn update_device( &mut self, window_size_data: WindowSizeData, theme: PrefersColorScheme, guards: &StylesheetGuards<'_>, )
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
impl Drop for LayoutThread
source§impl Layout for LayoutThread
impl Layout for LayoutThread
source§fn device(&self) -> &Device
fn device(&self) -> &Device
Device
used to handle media queries and
resolve font metrics.source§fn waiting_for_web_fonts_to_load(&self) -> bool
fn waiting_for_web_fonts_to_load(&self) -> bool
source§fn current_epoch(&self) -> Epoch
fn current_epoch(&self) -> Epoch
source§fn load_web_fonts_from_stylesheet(&self, stylesheet: ServoArc<Stylesheet>)
fn load_web_fonts_from_stylesheet(&self, stylesheet: ServoArc<Stylesheet>)
source§fn add_stylesheet(
&mut self,
stylesheet: ServoArc<Stylesheet>,
before_stylesheet: Option<ServoArc<Stylesheet>>,
)
fn add_stylesheet( &mut self, stylesheet: ServoArc<Stylesheet>, before_stylesheet: Option<ServoArc<Stylesheet>>, )
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>)
fn remove_stylesheet(&mut self, stylesheet: ServoArc<Stylesheet>)
fn query_content_box(&self, node: OpaqueNode) -> Option<UntypedRect<Au>>
fn query_content_boxes(&self, node: OpaqueNode) -> Vec<UntypedRect<Au>>
fn query_client_rect(&self, node: OpaqueNode) -> UntypedRect<i32>
fn query_element_inner_outer_text(&self, node: TrustedNodeAddress) -> String
fn query_nodes_from_point( &self, point: UntypedPoint2D<f32>, query_type: NodesFromPointQueryType, ) -> Vec<UntrustedNodeAddress>
fn query_offset_parent(&self, node: OpaqueNode) -> OffsetParentResponse
fn query_resolved_style( &self, node: TrustedNodeAddress, pseudo: Option<PseudoElement>, property_id: PropertyId, animations: DocumentAnimationSet, animation_timeline_value: f64, ) -> String
fn query_resolved_font_style( &self, node: TrustedNodeAddress, value: &str, animations: DocumentAnimationSet, animation_timeline_value: f64, ) -> Option<ServoArc<Font>>
fn query_scrolling_area(&self, node: Option<OpaqueNode>) -> UntypedRect<i32>
fn query_text_indext( &self, node: OpaqueNode, point_in_node: UntypedPoint2D<f32>, ) -> Option<usize>
source§fn collect_reports(&self, reports: &mut Vec<Report>)
fn collect_reports(&self, reports: &mut Vec<Report>)
source§fn set_quirks_mode(&mut self, quirks_mode: QuirksMode)
fn set_quirks_mode(&mut self, quirks_mode: QuirksMode)
source§fn reflow(&mut self, reflow_request: ReflowRequest) -> Option<ReflowResult>
fn reflow(&mut self, reflow_request: ReflowRequest) -> Option<ReflowResult>
source§fn register_paint_worklet_modules(
&mut self,
_name: Atom,
_properties: Vec<Atom>,
_painter: Box<dyn Painter>,
)
fn register_paint_worklet_modules( &mut self, _name: Atom, _properties: Vec<Atom>, _painter: Box<dyn Painter>, )
source§fn set_scroll_states(&mut self, scroll_states: &[ScrollState])
fn set_scroll_states(&mut self, scroll_states: &[ScrollState])
source§fn set_epoch_paint_time(
&mut self,
epoch: Epoch,
paint_time: CrossProcessInstant,
)
fn set_epoch_paint_time( &mut self, epoch: Epoch, paint_time: CrossProcessInstant, )
source§impl ProfilerMetadataFactory for LayoutThread
impl ProfilerMetadataFactory for LayoutThread
fn new_metadata(&self) -> Option<TimerMetadata>
Auto Trait Implementations§
impl !Freeze for LayoutThread
impl !RefUnwindSafe for LayoutThread
impl !Send for LayoutThread
impl !Sync for LayoutThread
impl Unpin for LayoutThread
impl !UnwindSafe for LayoutThread
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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