mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Measure PropertyDeclaration more thoroughly.
This patch replaces the handwritten MallocSizeOf implementation for PropertyDeclaration with a derived one, which gives much more thorough measurement. This requires (a) deriving MallocSizeOf for a *lot* of additional types (most of which already have `derive(HeapSizeOf)` in Servo builds), and (b) implementing MallocSizeOf for a few more types in the `malloc_size_of` crate. These changes would significantly improve the reporting coverage for gmail if it weren't for the fact that SpecifiedUrl isn't measured due to a lack of clarity about its fields; that can be fixed as a follow-up once bug 1397971 has landed.
This commit is contained in:
parent
1aa8be392b
commit
c5aa2cb986
66 changed files with 302 additions and 59 deletions
|
@ -14,6 +14,7 @@ use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
|||
|
||||
/// A computed angle.
|
||||
#[animate(fallback = "Self::animate_fallback")]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
|
||||
#[derive(Animate, Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(PartialOrd, ToAnimatedZero)]
|
||||
|
|
|
@ -15,10 +15,12 @@ use values::animated::color::{Color as AnimatedColor, RGBA as AnimatedRGBA};
|
|||
/// Conceptually, the formula is "color * (1 - p) + currentcolor * p"
|
||||
/// where p is foreground_ratio.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct Color {
|
||||
/// RGBA color.
|
||||
pub color: RGBA,
|
||||
|
||||
/// The ratio of currentcolor in complex color.
|
||||
pub foreground_ratio: u8,
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ pub type GradientKind = GenericGradientKind<
|
|||
|
||||
/// A computed gradient line direction.
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum LineDirection {
|
||||
/// An angle.
|
||||
|
|
|
@ -66,6 +66,7 @@ impl ToComputedValue for specified::Length {
|
|||
}
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToAnimatedZero)]
|
||||
pub struct CalcLengthOrPercentage {
|
||||
|
@ -293,6 +294,7 @@ impl ToComputedValue for specified::CalcLengthOrPercentage {
|
|||
|
||||
#[allow(missing_docs)]
|
||||
#[animate(fallback = "Self::animate_fallback")]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[css(derive_debug)]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, PartialEq)]
|
||||
|
@ -450,6 +452,7 @@ impl ToComputedValue for specified::LengthOrPercentage {
|
|||
|
||||
#[allow(missing_docs)]
|
||||
#[animate(fallback = "Self::animate_fallback")]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[css(derive_debug)]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, PartialEq, ToCss)]
|
||||
|
@ -681,6 +684,7 @@ impl NonNegativeLengthOrPercentage {
|
|||
}
|
||||
|
||||
/// The computed `<length>` value.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, PartialEq, PartialOrd)]
|
||||
#[derive(ToAnimatedValue, ToAnimatedZero)]
|
||||
|
|
|
@ -379,6 +379,7 @@ impl From<GreaterThanOrEqualToOneNumber> for CSSFloat {
|
|||
}
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, PartialEq, ToCss)]
|
||||
pub enum NumberOrPercentage {
|
||||
|
|
|
@ -9,6 +9,7 @@ use style_traits::ToCss;
|
|||
use values::{CSSFloat, serialize_percentage};
|
||||
|
||||
/// A computed percentage.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, Default)]
|
||||
#[derive(PartialEq, PartialOrd, ToAnimatedZero)]
|
||||
|
|
|
@ -10,6 +10,7 @@ use values::CSSFloat;
|
|||
|
||||
/// A computed `<time>` value.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
|
||||
pub struct Time {
|
||||
seconds: CSSFloat,
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
//! Generic types for CSS values related to backgrounds.
|
||||
|
||||
/// A generic value for the `background-size` property.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||
#[derive(PartialEq, ToComputedValue, ToCss)]
|
||||
|
|
|
@ -18,6 +18,7 @@ pub type ClippingShape<BasicShape, Url> = ShapeSource<BasicShape, GeometryBox, U
|
|||
|
||||
/// https://drafts.fxtf.org/css-masking-1/#typedef-geometry-box
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||
pub enum GeometryBox {
|
||||
|
@ -41,6 +42,7 @@ add_impls_for_keyword_enum!(ShapeBox);
|
|||
|
||||
/// A shape source, for some reference box.
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||
pub enum ShapeSource<BasicShape, ReferenceBox, Url> {
|
||||
|
@ -58,6 +60,7 @@ pub enum ShapeSource<BasicShape, ReferenceBox, Url> {
|
|||
}
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Debug, PartialEq)]
|
||||
#[derive(ToComputedValue, ToCss)]
|
||||
|
@ -70,6 +73,7 @@ pub enum BasicShape<H, V, LengthOrPercentage> {
|
|||
|
||||
/// https://drafts.csswg.org/css-shapes/#funcdef-inset
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Debug, PartialEq, ToComputedValue)]
|
||||
pub struct InsetRect<LengthOrPercentage> {
|
||||
|
@ -79,6 +83,7 @@ pub struct InsetRect<LengthOrPercentage> {
|
|||
|
||||
/// https://drafts.csswg.org/css-shapes/#funcdef-circle
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, PartialEq, ToComputedValue)]
|
||||
pub struct Circle<H, V, LengthOrPercentage> {
|
||||
|
@ -88,6 +93,7 @@ pub struct Circle<H, V, LengthOrPercentage> {
|
|||
|
||||
/// https://drafts.csswg.org/css-shapes/#funcdef-ellipse
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, PartialEq, ToComputedValue)]
|
||||
pub struct Ellipse<H, V, LengthOrPercentage> {
|
||||
|
@ -98,6 +104,7 @@ pub struct Ellipse<H, V, LengthOrPercentage> {
|
|||
|
||||
/// https://drafts.csswg.org/css-shapes/#typedef-shape-radius
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, PartialEq)]
|
||||
#[derive(ToComputedValue, ToCss)]
|
||||
|
@ -109,6 +116,7 @@ pub enum ShapeRadius<LengthOrPercentage> {
|
|||
FarthestSide,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
|
||||
/// A generic type for representing the `polygon()` function
|
||||
|
|
|
@ -10,6 +10,7 @@ use style_traits::ToCss;
|
|||
use values::generics::rect::Rect;
|
||||
|
||||
/// A generic value for a single side of a `border-image-width` property.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||
pub enum BorderImageSideWidth<LengthOrPercentage, Number> {
|
||||
|
@ -23,6 +24,7 @@ pub enum BorderImageSideWidth<LengthOrPercentage, Number> {
|
|||
|
||||
/// A generic value for the `border-image-slice` property.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct BorderImageSlice<NumberOrPercentage> {
|
||||
/// The offsets.
|
||||
|
@ -34,6 +36,7 @@ pub struct BorderImageSlice<NumberOrPercentage> {
|
|||
/// A generic value for `border-radius`, `outline-radius` and `inset()`.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-backgrounds-3/#border-radius
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||
#[derive(PartialEq, ToComputedValue)]
|
||||
|
@ -49,6 +52,7 @@ pub struct BorderRadius<LengthOrPercentage> {
|
|||
}
|
||||
|
||||
/// A generic value for `border-*-radius` longhand properties.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||
#[derive(PartialEq, ToComputedValue)]
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
use values::animated::ToAnimatedZero;
|
||||
|
||||
/// A generic value for the `vertical-align` property.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, PartialEq)]
|
||||
#[derive(ToComputedValue, ToCss)]
|
||||
|
|
|
@ -10,6 +10,7 @@ use style_traits::values::{SequenceWriter, ToCss};
|
|||
use values::specified::url::SpecifiedUrl;
|
||||
|
||||
/// A generic value for a single `box-shadow`.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, Debug, PartialEq)]
|
||||
#[derive(ToAnimatedValue, ToAnimatedZero)]
|
||||
|
@ -24,6 +25,7 @@ pub struct BoxShadow<Color, SizeLength, BlurShapeLength, ShapeLength> {
|
|||
}
|
||||
|
||||
/// A generic value for a single `filter`.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
|
||||
#[derive(Clone, Debug, PartialEq, ToAnimatedValue, ToComputedValue, ToCss)]
|
||||
pub enum Filter<Angle, Factor, Length, DropShadow> {
|
||||
|
@ -66,6 +68,7 @@ pub enum Filter<Angle, Factor, Length, DropShadow> {
|
|||
///
|
||||
/// Contrary to the canonical order from the spec, the color is serialised
|
||||
/// first, like in Gecko and Webkit.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Debug)]
|
||||
#[derive(PartialEq, ToAnimatedValue, ToAnimatedZero, ToCss)]
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
//! unshipped at some point in the future.
|
||||
|
||||
/// A generic value for scroll snap points.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||
pub enum ScrollSnapPoint<LengthOrPercentage> {
|
||||
/// `none`
|
||||
|
|
|
@ -14,11 +14,12 @@ use values::computed::{Context, ToComputedValue};
|
|||
use values::specified;
|
||||
use values::specified::grid::parse_line_names;
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, ToComputedValue)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
/// A `<grid-line>` type.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#typedef-grid-row-start-grid-line
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, Default, PartialEq, ToComputedValue)]
|
||||
pub struct GridLine<Integer> {
|
||||
/// Flag to check whether it's a `span` keyword.
|
||||
pub is_span: bool,
|
||||
|
@ -143,6 +144,7 @@ add_impls_for_keyword_enum!(TrackKeyword);
|
|||
/// avoid re-implementing it for the computed type.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#typedef-track-breadth
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
|
||||
pub enum TrackBreadth<L> {
|
||||
|
@ -181,6 +183,7 @@ impl<L: ToCss> ToCss for TrackBreadth<L> {
|
|||
/// generic only to avoid code bloat. It only takes `<length-percentage>`
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#typedef-track-size
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum TrackSize<L> {
|
||||
|
@ -344,6 +347,7 @@ where
|
|||
/// The initial argument of the `repeat` function.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#typedef-track-repeat
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||
pub enum RepeatCount<Integer> {
|
||||
|
@ -377,6 +381,7 @@ impl Parse for RepeatCount<specified::Integer> {
|
|||
///
|
||||
/// It can also hold `repeat()` function parameters, which expands into the respective
|
||||
/// values in its computed form.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
|
||||
pub struct TrackRepeat<L, I> {
|
||||
|
@ -460,6 +465,7 @@ impl<L: Clone> TrackRepeat<L, specified::Integer> {
|
|||
|
||||
/// Track list values. Can be <track-size> or <track-repeat>
|
||||
#[derive(Clone, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum TrackListValue<LengthOrPercentage, Integer> {
|
||||
/// A <track-size> value.
|
||||
|
@ -472,6 +478,7 @@ pub enum TrackListValue<LengthOrPercentage, Integer> {
|
|||
///
|
||||
/// https://drafts.csswg.org/css-grid/#typedef-track-list
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum TrackListType {
|
||||
/// [`<auto-track-list>`](https://drafts.csswg.org/css-grid/#typedef-auto-track-list)
|
||||
|
@ -494,6 +501,7 @@ pub enum TrackListType {
|
|||
/// A grid `<track-list>` type.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#typedef-track-list
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct TrackList<LengthOrPercentage, Integer> {
|
||||
|
@ -563,6 +571,7 @@ impl<L: ToCss, I: ToCss> ToCss for TrackList<L, I> {
|
|||
/// `subgrid [ <line-names> | repeat(<positive-integer> | auto-fill, <line-names>+) ]+`
|
||||
/// Old spec: https://www.w3.org/TR/2015/WD-css-grid-1-20150917/#typedef-line-name-list
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct LineNameList {
|
||||
/// The optional `<line-name-list>`
|
||||
|
@ -658,6 +667,7 @@ impl ToCss for LineNameList {
|
|||
/// Variants for `<grid-template-rows> | <grid-template-columns>`
|
||||
/// Subgrid deferred to Level 2 spec due to lack of implementation.
|
||||
/// But it's implemented in gecko, so we have to as well.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||
pub enum GridTemplateComponent<L, I> {
|
||||
|
|
|
@ -15,6 +15,7 @@ use style_traits::ToCss;
|
|||
/// An [image].
|
||||
///
|
||||
/// [image]: https://drafts.csswg.org/css-images/#image-values
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, PartialEq, ToComputedValue)]
|
||||
pub enum Image<Gradient, MozImageRect, ImageUrl> {
|
||||
|
@ -35,6 +36,7 @@ pub enum Image<Gradient, MozImageRect, ImageUrl> {
|
|||
|
||||
/// A CSS gradient.
|
||||
/// https://drafts.csswg.org/css-images/#gradients
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
|
||||
pub struct Gradient<LineDirection, Length, LengthOrPercentage, Position, Color, Angle> {
|
||||
|
@ -51,6 +53,7 @@ pub struct Gradient<LineDirection, Length, LengthOrPercentage, Position, Color,
|
|||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
/// Whether we used the modern notation or the compatibility `-webkit`, `-moz` prefixes.
|
||||
pub enum CompatMode {
|
||||
|
@ -63,6 +66,7 @@ pub enum CompatMode {
|
|||
}
|
||||
|
||||
/// A gradient kind.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)]
|
||||
pub enum GradientKind<LineDirection, Length, LengthOrPercentage, Position, Angle> {
|
||||
|
@ -74,6 +78,7 @@ pub enum GradientKind<LineDirection, Length, LengthOrPercentage, Position, Angle
|
|||
|
||||
/// A radial gradient's ending shape.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum EndingShape<Length, LengthOrPercentage> {
|
||||
/// A circular gradient.
|
||||
|
@ -84,6 +89,7 @@ pub enum EndingShape<Length, LengthOrPercentage> {
|
|||
|
||||
/// A circle shape.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum Circle<Length> {
|
||||
/// A circle radius.
|
||||
|
@ -94,6 +100,7 @@ pub enum Circle<Length> {
|
|||
|
||||
/// An ellipse shape.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum Ellipse<LengthOrPercentage> {
|
||||
/// An ellipse pair of radii.
|
||||
|
@ -115,6 +122,7 @@ add_impls_for_keyword_enum!(ShapeExtent);
|
|||
|
||||
/// A gradient item.
|
||||
/// https://drafts.csswg.org/css-images-4/#color-stop-syntax
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||
pub enum GradientItem<Color, LengthOrPercentage> {
|
||||
|
@ -127,6 +135,7 @@ pub enum GradientItem<Color, LengthOrPercentage> {
|
|||
/// A color stop.
|
||||
/// https://drafts.csswg.org/css-images/#typedef-color-stop-list
|
||||
#[derive(Clone, Copy, PartialEq, ToComputedValue, ToCss)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct ColorStop<Color, LengthOrPercentage> {
|
||||
/// The color of this stop.
|
||||
|
@ -165,6 +174,7 @@ impl ToCss for PaintWorklet {
|
|||
///
|
||||
/// `-moz-image-rect(<uri>, top, right, bottom, left);`
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[css(comma, function)]
|
||||
#[derive(Clone, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||
|
|
|
@ -71,6 +71,7 @@ impl SymbolsType {
|
|||
///
|
||||
/// Since wherever <counter-style> is used, 'none' is a valid value as
|
||||
/// well, we combine them into one type to make code simpler.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue, ToCss)]
|
||||
pub enum CounterStyleOrNone {
|
||||
/// `none`
|
||||
|
@ -129,6 +130,7 @@ impl Parse for CounterStyleOrNone {
|
|||
///
|
||||
/// For font-feature-settings, this is a tag and an integer,
|
||||
/// for font-variation-settings this is a tag and a float
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue)]
|
||||
pub struct FontSettingTag<T> {
|
||||
|
@ -186,6 +188,7 @@ impl<T: Parse> Parse for FontSettingTag<T> {
|
|||
|
||||
|
||||
/// A font settings value for font-variation-settings or font-feature-settings
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue, ToCss)]
|
||||
pub enum FontSettings<T> {
|
||||
|
@ -210,6 +213,7 @@ impl<T: Parse> Parse for FontSettings<T> {
|
|||
///
|
||||
/// Do not use this type anywhere except within FontSettings
|
||||
/// because it serializes with the preceding space
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToComputedValue)]
|
||||
pub struct FontSettingTagInt(pub u32);
|
||||
|
@ -218,7 +222,7 @@ pub struct FontSettingTagInt(pub u32);
|
|||
///
|
||||
/// Do not use this type anywhere except within FontSettings
|
||||
/// because it serializes with the preceding space
|
||||
#[cfg_attr(feature = "gecko", derive(Animate, ComputeSquaredDistance))]
|
||||
#[cfg_attr(feature = "gecko", derive(Animate, ComputeSquaredDistance, MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
|
||||
pub struct FontSettingTagFloat(pub f32);
|
||||
|
@ -273,12 +277,14 @@ impl ToCss for FontSettingTagFloat {
|
|||
}
|
||||
|
||||
/// A wrapper of Non-negative values.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||
#[derive(PartialEq, PartialOrd, ToAnimatedZero, ToComputedValue, ToCss)]
|
||||
pub struct NonNegative<T>(pub T);
|
||||
|
||||
/// A wrapper of greater-than-or-equal-to-one values.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||
#[derive(PartialEq, PartialOrd, ToAnimatedZero, ToComputedValue, ToCss)]
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
//! [`position`](https://drafts.csswg.org/css-backgrounds-3/#position)
|
||||
|
||||
/// A generic type for representing a CSS [position](https://drafts.csswg.org/css-values/#position).
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||
#[derive(PartialEq, ToAnimatedZero, ToComputedValue)]
|
||||
|
|
|
@ -11,6 +11,7 @@ use style_traits::{ToCss, ParseError};
|
|||
|
||||
/// A CSS value made of four components, where its `ToCss` impl will try to
|
||||
/// serialize as few components as possible, like for example in `border-width`.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||
#[derive(PartialEq, ToComputedValue)]
|
||||
|
|
|
@ -16,6 +16,7 @@ use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
|||
/// An SVG paint value
|
||||
///
|
||||
/// https://www.w3.org/TR/SVG2/painting.html#SpecifyingPaint
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Debug, PartialEq)]
|
||||
#[derive(ToAnimatedValue, ToComputedValue, ToCss)]
|
||||
|
@ -31,6 +32,7 @@ pub struct SVGPaint<ColorType, UrlPaintServer> {
|
|||
/// Whereas the spec only allows PaintServer
|
||||
/// to have a fallback, Gecko lets the context
|
||||
/// properties have a fallback as well.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Debug, PartialEq)]
|
||||
#[derive(ToAnimatedValue, ToAnimatedZero, ToComputedValue, ToCss)]
|
||||
|
@ -109,6 +111,7 @@ impl<ColorType: Parse, UrlPaintServer: Parse> Parse for SVGPaint<ColorType, UrlP
|
|||
|
||||
/// A value of <length> | <percentage> | <number> for svg which allow unitless length.
|
||||
/// https://www.w3.org/TR/SVG11/painting.html#StrokeProperties
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToAnimatedValue)]
|
||||
#[derive(ToAnimatedZero, ToComputedValue, ToCss)]
|
||||
|
@ -191,6 +194,7 @@ impl <LengthOrPercentageType: Parse, NumberType: Parse> Parse for
|
|||
}
|
||||
|
||||
/// An SVG length value supports `context-value` in addition to length.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, PartialEq)]
|
||||
#[derive(ToAnimatedValue, ToAnimatedZero)]
|
||||
|
@ -203,6 +207,7 @@ pub enum SVGLength<LengthType> {
|
|||
}
|
||||
|
||||
/// Generic value for stroke-dasharray.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, ComputeSquaredDistance, Debug, PartialEq, ToAnimatedValue, ToComputedValue)]
|
||||
pub enum SVGStrokeDashArray<LengthType> {
|
||||
|
@ -237,6 +242,7 @@ impl<LengthType> ToCss for SVGStrokeDashArray<LengthType> where LengthType: ToCs
|
|||
|
||||
/// An SVG opacity value accepts `context-{fill,stroke}-opacity` in
|
||||
/// addition to opacity value.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||
#[derive(PartialEq, ToAnimatedZero, ToComputedValue, ToCss)]
|
||||
|
|
|
@ -12,6 +12,7 @@ use values::animated::{Animate, Procedure, ToAnimatedZero};
|
|||
use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||
|
||||
/// A generic value for the `initial-letter` property.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||
pub enum InitialLetter<Number, Integer> {
|
||||
|
@ -30,6 +31,7 @@ impl<N, I> InitialLetter<N, I> {
|
|||
}
|
||||
|
||||
/// A generic spacing value for the `letter-spacing` and `word-spacing` properties.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||
pub enum Spacing<Value> {
|
||||
|
@ -109,6 +111,7 @@ where
|
|||
}
|
||||
|
||||
/// A generic value for the `line-height` property.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||
#[derive(PartialEq, ToAnimatedValue, ToCss)]
|
||||
|
|
|
@ -10,6 +10,7 @@ use values::CSSFloat;
|
|||
|
||||
/// A generic 2D transformation matrix.
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||
#[css(comma, function)]
|
||||
|
@ -23,6 +24,7 @@ pub struct Matrix<T, U = T> {
|
|||
}
|
||||
|
||||
/// A generic transform origin.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||
#[derive(PartialEq, ToAnimatedZero, ToComputedValue, ToCss)]
|
||||
|
@ -38,6 +40,7 @@ pub struct TransformOrigin<H, V, Depth> {
|
|||
/// A generic timing function.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-timing-1/#single-timing-function-production
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum TimingFunction<Integer, Number> {
|
||||
|
|
|
@ -67,6 +67,7 @@ impl Parse for Impossible {
|
|||
}
|
||||
|
||||
/// A struct representing one of two kinds of values.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy)]
|
||||
#[derive(PartialEq, ToAnimatedValue, ToAnimatedZero, ToComputedValue, ToCss)]
|
||||
|
@ -99,6 +100,7 @@ impl<A: Parse, B: Parse> Parse for Either<A, B> {
|
|||
|
||||
/// https://drafts.csswg.org/css-values-4/#custom-idents
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, ToComputedValue)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct CustomIdent(pub Atom);
|
||||
|
||||
|
@ -128,6 +130,7 @@ impl ToCss for CustomIdent {
|
|||
|
||||
/// https://drafts.csswg.org/css-animations/#typedef-keyframes-name
|
||||
#[derive(Clone, Debug, ToComputedValue)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum KeyframesName {
|
||||
/// <custom-ident>
|
||||
|
|
|
@ -18,6 +18,7 @@ bitflags! {
|
|||
/// Constants shared by multiple CSS Box Alignment properties
|
||||
///
|
||||
/// These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(ToComputedValue)]
|
||||
pub flags AlignFlags: u8 {
|
||||
// Enumeration stored in the lower 5 bits:
|
||||
|
@ -115,6 +116,7 @@ const ALIGN_ALL_SHIFT: u32 = structs::NS_STYLE_ALIGN_ALL_SHIFT;
|
|||
/// The 16-bit field stores the primary value in its lower 8 bits, and the optional fallback value
|
||||
/// in its upper 8 bits. This matches the representation of these properties in Gecko.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToComputedValue)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
|
||||
pub struct AlignJustifyContent(u16);
|
||||
|
||||
|
@ -206,6 +208,7 @@ impl Parse for AlignJustifyContent {
|
|||
/// Value of the `align-self` or `justify-self` property.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-align/#self-alignment
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToComputedValue, ToCss)]
|
||||
pub struct AlignJustifySelf(pub AlignFlags);
|
||||
|
||||
|
@ -243,6 +246,7 @@ impl Parse for AlignJustifySelf {
|
|||
/// Value of the `align-items` property
|
||||
///
|
||||
/// https://drafts.csswg.org/css-align/#self-alignment
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToComputedValue, ToCss)]
|
||||
pub struct AlignItems(pub AlignFlags);
|
||||
|
||||
|
@ -280,6 +284,7 @@ impl Parse for AlignItems {
|
|||
/// Value of the `justify-items` property
|
||||
///
|
||||
/// https://drafts.csswg.org/css-align/#justify-items-property
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToCss)]
|
||||
pub struct JustifyItems(pub AlignFlags);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ use values::specified::calc::CalcNode;
|
|||
/// Computed angles are essentially same as specified ones except for `calc()`
|
||||
/// value serialization. Therefore we are storing a computed angle inside
|
||||
/// to hold the actual value and its unit.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub struct Angle {
|
||||
|
|
|
@ -17,6 +17,7 @@ use values::specified::{AllowQuirks, Number, NumberOrPercentage};
|
|||
use values::specified::length::{Length, LengthOrPercentage};
|
||||
|
||||
/// A specified value for a single side of the `border-width` property.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
pub enum BorderSideWidth {
|
||||
|
|
|
@ -64,6 +64,7 @@ pub enum CalcUnit {
|
|||
|
||||
/// A struct to hold a simplified `<length>` or `<percentage>` expression.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[allow(missing_docs)]
|
||||
pub struct CalcLengthOrPercentage {
|
||||
|
|
|
@ -19,6 +19,7 @@ use values::computed::{Color as ComputedColor, Context, ToComputedValue};
|
|||
|
||||
/// Specified color value
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum Color {
|
||||
/// The 'currentColor' keyword
|
||||
|
@ -301,6 +302,7 @@ impl ToComputedValue for Color {
|
|||
/// Specified color value, but resolved to just RGBA for computed value
|
||||
/// with value from color property at the same context.
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct RGBAColor(pub Color);
|
||||
|
||||
|
@ -332,6 +334,7 @@ impl From<Color> for RGBAColor {
|
|||
|
||||
/// Specified value for the "color" property, which resolves the `currentcolor`
|
||||
/// keyword to the parent color instead of self's color.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
pub struct ColorPropertyValue(pub Color);
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ pub type Filter = GenericFilter<Angle, Factor, NonNegativeLength, Impossible>;
|
|||
|
||||
/// A value for the `<factor>` parts in `Filter`.
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct Factor(NumberOrPercentage);
|
||||
|
||||
|
|
|
@ -86,6 +86,7 @@ pub type GradientKind = GenericGradientKind<
|
|||
|
||||
/// A specified gradient line direction.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum LineDirection {
|
||||
/// An angular direction.
|
||||
|
@ -105,7 +106,7 @@ pub enum LineDirection {
|
|||
}
|
||||
|
||||
/// A binary enum to hold either Position or LegacyPosition.
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[cfg(feature = "gecko")]
|
||||
pub enum GradientPosition {
|
||||
/// 1, 2, 3, 4-valued <position>.
|
||||
|
|
|
@ -53,6 +53,7 @@ pub fn au_to_int_px(au: f32) -> i32 {
|
|||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
/// A font relative length.
|
||||
pub enum FontRelativeLength {
|
||||
|
@ -194,6 +195,7 @@ impl FontRelativeLength {
|
|||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
/// A viewport-relative length.
|
||||
///
|
||||
|
@ -244,6 +246,7 @@ impl ViewportPercentageLength {
|
|||
|
||||
/// HTML5 "character width", as defined in HTML5 § 14.5.4.
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct CharacterWidth(pub i32);
|
||||
|
||||
|
@ -263,6 +266,7 @@ impl CharacterWidth {
|
|||
|
||||
/// Represents an absolute length with its unit
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum AbsoluteLength {
|
||||
/// An absolute length in pixels (px)
|
||||
|
@ -376,6 +380,7 @@ impl Add<AbsoluteLength> for AbsoluteLength {
|
|||
/// Represents a physical length (mozmm) based on DPI
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[cfg(feature = "gecko")]
|
||||
#[derive(MallocSizeOf)]
|
||||
pub struct PhysicalLength(pub CSSFloat);
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
|
@ -423,6 +428,7 @@ impl Mul<CSSFloat> for PhysicalLength {
|
|||
///
|
||||
/// https://drafts.csswg.org/css-values/#lengths
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum NoCalcLength {
|
||||
/// An absolute length
|
||||
|
@ -568,6 +574,7 @@ impl NoCalcLength {
|
|||
/// This is commonly used for the `<length>` values.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-values/#lengths
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
pub enum Length {
|
||||
|
@ -782,6 +789,7 @@ pub type NonNegativeLengthOrNumber = Either<NonNegativeLength, NonNegativeNumber
|
|||
|
||||
/// A length or a percentage value.
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
pub enum LengthOrPercentage {
|
||||
|
@ -952,6 +960,7 @@ impl LengthOrPercentage {
|
|||
|
||||
/// Either a `<length>`, a `<percentage>`, or the `auto` keyword.
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
pub enum LengthOrPercentageOrAuto {
|
||||
|
@ -1068,6 +1077,7 @@ impl LengthOrPercentageOrAuto {
|
|||
}
|
||||
|
||||
/// Either a `<length>`, a `<percentage>`, or the `none` keyword.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
#[allow(missing_docs)]
|
||||
|
@ -1216,6 +1226,7 @@ impl LengthOrNumber {
|
|||
/// Unlike `max-width` or `max-height` properties, a MozLength can be
|
||||
/// `auto`, and cannot be `none`.
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
pub enum MozLength {
|
||||
|
@ -1242,6 +1253,7 @@ impl MozLength {
|
|||
|
||||
/// A value suitable for a `max-width` or `max-height` property.
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
pub enum MaxLength {
|
||||
|
|
|
@ -174,6 +174,7 @@ impl BorderStyle {
|
|||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[allow(missing_docs)]
|
||||
pub struct Number {
|
||||
|
@ -281,6 +282,7 @@ impl Parse for GreaterThanOrEqualToOneNumber {
|
|||
///
|
||||
/// FIXME(emilio): Should probably use Either.
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToCss)]
|
||||
pub enum NumberOrPercentage {
|
||||
|
@ -316,6 +318,7 @@ impl Parse for NumberOrPercentage {
|
|||
}
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, ToCss)]
|
||||
pub struct Opacity(Number);
|
||||
|
@ -352,6 +355,7 @@ impl ToComputedValue for Opacity {
|
|||
///
|
||||
/// https://drafts.csswg.org/css-values/#integers
|
||||
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct Integer {
|
||||
value: CSSInteger,
|
||||
|
@ -504,6 +508,7 @@ pub type LengthOrPercentageOrNumber = Either<Number, LengthOrPercentage>;
|
|||
pub type NonNegativeLengthOrPercentageOrNumber = Either<NonNegativeNumber, NonNegativeLengthOrPercentage>;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
/// rect(<top>, <left>, <bottom>, <right>) used by clip and image-region
|
||||
pub struct ClipRect {
|
||||
|
@ -674,6 +679,7 @@ pub type NamespaceId = ();
|
|||
/// An attr(...) rule
|
||||
///
|
||||
/// `[namespace? `|`]? ident`
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue)]
|
||||
pub struct Attr {
|
||||
|
|
|
@ -17,6 +17,7 @@ use values::specified::calc::CalcNode;
|
|||
|
||||
/// A percentage value.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct Percentage {
|
||||
/// The percentage value as a float.
|
||||
|
|
|
@ -27,6 +27,7 @@ pub type HorizontalPosition = PositionComponent<X>;
|
|||
pub type VerticalPosition = PositionComponent<Y>;
|
||||
|
||||
/// The specified value of a component of a CSS `<position>`.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
pub enum PositionComponent<S> {
|
||||
|
|
|
@ -17,6 +17,7 @@ use values::specified::calc::CalcNode;
|
|||
|
||||
/// A time value according to CSS-VALUES § 6.2.
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct Time {
|
||||
seconds: CSSFloat,
|
||||
|
@ -26,6 +27,7 @@ pub struct Time {
|
|||
|
||||
/// A time unit.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum TimeUnit {
|
||||
/// `s`
|
||||
|
|
|
@ -21,6 +21,7 @@ use values::specified::position::{Side, X, Y};
|
|||
pub type TransformOrigin = GenericTransformOrigin<OriginComponent<X>, OriginComponent<Y>, Length>;
|
||||
|
||||
/// The specified value of a component of a CSS `<transform-origin>`.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
pub enum OriginComponent<S> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue