mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Update Stylo to 2023-07-23 (#31437)
* Update Stylo to 2023-07-23 * to_shmem should be local when working with Stylo * Fixup for https://phabricator.services.mozilla.com/D180769 * Fixup for https://phabricator.services.mozilla.com/D181125 * Fixup for https://phabricator.services.mozilla.com/D181162 * Fixup for https://phabricator.services.mozilla.com/D181798 * Fixup for https://phabricator.services.mozilla.com/D182514 * Fixup for https://phabricator.services.mozilla.com/D182539 * Update test expectations
This commit is contained in:
parent
6eb96290fa
commit
31cfaf290d
41 changed files with 171 additions and 1208 deletions
|
@ -5,9 +5,10 @@
|
|||
use dom_struct::dom_struct;
|
||||
use servo_arc::Arc;
|
||||
use style::shared_lock::{Locked, SharedRwLock};
|
||||
use style::stylesheets::CssRules as StyleCssRules;
|
||||
use style::stylesheets::{CssRuleTypes, CssRules as StyleCssRules};
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::CSSGroupingRuleBinding::CSSGroupingRuleMethods;
|
||||
use crate::dom::bindings::codegen::Bindings::CSSRuleBinding::CSSRule_Binding::CSSRuleMethods;
|
||||
use crate::dom::bindings::error::{ErrorResult, Fallible};
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::bindings::reflector::DomObject;
|
||||
|
@ -67,7 +68,10 @@ impl CSSGroupingRuleMethods for CSSGroupingRule {
|
|||
|
||||
// https://drafts.csswg.org/cssom/#dom-cssgroupingrule-insertrule
|
||||
fn InsertRule(&self, rule: DOMString, index: u32) -> Fallible<u32> {
|
||||
self.rulelist().insert_rule(&rule, index, /* nested */ true)
|
||||
// TODO: this should accumulate the rule types of all ancestors.
|
||||
let containing_rule_types = CssRuleTypes::from_bits(self.cssrule.Type().into());
|
||||
self.rulelist()
|
||||
.insert_rule(&rule, index, containing_rule_types)
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-cssgroupingrule-deleterule
|
||||
|
|
|
@ -8,7 +8,7 @@ use dom_struct::dom_struct;
|
|||
use servo_arc::Arc;
|
||||
use style::shared_lock::Locked;
|
||||
use style::stylesheets::{
|
||||
AllowImportRules, CssRules, CssRulesHelpers, KeyframesRule, RulesMutateError,
|
||||
AllowImportRules, CssRuleTypes, CssRules, CssRulesHelpers, KeyframesRule, RulesMutateError,
|
||||
StylesheetLoader as StyleStylesheetLoader,
|
||||
};
|
||||
|
||||
|
@ -92,7 +92,12 @@ impl CSSRuleList {
|
|||
|
||||
/// Should only be called for CssRules-backed rules. Use append_lazy_rule
|
||||
/// for keyframes-backed rules.
|
||||
pub fn insert_rule(&self, rule: &str, idx: u32, nested: bool) -> Fallible<u32> {
|
||||
pub fn insert_rule(
|
||||
&self,
|
||||
rule: &str,
|
||||
idx: u32,
|
||||
containing_rule_types: CssRuleTypes,
|
||||
) -> Fallible<u32> {
|
||||
let css_rules = if let RulesSource::Rules(ref rules) = self.rules {
|
||||
rules
|
||||
} else {
|
||||
|
@ -117,7 +122,7 @@ impl CSSRuleList {
|
|||
rule,
|
||||
&parent_stylesheet.contents,
|
||||
index,
|
||||
nested,
|
||||
containing_rule_types,
|
||||
loader.as_ref().map(|l| l as &dyn StyleStylesheetLoader),
|
||||
AllowImportRules::Yes,
|
||||
)?;
|
||||
|
|
|
@ -6,7 +6,7 @@ use std::mem;
|
|||
|
||||
use cssparser::{Parser as CssParser, ParserInput as CssParserInput, ToCss};
|
||||
use dom_struct::dom_struct;
|
||||
use selectors::parser::SelectorList;
|
||||
use selectors::parser::{ParseRelative, SelectorList};
|
||||
use servo_arc::Arc;
|
||||
use style::selector_parser::SelectorParser;
|
||||
use style::shared_lock::{Locked, ToCssWithGuard};
|
||||
|
@ -111,7 +111,9 @@ impl CSSStyleRuleMethods for CSSStyleRule {
|
|||
};
|
||||
let mut css_parser = CssParserInput::new(&*value);
|
||||
let mut css_parser = CssParser::new(&mut css_parser);
|
||||
if let Ok(mut s) = SelectorList::parse(&parser, &mut css_parser) {
|
||||
// TODO: Maybe allow setting relative selectors from the OM, if we're in a nested style
|
||||
// rule?
|
||||
if let Ok(mut s) = SelectorList::parse(&parser, &mut css_parser, ParseRelative::No) {
|
||||
// This mirrors what we do in CSSStyleOwner::mutate_associated_block.
|
||||
let mut guard = self.cssrule.shared_lock().write();
|
||||
let stylerule = self.stylerule.write_with(&mut guard);
|
||||
|
|
|
@ -7,7 +7,7 @@ use std::cell::Cell;
|
|||
use dom_struct::dom_struct;
|
||||
use servo_arc::Arc;
|
||||
use style::shared_lock::SharedRwLock;
|
||||
use style::stylesheets::Stylesheet as StyleStyleSheet;
|
||||
use style::stylesheets::{CssRuleTypes, Stylesheet as StyleStyleSheet};
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::CSSStyleSheetBinding::CSSStyleSheetMethods;
|
||||
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||
|
@ -129,7 +129,7 @@ impl CSSStyleSheetMethods for CSSStyleSheet {
|
|||
return Err(Error::Security);
|
||||
}
|
||||
self.rulelist()
|
||||
.insert_rule(&rule, index, /* nested */ false)
|
||||
.insert_rule(&rule, index, CssRuleTypes::default())
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-cssstylesheet-deleterule
|
||||
|
|
|
@ -31,7 +31,8 @@ use script_layout_interface::{
|
|||
};
|
||||
use script_traits::{DocumentActivity, UntrustedNodeAddress};
|
||||
use selectors::matching::{
|
||||
matches_selector_list, MatchingContext, MatchingMode, NeedsSelectorFlags,
|
||||
matches_selector_list, IgnoreNthChildForInvalidation, MatchingContext, MatchingMode,
|
||||
NeedsSelectorFlags,
|
||||
};
|
||||
use selectors::parser::SelectorList;
|
||||
use servo_arc::Arc;
|
||||
|
@ -480,6 +481,7 @@ impl<'a> Iterator for QuerySelectorIterator {
|
|||
&mut nth_index_cache,
|
||||
node.owner_doc().quirks_mode(),
|
||||
NeedsSelectorFlags::No,
|
||||
IgnoreNthChildForInvalidation::No,
|
||||
);
|
||||
if let Some(element) = DomRoot::downcast(node) {
|
||||
if matches_selector_list(selectors, &element, &mut ctx) {
|
||||
|
@ -976,6 +978,7 @@ impl Node {
|
|||
&mut nth_index_cache,
|
||||
doc.quirks_mode(),
|
||||
NeedsSelectorFlags::No,
|
||||
IgnoreNthChildForInvalidation::No,
|
||||
);
|
||||
Ok(self
|
||||
.traverse_preorder(ShadowIncluding::No)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue