diff options
Diffstat (limited to 'components/script')
25 files changed, 33 insertions, 25 deletions
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 1bc9c165fb1..2ecae0d9d73 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -99,6 +99,7 @@ use style::media_queries::MediaList; use style::properties::PropertyDeclarationBlock; use style::selector_parser::{PseudoElement, Snapshot}; use style::shared_lock::{SharedRwLock as StyleSharedRwLock, Locked as StyleLocked}; +use style::stylearc::Arc as StyleArc; use style::stylesheets::{CssRules, FontFaceRule, KeyframesRule, MediaRule}; use style::stylesheets::{NamespaceRule, StyleRule, ImportRule, SupportsRule}; use style::values::specified::Length; @@ -166,6 +167,12 @@ unsafe impl<T: JSTraceable> JSTraceable for Arc<T> { } } +unsafe impl<T: JSTraceable> JSTraceable for StyleArc<T> { + unsafe fn trace(&self, trc: *mut JSTracer) { + (**self).trace(trc) + } +} + unsafe impl<T: JSTraceable + ?Sized> JSTraceable for Box<T> { unsafe fn trace(&self, trc: *mut JSTracer) { (**self).trace(trc) diff --git a/components/script/dom/cssconditionrule.rs b/components/script/dom/cssconditionrule.rs index 8bf5dad6c93..1944c28c379 100644 --- a/components/script/dom/cssconditionrule.rs +++ b/components/script/dom/cssconditionrule.rs @@ -10,8 +10,8 @@ use dom::cssmediarule::CSSMediaRule; use dom::cssstylesheet::CSSStyleSheet; use dom::csssupportsrule::CSSSupportsRule; use dom_struct::dom_struct; -use std::sync::Arc; use style::shared_lock::{SharedRwLock, Locked}; +use style::stylearc::Arc; use style::stylesheets::CssRules as StyleCssRules; #[dom_struct] diff --git a/components/script/dom/cssfontfacerule.rs b/components/script/dom/cssfontfacerule.rs index 1f247c25fdc..560722d2452 100644 --- a/components/script/dom/cssfontfacerule.rs +++ b/components/script/dom/cssfontfacerule.rs @@ -10,8 +10,8 @@ use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstylesheet::CSSStyleSheet; use dom::window::Window; use dom_struct::dom_struct; -use std::sync::Arc; use style::shared_lock::{Locked, ToCssWithGuard}; +use style::stylearc::Arc; use style::stylesheets::FontFaceRule; #[dom_struct] diff --git a/components/script/dom/cssgroupingrule.rs b/components/script/dom/cssgroupingrule.rs index 249aaccd42e..4fd77b46a7c 100644 --- a/components/script/dom/cssgroupingrule.rs +++ b/components/script/dom/cssgroupingrule.rs @@ -12,8 +12,8 @@ use dom::cssrule::CSSRule; use dom::cssrulelist::{CSSRuleList, RulesSource}; use dom::cssstylesheet::CSSStyleSheet; use dom_struct::dom_struct; -use std::sync::Arc; use style::shared_lock::{SharedRwLock, Locked}; +use style::stylearc::Arc; use style::stylesheets::CssRules as StyleCssRules; #[dom_struct] diff --git a/components/script/dom/cssimportrule.rs b/components/script/dom/cssimportrule.rs index 3c0eb7eb4aa..d9d867cbc19 100644 --- a/components/script/dom/cssimportrule.rs +++ b/components/script/dom/cssimportrule.rs @@ -10,8 +10,8 @@ use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstylesheet::CSSStyleSheet; use dom::window::Window; use dom_struct::dom_struct; -use std::sync::Arc; use style::shared_lock::{Locked, ToCssWithGuard}; +use style::stylearc::Arc; use style::stylesheets::ImportRule; #[dom_struct] diff --git a/components/script/dom/csskeyframerule.rs b/components/script/dom/csskeyframerule.rs index d36e8988e04..46dac811d9f 100644 --- a/components/script/dom/csskeyframerule.rs +++ b/components/script/dom/csskeyframerule.rs @@ -12,9 +12,9 @@ use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSSt use dom::cssstylesheet::CSSStyleSheet; use dom::window::Window; use dom_struct::dom_struct; -use std::sync::Arc; use style::keyframes::Keyframe; use style::shared_lock::{Locked, ToCssWithGuard}; +use style::stylearc::Arc; #[dom_struct] pub struct CSSKeyframeRule { diff --git a/components/script/dom/csskeyframesrule.rs b/components/script/dom/csskeyframesrule.rs index a3715e914ed..f48abe60751 100644 --- a/components/script/dom/csskeyframesrule.rs +++ b/components/script/dom/csskeyframesrule.rs @@ -16,9 +16,9 @@ use dom::cssrulelist::{CSSRuleList, RulesSource}; use dom::cssstylesheet::CSSStyleSheet; use dom::window::Window; use dom_struct::dom_struct; -use std::sync::Arc; use style::keyframes::{Keyframe, KeyframeSelector}; use style::shared_lock::{Locked, ToCssWithGuard}; +use style::stylearc::Arc; use style::stylesheets::KeyframesRule; use style::values::KeyframesName; diff --git a/components/script/dom/cssmediarule.rs b/components/script/dom/cssmediarule.rs index 45bf65b1adf..afc41d31be0 100644 --- a/components/script/dom/cssmediarule.rs +++ b/components/script/dom/cssmediarule.rs @@ -15,10 +15,10 @@ use dom::cssstylesheet::CSSStyleSheet; use dom::medialist::MediaList; use dom::window::Window; use dom_struct::dom_struct; -use std::sync::Arc; use style::media_queries::parse_media_query_list; use style::parser::{LengthParsingMode, ParserContext}; use style::shared_lock::{Locked, ToCssWithGuard}; +use style::stylearc::Arc; use style::stylesheets::{CssRuleType, MediaRule}; use style_traits::ToCss; diff --git a/components/script/dom/cssnamespacerule.rs b/components/script/dom/cssnamespacerule.rs index 744a8020667..eafabf8a4a6 100644 --- a/components/script/dom/cssnamespacerule.rs +++ b/components/script/dom/cssnamespacerule.rs @@ -11,8 +11,8 @@ use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstylesheet::CSSStyleSheet; use dom::window::Window; use dom_struct::dom_struct; -use std::sync::Arc; use style::shared_lock::{Locked, ToCssWithGuard}; +use style::stylearc::Arc; use style::stylesheets::NamespaceRule; #[dom_struct] diff --git a/components/script/dom/cssrulelist.rs b/components/script/dom/cssrulelist.rs index 67eac2beda2..d0dfe120410 100644 --- a/components/script/dom/cssrulelist.rs +++ b/components/script/dom/cssrulelist.rs @@ -13,8 +13,8 @@ use dom::cssrule::CSSRule; use dom::cssstylesheet::CSSStyleSheet; use dom::window::Window; use dom_struct::dom_struct; -use std::sync::Arc; use style::shared_lock::Locked; +use style::stylearc::Arc; use style::stylesheets::{CssRules, CssRulesHelpers, KeyframesRule, RulesMutateError}; #[allow(unsafe_code)] diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs index d0996f04567..8b81201de77 100644 --- a/components/script/dom/cssstyledeclaration.rs +++ b/components/script/dom/cssstyledeclaration.rs @@ -16,13 +16,13 @@ use dom::window::Window; use dom_struct::dom_struct; use servo_url::ServoUrl; use std::ascii::AsciiExt; -use std::sync::Arc; use style::attr::AttrValue; use style::parser::LengthParsingMode; use style::properties::{Importance, PropertyDeclarationBlock, PropertyId, LonghandId, ShorthandId}; use style::properties::{parse_one_declaration, parse_style_attribute}; use style::selector_parser::PseudoElement; use style::shared_lock::Locked; +use style::stylearc::Arc; use style_traits::ToCss; // http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface diff --git a/components/script/dom/cssstylerule.rs b/components/script/dom/cssstylerule.rs index fed2b947f90..607f2cfb816 100644 --- a/components/script/dom/cssstylerule.rs +++ b/components/script/dom/cssstylerule.rs @@ -12,8 +12,8 @@ use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSSt use dom::cssstylesheet::CSSStyleSheet; use dom::window::Window; use dom_struct::dom_struct; -use std::sync::Arc; use style::shared_lock::{Locked, ToCssWithGuard}; +use style::stylearc::Arc; use style::stylesheets::StyleRule; #[dom_struct] diff --git a/components/script/dom/cssstylesheet.rs b/components/script/dom/cssstylesheet.rs index ee097313c2e..cb378b2261a 100644 --- a/components/script/dom/cssstylesheet.rs +++ b/components/script/dom/cssstylesheet.rs @@ -15,8 +15,8 @@ use dom::stylesheet::StyleSheet; use dom::window::Window; use dom_struct::dom_struct; use std::cell::Cell; -use std::sync::Arc; use style::shared_lock::SharedRwLock; +use style::stylearc::Arc; use style::stylesheets::Stylesheet as StyleStyleSheet; #[dom_struct] diff --git a/components/script/dom/csssupportsrule.rs b/components/script/dom/csssupportsrule.rs index 86aedf10864..9a0743856d6 100644 --- a/components/script/dom/csssupportsrule.rs +++ b/components/script/dom/csssupportsrule.rs @@ -13,9 +13,9 @@ use dom::cssrule::SpecificCSSRule; use dom::cssstylesheet::CSSStyleSheet; use dom::window::Window; use dom_struct::dom_struct; -use std::sync::Arc; use style::parser::{LengthParsingMode, ParserContext}; use style::shared_lock::{Locked, ToCssWithGuard}; +use style::stylearc::Arc; use style::stylesheets::{CssRuleType, SupportsRule}; use style::supports::SupportsCondition; use style_traits::ToCss; diff --git a/components/script/dom/cssviewportrule.rs b/components/script/dom/cssviewportrule.rs index 38abf909ff0..4438aabb53e 100644 --- a/components/script/dom/cssviewportrule.rs +++ b/components/script/dom/cssviewportrule.rs @@ -10,8 +10,8 @@ use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstylesheet::CSSStyleSheet; use dom::window::Window; use dom_struct::dom_struct; -use std::sync::Arc; use style::shared_lock::{Locked, ToCssWithGuard}; +use style::stylearc::Arc; use style::viewport::ViewportRule; #[dom_struct] diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 06b8f7596cf..024c201a85c 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -128,7 +128,6 @@ use std::default::Default; use std::iter::once; use std::mem; use std::rc::Rc; -use std::sync::Arc; use std::time::{Duration, Instant}; use style::attr::AttrValue; use style::context::{QuirksMode, ReflowGoal}; @@ -136,6 +135,7 @@ use style::restyle_hints::{RestyleHint, RESTYLE_SELF, RESTYLE_STYLE_ATTRIBUTE}; use style::selector_parser::{RestyleDamage, Snapshot}; use style::shared_lock::SharedRwLock as StyleSharedRwLock; use style::str::{HTML_SPACE_CHARACTERS, split_html_space_chars, str_join}; +use style::stylearc::Arc; use style::stylesheets::Stylesheet; use task_source::TaskSource; use time; diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index d6974fb9075..a7d2d96fe73 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -96,7 +96,6 @@ use std::convert::TryFrom; use std::default::Default; use std::fmt; use std::rc::Rc; -use std::sync::Arc; use style::attr::{AttrValue, LengthOrPercentageOrAuto}; use style::context::{QuirksMode, ReflowGoal}; use style::element_state::*; @@ -107,6 +106,7 @@ use style::rule_tree::CascadeLevel; use style::selector_parser::{NonTSPseudoClass, RestyleDamage, SelectorImpl, SelectorParser}; use style::shared_lock::{SharedRwLock, Locked}; use style::sink::Push; +use style::stylearc::Arc; use style::stylist::ApplicableDeclarationBlock; use style::thread_state; use style::values::CSSFloat; diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs index bf36d28b29d..f3c12a30699 100644 --- a/components/script/dom/htmllinkelement.rs +++ b/components/script/dom/htmllinkelement.rs @@ -30,11 +30,11 @@ use std::ascii::AsciiExt; use std::borrow::ToOwned; use std::cell::Cell; use std::default::Default; -use std::sync::Arc; use style::attr::AttrValue; use style::media_queries::parse_media_query_list; use style::parser::{LengthParsingMode, ParserContext as CssParserContext}; use style::str::HTML_SPACE_CHARACTERS; +use style::stylearc::Arc; use style::stylesheets::{CssRuleType, Stylesheet}; use stylesheet_loader::{StylesheetLoader, StylesheetContextSource, StylesheetOwner}; diff --git a/components/script/dom/htmlmetaelement.rs b/components/script/dom/htmlmetaelement.rs index 62d7215e3df..0c1ac5a0229 100644 --- a/components/script/dom/htmlmetaelement.rs +++ b/components/script/dom/htmlmetaelement.rs @@ -21,11 +21,11 @@ use dom_struct::dom_struct; use html5ever_atoms::LocalName; use servo_config::prefs::PREFS; use std::ascii::AsciiExt; -use std::sync::Arc; use std::sync::atomic::AtomicBool; use style::attr::AttrValue; use style::media_queries::MediaList; use style::str::HTML_SPACE_CHARACTERS; +use style::stylearc::Arc; use style::stylesheets::{Stylesheet, CssRule, CssRules, Origin}; use style::viewport::ViewportRule; diff --git a/components/script/dom/htmlobjectelement.rs b/components/script/dom/htmlobjectelement.rs index c80a7838198..ee847610791 100755 --- a/components/script/dom/htmlobjectelement.rs +++ b/components/script/dom/htmlobjectelement.rs @@ -21,7 +21,7 @@ use dom_struct::dom_struct; use html5ever_atoms::LocalName; use net_traits::image::base::Image; use std::default::Default; -use std::sync::Arc; +use style::stylearc::Arc; #[dom_struct] pub struct HTMLObjectElement { diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs index 8905c3baa65..8b9a2c74fcb 100644 --- a/components/script/dom/htmlstyleelement.rs +++ b/components/script/dom/htmlstyleelement.rs @@ -23,9 +23,9 @@ use html5ever_atoms::LocalName; use net_traits::ReferrerPolicy; use script_layout_interface::message::Msg; use std::cell::Cell; -use std::sync::Arc; use style::media_queries::parse_media_query_list; use style::parser::{LengthParsingMode, ParserContext as CssParserContext}; +use style::stylearc::Arc; use style::stylesheets::{CssRuleType, Stylesheet, Origin}; use stylesheet_loader::{StylesheetLoader, StylesheetOwner}; diff --git a/components/script/dom/medialist.rs b/components/script/dom/medialist.rs index f2a2299d169..514bccecc4a 100644 --- a/components/script/dom/medialist.rs +++ b/components/script/dom/medialist.rs @@ -12,11 +12,11 @@ use dom::bindings::str::DOMString; use dom::cssstylesheet::CSSStyleSheet; use dom::window::Window; use dom_struct::dom_struct; -use std::sync::Arc; use style::media_queries::{MediaQuery, parse_media_query_list}; use style::media_queries::MediaList as StyleMediaList; use style::parser::{LengthParsingMode, ParserContext}; use style::shared_lock::{SharedRwLock, Locked}; +use style::stylearc::Arc; use style::stylesheets::CssRuleType; use style_traits::ToCss; diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 0384c4ed19d..aa0fcc9a2a1 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -78,10 +78,10 @@ use std::default::Default; use std::iter; use std::mem; use std::ops::Range; -use std::sync::Arc; use style::context::QuirksMode; use style::dom::OpaqueNode; use style::selector_parser::{SelectorImpl, SelectorParser}; +use style::stylearc::Arc; use style::stylesheets::Stylesheet; use style::thread_state; use uuid::Uuid; diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs index 3ddb1d2b5c9..5fe45595388 100644 --- a/components/script/layout_wrapper.rs +++ b/components/script/layout_wrapper.rs @@ -58,7 +58,6 @@ use std::fmt::Debug; use std::hash::{Hash, Hasher}; use std::marker::PhantomData; use std::mem::transmute; -use std::sync::Arc; use std::sync::atomic::Ordering; use style; use style::attr::AttrValue; @@ -74,6 +73,7 @@ use style::selector_parser::{NonTSPseudoClass, PseudoElement, SelectorImpl}; use style::shared_lock::{SharedRwLock as StyleSharedRwLock, Locked as StyleLocked}; use style::sink::Push; use style::str::is_whitespace; +use style::stylearc::Arc; use style::stylist::ApplicableDeclarationBlock; #[derive(Copy, Clone)] diff --git a/components/script/stylesheet_loader.rs b/components/script/stylesheet_loader.rs index 14b8c385e39..3143d8b34ad 100644 --- a/components/script/stylesheet_loader.rs +++ b/components/script/stylesheet_loader.rs @@ -24,9 +24,10 @@ use net_traits::request::{CorsSettings, CredentialsMode, Destination, RequestIni use network_listener::{NetworkListener, PreInvoke}; use servo_url::ServoUrl; use std::mem; -use std::sync::{Arc, Mutex}; +use std::sync::Mutex; use style::media_queries::MediaList; use style::shared_lock::Locked as StyleLocked; +use style::stylearc::Arc; use style::stylesheets::{ImportRule, Stylesheet, Origin}; use style::stylesheets::StylesheetLoader as StyleStylesheetLoader; @@ -207,7 +208,7 @@ impl<'a> StylesheetLoader<'a> { let document = document_from_node(self.elem); let gen = self.elem.downcast::<HTMLLinkElement>() .map(HTMLLinkElement::get_request_generation_id); - let context = Arc::new(Mutex::new(StylesheetContext { + let context = ::std::sync::Arc::new(Mutex::new(StylesheetContext { elem: Trusted::new(&*self.elem), source: source, url: url.clone(), |