mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Don't use define_css_keyword_enum in style anymore
This commit is contained in:
parent
09e304adb3
commit
3d99a4489c
14 changed files with 174 additions and 158 deletions
|
@ -30,13 +30,16 @@ pub enum GeometryBox {
|
|||
pub type FloatAreaShape<BasicShape, Image> = ShapeSource<BasicShape, ShapeBox, Image>;
|
||||
|
||||
// https://drafts.csswg.org/css-shapes-1/#typedef-shape-box
|
||||
define_css_keyword_enum!(ShapeBox:
|
||||
"margin-box" => MarginBox,
|
||||
"border-box" => BorderBox,
|
||||
"padding-box" => PaddingBox,
|
||||
"content-box" => ContentBox
|
||||
);
|
||||
add_impls_for_keyword_enum!(ShapeBox);
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq)]
|
||||
#[derive(ToComputedValue, ToCss)]
|
||||
pub enum ShapeBox {
|
||||
MarginBox,
|
||||
BorderBox,
|
||||
PaddingBox,
|
||||
ContentBox,
|
||||
}
|
||||
|
||||
/// A shape source, for some reference box.
|
||||
#[allow(missing_docs)]
|
||||
|
@ -117,11 +120,14 @@ pub struct Polygon<LengthOrPercentage> {
|
|||
// NOTE: Basic shapes spec says that these are the only two values, however
|
||||
// https://www.w3.org/TR/SVG/painting.html#FillRuleProperty
|
||||
// says that it can also be `inherit`
|
||||
define_css_keyword_enum!(FillRule:
|
||||
"nonzero" => Nonzero,
|
||||
"evenodd" => Evenodd
|
||||
);
|
||||
add_impls_for_keyword_enum!(FillRule);
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq)]
|
||||
#[derive(ToComputedValue, ToCss)]
|
||||
pub enum FillRule {
|
||||
Nonzero,
|
||||
Evenodd,
|
||||
}
|
||||
|
||||
// FIXME(nox): Implement ComputeSquaredDistance for T types and stop
|
||||
// using PartialEq here, this will let us derive this impl.
|
||||
|
|
|
@ -140,12 +140,15 @@ impl Parse for GridLine<specified::Integer> {
|
|||
}
|
||||
}
|
||||
|
||||
define_css_keyword_enum!{ TrackKeyword:
|
||||
"auto" => Auto,
|
||||
"max-content" => MaxContent,
|
||||
"min-content" => MinContent
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq)]
|
||||
#[derive(ToComputedValue, ToCss)]
|
||||
pub enum TrackKeyword {
|
||||
Auto,
|
||||
MaxContent,
|
||||
MinContent,
|
||||
}
|
||||
add_impls_for_keyword_enum!(TrackKeyword);
|
||||
|
||||
/// A track breadth for explicit grid track sizing. It's generic solely to
|
||||
/// avoid re-implementing it for the computed type.
|
||||
|
|
|
@ -97,15 +97,18 @@ pub enum Ellipse<LengthOrPercentage> {
|
|||
}
|
||||
|
||||
/// <https://drafts.csswg.org/css-images/#typedef-extent-keyword>
|
||||
define_css_keyword_enum!(ShapeExtent:
|
||||
"closest-side" => ClosestSide,
|
||||
"farthest-side" => FarthestSide,
|
||||
"closest-corner" => ClosestCorner,
|
||||
"farthest-corner" => FarthestCorner,
|
||||
"contain" => Contain,
|
||||
"cover" => Cover
|
||||
);
|
||||
add_impls_for_keyword_enum!(ShapeExtent);
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq)]
|
||||
#[derive(ToComputedValue, ToCss)]
|
||||
pub enum ShapeExtent {
|
||||
ClosestSide,
|
||||
FarthestSide,
|
||||
ClosestCorner,
|
||||
FarthestCorner,
|
||||
Contain,
|
||||
Cover,
|
||||
}
|
||||
|
||||
/// A gradient item.
|
||||
/// <https://drafts.csswg.org/css-images-4/#color-stop-syntax>
|
||||
|
|
|
@ -32,14 +32,17 @@ pub mod text;
|
|||
pub mod transform;
|
||||
|
||||
// https://drafts.csswg.org/css-counter-styles/#typedef-symbols-type
|
||||
define_css_keyword_enum! { SymbolsType:
|
||||
"cyclic" => Cyclic,
|
||||
"numeric" => Numeric,
|
||||
"alphabetic" => Alphabetic,
|
||||
"symbolic" => Symbolic,
|
||||
"fixed" => Fixed,
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq)]
|
||||
#[derive(ToComputedValue, ToCss)]
|
||||
pub enum SymbolsType {
|
||||
Cyclic,
|
||||
Numeric,
|
||||
Alphabetic,
|
||||
Symbolic,
|
||||
Fixed,
|
||||
}
|
||||
add_impls_for_keyword_enum!(SymbolsType);
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
impl SymbolsType {
|
||||
|
|
|
@ -98,20 +98,26 @@ pub enum TimingFunction<Integer, Number> {
|
|||
Frames(Integer),
|
||||
}
|
||||
|
||||
define_css_keyword_enum! { TimingKeyword:
|
||||
"linear" => Linear,
|
||||
"ease" => Ease,
|
||||
"ease-in" => EaseIn,
|
||||
"ease-out" => EaseOut,
|
||||
"ease-in-out" => EaseInOut,
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq)]
|
||||
#[derive(ToComputedValue, ToCss)]
|
||||
pub enum TimingKeyword {
|
||||
Linear,
|
||||
Ease,
|
||||
EaseIn,
|
||||
EaseOut,
|
||||
EaseInOut,
|
||||
}
|
||||
add_impls_for_keyword_enum!(TimingKeyword);
|
||||
|
||||
define_css_keyword_enum! { StepPosition:
|
||||
"start" => Start,
|
||||
"end" => End,
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq)]
|
||||
#[derive(ToComputedValue, ToCss)]
|
||||
pub enum StepPosition {
|
||||
Start,
|
||||
End,
|
||||
}
|
||||
add_impls_for_keyword_enum!(StepPosition);
|
||||
|
||||
impl<H, V, D> TransformOrigin<H, V, D> {
|
||||
/// Returns a new transform origin.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue