mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Implement ToCss for UnparsedValue
This commit is contained in:
parent
b59a8afd0f
commit
1937f594ac
1 changed files with 15 additions and 15 deletions
|
@ -1360,6 +1360,19 @@ pub struct UnparsedValue {
|
||||||
from_shorthand: Option<ShorthandId>,
|
from_shorthand: Option<ShorthandId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ToCss for UnparsedValue {
|
||||||
|
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||||
|
where
|
||||||
|
W: Write,
|
||||||
|
{
|
||||||
|
// https://drafts.csswg.org/css-variables/#variables-in-shorthands
|
||||||
|
if self.from_shorthand.is_none() {
|
||||||
|
dest.write_str(&*self.css)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl UnparsedValue {
|
impl UnparsedValue {
|
||||||
fn substitute_variables(
|
fn substitute_variables(
|
||||||
&self,
|
&self,
|
||||||
|
@ -1432,13 +1445,7 @@ impl<'a, T: ToCss> ToCss for DeclaredValue<'a, T> {
|
||||||
{
|
{
|
||||||
match *self {
|
match *self {
|
||||||
DeclaredValue::Value(ref inner) => inner.to_css(dest),
|
DeclaredValue::Value(ref inner) => inner.to_css(dest),
|
||||||
DeclaredValue::WithVariables(ref with_variables) => {
|
DeclaredValue::WithVariables(ref with_variables) => with_variables.to_css(dest),
|
||||||
// https://drafts.csswg.org/css-variables/#variables-in-shorthands
|
|
||||||
if with_variables.from_shorthand.is_none() {
|
|
||||||
dest.write_str(&*with_variables.css)?
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
},
|
|
||||||
DeclaredValue::CSSWideKeyword(ref keyword) => keyword.to_css(dest),
|
DeclaredValue::CSSWideKeyword(ref keyword) => keyword.to_css(dest),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1742,14 +1749,7 @@ impl ToCss for VariableDeclaration {
|
||||||
where
|
where
|
||||||
W: fmt::Write,
|
W: fmt::Write,
|
||||||
{
|
{
|
||||||
// https://drafts.csswg.org/css-variables/#variables-in-shorthands
|
self.value.to_css(dest)
|
||||||
match self.value.from_shorthand {
|
|
||||||
None => {
|
|
||||||
dest.write_str(&*self.value.css)?
|
|
||||||
}
|
|
||||||
Some(..) => {},
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue