pub trait Layout {
Show 25 methods
// Required methods
fn device(&self) -> &Device;
fn current_epoch(&self) -> Epoch;
fn load_web_fonts_from_stylesheet(&self, stylesheet: ServoArc<Stylesheet>);
fn add_stylesheet(
&mut self,
stylesheet: ServoArc<Stylesheet>,
before_stylsheet: 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 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: &HashMap<ExternalScrollId, LayoutVector2D>,
);
fn scroll_offset(&self, id: ExternalScrollId) -> Option<LayoutVector2D>;
fn needs_new_display_list(&self) -> bool;
fn query_box_area(
&self,
node: TrustedNodeAddress,
area: BoxAreaType,
) -> Option<Rect<Au>>;
fn query_box_areas(
&self,
node: TrustedNodeAddress,
area: BoxAreaType,
) -> Vec<Rect<Au>> ⓘ;
fn query_client_rect(&self, node: TrustedNodeAddress) -> Rect<i32>;
fn query_element_inner_outer_text(&self, node: TrustedNodeAddress) -> String;
fn query_offset_parent(
&self,
node: TrustedNodeAddress,
) -> 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<TrustedNodeAddress>,
) -> Rect<i32>;
fn query_text_indext(
&self,
node: OpaqueNode,
point: UntypedPoint2D<f32>,
) -> Option<usize>;
fn query_elements_from_point(
&self,
point: LayoutPoint,
flags: ElementsFromPointFlags,
) -> Vec<ElementsFromPointResult>;
fn register_custom_property(
&mut self,
property_registration: PropertyRegistration,
) -> Result<(), RegisterPropertyError>;
}
Required Methods§
Sourcefn device(&self) -> &Device
fn device(&self) -> &Device
Get a reference to this Layout’s Stylo Device
used to handle media queries and
resolve font metrics.
Sourcefn current_epoch(&self) -> Epoch
fn current_epoch(&self) -> Epoch
The currently laid out Epoch that this Layout has finished.
Sourcefn load_web_fonts_from_stylesheet(&self, stylesheet: ServoArc<Stylesheet>)
fn load_web_fonts_from_stylesheet(&self, stylesheet: ServoArc<Stylesheet>)
Load all fonts from the given stylesheet, returning the number of fonts that need to be loaded.
Sourcefn add_stylesheet(
&mut self,
stylesheet: ServoArc<Stylesheet>,
before_stylsheet: Option<ServoArc<Stylesheet>>,
)
fn add_stylesheet( &mut self, stylesheet: ServoArc<Stylesheet>, before_stylsheet: Option<ServoArc<Stylesheet>>, )
Add a stylesheet to this Layout. This will add it to the Layout’s 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).
Sourcefn collect_reports(&self, reports: &mut Vec<Report>, ops: &mut MallocSizeOfOps)
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.
Sourcefn set_quirks_mode(&mut self, quirks_mode: QuirksMode)
fn set_quirks_mode(&mut self, quirks_mode: QuirksMode)
Sets quirks mode for the document, causing the quirks mode stylesheet to be used.
Sourcefn remove_stylesheet(&mut self, stylesheet: ServoArc<Stylesheet>)
fn remove_stylesheet(&mut self, stylesheet: ServoArc<Stylesheet>)
Removes a stylesheet from the Layout.
Sourcefn reflow(&mut self, reflow_request: ReflowRequest) -> Option<ReflowResult>
fn reflow(&mut self, reflow_request: ReflowRequest) -> Option<ReflowResult>
Requests a reflow.
Sourcefn ensure_stacking_context_tree(&self, viewport_details: ViewportDetails)
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.
Sourcefn 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>, )
Tells layout that script has added some paint worklet modules.
Sourcefn set_scroll_offsets_from_renderer(
&mut self,
scroll_states: &HashMap<ExternalScrollId, LayoutVector2D>,
)
fn set_scroll_offsets_from_renderer( &mut self, scroll_states: &HashMap<ExternalScrollId, LayoutVector2D>, )
Set the scroll states of this layout after a compositor scroll.
Sourcefn scroll_offset(&self, id: ExternalScrollId) -> Option<LayoutVector2D>
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.
Sourcefn needs_new_display_list(&self) -> bool
fn needs_new_display_list(&self) -> bool
Returns true if this layout needs to produce a new display list for rendering updates.