From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- servo/components/style/values/generics/effects.rs | 121 ++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 servo/components/style/values/generics/effects.rs (limited to 'servo/components/style/values/generics/effects.rs') diff --git a/servo/components/style/values/generics/effects.rs b/servo/components/style/values/generics/effects.rs new file mode 100644 index 0000000000..f5666f3055 --- /dev/null +++ b/servo/components/style/values/generics/effects.rs @@ -0,0 +1,121 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +//! Generic types for CSS values related to effects. + +/// A generic value for a single `box-shadow`. +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToAnimatedZero, + ToCss, + ToResolvedValue, + ToShmem, +)] +#[repr(C)] +pub struct GenericBoxShadow { + /// The base shadow. + pub base: GenericSimpleShadow, + /// The spread radius. + pub spread: ShapeLength, + /// Whether this is an inset box shadow. + #[animation(constant)] + #[css(represents_keyword)] + pub inset: bool, +} + +pub use self::GenericBoxShadow as BoxShadow; + +/// A generic value for a single `filter`. +#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] +#[derive( + Clone, + ComputeSquaredDistance, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToComputedValue, + ToCss, + ToResolvedValue, + ToShmem, +)] +#[animation(no_bound(U))] +#[repr(C, u8)] +pub enum GenericFilter { + /// `blur()` + #[css(function)] + Blur(Length), + /// `brightness()` + #[css(function)] + Brightness(NonNegativeFactor), + /// `contrast()` + #[css(function)] + Contrast(NonNegativeFactor), + /// `grayscale()` + #[css(function)] + Grayscale(ZeroToOneFactor), + /// `hue-rotate()` + #[css(function)] + HueRotate(Angle), + /// `invert()` + #[css(function)] + Invert(ZeroToOneFactor), + /// `opacity()` + #[css(function)] + Opacity(ZeroToOneFactor), + /// `saturate()` + #[css(function)] + Saturate(NonNegativeFactor), + /// `sepia()` + #[css(function)] + Sepia(ZeroToOneFactor), + /// `drop-shadow(...)` + #[css(function)] + DropShadow(Shadow), + /// `` + #[animation(error)] + Url(U), +} + +pub use self::GenericFilter as Filter; + +/// A generic value for the `drop-shadow()` filter and the `text-shadow` property. +/// +/// Contrary to the canonical order from the spec, the color is serialised +/// first, like in Gecko and Webkit. +#[derive( + Animate, + Clone, + ComputeSquaredDistance, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToAnimatedValue, + ToAnimatedZero, + ToCss, + ToResolvedValue, + ToShmem, +)] +#[repr(C)] +pub struct GenericSimpleShadow { + /// Color. + pub color: Color, + /// Horizontal radius. + pub horizontal: SizeLength, + /// Vertical radius. + pub vertical: SizeLength, + /// Blur radius. + pub blur: ShapeLength, +} + +pub use self::GenericSimpleShadow as SimpleShadow; -- cgit v1.2.3