pub struct LayoutThread {Show 19 fields
pub(crate) id: PipelineId,
pub(crate) webview_id: WebViewId,
pub(crate) url: ServoUrl,
pub(crate) stylist: Stylist,
pub(crate) is_iframe: bool,
pub(crate) script_chan: IpcSender<ScriptThreadMessage>,
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) 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) debug: DebugOptions,
}
Expand description
Information needed by layout.
Fields§
§id: PipelineId
The ID of the pipeline that we belong to.
webview_id: WebViewId
The webview that contains the pipeline 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<ScriptThreadMessage>
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?
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.
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(config: LayoutConfig) -> LayoutThread
pub(crate) fn build_layout_context<'a>( &'a self, guards: StylesheetGuards<'a>, snapshot_map: &'a SnapshotMap, reflow_request: &mut 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 cancel_image_animation_for_nodes_not_in_fragment_tree( image_animation_set: Arc<RwLock<FxHashMap<OpaqueNode, ImageAnimationState>>>, root: &FragmentTree, )
pub(crate) fn viewport_did_change( &mut self, viewport_details: ViewportDetails, ) -> bool
pub(crate) fn theme_did_change(&self, theme: PrefersColorScheme) -> bool
Sourcepub(crate) fn update_device(
&mut self,
viewport_details: ViewportDetails,
theme: PrefersColorScheme,
guards: &StylesheetGuards<'_>,
)
pub(crate) fn update_device( &mut self, viewport_details: ViewportDetails, 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 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_offsets(&mut self, scroll_states: &[ScrollState])
fn set_scroll_offsets(&mut self, scroll_states: &[ScrollState])
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