mirror of
https://github.com/servo/servo.git
synced 2025-08-17 11:25:35 +01:00
Derive the most trivial ToCss implementations 🌋
For now, all variants get serialised as the space-separated serialisations of their fields. Unit variants are not supported.
This commit is contained in:
parent
6d6f03974d
commit
c4f1d647a0
18 changed files with 113 additions and 263 deletions
|
@ -114,17 +114,15 @@ ${helpers.single_keyword("list-style-position", "outside inside", animation_valu
|
|||
<%helpers:longhand name="list-style-image" animation_value_type="none"
|
||||
boxed="${product == 'gecko'}"
|
||||
spec="https://drafts.csswg.org/css-lists/#propdef-list-style-image">
|
||||
use std::fmt;
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
use values::specified::UrlOrNone;
|
||||
pub use self::computed_value::T as SpecifiedValue;
|
||||
use style_traits::ToCss;
|
||||
|
||||
pub mod computed_value {
|
||||
use values::specified::UrlOrNone;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Debug, Clone, PartialEq, ToCss)]
|
||||
pub struct T(pub UrlOrNone);
|
||||
}
|
||||
|
||||
|
@ -132,12 +130,6 @@ ${helpers.single_keyword("list-style-position", "outside inside", animation_valu
|
|||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||
no_viewport_percentage!(SpecifiedValue);
|
||||
|
||||
impl ToCss for SpecifiedValue {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
self.0.to_css(dest)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_initial_value() -> computed_value::T {
|
||||
computed_value::T(Either::Second(None_))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue