pub struct LayoutThread {Show 22 fields
id: PipelineId,
webview_id: WebViewId,
url: ServoUrl,
stylist: Stylist,
is_iframe: bool,
script_chan: GenericSender<ScriptThreadMessage>,
time_profiler_chan: ProfilerChan,
image_cache: Arc<dyn ImageCache>,
font_context: Arc<FontContext>,
have_added_user_agent_stylesheets: bool,
have_ever_generated_display_list: Cell<bool>,
need_new_display_list: Cell<bool>,
need_new_stacking_context_tree: Cell<bool>,
box_tree: RefCell<Option<Arc<BoxTree>>>,
fragment_tree: RefCell<Option<Rc<FragmentTree>>>,
stacking_context_tree: RefCell<Option<StackingContextTree>>,
epoch: Cell<Epoch>,
resolved_images_cache: Arc<RwLock<FnvHashMap<(ServoUrl, UsePlaceholder), Result<Image, ResolveImageError>>>>,
registered_painters: RegisteredPaintersImpl,
compositor_api: CrossProcessCompositorApi,
debug: DebugOptions,
previously_highlighted_dom_node: Cell<Option<OpaqueNode>>,
}
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: GenericSender<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.
have_added_user_agent_stylesheets: bool
Whether or not user agent stylesheets have been added to the Stylist or not.
have_ever_generated_display_list: Cell<bool>
Is this the first reflow in this LayoutThread?
need_new_display_list: Cell<bool>
Whether a new display list is necessary due to changes to layout or stacking contexts. This is set to true every time layout changes, even when a display list isn’t requested for this layout, such as for layout queries. The next time a layout requests a display list, it is produced unconditionally, even when the layout trees remain the same.
need_new_stacking_context_tree: Cell<bool>
Whether or not the existing stacking context tree is dirty and needs to be rebuilt. This happens after a relayout or overflow update. The reason that we don’t simply clear the stacking context tree when it becomes dirty is that we need to preserve scroll offsets from the old tree to the new one.
box_tree: RefCell<Option<Arc<BoxTree>>>
The box tree.
fragment_tree: RefCell<Option<Rc<FragmentTree>>>
The fragment tree.
stacking_context_tree: RefCell<Option<StackingContextTree>>
The StackingContextTree
cached from previous layouts.
epoch: Cell<Epoch>
A counter for epoch messages
resolved_images_cache: Arc<RwLock<FnvHashMap<(ServoUrl, UsePlaceholder), Result<Image, ResolveImageError>>>>
§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.
previously_highlighted_dom_node: Cell<Option<OpaqueNode>>
Tracks the node that was highlighted by the devtools during the last reflow.
If this changed, then we need to create a new display list.
Implementations§
Source§impl LayoutThread
impl LayoutThread
fn new(config: LayoutConfig) -> LayoutThread
fn load_all_web_fonts_from_stylesheet_with_guard( &self, stylesheet: &DocumentStyleSheet, guard: &SharedRwLockReadGuard<'_>, )
Sourcefn can_skip_reflow_request_entirely(
&self,
reflow_request: &ReflowRequest,
) -> bool
fn can_skip_reflow_request_entirely( &self, reflow_request: &ReflowRequest, ) -> bool
In some cases, if a restyle isn’t necessary we can skip doing any work for layout entirely. This check allows us to return early from layout without doing any work at all.
fn maybe_print_reflow_event(&self, reflow_request: &ReflowRequest)
Sourcefn handle_update_scroll_node_request(
&self,
reflow_request: &ReflowRequest,
) -> bool
fn handle_update_scroll_node_request( &self, reflow_request: &ReflowRequest, ) -> bool
Checks whether we need to update the scroll node, and report whether the node is scrolled. We need to update the scroll node whenever it is requested.
Sourcefn handle_reflow(
&mut self,
reflow_request: ReflowRequest,
) -> Option<ReflowResult>
fn handle_reflow( &mut self, reflow_request: ReflowRequest, ) -> Option<ReflowResult>
The high-level routine that performs layout.
fn update_device_if_necessary( &mut self, reflow_request: &ReflowRequest, viewport_changed: bool, guards: &StylesheetGuards<'_>, ) -> bool
fn prepare_stylist_for_reflow<'dom>( &mut self, reflow_request: &ReflowRequest, document: ServoLayoutDocument<'dom>, root_element: ServoLayoutElement<'dom>, guards: &StylesheetGuards<'_>, ua_stylesheets: &UserAgentStylesheets, snapshot_map: &SnapshotMap, )
fn restyle_and_build_trees( &mut self, reflow_request: &mut ReflowRequest, document: ServoLayoutDocument<'_>, root_element: ServoLayoutElement<'_>, image_resolver: &Arc<ImageResolver>, ) -> (ReflowPhasesRun, RestyleDamage, IFrameSizes)
fn calculate_overflow(&self, damage: RestyleDamage) -> bool
fn build_stacking_context_tree_for_reflow( &self, reflow_request: &ReflowRequest, damage: RestyleDamage, ) -> bool
fn build_stacking_context_tree(&self, viewport_details: ViewportDetails) -> bool
Sourcefn build_display_list(
&self,
reflow_request: &ReflowRequest,
damage: RestyleDamage,
image_resolver: &Arc<ImageResolver>,
) -> bool
fn build_display_list( &self, reflow_request: &ReflowRequest, damage: RestyleDamage, image_resolver: &Arc<ImageResolver>, ) -> bool
Build the display list for the current layout and send it to the renderer. If no display list is built, returns false.
fn set_scroll_offset_from_script( &self, external_scroll_id: ExternalScrollId, offset: LayoutVector2D, ) -> bool
Sourcefn profiler_metadata(&self) -> Option<TimerMetadata>
fn profiler_metadata(&self) -> Option<TimerMetadata>
Returns profiling information which is passed to the time profiler.
fn viewport_did_change(&mut self, viewport_details: ViewportDetails) -> bool
fn theme_did_change(&self, theme: Theme) -> bool
Sourcefn update_device(
&mut self,
viewport_details: ViewportDetails,
theme: Theme,
guards: &StylesheetGuards<'_>,
)
fn update_device( &mut self, viewport_details: ViewportDetails, theme: Theme, 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 query_box_area(
&self,
node: TrustedNodeAddress,
area: BoxAreaType,
) -> Option<UntypedRect<Au>>
fn query_box_area( &self, node: TrustedNodeAddress, area: BoxAreaType, ) -> Option<UntypedRect<Au>>
Return the union of this node’s areas in the coordinate space of the Document. This is used
to implement getBoundingClientRect()
and support many other API where the such query is
required.
Part of https://drafts.csswg.org/cssom-view-1/#element-get-the-bounding-box.
Source§fn query_box_areas(
&self,
node: TrustedNodeAddress,
area: BoxAreaType,
) -> Vec<UntypedRect<Au>> ⓘ
fn query_box_areas( &self, node: TrustedNodeAddress, area: BoxAreaType, ) -> Vec<UntypedRect<Au>> ⓘ
Get a Vec
of bounding boxes of this node’s Fragment
s specific area in the coordinate space of
the Document. This is used to implement getClientRects()
.
See https://drafts.csswg.org/cssom-view/#dom-element-getclientrects.
Source§fn register_custom_property(
&mut self,
property_registration: PropertyRegistration,
) -> Result<(), RegisterPropertyError>
fn register_custom_property( &mut self, property_registration: PropertyRegistration, ) -> Result<(), RegisterPropertyError>
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_client_rect(&self, node: TrustedNodeAddress) -> UntypedRect<i32>
fn query_element_inner_outer_text(&self, node: TrustedNodeAddress) -> String
fn query_offset_parent(&self, node: TrustedNodeAddress) -> OffsetParentResponse
fn query_scroll_parent( &self, node: TrustedNodeAddress, ) -> Option<ScrollParentResponse>
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<TrustedNodeAddress>, ) -> UntypedRect<i32>
fn query_text_indext( &self, node: OpaqueNode, point_in_node: UntypedPoint2D<f32>, ) -> Option<usize>
fn query_elements_from_point( &self, point: LayoutPoint, flags: ElementsFromPointFlags, ) -> Vec<ElementsFromPointResult>
Source§fn collect_reports(&self, reports: &mut Vec<Report>, ops: &mut MallocSizeOfOps)
fn collect_reports(&self, reports: &mut Vec<Report>, ops: &mut MallocSizeOfOps)
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 ensure_stacking_context_tree(&self, viewport_details: ViewportDetails)
fn ensure_stacking_context_tree(&self, viewport_details: ViewportDetails)
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_from_renderer(
&mut self,
scroll_states: &FnvHashMap<ExternalScrollId, LayoutVector2D>,
)
fn set_scroll_offsets_from_renderer( &mut self, scroll_states: &FnvHashMap<ExternalScrollId, LayoutVector2D>, )
Source§fn scroll_offset(&self, id: ExternalScrollId) -> Option<LayoutVector2D>
fn scroll_offset(&self, id: ExternalScrollId) -> Option<LayoutVector2D>
ExternalScrollId
or None
if it does
not exist in the tree.Source§fn needs_new_display_list(&self) -> bool
fn needs_new_display_list(&self) -> bool
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