diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-11-29 01:28:06 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-29 01:28:06 -0800 |
commit | 40917e7991ddd0f1fdcf83f0bf637a721f37256a (patch) | |
tree | 5ce0922ab4ca83480923276ac45285dab4f5704b /components/script/dom/cssgroupingrule.rs | |
parent | 2c05bf3c427fd6f14c1eae22de0241a4c4ac7769 (diff) | |
parent | 70b250fe2ac43658a823cf5de4eb636f7b603d3d (diff) | |
download | servo-40917e7991ddd0f1fdcf83f0bf637a721f37256a.tar.gz servo-40917e7991ddd0f1fdcf83f0bf637a721f37256a.zip |
Auto merge of #14395 - servo:stylesheet-metadata, r=Manishearth
Use stylesheet’s base URL and ns prefixes in CSSOM insert/appendRule.
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).
<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14395)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/cssgroupingrule.rs')
-rw-r--r-- | components/script/dom/cssgroupingrule.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/components/script/dom/cssgroupingrule.rs b/components/script/dom/cssgroupingrule.rs index cd55cd358b6..aa381dcbaec 100644 --- a/components/script/dom/cssgroupingrule.rs +++ b/components/script/dom/cssgroupingrule.rs @@ -4,7 +4,6 @@ use dom::bindings::codegen::Bindings::CSSGroupingRuleBinding; use dom::bindings::codegen::Bindings::CSSGroupingRuleBinding::CSSGroupingRuleMethods; -use dom::bindings::codegen::Bindings::CSSRuleBinding::CSSRuleBinding::CSSRuleMethods; use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::js::{JS, MutNullableHeap, Root}; @@ -25,27 +24,26 @@ pub struct CSSGroupingRule { } impl CSSGroupingRule { - pub fn new_inherited(parent: Option<&CSSStyleSheet>, + pub fn new_inherited(parent_stylesheet: &CSSStyleSheet, rules: StyleCssRules) -> CSSGroupingRule { CSSGroupingRule { - cssrule: CSSRule::new_inherited(parent), + cssrule: CSSRule::new_inherited(parent_stylesheet), rules: rules, rulelist: MutNullableHeap::new(None), } } #[allow(unrooted_must_root)] - pub fn new(window: &Window, parent: Option<&CSSStyleSheet>, rules: StyleCssRules) -> Root<CSSGroupingRule> { - reflect_dom_object(box CSSGroupingRule::new_inherited(parent, rules), + pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet, rules: StyleCssRules) -> Root<CSSGroupingRule> { + reflect_dom_object(box CSSGroupingRule::new_inherited(parent_stylesheet, rules), window, CSSGroupingRuleBinding::Wrap) } fn rulelist(&self) -> Root<CSSRuleList> { - let sheet = self.upcast::<CSSRule>().GetParentStyleSheet(); - let sheet = sheet.as_ref().map(|s| &**s); + let parent_stylesheet = self.upcast::<CSSRule>().parent_stylesheet(); self.rulelist.or_init(|| CSSRuleList::new(self.global().as_window(), - sheet, + parent_stylesheet, RulesSource::Rules(self.rules.clone()))) } } |