mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Derive ToResolvedValue.
Differential Revision: https://phabricator.services.mozilla.com/D26783
This commit is contained in:
parent
6ac777ebf2
commit
a47dcb5707
53 changed files with 359 additions and 108 deletions
|
@ -16,7 +16,7 @@ use style_traits::{CssWriter, ToCss};
|
|||
/// An [image].
|
||||
///
|
||||
/// [image]: https://drafts.csswg.org/css-images/#image-values
|
||||
#[derive(Clone, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem)]
|
||||
#[derive(Clone, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
pub enum Image<Gradient, MozImageRect, ImageUrl> {
|
||||
/// A `<url()>` image.
|
||||
Url(ImageUrl),
|
||||
|
@ -36,7 +36,7 @@ pub enum Image<Gradient, MozImageRect, ImageUrl> {
|
|||
|
||||
/// A CSS gradient.
|
||||
/// <https://drafts.csswg.org/css-images/#gradients>
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToShmem)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
pub struct Gradient<LineDirection, Length, LengthPercentage, Position, Color, Angle> {
|
||||
/// Gradients can be linear or radial.
|
||||
pub kind: GradientKind<LineDirection, Length, LengthPercentage, Position, Angle>,
|
||||
|
@ -48,7 +48,7 @@ pub struct Gradient<LineDirection, Length, LengthPercentage, Position, Color, An
|
|||
pub compat_mode: CompatMode,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToShmem)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
/// Whether we used the modern notation or the compatibility `-webkit`, `-moz` prefixes.
|
||||
pub enum CompatMode {
|
||||
/// Modern syntax.
|
||||
|
@ -60,7 +60,7 @@ pub enum CompatMode {
|
|||
}
|
||||
|
||||
/// A gradient kind.
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToShmem)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
pub enum GradientKind<LineDirection, Length, LengthPercentage, Position, Angle> {
|
||||
/// A linear gradient.
|
||||
Linear(LineDirection),
|
||||
|
@ -73,7 +73,7 @@ pub enum GradientKind<LineDirection, Length, LengthPercentage, Position, Angle>
|
|||
}
|
||||
|
||||
/// A radial gradient's ending shape.
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
pub enum EndingShape<Length, LengthPercentage> {
|
||||
/// A circular gradient.
|
||||
Circle(Circle<Length>),
|
||||
|
@ -82,7 +82,7 @@ pub enum EndingShape<Length, LengthPercentage> {
|
|||
}
|
||||
|
||||
/// A circle shape.
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToShmem)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
pub enum Circle<Length> {
|
||||
/// A circle radius.
|
||||
Radius(Length),
|
||||
|
@ -91,7 +91,7 @@ pub enum Circle<Length> {
|
|||
}
|
||||
|
||||
/// An ellipse shape.
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
pub enum Ellipse<LengthPercentage> {
|
||||
/// An ellipse pair of radii.
|
||||
Radii(LengthPercentage, LengthPercentage),
|
||||
|
@ -103,7 +103,7 @@ pub enum Ellipse<LengthPercentage> {
|
|||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(
|
||||
Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss, ToShmem,
|
||||
Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
)]
|
||||
pub enum ShapeExtent {
|
||||
ClosestSide,
|
||||
|
@ -116,7 +116,7 @@ pub enum ShapeExtent {
|
|||
|
||||
/// A gradient item.
|
||||
/// <https://drafts.csswg.org/css-images-4/#color-stop-syntax>
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
pub enum GradientItem<Color, LengthPercentage> {
|
||||
/// A color stop.
|
||||
ColorStop(ColorStop<Color, LengthPercentage>),
|
||||
|
@ -126,7 +126,7 @@ pub enum GradientItem<Color, LengthPercentage> {
|
|||
|
||||
/// A color stop.
|
||||
/// <https://drafts.csswg.org/css-images/#typedef-color-stop-list>
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
|
||||
pub struct ColorStop<Color, LengthPercentage> {
|
||||
/// The color of this stop.
|
||||
pub color: Color,
|
||||
|
@ -170,7 +170,7 @@ impl ToCss for PaintWorklet {
|
|||
#[allow(missing_docs)]
|
||||
#[css(comma, function)]
|
||||
#[derive(
|
||||
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem,
|
||||
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToResolvedValue, ToShmem,
|
||||
)]
|
||||
pub struct MozImageRect<NumberOrPercentage, MozImageRectUrl> {
|
||||
pub url: MozImageRectUrl,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue