mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
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:
parent
1440406e91
commit
401e49010f
13 changed files with 65 additions and 175 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
)?;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -414,15 +414,16 @@ impl<'dom> style::dom::TElement for ServoLayoutElement<'dom> {
|
|||
self.element.get_selector_flags().contains(flags)
|
||||
}
|
||||
|
||||
fn relative_selector_search_direction(&self) -> Option<ElementSelectorFlags> {
|
||||
let flags = self.element.get_selector_flags().intersection(
|
||||
ElementSelectorFlags::RELATIVE_SELECTOR_SEARCH_DIRECTION_ANCESTOR_SIBLING,
|
||||
);
|
||||
if flags.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(flags)
|
||||
}
|
||||
fn relative_selector_search_direction(&self) -> ElementSelectorFlags {
|
||||
self.element
|
||||
.get_selector_flags()
|
||||
.intersection(ElementSelectorFlags::RELATIVE_SELECTOR_SEARCH_DIRECTION_ANCESTOR_SIBLING)
|
||||
}
|
||||
|
||||
fn each_custom_state<F>(&self, _callback: F)
|
||||
where
|
||||
F: FnMut(&AtomIdent),
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -551,6 +552,7 @@ impl<'dom> ::selectors::Element for ServoLayoutElement<'dom> {
|
|||
NonTSPseudoClass::Link | NonTSPseudoClass::AnyLink => self.is_link(),
|
||||
NonTSPseudoClass::Visited => false,
|
||||
|
||||
NonTSPseudoClass::CustomState(ref state) => self.has_custom_state(&state.0),
|
||||
NonTSPseudoClass::Lang(ref lang) => self.match_element_lang(None, lang),
|
||||
|
||||
NonTSPseudoClass::ServoNonZeroBorder => !matches!(
|
||||
|
@ -651,6 +653,10 @@ impl<'dom> ::selectors::Element for ServoLayoutElement<'dom> {
|
|||
each_relevant_element_hash(*self, |hash| filter.insert_hash(hash & BLOOM_HASH_MASK));
|
||||
true
|
||||
}
|
||||
|
||||
fn has_custom_state(&self, _name: &AtomIdent) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// A wrapper around elements that ensures layout can only
|
||||
|
@ -893,4 +899,8 @@ impl<'dom> ::selectors::Element for ServoThreadSafeLayoutElement<'dom> {
|
|||
});
|
||||
true
|
||||
}
|
||||
|
||||
fn has_custom_state(&self, _name: &AtomIdent) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue