aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorOriol Brufau <obrufau@igalia.com>2024-04-13 19:42:09 +0200
committerGitHub <noreply@github.com>2024-04-13 17:42:09 +0000
commita5e97525a0b924c8031cd277dfdf85ea9e17a6bc (patch)
tree454bba94d6ff6fdffb9514cd177daea1f95e6900 /components
parent93bb276602e8abd5baaec88d295a047ca449bf1d (diff)
downloadservo-a5e97525a0b924c8031cd277dfdf85ea9e17a6bc.tar.gz
servo-a5e97525a0b924c8031cd277dfdf85ea9e17a6bc.zip
Upgrade Stylo to 2024-01-16 (#32066)
* Upgrade Stylo to 2024-01-16 * Fixup for https://phabricator.services.mozilla.com/D187736 * Fixup for https://phabricator.services.mozilla.com/D196415 * Fixup for https://phabricator.services.mozilla.com/D197147 * Fixup for https://phabricator.services.mozilla.com/D196194 * Fixup for https://phabricator.services.mozilla.com/D196195 * Update test expectations
Diffstat (limited to 'components')
-rw-r--r--components/layout/query.rs26
-rw-r--r--components/layout_2020/query.rs14
-rw-r--r--components/script/dom/cssrule.rs1
-rw-r--r--components/script/dom/cssstyledeclaration.rs8
4 files changed, 29 insertions, 20 deletions
diff --git a/components/layout/query.rs b/components/layout/query.rs
index fd924f67bfb..2bb2d882c09 100644
--- a/components/layout/query.rs
+++ b/components/layout/query.rs
@@ -637,7 +637,7 @@ fn create_font_declaration(
let mut declarations = SourcePropertyDeclaration::default();
let result = parse_one_declaration_into(
&mut declarations,
- PropertyId::Shorthand(ShorthandId::Font),
+ PropertyId::NonCustom(ShorthandId::Font.into()),
value,
Origin::Author,
&UrlExtraData(url_data.get_arc()),
@@ -766,10 +766,14 @@ pub fn process_resolved_style_request<'dom>(
);
let style = styles.primary();
let longhand_id = match *property {
- PropertyId::LonghandAlias(id, _) | PropertyId::Longhand(id) => id,
- // Firefox returns blank strings for the computed value of shorthands,
- // so this should be web-compatible.
- PropertyId::ShorthandAlias(..) | PropertyId::Shorthand(_) => return String::new(),
+ PropertyId::NonCustom(id) => {
+ match id.unaliased().as_longhand() {
+ Some(id) => id,
+ // Firefox returns blank strings for the computed value of shorthands,
+ // so this should be web-compatible.
+ None => return String::new(),
+ }
+ },
PropertyId::Custom(ref name) => {
return style.computed_value_to_string(PropertyDeclarationId::Custom(name));
},
@@ -811,10 +815,14 @@ fn process_resolved_style_request_internal<'dom>(
let style = &*layout_el.resolved_style();
let longhand_id = match *property {
- PropertyId::LonghandAlias(id, _) | PropertyId::Longhand(id) => id,
- // Firefox returns blank strings for the computed value of shorthands,
- // so this should be web-compatible.
- PropertyId::ShorthandAlias(..) | PropertyId::Shorthand(_) => return String::new(),
+ PropertyId::NonCustom(id) => {
+ match id.unaliased().as_longhand() {
+ Some(id) => id,
+ // Firefox returns blank strings for the computed value of shorthands,
+ // so this should be web-compatible.
+ None => return String::new(),
+ }
+ },
PropertyId::Custom(ref name) => {
return style.computed_value_to_string(PropertyDeclarationId::Custom(name));
},
diff --git a/components/layout_2020/query.rs b/components/layout_2020/query.rs
index d53da05677a..97df9f3e971 100644
--- a/components/layout_2020/query.rs
+++ b/components/layout_2020/query.rs
@@ -127,9 +127,9 @@ pub fn process_resolved_style_request<'dom>(
let style = &*layout_element.resolved_style();
let longhand_id = match *property {
- PropertyId::LonghandAlias(id, _) | PropertyId::Longhand(id) => id,
- PropertyId::ShorthandAlias(id, _) | PropertyId::Shorthand(id) => {
- return shorthand_to_css_string(id, style);
+ PropertyId::NonCustom(id) => match id.longhand_or_shorthand() {
+ Ok(longhand_id) => longhand_id,
+ Err(shorthand_id) => return shorthand_to_css_string(shorthand_id, style),
},
PropertyId::Custom(ref name) => {
return style.computed_value_to_string(PropertyDeclarationId::Custom(name));
@@ -263,9 +263,9 @@ pub fn process_resolved_style_request_for_unstyled_node<'dom>(
);
let style = styles.primary();
let longhand_id = match *property {
- PropertyId::LonghandAlias(id, _) | PropertyId::Longhand(id) => id,
- PropertyId::ShorthandAlias(id, _) | PropertyId::Shorthand(id) => {
- return shorthand_to_css_string(id, style);
+ PropertyId::NonCustom(id) => match id.longhand_or_shorthand() {
+ Ok(longhand_id) => longhand_id,
+ Err(shorthand_id) => return shorthand_to_css_string(shorthand_id, style),
},
PropertyId::Custom(ref name) => {
return style.computed_value_to_string(PropertyDeclarationId::Custom(name));
@@ -528,7 +528,7 @@ where
let mut declarations = SourcePropertyDeclaration::default();
let result = parse_one_declaration_into(
&mut declarations,
- PropertyId::Shorthand(ShorthandId::Font),
+ PropertyId::NonCustom(ShorthandId::Font.into()),
value,
Origin::Author,
&UrlExtraData(url_data.get_arc()),
diff --git a/components/script/dom/cssrule.rs b/components/script/dom/cssrule.rs
index bafc803f721..c56f299c16f 100644
--- a/components/script/dom/cssrule.rs
+++ b/components/script/dom/cssrule.rs
@@ -116,6 +116,7 @@ impl CSSRule {
},
StyleCssRule::FontPaletteValues(_) => unimplemented!(), // TODO
StyleCssRule::Property(_) => unimplemented!(), // TODO
+ StyleCssRule::Margin(_) => unimplemented!(), // TODO
}
}
diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs
index e05a611940c..0090bb54eb7 100644
--- a/components/script/dom/cssstyledeclaration.rs
+++ b/components/script/dom/cssstyledeclaration.rs
@@ -349,10 +349,10 @@ lazy_static! {
// The 'all' shorthand contains all the enabled longhands with 2 exceptions:
// 'direction' and 'unicode-bidi', so these must be added afterward.
let mut enabled_longhands: Vec<LonghandId> = ShorthandId::All.longhands().collect();
- if PropertyId::Longhand(LonghandId::Direction).enabled_for_all_content() {
+ if PropertyId::NonCustom(LonghandId::Direction.into()).enabled_for_all_content() {
enabled_longhands.push(LonghandId::Direction);
}
- if PropertyId::Longhand(LonghandId::UnicodeBidi).enabled_for_all_content() {
+ if PropertyId::NonCustom(LonghandId::UnicodeBidi.into()).enabled_for_all_content() {
enabled_longhands.push(LonghandId::UnicodeBidi);
}
@@ -459,13 +459,13 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-cssfloat
fn CssFloat(&self) -> DOMString {
- self.get_property_value(PropertyId::Longhand(LonghandId::Float))
+ self.get_property_value(PropertyId::NonCustom(LonghandId::Float.into()))
}
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-cssfloat
fn SetCssFloat(&self, value: DOMString) -> ErrorResult {
self.set_property(
- PropertyId::Longhand(LonghandId::Float),
+ PropertyId::NonCustom(LonghandId::Float.into()),
value,
DOMString::new(),
)