Crate webrender_api

source ·
Expand description

The webrender_api crate contains an assortment types and functions used by WebRender consumers as well as, in many cases, WebRender itself.

This separation allows Servo to parallelize compilation across webrender and other crates that depend on webrender_api. So in practice, we put things in this crate when Servo needs to use them. Firefox depends on the webrender crate directly, and so this distinction is not really relevant there.


pub use euclid;


color 🔒
font 🔒
image 🔒
A collection of coordinate spaces and their corresponding Point, Size and Rect types.


Renders a filtered region of its backdrop
Immutable description of a font instance requested by the user of the API.
Metadata (but not storage) for a blob image.
An opaque identifier describing a blob image registered with WebRender. This is used as a handle to reference blob images, and can be used as an image in display items.
Input parameters for the BlobImageRasterizer.
A key identifying blob image rasterization work requested from the blob image rasterizer.
A display list.
Describes the memory layout of a display list.
Clears all colors from the area, making it possible to cut holes in the window. (useful for things like the macos frosted-glass effect).
Just an abstraction for bundling up a bunch of clips into a “super clip”.
Represents RGBA screen colors with floating point numbers.
Represents RGBA screen colors with one byte per channel.
A grouping of fields a lot of display items need, just to avoid repeating these over and over in this file.
Guard to add a crash annotation at creation, and clear it at destruction.
Flags to enable/disable various builtin debugging tools.
A key uniquely identifying a WebRender document.
When using generate_frame(), a list of PropertyValue structures can optionally be supplied to provide the current value of any animated properties.
An epoch identifies the state of a pipeline in time.
An opaque pointer-sized value.
The data that an external client should provide about an external image. For instance, if providing video frames, the application could call wr.render() whenever a new video frame is ready. Note that the UV coords are supplied in texel-space!
Descriptor for external image resources. See ImageData.
An arbitrary identifier for an external image provided by the application. It must be a unique identifier for each external image.
An external identifier that uniquely identifies a scroll frame independent of its ClipId, which may change from frame to frame. This should be unique within a pipeline. WebRender makes no attempt to ensure uniqueness. The zero value is reserved for use by the root scroll node of every pipeline, which always has an external id.
SVG Filter Primitive. See: cbindgen:derive-eq=false
Data corresponding to an instantiation of a font, with size and other options specified.
Hashable floating-point storage for font size.
Construct a gradient to be used in display lists.
A minimal hit-testable item for the parent browser’s convenience, and is slimmer than a RectangleDisplayItem (no color). The existence of this as a distinct item also makes it easier to inspect/debug display items.
Describe an item that matched a hit-test query.
Returned by RenderApi::hit_test.
A hit tester requested to the render backend thread but not necessarily ready yet.
ID namespaces uniquely identify different users of WebRender’s API.
Metadata (but not storage) describing an image In WebRender.
Various flags that are part of an image descriptor.
This describes an image that fills the specified area. It stretches or shrinks the image as necessary. While RepeatingImageDisplayItem could otherwise provide a superset of the functionality, it has been problematic inferring the desired repetition properties when snapping changes the size of the primitive.
An opaque identifier describing an image registered with WebRender. This is used as a handle to reference images, and is used as the hash map key for the actual image storage in the ResourceCache.
Stats for an individual item
A request to notify a handler when the transaction reaches certain stages of the rendering pipeline.
From the point of view of WR, PipelineId is completely opaque and generic as long as it’s clonable, serializable, comparable, and hashable.
Represents pre-multiplied RGBA colors with floating point numbers.
A key to identify an animated property binding.
A unique key that is used for connecting animated property values to bindings in the display list.
The current value of an animated property. This is supplied by the calling code.
Various settings that the caller can select based on desired tradeoffs between rendering quality and performance / power usage.
Representation of a rasterized blob image. This is obtained by passing BlobImageData to the embedding via the rasterization callback.
A solid or an animating color to draw (may not actually be a rectangle due to complex clips)
This describes a background-image and its tiling. It repeats in a grid to fill the specified area.
A map of font instance data accessed concurrently from multiple threads.
Per-primitive information about the nodes in the clip tree and the spatial tree that the primitive belongs to.
A reference to a spatial node defining item positioning.
The minimum and maximum allowable offset for a sticky frame in a single dimension.
Represents a zoom factor.


Error code for when blob rasterization failed.
A stage of the rendering pipeline.
A reference to a clipping node defining how an item is clipped.
Specifies the color depth of an image. Currently only used for YUV images.
Available composite operoations for the composite filter primitive
Crash annotations included in crash reports.
This is a “complete” version of the DisplayItem, with all implicit trailing arrays included, for debug serialization (captures).
The possible states of a Dirty rect.
DisplayListSection determines the target buffer for the display items.
The source for an external image.
Storage format identifier for externally-managed images.
CSS filter.
An input to a SVG filter primitive.
See: cbindgen:derive-eq=false
Container for the raw data describing a font. This might be a stream of bytes corresponding to a downloaded font, or a handle to a native font from the operating system.
Specifies the type of texture target in driver terms.
Represents the backing store of an arbitrary series of pixels for display by WebRender. This storage can take several forms.
Specifies the format of a series of pixels, in driver terms.
Information specific to a primitive type that uniquely identifies a primitive template by key.
A binding property can either be a specific value (the normal, non-animated case) or point to a binding location to fetch the current value from. Note that Binding has also a non-animated value, the value is used for the case where the animation is still in-delay phase (i.e. the animation doesn’t produce any animation values).
Configure whether the contents of a stacking context should be rasterized in local space or screen space. Local space rasterized pictures are typically used when we want to cache the output, and performance is important. Note that this is a performance hint only, which WR may choose to ignore.
Describe whether or not scrolling should be clamped by the content bounds.



An object that can perform hit-testing without doing synchronous queries to the RenderBackendThread.
A group of rasterization requests to execute synchronously on the scene builder thread.
A handler on the render backend that can create rasterizer objects which will be sent to the scene builder thread to execute the rasterization.
The resources exposed by the resource cache available for use by the blob rasterizer.
Handler to expose support for annotating crash reports.
The interfaces that an application can implement to support providing external image buffers. When the application passes an external image to WR, it should keep that external image life time. People could check the epoch id in RenderNotifier at the client side to make sure that the external image is not used by WR. Then, do the clean up for that external image.
A handler to notify when a transaction reaches certain stages of the rendering pipeline.
A handler to integrate WebRender with the thread that contains the Renderer.

Type Definitions

Backing store for blob image command streams.
Result type for blob raserization.
An identifier used to refer to previously sent display items. Currently it refers to individual display items, but this may change later.
A tag that can be used to identify items during hit testing. If the tag is missing then the item doesn’t take part in hit testing at all. This is composed of two numbers. In Servo, the first is an identifier while the second is used to select the cursor that should be used during mouse movement. In Gecko, the first is a scrollframe identifier, while the second is used to store various flags that APZ needs to properly process input events.
This type carries no valuable semantics for WR. However, it reflects the fact that clients (Servo) may generate pipelines by different semi-independent sources. These pipelines still belong to the same IdNamespace and the same DocumentId. Having this extra Id field enables them to generate PipelineId without collision.
Width and height in device pixels of image tiles.
A C function that takes a pointer to a heap allocation and returns its size.