Expand description
This module contains traits in script used generically in the rest of Servo. The traits are here instead of in script so that these modules won’t have to depend on script.
Modules§
Structs§
- Animating
Images - Axes
Overflow - DomParallel
Info - Information that we need stored in each DOM node.
- Elements
From Point Flags - Elements
From Point Result - Describe an item that matched a hit-test query.
- HTML
Canvas Data - HTML
Media Data - IFrame
Size - Image
Animation State - Layout
Config - Layout
Damage - Individual layout actions that may be necessary after restyling. This is an extension
of
RestyleDamagefrom stylo, which only uses the 4 lower bits. - Media
Frame - Media
Metadata - Offset
Parent Response - Pending
Image - The data associated with an image that is not yet present in the image cache. Used by the script thread to hold on to DOM elements that need to be repainted when an image fetch is complete.
- Pending
Rasterization Image - A data structure to tarck vector image that are fully loaded (i.e has a parsed SVG tree) but not yet rasterized to the size needed by layout. The rasterization is happening in the image cache.
- Pending
Restyle - A pending restyle.
- Physical
Sides - Pseudo
Element Chain - A chain of pseudo-elements up to two levels deep. This is used to represent cases
where a pseudo-element has its own child pseudo element (for instance
.div::after::marker). If bothSelf::primaryandSelf::secondaryareNone, then this chain represents the element itself. Not all combinations of pseudo-elements are possible and we may not be able to calculate a style for allPseudoElementChains. - Reflow
Phases Run - The phases of reflow that were run when processing a reflow in layout.
- Reflow
Request - Information needed for a script-initiated reflow.
- Reflow
Request Restyle - Information needed for a script-initiated reflow that requires a restyle and reconstruction of box and fragment trees.
- Reflow
Result - Information derived from a layout pass that needs to be returned to the script thread.
- Reflow
Statistics - Restyle
Reason - Conditions which cause a [
Document] to need to be restyled during reflow, which might cause the rest of layout to happen as well. - SVGElement
Data - Script
Selection - A selection shared between script and layout. This selection is managed by the DOM node that maintains it, and can be modified from script. Once modified, layout is expected to reflect the new selection visual on the next display list update.
- Scroll
Container Query Flags - Style
Data - Thread
State 🔒Restorer - Trusted
Node Address - The address of a node known to be valid. These are sent from script to layout.
Enums§
- BoxArea
Type - Type of the area of CSS box for query. See https://www.w3.org/TR/css-box-3/#box-model.
- Fragment
Type - The type of fragment that a scroll root is created for.
- Layout
Element Type - Layout
Image Destination - The destination in layout where an image is needed.
- Layout
Node Type - Node
Rendering Type - Whether or not this node is being rendered or delegates rendering according to the HTML standard.
- Pending
Image State - Whether the pending image needs to be fetched or is waiting on an existing fetch.
- Query
Msg - Reflow
Goal - The goal of a reflow request.
- Scroll
Container Response
Traits§
- Dangerous
Style Element - An element that can be passed to
styloandselectorsthat allows accessing the parent node. We consider this to be too dangerous for normal layout, so it is reserved only for usingstyloandselectors. - Dangerous
Style Node - A node that can be passed to
styloandselectorsthat allows accessing the parent node. We consider this to be too dangerous for normal layout, so it is reserved only for usingstyloandselectors. - Generic
Layout Data Trait - Layout
- Layout
Data Trait - Layout
DomType Bundle - A trait that holds all the concrete implementations of the Layout DOM traits. This is
useful because it means that other types (specifically the implementation of the
Layouttrait) can be parameterized over a single type (LayoutDomTypeBundle) rather than all of the various Layout DOM trait implementations. - Layout
Element - A trait that exposes a DOM element to layout. Implementors of this trait must abide by certain safety requirements. Layout will only ever access and mutate each element from a single thread at a time, though children may be used in parallel from other threads. That is why this trait does not allow access to parent nodes, as it would make it easy to cause race conditions and memory errors.
- Layout
Factory - Layout
Node - A trait that exposes a DOM nodes to layout. Implementors of this trait must abide by certain safety requirements. Layout will only ever access and mutate each node from a single thread at a time, though children may be used in parallel from other threads. That is why this trait does not allow access to parent nodes, as it would make it easy to cause race conditions and memory errors.
- Script
Thread Factory - This trait is part of
layout_apibecause it depends on bothscript_traitsand alsoLayoutFactoryfrom this crate. If it was inscript_traitsthere would be a circular dependency.
Functions§
- combine_
id_ with_ fragment_ type - node_
id_ from_ scroll_ id - with_
layout_ state - Set up the thread-local state to reflect that layout code is about to run,
then call the provided function.
This must be used when running code that will interact with the DOM tree
through types like
ServoLayoutNode,ServoLayoutElement, andLayoutDom, which have rules about how they must be used from layout worker threads.
Type Aliases§
- CSSPixel
Rect Iterator - Dangerous
Style Element Of - Type alias to extract
ConcreteDangerousStyleElementfrom aLayoutDomTypeBundleimplementation. - Dangerous
Style Node Of - Type alias to extract
ConcreteDangerousStyleNodefrom aLayoutDomTypeBundleimplementation. - Generic
Layout Data - IFrame
Sizes - Layout
Element Of - Type alias to extract
ConcreteLayoutElementfrom aLayoutDomTypeBundleimplementation. - Layout
Node Of - Type alias to extract
ConcreteLayoutNodefrom aLayoutDomTypeBundleimplementation. - Shared
Selection