aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/bindings/trace.rs2
-rw-r--r--components/script/dom/cssstylerule.rs26
-rw-r--r--components/script/dom/document.rs3
3 files changed, 18 insertions, 13 deletions
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs
index 387709d7332..7cad9f98523 100644
--- a/components/script/dom/bindings/trace.rs
+++ b/components/script/dom/bindings/trace.rs
@@ -550,7 +550,7 @@ unsafe impl JSTraceable for StyleLocked<NamespaceRule> {
}
}
-unsafe impl JSTraceable for RwLock<StyleRule> {
+unsafe impl JSTraceable for StyleLocked<StyleRule> {
unsafe fn trace(&self, _trc: *mut JSTracer) {
// Do nothing.
}
diff --git a/components/script/dom/cssstylerule.rs b/components/script/dom/cssstylerule.rs
index 2423861e446..fed2b947f90 100644
--- a/components/script/dom/cssstylerule.rs
+++ b/components/script/dom/cssstylerule.rs
@@ -12,21 +12,20 @@ use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSSt
use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window;
use dom_struct::dom_struct;
-use parking_lot::RwLock;
use std::sync::Arc;
-use style::shared_lock::ToCssWithGuard;
+use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylesheets::StyleRule;
#[dom_struct]
pub struct CSSStyleRule {
cssrule: CSSRule,
#[ignore_heap_size_of = "Arc"]
- stylerule: Arc<RwLock<StyleRule>>,
+ stylerule: Arc<Locked<StyleRule>>,
style_decl: MutNullableJS<CSSStyleDeclaration>,
}
impl CSSStyleRule {
- fn new_inherited(parent_stylesheet: &CSSStyleSheet, stylerule: Arc<RwLock<StyleRule>>)
+ fn new_inherited(parent_stylesheet: &CSSStyleSheet, stylerule: Arc<Locked<StyleRule>>)
-> CSSStyleRule {
CSSStyleRule {
cssrule: CSSRule::new_inherited(parent_stylesheet),
@@ -37,7 +36,7 @@ impl CSSStyleRule {
#[allow(unrooted_must_root)]
pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet,
- stylerule: Arc<RwLock<StyleRule>>) -> Root<CSSStyleRule> {
+ stylerule: Arc<Locked<StyleRule>>) -> Root<CSSStyleRule> {
reflect_dom_object(box CSSStyleRule::new_inherited(parent_stylesheet, stylerule),
window,
CSSStyleRuleBinding::Wrap)
@@ -52,7 +51,7 @@ impl SpecificCSSRule for CSSStyleRule {
fn get_css(&self) -> DOMString {
let guard = self.cssrule.shared_lock().read();
- self.stylerule.read().to_css_string(&guard).into()
+ self.stylerule.read_with(&guard).to_css_string(&guard).into()
}
}
@@ -60,11 +59,16 @@ impl CSSStyleRuleMethods for CSSStyleRule {
// https://drafts.csswg.org/cssom/#dom-cssstylerule-style
fn Style(&self) -> Root<CSSStyleDeclaration> {
self.style_decl.or_init(|| {
- CSSStyleDeclaration::new(self.global().as_window(),
- CSSStyleOwner::CSSRule(JS::from_ref(self.upcast()),
- self.stylerule.read().block.clone()),
- None,
- CSSModificationAccess::ReadWrite)
+ let guard = self.cssrule.shared_lock().read();
+ CSSStyleDeclaration::new(
+ self.global().as_window(),
+ CSSStyleOwner::CSSRule(
+ JS::from_ref(self.upcast()),
+ self.stylerule.read_with(&guard).block.clone()
+ ),
+ None,
+ CSSModificationAccess::ReadWrite
+ )
})
}
}
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 7a50fe5cf6c..b875c75d837 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -134,6 +134,7 @@ use style::attr::AttrValue;
use style::context::{QuirksMode, ReflowGoal};
use style::restyle_hints::{RestyleHint, RESTYLE_STYLE_ATTRIBUTE};
use style::selector_parser::{RestyleDamage, Snapshot};
+use style::servo::AUTHOR_SHARED_LOCK;
use style::shared_lock::SharedRwLock as StyleSharedRwLock;
use style::str::{HTML_SPACE_CHARACTERS, split_html_space_chars, str_join};
use style::stylesheets::Stylesheet;
@@ -2131,7 +2132,7 @@ impl Document {
scripts: Default::default(),
anchors: Default::default(),
applets: Default::default(),
- style_shared_lock: StyleSharedRwLock::new(),
+ style_shared_lock: AUTHOR_SHARED_LOCK.clone(),
stylesheets: DOMRefCell::new(None),
stylesheets_changed_since_reflow: Cell::new(false),
stylesheet_list: MutNullableJS::new(None),