mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Use stylesheet’s base URL and ns prefixes in CSSOM insert/appendRule.
This commit is contained in:
parent
f1d49d3773
commit
70b250fe2a
5 changed files with 24 additions and 20 deletions
|
@ -19,7 +19,7 @@ use parking_lot::RwLock;
|
|||
use std::sync::Arc;
|
||||
use style::keyframes::{Keyframe, KeyframeSelector};
|
||||
use style::parser::ParserContextExtraData;
|
||||
use style::stylesheets::{KeyframesRule, Origin};
|
||||
use style::stylesheets::KeyframesRule;
|
||||
use style_traits::ToCss;
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -83,8 +83,7 @@ impl CSSKeyframesRuleMethods for CSSKeyframesRule {
|
|||
fn AppendRule(&self, rule: DOMString) {
|
||||
let global = self.global();
|
||||
let window = global.as_window();
|
||||
let doc = window.Document();
|
||||
let rule = Keyframe::parse(&rule, Origin::Author, doc.url().clone(),
|
||||
let rule = Keyframe::parse(&rule, self.cssrule.parent_stylesheet().style_stylesheet(),
|
||||
ParserContextExtraData::default());
|
||||
if let Ok(rule) = rule {
|
||||
self.keyframesrule.write().keyframes.push(rule);
|
||||
|
|
|
@ -84,10 +84,10 @@ impl CSSRuleList {
|
|||
|
||||
let global = self.global();
|
||||
let window = global.as_window();
|
||||
let doc = window.Document();
|
||||
let index = idx as usize;
|
||||
|
||||
let new_rule = css_rules.insert_rule(rule, doc.url().clone(), index, nested)?;
|
||||
let parent_stylesheet = self.parent_stylesheet.style_stylesheet();
|
||||
let new_rule = css_rules.insert_rule(rule, parent_stylesheet, index, nested)?;
|
||||
|
||||
let parent_stylesheet = &*self.parent_stylesheet;
|
||||
let dom_rule = CSSRule::new_specific(&window, parent_stylesheet, new_rule);
|
||||
|
|
|
@ -67,6 +67,10 @@ impl CSSStyleSheet {
|
|||
self.global().as_window().Document().invalidate_stylesheets();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn style_stylesheet(&self) -> &StyleStyleSheet {
|
||||
&self.style_stylesheet
|
||||
}
|
||||
}
|
||||
|
||||
impl CSSStyleSheetMethods for CSSStyleSheet {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue