Upgrade Stylo to 2024-04-16 (#32128)

* Upgrade Stylo to 2024-04-16

* Fixup for https://phabricator.services.mozilla.com/D205051

* Fixup for https://phabricator.services.mozilla.com/D203153

* Fixup for https://phabricator.services.mozilla.com/D202460

* Fixup for https://phabricator.services.mozilla.com/D205718

* Fixup for https://phabricator.services.mozilla.com/D206428

* Update test expectations
This commit is contained in:
Oriol Brufau 2024-04-25 16:48:07 +02:00 committed by GitHub
parent 1440406e91
commit 401e49010f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 65 additions and 175 deletions

View file

@ -5,7 +5,7 @@
use dom_struct::dom_struct;
use servo_arc::Arc;
use style::shared_lock::{Locked, SharedRwLock};
use style::stylesheets::{CssRuleTypes, CssRules as StyleCssRules};
use style::stylesheets::{CssRuleType, CssRuleTypes, CssRules as StyleCssRules};
use crate::dom::bindings::codegen::Bindings::CSSGroupingRuleBinding::CSSGroupingRuleMethods;
use crate::dom::bindings::error::{ErrorResult, Fallible};
@ -70,8 +70,16 @@ impl CSSGroupingRuleMethods for CSSGroupingRule {
// TODO: this should accumulate the rule types of all ancestors.
let rule_type = self.cssrule.as_specific().ty();
let containing_rule_types = CssRuleTypes::from(rule_type);
self.rulelist()
.insert_rule(&rule, index, containing_rule_types)
let parse_relative_rule_type = match rule_type {
CssRuleType::Style | CssRuleType::Scope => Some(rule_type),
_ => None,
};
self.rulelist().insert_rule(
&rule,
index,
containing_rule_types,
parse_relative_rule_type,
)
}
// https://drafts.csswg.org/cssom/#dom-cssgroupingrule-deleterule

View file

@ -117,6 +117,8 @@ impl CSSRule {
StyleCssRule::FontPaletteValues(_) => unimplemented!(), // TODO
StyleCssRule::Property(_) => unimplemented!(), // TODO
StyleCssRule::Margin(_) => unimplemented!(), // TODO
StyleCssRule::Scope(_) => unimplemented!(), // TODO
StyleCssRule::StartingStyle(_) => unimplemented!(), // TODO
}
}

View file

@ -8,8 +8,8 @@ use dom_struct::dom_struct;
use servo_arc::Arc;
use style::shared_lock::Locked;
use style::stylesheets::{
AllowImportRules, CssRuleTypes, CssRules, CssRulesHelpers, KeyframesRule, RulesMutateError,
StylesheetLoader as StyleStylesheetLoader,
AllowImportRules, CssRuleType, CssRuleTypes, CssRules, CssRulesHelpers, KeyframesRule,
RulesMutateError, StylesheetLoader as StyleStylesheetLoader,
};
use crate::dom::bindings::cell::DomRefCell;
@ -97,6 +97,7 @@ impl CSSRuleList {
rule: &str,
idx: u32,
containing_rule_types: CssRuleTypes,
parse_relative_rule_type: Option<CssRuleType>,
) -> Fallible<u32> {
let css_rules = if let RulesSource::Rules(ref rules) = self.rules {
rules
@ -122,6 +123,7 @@ impl CSSRuleList {
&parent_stylesheet.contents,
index,
containing_rule_types,
parse_relative_rule_type,
loader.as_ref().map(|l| l as &dyn StyleStylesheetLoader),
AllowImportRules::Yes,
)?;

View file

@ -129,7 +129,7 @@ impl CSSStyleSheetMethods for CSSStyleSheet {
return Err(Error::Security);
}
self.rulelist()
.insert_rule(&rule, index, CssRuleTypes::default())
.insert_rule(&rule, index, CssRuleTypes::default(), None)
}
// https://drafts.csswg.org/cssom/#dom-cssstylesheet-deleterule

View file

@ -3311,6 +3311,8 @@ impl SelectorsElement for DomRoot<Element> {
},
},
NonTSPseudoClass::CustomState(ref state) => self.has_custom_state(&state.0),
// FIXME(heycam): This is wrong, since extended_filtering accepts
// a string containing commas (separating each language tag in
// a list) but the pseudo-class instead should be parsing and
@ -3432,6 +3434,10 @@ impl SelectorsElement for DomRoot<Element> {
true
}
fn has_custom_state(&self, _name: &AtomIdent) -> bool {
false
}
}
impl Element {