Skip to main content

Layout

Trait Layout 

Source
pub trait Layout {
Show 38 methods // Required methods fn device(&self) -> &Device; fn set_theme(&mut self, theme: Theme) -> bool; fn set_viewport_details( &mut self, viewport_details: ViewportDetails, ) -> bool; fn add_stylesheet( &mut self, stylesheet: ServoArc<Stylesheet>, before_stylesheet: Option<ServoArc<Stylesheet>>, ); fn exit_now(&mut self); fn collect_reports( &self, reports: &mut Vec<Report>, ops: &mut MallocSizeOfOps, ); fn set_quirks_mode(&mut self, quirks_mode: QuirksMode); fn remove_stylesheet(&mut self, stylesheet: ServoArc<Stylesheet>); fn remove_cached_image(&mut self, image_url: &ServoUrl); fn reflow(&mut self, reflow_request: ReflowRequest) -> Option<ReflowResult>; fn ensure_stacking_context_tree(&self, viewport_details: ViewportDetails); fn register_paint_worklet_modules( &mut self, name: Atom, properties: Vec<Atom>, painter: Box<dyn Painter>, ); fn set_scroll_offsets_from_renderer( &mut self, scroll_states: &FxHashMap<ExternalScrollId, LayoutVector2D>, ); fn scroll_offset(&self, id: ExternalScrollId) -> Option<LayoutVector2D>; fn needs_new_display_list(&self) -> bool; fn set_needs_new_display_list(&self); fn node_rendering_type( &self, node: TrustedNodeAddress, pseudo: Option<PseudoElement>, ) -> NodeRenderingType; fn query_containing_block( &self, node: TrustedNodeAddress, ) -> Option<UntrustedNodeAddress>; fn query_containing_block_is_descendant( &self, root: TrustedNodeAddress, possible_descendant: TrustedNodeAddress, ) -> bool; fn query_padding(&self, node: TrustedNodeAddress) -> Option<PhysicalSides>; fn query_box_area( &self, node: TrustedNodeAddress, area: BoxAreaType, exclude_transform_and_inline: bool, ) -> Option<Rect<Au, CSSPixel>>; fn query_box_areas( &self, node: TrustedNodeAddress, area: BoxAreaType, ) -> CSSPixelRectVec; fn query_client_rect(&self, node: TrustedNodeAddress) -> Rect<i32, CSSPixel>; fn query_current_css_zoom(&self, node: TrustedNodeAddress) -> f32; fn query_element_inner_outer_text(&self, node: TrustedNodeAddress) -> String; fn query_offset_parent( &self, node: TrustedNodeAddress, ) -> OffsetParentResponse; fn query_scroll_container( &self, node: Option<TrustedNodeAddress>, flags: ScrollContainerQueryFlags, ) -> Option<ScrollContainerResponse>; 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>, ) -> Rect<i32, CSSPixel>; fn query_text_index( &self, node: TrustedNodeAddress, point: Point2D<Au, CSSPixel>, ) -> Option<usize>; fn query_elements_from_point( &self, point: LayoutPoint, ) -> Vec<ElementsFromPointResult>; fn query_effective_overflow( &self, node: TrustedNodeAddress, ) -> Option<AxesOverflow>; fn stylist_mut(&mut self) -> &mut Stylist; fn set_accessibility_active(&self, enabled: bool, epoch: Epoch); fn accessibility_active(&self) -> bool; fn needs_accessibility_update(&self) -> bool; fn set_needs_accessibility_update(&self);
}

Required Methods§

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 set_theme(&mut self, theme: Theme) -> bool

Set the theme on this Layout’s Device. The caller should also trigger a new layout when this happens, though it can happen later. Returns true if the Theme actually changed or false otherwise.

Source

fn set_viewport_details(&mut self, viewport_details: ViewportDetails) -> bool

Set the ViewportDetails on this Layout’s Device. The caller should also trigger a new layout when this happens, though it can happen later. Returns true if the ViewportDetails actually changed or false otherwise.

Source

fn add_stylesheet( &mut self, stylesheet: ServoArc<Stylesheet>, before_stylesheet: Option<ServoArc<Stylesheet>>, )

Add a stylesheet to this Layout’s Stylist.

The second stylesheet is the insertion point (if it exists, the sheet needs to be inserted before it).

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>, ops: &mut MallocSizeOfOps)

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 remove_stylesheet(&mut self, stylesheet: ServoArc<Stylesheet>)

Removes a stylesheet from the Layout.

Source

fn remove_cached_image(&mut self, image_url: &ServoUrl)

Removes an image from the Layout image resolver cache.

Source

fn reflow(&mut self, reflow_request: ReflowRequest) -> Option<ReflowResult>

Requests a reflow.

Source

fn ensure_stacking_context_tree(&self, viewport_details: ViewportDetails)

Do not request a reflow, but ensure that any previous reflow completes building a stacking context tree so that it is ready to query the final size of any elements in script.

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_offsets_from_renderer( &mut self, scroll_states: &FxHashMap<ExternalScrollId, LayoutVector2D>, )

Set the scroll states of this layout after a Paint scroll.

Source

fn scroll_offset(&self, id: ExternalScrollId) -> Option<LayoutVector2D>

Get the scroll offset of the given scroll node with id of ExternalScrollId or None if it does not exist in the tree.

Source

fn needs_new_display_list(&self) -> bool

Returns true if this layout needs to produce a new display list for rendering updates.

Source

fn set_needs_new_display_list(&self)

Marks that this layout needs to produce a new display list for rendering updates.

Source

fn node_rendering_type( &self, node: TrustedNodeAddress, pseudo: Option<PseudoElement>, ) -> NodeRenderingType

Returns the NodeRenderingType for this node and pseudo. This is used to determine if a node is being rendered, delegating its rendering, or not being rendered at all.

Source

fn query_containing_block( &self, node: TrustedNodeAddress, ) -> Option<UntrustedNodeAddress>

Source

fn query_containing_block_is_descendant( &self, root: TrustedNodeAddress, possible_descendant: TrustedNodeAddress, ) -> bool

Source

fn query_padding(&self, node: TrustedNodeAddress) -> Option<PhysicalSides>

Source

fn query_box_area( &self, node: TrustedNodeAddress, area: BoxAreaType, exclude_transform_and_inline: bool, ) -> Option<Rect<Au, CSSPixel>>

Source

fn query_box_areas( &self, node: TrustedNodeAddress, area: BoxAreaType, ) -> CSSPixelRectVec

Source

fn query_client_rect(&self, node: TrustedNodeAddress) -> Rect<i32, CSSPixel>

Source

fn query_current_css_zoom(&self, node: TrustedNodeAddress) -> f32

Source

fn query_element_inner_outer_text(&self, node: TrustedNodeAddress) -> String

Source

fn query_offset_parent(&self, node: TrustedNodeAddress) -> OffsetParentResponse

Source

fn query_scroll_container( &self, node: Option<TrustedNodeAddress>, flags: ScrollContainerQueryFlags, ) -> Option<ScrollContainerResponse>

Query the scroll container for the given node. If node is None, the scroll container for the viewport is returned.

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<TrustedNodeAddress>, ) -> Rect<i32, CSSPixel>

Source

fn query_text_index( &self, node: TrustedNodeAddress, point: Point2D<Au, CSSPixel>, ) -> Option<usize>

Find the character offset of the point in the given node, if it has text content.

Source

fn query_elements_from_point( &self, point: LayoutPoint, ) -> Vec<ElementsFromPointResult>

Source

fn query_effective_overflow( &self, node: TrustedNodeAddress, ) -> Option<AxesOverflow>

Source

fn stylist_mut(&mut self) -> &mut Stylist

Source

fn set_accessibility_active(&self, enabled: bool, epoch: Epoch)

Set whether the accessibility tree should be constructed for this Layout. This should be called by the embedder when accessibility is requested by the user.

Source

fn accessibility_active(&self) -> bool

Returns whether accessibility is active for this Layout.

Source

fn needs_accessibility_update(&self) -> bool

Whether the accessibility tree needs updating. This is set to true when

  • accessibility is activated; or
  • a page is loaded after accesibility is activated.

In future, this should be set to true if DOM or style have changed in a way that impacts the accessibility tree.

Checked in can_skip_reflow_request_entirely(), as a dirty accessibility tree should force a reflow, and handle_reflow() to determine whether to update the accessibility tree during reflow.

Source

fn set_needs_accessibility_update(&self)

Implementors§