Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose public getter to stylesheet's owner #23073

Merged
merged 1 commit into from Mar 23, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -6,12 +6,15 @@ use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::CSSRuleListBinding;
use crate::dom::bindings::codegen::Bindings::CSSRuleListBinding::CSSRuleListMethods;
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
use crate::dom::csskeyframerule::CSSKeyframeRule;
use crate::dom::cssrule::CSSRule;
use crate::dom::cssstylesheet::CSSStyleSheet;
use crate::dom::htmlelement::HTMLElement;
use crate::dom::window::Window;
use crate::stylesheet_loader::StylesheetLoader;
use dom_struct::dom_struct;
use servo_arc::Arc;
use style::shared_lock::Locked;
@@ -101,14 +104,20 @@ impl CSSRuleList {
let index = idx as usize;

let parent_stylesheet = self.parent_stylesheet.style_stylesheet();
let owner = self
.parent_stylesheet
.get_owner()
.downcast::<HTMLElement>()
.unwrap();
let loader = StylesheetLoader::for_element(owner);
let new_rule = css_rules.with_raw_offset_arc(|arc| {
arc.insert_rule(
&parent_stylesheet.shared_lock,
rule,
&parent_stylesheet.contents,
index,
nested,
None,
Some(&loader),
)
})?;

@@ -75,6 +75,10 @@ impl CSSStyleSheet {
self.style_stylesheet.disabled()
}

pub fn get_owner(&self) -> &Element {
&*self.owner
}

pub fn set_disabled(&self, disabled: bool) {
if self.style_stylesheet.set_disabled(disabled) {
self.global()
@@ -1,5 +1,8 @@
{
"items": {
"conformancechecker": {
"css/cssom/stylesheet-owner.html": []
},
"manual": {
"2dcontext/conformance-requirements/2d.coordinatespace-manual.html": [
[
{}
]
],
"css/cssom/stylesheet-owner.html": [],
"css/selectors/focus-visible-001-manual.html": [
[
"css/selectors/focus-visible-001-manual.html",
{}
]
],
"css/cssom/insertRule-from-script.html": [
[
"css/cssom/insertRule-from-script.html",
[
[
"/css/cssom/insertRule-from-script-ref.html",
"=="
]
],
{}
]
],
"css/cssom/medialist-dynamic-001.html": [
[
"css/cssom/medialist-dynamic-001.html",
]
},
"stub": {
"css/cssom/stylesheet-owner.html": [],
"service-workers/stub-3.1-service-worker-obj.html": [
[
"service-workers/stub-3.1-service-worker-obj.html",
{}
]
],
"css/cssom/insertRule-from-script-ref.html": [
[
{}
]
],
"css/cssom/medialist-dynamic-001-ref.html": [
[
{}
{}
]
],
"css/cssom/stylesheet-owner.html": [],
"css/cssom/stylesheet-replacedata-dynamic-ref.html": [
[
{}
{}
]
],
"css/cssom/support/black.css": [
[
{}
]
],
"css/cssom/support/c-red.css": [
[
{}
{}
]
],
"css/cssom/stylesheet-owner.html": [],
"css/cssom/stylesheet-same-origin.sub.html": [
[
"css/cssom/stylesheet-same-origin.sub.html",
{}
]
],
"css/cssom/stylesheet-owner.html": [],
"css/mediaqueries/media-queries-001.xht": [
[
"css/mediaqueries/media-queries-001.xht",
]
},
"wdspec": {
"css/cssom/stylesheet-owner.html": [],
"infrastructure/webdriver/tests/test_load_file.py": [
[
"infrastructure/webdriver/tests/test_load_file.py",
"16f2358dc2d806de878bf2a1403aec9e6c41d9bd",
"testharness"
],
"css/cssom/insertRule-from-script-ref.html": [
"2fa45526a66565f86832f843ec477fe76e496775",
"support"
],
"css/cssom/insertRule-from-script.html": [
"c364afc282b061ef6520b9f8c9b5271f0b11d000",
"reftest"
],
"css/cssom/insertRule-import-no-index.html": [
"ad3622f86aaa4dfd58ee18015d1ef8dd1ebd6a70",
"testharness"
"a0473f5ca26652c1229290bbf1f81eabc1e37280",
"support"
],
"css/cssom/support/black.css": [
"833a0e00926ba4eb4615d177df63747cdb23f321",
"support"
],
"css/cssom/support/c-red.css": [
"d4ba5c64e95406f541e2f8cc19e192e9f521ed6b",
"support"

This file was deleted.

@@ -0,0 +1,6 @@
<!doctype html>
<head>
<meta charset="utf-8">
<title>insertrule @import test reference</title>
<link rel="stylesheet" href="support/black.css">
</head>
@@ -0,0 +1,12 @@
<!doctype html>
<head>
<meta charset="utf-8">
<title>insertrule @import test</title>
<link rel="help" href="https://drafts.csswg.org/cssom/">
<link rel="help" href="http://www.w3.org/TR/cssom-1/#the-cssrule-interface">
<link rel="match" href="insertRule-from-script-ref.html">
<style></style>
</head>
<body>
<script>document.styleSheets[0].insertRule("@import url(\"support/black.css\");");</script>
</body>
@@ -0,0 +1,4 @@
html {
background-color: black;
color: white;
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.