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
impl LayoutThread
pub(crate) fn root_flow_for_query(&self) -> Option<FlowRef>
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
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>
pub(crate) fn load_all_web_fonts_from_stylesheet_with_guard( &self, stylesheet: &DocumentStyleSheet, guard: &SharedRwLockReadGuard<'_>, )
pub(crate) fn try_get_layout_root<'dom>( &self, node: impl LayoutNode<'dom>, ) -> Option<FlowRef>
sourcepub(crate) fn solve_constraints(
layout_root: &mut dyn Flow,
layout_context: &LayoutContext<'_>,
)
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.
sourcepub(crate) fn solve_constraints_parallel(
traversal: &ThreadPool,
layout_root: &mut dyn Flow,
profiler_metadata: Option<TimerMetadata>,
time_profiler_chan: ProfilerChan,
layout_context: &LayoutContext<'_>,
)
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.
sourcepub(crate) fn update_iframe_sizes(
&self,
new_iframe_sizes: FnvHashMap<BrowsingContextId, Size2D<f32, CSSPixel>>,
)
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.
sourcepub(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<'_>,
)
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.
sourcepub(crate) fn handle_reflow(&mut self, data: &mut ScriptReflowResult)
pub(crate) fn handle_reflow(&mut self, data: &mut ScriptReflowResult)
The high-level routine that performs layout.
pub(crate) fn update_scroll_node_state(&self, state: &ScrollState)
sourcepub(crate) fn cancel_animations_for_nodes_not_in_flow_tree(
animations: &mut FxHashMap<AnimationSetKey, ElementAnimationSet>,
root_flow: &mut dyn Flow,
)
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.
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>, )
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<'_>, )
pub(crate) fn reflow_all_nodes(flow: &mut dyn Flow)
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 handle_viewport_change(
&mut self,
window_size_data: WindowSizeData,
guards: &StylesheetGuards<'_>,
) -> bool
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
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_inner_window_dimension( &self, browsing_context_id: BrowsingContextId, ) -> Option<Size2D<f32, CSSPixel>>
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 set_quirks_mode(&mut self, quirks_mode: QuirksMode)
fn set_quirks_mode(&mut self, quirks_mode: QuirksMode)
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 collect_reports(&self, reports: &mut Vec<Report>)
fn collect_reports(&self, reports: &mut Vec<Report>)
source§fn reflow(&mut self, script_reflow: ScriptReflow)
fn reflow(&mut self, script_reflow: ScriptReflow)
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