mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Get rid of ComputedValueAsSpecified in box.mako.rs.
This commit is contained in:
parent
a4da2220c1
commit
5e136a7a05
2 changed files with 19 additions and 29 deletions
|
@ -34,7 +34,6 @@
|
||||||
-moz-grid-group -moz-grid-line -moz-stack -moz-inline-stack -moz-deck
|
-moz-grid-group -moz-grid-line -moz-stack -moz-inline-stack -moz-deck
|
||||||
-moz-popup -moz-groupbox""".split()
|
-moz-popup -moz-groupbox""".split()
|
||||||
%>
|
%>
|
||||||
use values::computed::ComputedValueAsSpecified;
|
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
|
@ -137,7 +136,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
|
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, ToComputedValue)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
|
||||||
pub enum SpecifiedValue {
|
pub enum SpecifiedValue {
|
||||||
% for value in values:
|
% for value in values:
|
||||||
|
@ -180,8 +179,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
|
||||||
|
|
||||||
% if product == "servo":
|
% if product == "servo":
|
||||||
fn cascade_property_custom(_declaration: &PropertyDeclaration,
|
fn cascade_property_custom(_declaration: &PropertyDeclaration,
|
||||||
context: &mut computed::Context) {
|
context: &mut computed::Context) {
|
||||||
|
@ -403,14 +400,13 @@ ${helpers.predefined_type("transition-delay",
|
||||||
use Atom;
|
use Atom;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
use values::computed::ComputedValueAsSpecified;
|
|
||||||
use values::KeyframesName;
|
use values::KeyframesName;
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
pub use super::SpecifiedValue as T;
|
pub use super::SpecifiedValue as T;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
#[derive(Clone, Debug, Eq, Hash, PartialEq, ToComputedValue)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub struct SpecifiedValue(pub Option<KeyframesName>);
|
pub struct SpecifiedValue(pub Option<KeyframesName>);
|
||||||
|
|
||||||
|
@ -448,8 +444,10 @@ ${helpers.predefined_type("transition-delay",
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Parse for SpecifiedValue {
|
impl Parse for SpecifiedValue {
|
||||||
fn parse<'i, 't>(context: &ParserContext, input: &mut ::cssparser::Parser<'i, 't>)
|
fn parse<'i, 't>(
|
||||||
-> Result<Self, ParseError<'i>> {
|
context: &ParserContext,
|
||||||
|
input: &mut ::cssparser::Parser<'i, 't>
|
||||||
|
) -> Result<Self, ParseError<'i>> {
|
||||||
if let Ok(name) = input.try(|input| KeyframesName::parse(context, input)) {
|
if let Ok(name) = input.try(|input| KeyframesName::parse(context, input)) {
|
||||||
Ok(SpecifiedValue(Some(name)))
|
Ok(SpecifiedValue(Some(name)))
|
||||||
} else {
|
} else {
|
||||||
|
@ -458,12 +456,13 @@ ${helpers.predefined_type("transition-delay",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
|
pub fn parse<'i, 't>(
|
||||||
-> Result<SpecifiedValue,ParseError<'i>> {
|
context: &ParserContext,
|
||||||
|
input: &mut Parser<'i, 't>,
|
||||||
|
) -> Result<SpecifiedValue,ParseError<'i>> {
|
||||||
SpecifiedValue::parse(context, input)
|
SpecifiedValue::parse(context, input)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
|
||||||
</%helpers:vector_longhand>
|
</%helpers:vector_longhand>
|
||||||
|
|
||||||
${helpers.predefined_type("animation-duration",
|
${helpers.predefined_type("animation-duration",
|
||||||
|
@ -496,15 +495,13 @@ ${helpers.predefined_type("animation-timing-function",
|
||||||
extra_prefixes="moz webkit"
|
extra_prefixes="moz webkit"
|
||||||
spec="https://drafts.csswg.org/css-animations/#propdef-animation-iteration-count",
|
spec="https://drafts.csswg.org/css-animations/#propdef-animation-iteration-count",
|
||||||
allowed_in_keyframe_block="False">
|
allowed_in_keyframe_block="False">
|
||||||
use values::computed::ComputedValueAsSpecified;
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
pub use super::SpecifiedValue as T;
|
pub use super::SpecifiedValue as T;
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://drafts.csswg.org/css-animations/#animation-iteration-count
|
// https://drafts.csswg.org/css-animations/#animation-iteration-count
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
#[derive(Clone, Debug, PartialEq, ToCss, ToComputedValue)]
|
||||||
pub enum SpecifiedValue {
|
pub enum SpecifiedValue {
|
||||||
Number(f32),
|
Number(f32),
|
||||||
Infinite,
|
Infinite,
|
||||||
|
@ -538,12 +535,12 @@ ${helpers.predefined_type("animation-timing-function",
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
|
pub fn parse<'i, 't>(
|
||||||
-> Result<SpecifiedValue, ParseError<'i>> {
|
context: &ParserContext,
|
||||||
|
input: &mut Parser<'i, 't>,
|
||||||
|
) -> Result<SpecifiedValue, ParseError<'i>> {
|
||||||
SpecifiedValue::parse(context, input)
|
SpecifiedValue::parse(context, input)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
|
||||||
</%helpers:vector_longhand>
|
</%helpers:vector_longhand>
|
||||||
|
|
||||||
<% animation_direction_custom_consts = { "alternate-reverse": "Alternate_reverse" } %>
|
<% animation_direction_custom_consts = { "alternate-reverse": "Alternate_reverse" } %>
|
||||||
|
@ -1626,15 +1623,13 @@ ${helpers.predefined_type("transform-origin",
|
||||||
spec="https://drafts.csswg.org/css-contain/#contain-property">
|
spec="https://drafts.csswg.org/css-contain/#contain-property">
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
use values::computed::ComputedValueAsSpecified;
|
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
pub type T = super::SpecifiedValue;
|
pub type T = super::SpecifiedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
|
#[derive(ToComputedValue)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub flags SpecifiedValue: u8 {
|
pub flags SpecifiedValue: u8 {
|
||||||
const LAYOUT = 0x01,
|
const LAYOUT = 0x01,
|
||||||
|
@ -1770,15 +1765,12 @@ ${helpers.single_keyword("-moz-orient",
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
use values::CustomIdent;
|
use values::CustomIdent;
|
||||||
use values::computed::ComputedValueAsSpecified;
|
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
pub use super::SpecifiedValue as T;
|
pub use super::SpecifiedValue as T;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub enum SpecifiedValue {
|
pub enum SpecifiedValue {
|
||||||
Auto,
|
Auto,
|
||||||
|
@ -1843,9 +1835,6 @@ ${helpers.predefined_type(
|
||||||
use gecko_bindings::structs;
|
use gecko_bindings::structs;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
use values::computed::ComputedValueAsSpecified;
|
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
|
||||||
|
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
pub use super::SpecifiedValue as T;
|
pub use super::SpecifiedValue as T;
|
||||||
|
@ -1853,6 +1842,7 @@ ${helpers.predefined_type(
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
/// These constants match Gecko's `NS_STYLE_TOUCH_ACTION_*` constants.
|
/// These constants match Gecko's `NS_STYLE_TOUCH_ACTION_*` constants.
|
||||||
|
#[derive(ToComputedValue)]
|
||||||
pub flags SpecifiedValue: u8 {
|
pub flags SpecifiedValue: u8 {
|
||||||
const TOUCH_ACTION_NONE = structs::NS_STYLE_TOUCH_ACTION_NONE as u8,
|
const TOUCH_ACTION_NONE = structs::NS_STYLE_TOUCH_ACTION_NONE as u8,
|
||||||
const TOUCH_ACTION_AUTO = structs::NS_STYLE_TOUCH_ACTION_AUTO as u8,
|
const TOUCH_ACTION_AUTO = structs::NS_STYLE_TOUCH_ACTION_AUTO as u8,
|
||||||
|
|
|
@ -127,7 +127,7 @@ impl ToCss for CustomIdent {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-animations/#typedef-keyframes-name
|
/// https://drafts.csswg.org/css-animations/#typedef-keyframes-name
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, ToComputedValue)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub enum KeyframesName {
|
pub enum KeyframesName {
|
||||||
/// <custom-ident>
|
/// <custom-ident>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue