mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Correctly track whether a longhand contains any variable.
This commit is contained in:
parent
05b5aabc69
commit
835d95eb41
2 changed files with 63 additions and 36 deletions
|
@ -561,8 +561,8 @@ impl ShorthandId {
|
|||
///
|
||||
/// Returns the optional appendable value.
|
||||
pub fn get_shorthand_appendable_value<'a, I>(self,
|
||||
declarations: I)
|
||||
-> Option<AppendableValue<'a, I::IntoIter>>
|
||||
declarations: I)
|
||||
-> Option<AppendableValue<'a, I::IntoIter>>
|
||||
where I: IntoIterator<Item=&'a PropertyDeclaration>,
|
||||
I::IntoIter: Clone,
|
||||
{
|
||||
|
@ -580,15 +580,21 @@ impl ShorthandId {
|
|||
// https://drafts.csswg.org/css-variables/#variables-in-shorthands
|
||||
if let Some(css) = first_declaration.with_variables_from_shorthand(self) {
|
||||
if declarations2.all(|d| d.with_variables_from_shorthand(self) == Some(css)) {
|
||||
return Some(AppendableValue::Css(css));
|
||||
}
|
||||
return None;
|
||||
return Some(AppendableValue::Css {
|
||||
css: css,
|
||||
with_variables: true,
|
||||
});
|
||||
}
|
||||
return None;
|
||||
}
|
||||
|
||||
// Check whether they are all the same CSS-wide keyword.
|
||||
if let Some(keyword) = first_declaration.get_css_wide_keyword() {
|
||||
if declarations2.all(|d| d.get_css_wide_keyword() == Some(keyword)) {
|
||||
return Some(AppendableValue::Css(keyword.to_str()));
|
||||
return Some(AppendableValue::Css {
|
||||
css: keyword.to_str(),
|
||||
with_variables: false,
|
||||
});
|
||||
}
|
||||
return None;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue