/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use euclid::{SideOffsets2D, Angle}; use peek_poke::PeekPoke; use std::ops::Not; // local imports usecrate::{font, SnapshotImageKey}; usecrate::{APZScrollGeneration, HasScrollLinkedEffect, PipelineId, PropertyBinding}; usecrate::serde::{Serialize, Deserialize}; usecrate::color::ColorF; usecrate::image::{ColorDepth, ImageKey}; usecrate::units::*; use std::hash::{Hash, Hasher};
// ****************************************************************** // * NOTE: some of these structs have an "IMPLICIT" comment. * // * This indicates that the BuiltDisplayList will have serialized * // * a list of values nearby that this item consumes. The traversal * // * iterator should handle finding these. DebugDisplayItem should * // * make them explicit. * // ******************************************************************
/// 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. pubtype ItemTag = (u64, u16);
bitflags! { impl PrimitiveFlags: u8 { /// The CSS backface-visibility property (yes, it can be really granular) const IS_BACKFACE_VISIBLE = 1 << 0; /// If set, this primitive represents a scroll bar container const IS_SCROLLBAR_CONTAINER = 1 << 1; /// This is used as a performance hint - this primitive may be promoted to a native /// compositor surface under certain (implementation specific) conditions. This /// is typically used for large videos, and canvas elements. const PREFER_COMPOSITOR_SURFACE = 1 << 2; /// If set, this primitive can be passed directly to the compositor via its /// ExternalImageId, and the compositor will use the native image directly. /// Used as a further extension on top of PREFER_COMPOSITOR_SURFACE. const SUPPORTS_EXTERNAL_COMPOSITOR_SURFACE = 1 << 3; /// This flags disables snapping and forces anti-aliasing even if the primitive is axis-aligned. const ANTIALISED = 1 << 4; /// If true, this primitive is used as a background for checkerboarding const CHECKERBOARD_BACKGROUND = 1 << 5;
}
}
/// A grouping of fields a lot of display items need, just to avoid /// repeating these over and over in this file. #[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pubstruct CommonItemProperties { /// Bounds of the display item to clip to. Many items are logically /// infinite, and rely on this clip_rect to define their bounds /// (solid colors, background-images, gradients, etc). pub clip_rect: LayoutRect, /// Additional clips pub clip_chain_id: ClipChainId, /// The coordinate-space the item is in (yes, it can be really granular) pub spatial_id: SpatialId, /// Various flags describing properties of this primitive. pub flags: PrimitiveFlags,
}
/// Per-primitive information about the nodes in the clip tree and /// the spatial tree that the primitive belongs to. /// /// Note: this is a separate struct from `PrimitiveInfo` because /// it needs indirectional mapping during the DL flattening phase, /// turning into `ScrollNodeAndClipChain`. #[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pubstruct SpaceAndClipInfo { pub spatial_id: SpatialId, pub clip_chain_id: ClipChainId,
}
impl SpaceAndClipInfo { /// Create a new space/clip info associated with the root /// scroll frame. pubfn root_scroll(pipeline_id: PipelineId) -> Self {
SpaceAndClipInfo {
spatial_id: SpatialId::root_scroll_node(pipeline_id),
clip_chain_id: ClipChainId::INVALID,
}
}
}
// Spaces and Frames that content can be scoped under.
Iframe(IframeDisplayItem),
PushReferenceFrame(ReferenceFrameDisplayListItem),
PushStackingContext(PushStackingContextDisplayItem),
// These marker items indicate an array of data follows, to be used for the // next non-marker item.
SetGradientStops,
SetFilterOps,
SetFilterData,
SetPoints,
// These marker items terminate a scope introduced by a previous item.
PopReferenceFrame,
PopStackingContext,
PopAllShadows,
// For debugging purposes.
DebugMarker(u32),
}
/// This is a "complete" version of the DisplayItem, with all implicit trailing /// arrays included, for debug serialization (captures). #[cfg(any(feature = "serialize", feature = "deserialize"))] #[cfg_attr(feature = "serialize", derive(Serialize))] #[cfg_attr(feature = "deserialize", derive(Deserialize))] pubenum DebugDisplayItem {
Rectangle(RectangleDisplayItem),
HitTest(HitTestDisplayItem),
Text(TextDisplayItem, Vec<font::GlyphInstance>),
Line(LineDisplayItem),
Border(BorderDisplayItem),
BoxShadow(BoxShadowDisplayItem),
PushShadow(PushShadowDisplayItem),
Gradient(GradientDisplayItem),
RadialGradient(RadialGradientDisplayItem),
ConicGradient(ConicGradientDisplayItem),
Image(ImageDisplayItem),
RepeatingImage(RepeatingImageDisplayItem),
YuvImage(YuvImageDisplayItem),
BackdropFilter(BackdropFilterDisplayItem),
/// The minimum and maximum allowable offset for a sticky frame in a single dimension. #[repr(C)] #[derive(Clone, Copy, Debug, Default, Deserialize, MallocSizeOf, PartialEq, Serialize, PeekPoke)] pubstruct StickyOffsetBounds { /// The minimum offset for this frame, typically a negative value, which specifies how /// far in the negative direction the sticky frame can offset its contents in this /// dimension. pub min: f32,
/// The maximum offset for this frame, typically a positive value, which specifies how /// far in the positive direction the sticky frame can offset its contents in this /// dimension. pub max: f32,
}
/// The margins that should be maintained between the edge of the parent viewport and this /// sticky frame. A margin of None indicates that the sticky frame should not stick at all /// to that particular edge of the viewport. pub margins: SideOffsets2D<Option<f32>, LayoutPixel>,
/// The minimum and maximum vertical offsets for this sticky frame. Ignoring these constraints, /// the sticky frame will continue to stick to the edge of the viewport as its original /// position is scrolled out of view. Constraints specify a maximum and minimum offset from the /// original position relative to non-sticky content within the same scrolling frame. pub vertical_offset_bounds: StickyOffsetBounds,
/// The minimum and maximum horizontal offsets for this sticky frame. Ignoring these constraints, /// the sticky frame will continue to stick to the edge of the viewport as its original /// position is scrolled out of view. Constraints specify a maximum and minimum offset from the /// original position relative to non-sticky content within the same scrolling frame. pub horizontal_offset_bounds: StickyOffsetBounds,
/// A property binding that we use to store an animation ID for APZ pub transform: Option<PropertyBinding<LayoutTransform>>,
}
#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pubstruct ScrollFrameDescriptor { /// The id of the space this scroll frame creates pub scroll_frame_id: SpatialId, /// The size of the contents this contains (so the backend knows how far it can scroll). // FIXME: this can *probably* just be a size? Origin seems to just get thrown out. pub content_rect: LayoutRect, pub frame_rect: LayoutRect, pub parent_space: SpatialId, pub external_id: ExternalScrollId, /// The amount this scrollframe has already been scrolled by, in the caller. /// This means that all the display items that are inside the scrollframe /// will have their coordinates shifted by this amount, and this offset /// should be added to those display item coordinates in order to get a /// normalized value that is consistent across display lists. pub external_scroll_offset: LayoutVector2D, /// The generation of the external_scroll_offset. pub scroll_offset_generation: APZScrollGeneration, /// Whether this scrollframe document has any scroll-linked effect or not. pub has_scroll_linked_effect: HasScrollLinkedEffect,
}
/// A solid or an animating color to draw (may not actually be a rectangle due to complex clips) #[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pubstruct RectangleDisplayItem { pub common: CommonItemProperties, pub bounds: LayoutRect, pub color: PropertyBinding<ColorF>,
}
/// 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. #[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pubstruct HitTestDisplayItem { pub rect: LayoutRect, pub clip_chain_id: ClipChainId, pub spatial_id: SpatialId, pub flags: PrimitiveFlags, pub tag: ItemTag,
}
#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pubstruct LineDisplayItem { pub common: CommonItemProperties, /// We need a separate rect from common.clip_rect to encode cute /// tricks that firefox does to make a series of text-decorations seamlessly /// line up -- snapping the decorations to a multiple of their period, and /// then clipping them to their "proper" area. This rect is that "logical" /// snapped area that may be clipped to the right size by the clip_rect. pub area: LayoutRect, /// Whether the rect is interpretted as vertical or horizontal pub orientation: LineOrientation, /// This could potentially be implied from area, but we currently prefer /// that this is the responsibility of the layout engine. Value irrelevant /// for non-wavy lines. // FIXME: this was done before we could use tagged unions in enums, but now // it should just be part of LineStyle::Wavy. pub wavy_line_thickness: f32, pub color: ColorF, pub style: LineStyle,
}
#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pubstruct TextDisplayItem { pub common: CommonItemProperties, /// The area all the glyphs should be found in. Strictly speaking this isn't /// necessarily needed, but layout engines should already "know" this, and we /// use it cull and size things quickly before glyph layout is done. Currently /// the glyphs *can* be outside these bounds, but that should imply they /// can be cut off. // FIXME: these are currently sometimes ignored to keep some old wrench tests // working, but we should really just fix the tests! pub bounds: LayoutRect, pub font_key: font::FontInstanceKey, pub color: ColorF, pub glyph_options: Option<font::GlyphOptions>,
} // IMPLICIT: glyphs: Vec<font::GlyphInstance>
#[derive(Clone, Copy, Debug, Default, Deserialize, MallocSizeOf, PartialEq, Serialize, PeekPoke)] pubstruct NormalBorder { pub left: BorderSide, pub right: BorderSide, pub top: BorderSide, pub bottom: BorderSide, pub radius: BorderRadius, /// Whether to apply anti-aliasing on the border corners. /// /// Note that for this to be `false` and work, this requires the borders to /// be solid, and no border-radius. pub do_aa: bool,
}
/// Normalizes a border so that we don't render disallowed stuff, like inset /// borders that are less than two pixels wide. #[inline] pubfn normalize(&mutself, widths: &LayoutSideOffsets) {
debug_assert!( self.do_aa || self.can_disable_antialiasing(), "Unexpected disabled-antialiasing in a border, likely won't work or will be ignored"
);
#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pubstruct NinePatchBorder { /// Describes what to use as the 9-patch source image. If this is an image, /// it will be stretched to fill the size given by width x height. pub source: NinePatchBorderSource,
/// The width of the 9-part image. pub width: i32,
/// The height of the 9-part image. pub height: i32,
/// Distances from each edge where the image should be sliced up. These /// values are in 9-part-image space (the same space as width and height), /// and the resulting image parts will be used to fill the corresponding /// parts of the border as given by the border widths. This can lead to /// stretching. /// Slices can be overlapping. In that case, the same pixels from the /// 9-part image will show up in multiple parts of the resulting border. pub slice: DeviceIntSideOffsets,
/// Controls whether the center of the 9 patch image is rendered or /// ignored. The center is never rendered if the slices are overlapping. pub fill: bool,
/// Determines what happens if the horizontal side parts of the 9-part /// image have a different size than the horizontal parts of the border. pub repeat_horizontal: RepeatMode,
/// Determines what happens if the vertical side parts of the 9-part /// image have a different size than the vertical parts of the border. pub repeat_vertical: RepeatMode,
}
/// The area #[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pubstruct GradientDisplayItem { /// NOTE: common.clip_rect is the area the gradient covers pub common: CommonItemProperties, /// The area to tile the gradient over (first tile starts at origin of this rect) // FIXME: this should ideally just be `tile_origin` here, with the clip_rect // defining the bounds of the item. Needs non-trivial backend changes. pub bounds: LayoutRect, /// How big a tile of the of the gradient should be (common case: bounds.size) pub tile_size: LayoutSize, /// The space between tiles of the gradient (common case: 0) pub tile_spacing: LayoutSize, pub gradient: Gradient,
}
/// Just an abstraction for bundling up a bunch of clips into a "super clip". #[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pubstruct ClipChainItem { pub id: ClipChainId, pub parent: Option<ClipChainId>,
} // IMPLICIT clip_ids: Vec<ClipId>
#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pubstruct RadialGradientDisplayItem { pub common: CommonItemProperties, /// The area to tile the gradient over (first tile starts at origin of this rect) // FIXME: this should ideally just be `tile_origin` here, with the clip_rect // defining the bounds of the item. Needs non-trivial backend changes. pub bounds: LayoutRect, pub gradient: RadialGradient, pub tile_size: LayoutSize, pub tile_spacing: LayoutSize,
}
#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pubstruct ConicGradientDisplayItem { pub common: CommonItemProperties, /// The area to tile the gradient over (first tile starts at origin of this rect) // FIXME: this should ideally just be `tile_origin` here, with the clip_rect // defining the bounds of the item. Needs non-trivial backend changes. pub bounds: LayoutRect, pub gradient: ConicGradient, pub tile_size: LayoutSize, pub tile_spacing: LayoutSize,
}
/// Renders a filtered region of its backdrop #[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pubstruct BackdropFilterDisplayItem { pub common: CommonItemProperties,
} // IMPLICIT: filters: Vec<FilterOp>, filter_datas: Vec<FilterData>, filter_primitives: Vec<FilterPrimitive>
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize, PeekPoke)] pubenum ReferenceFrameKind { /// A normal transform matrix, may contain perspective (the CSS transform property)
Transform { /// Optionally marks the transform as only ever having a simple 2D scale or translation, /// allowing for optimizations.
is_2d_scale_translation: bool, /// Marks that the transform should be snapped. Used for transforms which animate in /// response to scrolling, eg for zooming or dynamic toolbar fixed-positioning.
should_snap: bool, /// Marks the transform being a part of the CSS stacking context that also has /// a perspective. In this case, backface visibility takes this perspective into /// account.
paired_with_perspective: bool,
}, /// A perspective transform, that optionally scrolls relative to a specific scroll node
Perspective {
scrolling_relative_to: Option<ExternalScrollId>,
}
}
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize, PeekPoke)] pubenum ReferenceTransformBinding { /// Standard reference frame which contains a precomputed transform. Static {
binding: PropertyBinding<LayoutTransform>,
}, /// Computed reference frame which dynamically calculates the transform /// based on the given parameters. The reference is the content size of /// the parent iframe, which is affected by snapping. /// /// This is used when a transform depends on the layout size of an /// element, otherwise the difference between the unsnapped size /// used in the transform, and the snapped size calculated during scene /// building can cause seaming.
Computed {
scale_from: Option<LayoutSize>,
vertical_flip: bool,
rotation: Rotation,
},
}
#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pubstruct ReferenceFrame { pub kind: ReferenceFrameKind, pub transform_style: TransformStyle, /// The transform matrix, either the perspective matrix or the transform /// matrix. pub transform: ReferenceTransformBinding, pub id: SpatialId,
}
/// If passed in a stacking context display item, inform WebRender that /// the contents of the stacking context should be retained into a texture /// and associated to an image key. /// /// Image display items can then display the cached snapshot using the /// same image key. /// /// The flow for creating/using/deleting snapshots is the same as with /// regular images: /// - The image key must have been created with `Transaction::add_snapshot_image`. /// - The current scene must not contain references to the snapshot when /// `Transaction::delete_snapshot_image` is called. #[repr(C)] #[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pubstruct SnapshotInfo { /// The image key to associate the snapshot with. pub key: SnapshotImageKey, /// The bounds of the snapshot in local space. /// /// This rectangle is relative to the same coordinate space as the /// child items of the stacking context. pub area: LayoutRect, /// If true, detach the stacking context from the scene and only /// render it into the snapshot. /// If false, the stacking context rendered in the frame normally /// in addition to being cached into the snapshot. pub detached: bool,
}
/// 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. #[derive(Clone, Copy, Debug, Deserialize, PartialEq, MallocSizeOf, Serialize, PeekPoke)] #[repr(u8)] pubenum RasterSpace { // Rasterize in local-space, applying supplied scale to primitives. // Best performance, but lower quality.
Local(f32),
// Rasterize the picture in screen-space, including rotation / skew etc in // the rasterized element. Best quality, but slower performance. Note that // any stacking context with a perspective transform will be rasterized // in local-space, even if this is set.
Screen,
}
bitflags! { impl StackingContextFlags: u8 { /// If true, this stacking context is a blend container than contains /// mix-blend-mode children (and should thus be isolated). const IS_BLEND_CONTAINER = 1 << 0; /// If true, this stacking context is a wrapper around a backdrop-filter (e.g. for /// a clip-mask). This is needed to allow the correct selection of a backdrop root /// since a clip-mask stacking context creates a parent surface. const WRAPS_BACKDROP_FILTER = 1 << 1; /// If true, this stacking context must be isolated from parent by a surface. const FORCED_ISOLATION = 1 << 2;
}
}
/// Available composite operoations for the composite filter primitive #[repr(C)] #[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize, PeekPoke)] pubenum CompositeOperator {
Over, In,
Atop,
Out,
Xor,
Lighter,
Arithmetic([f32; 4]),
}
impl CompositeOperator { // This must stay in sync with the composite operator defines in cs_svg_filter.glsl pubfn as_int(&self) -> u32 { matchself {
CompositeOperator::Over => 0,
CompositeOperator::In => 1,
CompositeOperator::Out => 2,
CompositeOperator::Atop => 3,
CompositeOperator::Xor => 4,
CompositeOperator::Lighter => 5,
CompositeOperator::Arithmetic(..) => 6,
}
}
}
/// An input to a SVG filter primitive. #[repr(C)] #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize, PeekPoke)] pubenum FilterPrimitiveInput { /// The input is the original graphic that the filter is being applied to.
Original, /// The input is the output of the previous filter primitive in the filter primitive chain.
Previous, /// The input is the output of the filter primitive at the given index in the filter primitive chain.
OutputOfPrimitiveIndex(usize),
}
impl FilterPrimitiveInput { /// Gets the index of the input. /// Returns `None` if the source graphic is the input. pubfn to_index(self, cur_index: usize) -> Option<usize> { matchself {
FilterPrimitiveInput::Previous if cur_index > 0 => Some(cur_index - 1),
FilterPrimitiveInput::OutputOfPrimitiveIndex(index) => Some(index),
_ => None,
}
}
}
#[repr(C)] #[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize, PeekPoke)] pubenum FilterOpGraphPictureBufferId { #[default] /// empty slot in feMerge inputs
None, /// reference to another (earlier) node in filter graph
BufferId(i16),
}
#[repr(C)] #[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, PeekPoke)] pubstruct FilterOpGraphPictureReference { /// Id of the picture in question in a namespace unique to this filter DAG pub buffer_id: FilterOpGraphPictureBufferId,
}
#[repr(C)] #[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, PeekPoke)] pubstruct FilterOpGraphNode { /// True if color_interpolation_filter == LinearRgb; shader will convert /// sRGB texture pixel colors on load and convert back on store, for correct /// interpolation pub linear: bool, /// virtualized picture input binding 1 (i.e. texture source), typically /// this is used, but certain filters do not use it pub input: FilterOpGraphPictureReference, /// virtualized picture input binding 2 (i.e. texture sources), only certain /// filters use this pub input2: FilterOpGraphPictureReference, /// rect this node will render into, in filter space pub subregion: LayoutRect,
}
/// Maximum number of SVGFE filters in one graph, this is constant size to avoid /// allocating anything, and the SVG spec allows us to drop all filters on an /// item if the graph is excessively complex - a graph this large will never be /// a good user experience, performance-wise. pubconst SVGFE_GRAPH_MAX: usize = 256;
#[repr(C)] #[derive(Clone, Copy, Debug, Deserialize, Serialize, PeekPoke)] pubenum FilterOp { /// Filter that does no transformation of the colors, needed for /// debug purposes, and is the default value in impl_default_for_enums. /// parameters: none /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear)
Identity, /// apply blur effect /// parameters: stdDeviationX, stdDeviationY /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear)
Blur(f32, f32), /// apply brightness effect /// parameters: amount /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear)
Brightness(f32), /// apply contrast effect /// parameters: amount /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear)
Contrast(f32), /// fade image toward greyscale version of image /// parameters: amount /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear)
Grayscale(f32), /// fade image toward hue-rotated version of image (rotate RGB around color wheel) /// parameters: angle /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear)
HueRotate(f32), /// fade image toward inverted image (1 - RGB) /// parameters: amount /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear)
Invert(f32), /// multiplies color and alpha by opacity /// parameters: amount /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear)
Opacity(PropertyBinding<f32>, f32), /// multiply saturation of colors /// parameters: amount /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear)
Saturate(f32), /// fade image toward sepia tone version of image /// parameters: amount /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear)
Sepia(f32), /// add drop shadow version of image to the image /// parameters: shadow /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear)
DropShadow(Shadow), /// transform color and alpha in image through 4x5 color matrix (transposed for efficiency) /// parameters: matrix[5][4] /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear)
ColorMatrix([f32; 20]), /// internal use - convert sRGB input to linear output /// parameters: none /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear)
SrgbToLinear, /// internal use - convert linear input to sRGB output /// parameters: none /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear)
LinearToSrgb, /// remap RGBA with color gradients and component swizzle /// parameters: FilterData /// CSS filter semantics - operates on previous picture, uses sRGB space (non-linear)
ComponentTransfer, /// replace image with a solid color /// NOTE: UNUSED; Gecko never produces this filter /// parameters: color /// CSS filter semantics - operates on previous picture,uses sRGB space (non-linear)
Flood(ColorF), /// Filter that copies the SourceGraphic image into the specified subregion, /// This is intentionally the only way to get SourceGraphic into the graph, /// as the filter region must be applied before it is used. /// parameters: FilterOpGraphNode /// SVG filter semantics - no inputs, no linear
SVGFESourceGraphic{node: FilterOpGraphNode}, /// Filter that copies the SourceAlpha image into the specified subregion, /// This is intentionally the only way to get SourceGraphic into the graph, /// as the filter region must be applied before it is used. /// parameters: FilterOpGraphNode /// SVG filter semantics - no inputs, no linear
SVGFESourceAlpha{node: FilterOpGraphNode}, /// Filter that does no transformation of the colors, used for subregion /// cropping only.
SVGFEIdentity{node: FilterOpGraphNode}, /// represents CSS opacity property as a graph node like the rest of the SVGFE* filters /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations
SVGFEOpacity{node: FilterOpGraphNode, valuebinding: PropertyBinding<f32>, value: f32}, /// convert a color image to an alpha channel - internal use; generated by /// SVGFilterInstance::GetOrCreateSourceAlphaIndex().
SVGFEToAlpha{node: FilterOpGraphNode}, /// combine 2 images with SVG_FEBLEND_MODE_DARKEN /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#feBlendElement
SVGFEBlendDarken{node: FilterOpGraphNode}, /// combine 2 images with SVG_FEBLEND_MODE_LIGHTEN /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#feBlendElement
SVGFEBlendLighten{node: FilterOpGraphNode}, /// combine 2 images with SVG_FEBLEND_MODE_MULTIPLY /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#feBlendElement
SVGFEBlendMultiply{node: FilterOpGraphNode}, /// combine 2 images with SVG_FEBLEND_MODE_NORMAL /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#feBlendElement
SVGFEBlendNormal{node: FilterOpGraphNode}, /// combine 2 images with SVG_FEBLEND_MODE_SCREEN /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#feBlendElement
SVGFEBlendScreen{node: FilterOpGraphNode}, /// combine 2 images with SVG_FEBLEND_MODE_OVERLAY /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode
SVGFEBlendOverlay{node: FilterOpGraphNode}, /// combine 2 images with SVG_FEBLEND_MODE_COLOR_DODGE /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode
SVGFEBlendColorDodge{node: FilterOpGraphNode}, /// combine 2 images with SVG_FEBLEND_MODE_COLOR_BURN /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode
SVGFEBlendColorBurn{node: FilterOpGraphNode}, /// combine 2 images with SVG_FEBLEND_MODE_HARD_LIGHT /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode
SVGFEBlendHardLight{node: FilterOpGraphNode}, /// combine 2 images with SVG_FEBLEND_MODE_SOFT_LIGHT /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode
SVGFEBlendSoftLight{node: FilterOpGraphNode}, /// combine 2 images with SVG_FEBLEND_MODE_DIFFERENCE /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode
SVGFEBlendDifference{node: FilterOpGraphNode}, /// combine 2 images with SVG_FEBLEND_MODE_EXCLUSION /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode
SVGFEBlendExclusion{node: FilterOpGraphNode}, /// combine 2 images with SVG_FEBLEND_MODE_HUE /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode
SVGFEBlendHue{node: FilterOpGraphNode}, /// combine 2 images with SVG_FEBLEND_MODE_SATURATION /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode
SVGFEBlendSaturation{node: FilterOpGraphNode}, /// combine 2 images with SVG_FEBLEND_MODE_COLOR /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode
SVGFEBlendColor{node: FilterOpGraphNode}, /// combine 2 images with SVG_FEBLEND_MODE_LUMINOSITY /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode
SVGFEBlendLuminosity{node: FilterOpGraphNode}, /// transform colors of image through 5x4 color matrix (transposed for efficiency) /// parameters: FilterOpGraphNode, matrix[5][4] /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#feColorMatrixElement
SVGFEColorMatrix{node: FilterOpGraphNode, values: [f32; 20]}, /// transform colors of image through configurable gradients with component swizzle /// parameters: FilterOpGraphNode, FilterData /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#feComponentTransferElement
SVGFEComponentTransfer{node: FilterOpGraphNode}, /// composite 2 images with chosen composite mode with parameters for that mode /// parameters: FilterOpGraphNode, k1, k2, k3, k4 /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#feCompositeElement
SVGFECompositeArithmetic{node: FilterOpGraphNode, k1: f32, k2: f32, k3: f32,
k4: f32}, /// composite 2 images with chosen composite mode with parameters for that mode /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#feCompositeElement
SVGFECompositeATop{node: FilterOpGraphNode}, /// composite 2 images with chosen composite mode with parameters for that mode /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#feCompositeElement
SVGFECompositeIn{node: FilterOpGraphNode}, /// composite 2 images with chosen composite mode with parameters for that mode /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Docs: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feComposite
SVGFECompositeLighter{node: FilterOpGraphNode}, /// composite 2 images with chosen composite mode with parameters for that mode /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#feCompositeElement
SVGFECompositeOut{node: FilterOpGraphNode}, /// composite 2 images with chosen composite mode with parameters for that mode /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#feCompositeElement
SVGFECompositeOver{node: FilterOpGraphNode}, /// composite 2 images with chosen composite mode with parameters for that mode /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#feCompositeElement
SVGFECompositeXOR{node: FilterOpGraphNode}, /// transform image through convolution matrix of up to 25 values (spec /// allows more but for performance reasons we do not) /// parameters: FilterOpGraphNode, orderX, orderY, kernelValues[25], /// divisor, bias, targetX, targetY, kernelUnitLengthX, kernelUnitLengthY, /// preserveAlpha /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#feConvolveMatrixElement
SVGFEConvolveMatrixEdgeModeDuplicate{node: FilterOpGraphNode, order_x: i32,
order_y: i32, kernel: [f32; 25], divisor: f32, bias: f32, target_x: i32,
target_y: i32, kernel_unit_length_x: f32, kernel_unit_length_y: f32,
preserve_alpha: i32}, /// transform image through convolution matrix of up to 25 values (spec /// allows more but for performance reasons we do not) /// parameters: FilterOpGraphNode, orderX, orderY, kernelValues[25], /// divisor, bias, targetX, targetY, kernelUnitLengthX, kernelUnitLengthY, /// preserveAlpha /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#feConvolveMatrixElement
SVGFEConvolveMatrixEdgeModeNone{node: FilterOpGraphNode, order_x: i32,
order_y: i32, kernel: [f32; 25], divisor: f32, bias: f32, target_x: i32,
target_y: i32, kernel_unit_length_x: f32, kernel_unit_length_y: f32,
preserve_alpha: i32}, /// transform image through convolution matrix of up to 25 values (spec /// allows more but for performance reasons we do not) /// parameters: FilterOpGraphNode, orderX, orderY, kernelValues[25], /// divisor, bias, targetX, targetY, kernelUnitLengthX, kernelUnitLengthY, /// preserveAlpha /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#feConvolveMatrixElement
SVGFEConvolveMatrixEdgeModeWrap{node: FilterOpGraphNode, order_x: i32,
order_y: i32, kernel: [f32; 25], divisor: f32, bias: f32, target_x: i32,
target_y: i32, kernel_unit_length_x: f32, kernel_unit_length_y: f32,
preserve_alpha: i32}, /// calculate lighting based on heightmap image with provided values for a /// distant light source with specified direction /// parameters: FilterOpGraphNode, surfaceScale, diffuseConstant, /// kernelUnitLengthX, kernelUnitLengthY, azimuth, elevation /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEDiffuseLightingElement /// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEDistantLightElement
SVGFEDiffuseLightingDistant{node: FilterOpGraphNode, surface_scale: f32,
diffuse_constant: f32, kernel_unit_length_x: f32,
kernel_unit_length_y: f32, azimuth: f32, elevation: f32}, /// calculate lighting based on heightmap image with provided values for a /// point light source at specified location /// parameters: FilterOpGraphNode, surfaceScale, diffuseConstant, /// kernelUnitLengthX, kernelUnitLengthY, x, y, z /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEDiffuseLightingElement /// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEPointLightElement
SVGFEDiffuseLightingPoint{node: FilterOpGraphNode, surface_scale: f32,
diffuse_constant: f32, kernel_unit_length_x: f32,
kernel_unit_length_y: f32, x: f32, y: f32, z: f32}, /// calculate lighting based on heightmap image with provided values for a /// spot light source at specified location pointing at specified target /// location with specified hotspot sharpness and cone angle /// parameters: FilterOpGraphNode, surfaceScale, diffuseConstant, /// kernelUnitLengthX, kernelUnitLengthY, x, y, z, pointsAtX, pointsAtY, /// pointsAtZ, specularExponent, limitingConeAngle /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEDiffuseLightingElement /// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFESpotLightElement
SVGFEDiffuseLightingSpot{node: FilterOpGraphNode, surface_scale: f32,
diffuse_constant: f32, kernel_unit_length_x: f32,
kernel_unit_length_y: f32, x: f32, y: f32, z: f32, points_at_x: f32,
points_at_y: f32, points_at_z: f32, cone_exponent: f32,
limiting_cone_angle: f32}, /// calculate a distorted version of first input image using offset values /// from second input image at specified intensity /// parameters: FilterOpGraphNode, scale, xChannelSelector, yChannelSelector /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEDisplacementMapElement
SVGFEDisplacementMap{node: FilterOpGraphNode, scale: f32,
x_channel_selector: u32, y_channel_selector: u32}, /// create and merge a dropshadow version of the specified image's alpha /// channel with specified offset and blur radius /// parameters: FilterOpGraphNode, flood_color, flood_opacity, dx, dy, /// stdDeviationX, stdDeviationY /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEDropShadowElement
SVGFEDropShadow{node: FilterOpGraphNode, color: ColorF, dx: f32, dy: f32,
std_deviation_x: f32, std_deviation_y: f32}, /// synthesize a new image of specified size containing a solid color /// parameters: FilterOpGraphNode, color /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEFloodElement
SVGFEFlood{node: FilterOpGraphNode, color: ColorF}, /// create a blurred version of the input image /// parameters: FilterOpGraphNode, stdDeviationX, stdDeviationY /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEGaussianBlurElement
SVGFEGaussianBlur{node: FilterOpGraphNode, std_deviation_x: f32, std_deviation_y: f32}, /// synthesize a new image based on a url (i.e. blob image source) /// parameters: FilterOpGraphNode, sampling_filter (see SamplingFilter in Types.h), transform /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEImageElement
SVGFEImage{node: FilterOpGraphNode, sampling_filter: u32, matrix: [f32; 6]}, /// create a new image based on the input image with the contour stretched /// outward (dilate operator) /// parameters: FilterOpGraphNode, radiusX, radiusY /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEMorphologyElement
SVGFEMorphologyDilate{node: FilterOpGraphNode, radius_x: f32, radius_y: f32}, /// create a new image based on the input image with the contour shrunken /// inward (erode operator) /// parameters: FilterOpGraphNode, radiusX, radiusY /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEMorphologyElement
SVGFEMorphologyErode{node: FilterOpGraphNode, radius_x: f32, radius_y: f32}, /// create a new image that is a scrolled version of the input image, this /// is basically a no-op as we support offset in the graph node /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEOffsetElement
SVGFEOffset{node: FilterOpGraphNode, offset_x: f32, offset_y: f32}, /// calculate lighting based on heightmap image with provided values for a /// distant light source with specified direction /// parameters: FilerData, surfaceScale, specularConstant, specularExponent, /// kernelUnitLengthX, kernelUnitLengthY, azimuth, elevation /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFESpecularLightingElement /// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEDistantLightElement
SVGFESpecularLightingDistant{node: FilterOpGraphNode, surface_scale: f32,
specular_constant: f32, specular_exponent: f32,
kernel_unit_length_x: f32, kernel_unit_length_y: f32, azimuth: f32,
elevation: f32}, /// calculate lighting based on heightmap image with provided values for a /// point light source at specified location /// parameters: FilterOpGraphNode, surfaceScale, specularConstant, /// specularExponent, kernelUnitLengthX, kernelUnitLengthY, x, y, z /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFESpecularLightingElement /// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEPointLightElement
SVGFESpecularLightingPoint{node: FilterOpGraphNode, surface_scale: f32,
specular_constant: f32, specular_exponent: f32,
kernel_unit_length_x: f32, kernel_unit_length_y: f32, x: f32, y: f32,
z: f32}, /// calculate lighting based on heightmap image with provided values for a /// spot light source at specified location pointing at specified target /// location with specified hotspot sharpness and cone angle /// parameters: FilterOpGraphNode, surfaceScale, specularConstant, /// specularExponent, kernelUnitLengthX, kernelUnitLengthY, x, y, z, /// pointsAtX, pointsAtY, pointsAtZ, specularExponent, limitingConeAngle /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFESpecularLightingElement /// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFESpotLightElement
SVGFESpecularLightingSpot{node: FilterOpGraphNode, surface_scale: f32,
specular_constant: f32, specular_exponent: f32,
kernel_unit_length_x: f32, kernel_unit_length_y: f32, x: f32, y: f32,
z: f32, points_at_x: f32, points_at_y: f32, points_at_z: f32,
cone_exponent: f32, limiting_cone_angle: f32}, /// create a new image based on the input image, repeated throughout the /// output rectangle /// parameters: FilterOpGraphNode /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFETileElement
SVGFETile{node: FilterOpGraphNode}, /// synthesize a new image based on Fractal Noise (Perlin) with the chosen /// stitching mode /// parameters: FilterOpGraphNode, baseFrequencyX, baseFrequencyY, /// numOctaves, seed /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFETurbulenceElement
SVGFETurbulenceWithFractalNoiseWithNoStitching{node: FilterOpGraphNode,
base_frequency_x: f32, base_frequency_y: f32, num_octaves: u32,
seed: u32}, /// synthesize a new image based on Fractal Noise (Perlin) with the chosen /// stitching mode /// parameters: FilterOpGraphNode, baseFrequencyX, baseFrequencyY, /// numOctaves, seed /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFETurbulenceElement
SVGFETurbulenceWithFractalNoiseWithStitching{node: FilterOpGraphNode,
base_frequency_x: f32, base_frequency_y: f32, num_octaves: u32,
seed: u32}, /// synthesize a new image based on Turbulence Noise (offset vectors) /// parameters: FilterOpGraphNode, baseFrequencyX, baseFrequencyY, /// numOctaves, seed /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFETurbulenceElement
SVGFETurbulenceWithTurbulenceNoiseWithNoStitching{node: FilterOpGraphNode,
base_frequency_x: f32, base_frequency_y: f32, num_octaves: u32,
seed: u32}, /// synthesize a new image based on Turbulence Noise (offset vectors) /// parameters: FilterOpGraphNode, baseFrequencyX, baseFrequencyY, /// numOctaves, seed /// SVG filter semantics - selectable input(s), selectable between linear /// (default) and sRGB color space for calculations /// Spec: https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFETurbulenceElement
SVGFETurbulenceWithTurbulenceNoiseWithStitching{node: FilterOpGraphNode,
base_frequency_x: f32, base_frequency_y: f32, num_octaves: u32, seed: u32},
}
/// 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. #[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pubstruct ImageDisplayItem { pub common: CommonItemProperties, /// The area to tile the image over (first tile starts at origin of this rect) // FIXME: this should ideally just be `tile_origin` here, with the clip_rect // defining the bounds of the item. Needs non-trivial backend changes. pub bounds: LayoutRect, pub image_key: ImageKey, pub image_rendering: ImageRendering, pub alpha_type: AlphaType, /// A hack used by gecko to color a simple bitmap font used for tofu glyphs pub color: ColorF,
}
/// This describes a background-image and its tiling. It repeats in a grid to fill /// the specified area. #[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pubstruct RepeatingImageDisplayItem { pub common: CommonItemProperties, /// The area to tile the image over (first tile starts at origin of this rect) // FIXME: this should ideally just be `tile_origin` here, with the clip_rect // defining the bounds of the item. Needs non-trivial backend changes. pub bounds: LayoutRect, /// How large to make a single tile of the image (common case: bounds.size) pub stretch_size: LayoutSize, /// The space between tiles (common case: 0) pub tile_spacing: LayoutSize, pub image_key: ImageKey, pub image_rendering: ImageRendering, pub alpha_type: AlphaType, /// A hack used by gecko to color a simple bitmap font used for tofu glyphs pub color: ColorF,
}
#[repr(C)] #[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pubstruct ComplexClipRegion { /// The boundaries of the rectangle. pub rect: LayoutRect, /// Border radii of this rectangle. pub radii: BorderRadius, /// Whether we are clipping inside or outside /// the region. pub mode: ClipMode,
}
pubfn can_use_fast_path_in(&self, rect: &LayoutRect) -> bool { if !self.shapes_all_round() { returnfalse;
} if !self.all_sides_uniform() { // The fast path needs uniform sides. returnfalse;
} // The shader code that evaluates the rounded corners in the fast path relies on each // corner fitting into their quadrant of the quad. In other words the radius cannot // exceed half of the length of the sides they are on. That necessarily holds if all the // radii are the same. let tl = self.top_left.width; if tl == self.bottom_right.width && tl == self.top_right.width && tl == self.bottom_left.width { returntrue;
} let half_size = rect.size() * 0.5; let fits = |v: f32| v <= half_size.width && v <= half_size.height;
fits(tl) && fits(self.bottom_right.width) && fits(self.top_right.width) && fits(self.bottom_left.width)
}
/// Return whether, in each corner, the radius in *either* direction is zero. /// This means that none of the corners are rounded. pubfn is_zero(&self) -> bool { let corner_is_zero = |corner: &LayoutSize| corner.width == 0.0 || corner.height == 0.0;
corner_is_zero(&self.top_left) &&
corner_is_zero(&self.top_right) &&
corner_is_zero(&self.bottom_right) &&
corner_is_zero(&self.bottom_left)
}
}
/// A reference to a clipping node defining how an item is clipped. #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize, PeekPoke)] pubstruct ClipId(pub usize, pub PipelineId);
impl ClipId { /// Return the root clip ID - effectively doing no clipping. pubfn root(pipeline_id: PipelineId) -> Self {
ClipId(ROOT_CLIP_ID, pipeline_id)
}
/// Return an invalid clip ID - needed in places where we carry /// one but need to not attempt to use it. pubfn invalid() -> Self {
ClipId(!0, PipelineId::dummy())
}
/// 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. /// /// When setting display lists with the `preserve_frame_state` this id is used to preserve scroll /// offsets between different sets of SpatialNodes which are ScrollFrames. #[derive(Clone, Copy, Debug, Default, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize, PeekPoke)] #[repr(C)] pubstruct ExternalScrollId(pub u64, pub PipelineId);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.