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
This commit is contained in:
Oriol Brufau 2024-04-13 19:42:09 +02:00 committed by GitHub
parent 93bb276602
commit a5e97525a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 105 additions and 9370 deletions

View file

@ -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));
},

View file

@ -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()),

View file

@ -116,6 +116,7 @@ impl CSSRule {
},
StyleCssRule::FontPaletteValues(_) => unimplemented!(), // TODO
StyleCssRule::Property(_) => unimplemented!(), // TODO
StyleCssRule::Margin(_) => unimplemented!(), // TODO
}
}

View file

@ -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(),
)