aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/bindings/trace.rs2
-rw-r--r--components/script/dom/cssstyledeclaration.rs4
-rw-r--r--components/script/dom/element.rs39
-rw-r--r--components/script/dom/htmlstyleelement.rs5
-rw-r--r--components/script/dom/node.rs23
5 files changed, 39 insertions, 34 deletions
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs
index d2af1ebe968..d814b3b6d12 100644
--- a/components/script/dom/bindings/trace.rs
+++ b/components/script/dom/bindings/trace.rs
@@ -58,7 +58,7 @@ use std::io::timer::Timer;
use std::rc::Rc;
use std::sync::mpsc::{Receiver, Sender};
use string_cache::{Atom, Namespace};
-use style::PropertyDeclarationBlock;
+use style::properties::PropertyDeclarationBlock;
use url::Url;
diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs
index 49a6bfbeae3..2de0942f968 100644
--- a/components/script/dom/cssstyledeclaration.rs
+++ b/components/script/dom/cssstyledeclaration.rs
@@ -17,8 +17,8 @@ use dom::node::{window_from_node, document_from_node, NodeDamage, Node};
use dom::window::Window;
use util::str::DOMString;
use string_cache::Atom;
-use style::{is_supported_property, longhands_from_shorthand, parse_style_attribute};
-use style::PropertyDeclaration;
+use style::properties::{is_supported_property, longhands_from_shorthand, parse_style_attribute};
+use style::properties::PropertyDeclaration;
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index 540916c027e..84f3d88ac7d 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -50,8 +50,11 @@ use dom::node::{window_from_node};
use dom::nodelist::NodeList;
use dom::virtualmethods::{VirtualMethods, vtable_for};
use devtools_traits::AttrInfo;
-use style::{self, SimpleColorAttribute, UnsignedIntegerAttribute};
-use style::{IntegerAttribute, LengthAttribute, matches};
+use style::legacy::{SimpleColorAttribute, UnsignedIntegerAttribute, IntegerAttribute, LengthAttribute};
+use style::selector_matching::matches;
+use style::properties::{PropertyDeclarationBlock, PropertyDeclaration, parse_style_attribute};
+use style::selectors::parse_author_origin_selector_list_from_str;
+use style;
use util::namespace;
use util::str::{DOMString, LengthOrPercentageOrAuto};
@@ -74,7 +77,7 @@ pub struct Element {
namespace: Namespace,
prefix: Option<DOMString>,
attrs: DOMRefCell<Vec<JS<Attr>>>,
- style_attribute: DOMRefCell<Option<style::PropertyDeclarationBlock>>,
+ style_attribute: DOMRefCell<Option<PropertyDeclarationBlock>>,
attr_list: MutNullableJS<NamedNodeMap>,
class_list: MutNullableJS<DOMTokenList>,
}
@@ -152,7 +155,7 @@ pub trait RawLayoutElementHelpers {
-> Option<RGBA>;
fn local_name<'a>(&'a self) -> &'a Atom;
fn namespace<'a>(&'a self) -> &'a Namespace;
- fn style_attribute<'a>(&'a self) -> &'a DOMRefCell<Option<style::PropertyDeclarationBlock>>;
+ fn style_attribute<'a>(&'a self) -> &'a DOMRefCell<Option<PropertyDeclarationBlock>>;
}
#[inline]
@@ -363,7 +366,7 @@ impl RawLayoutElementHelpers for Element {
&self.namespace
}
- fn style_attribute<'a>(&'a self) -> &'a DOMRefCell<Option<style::PropertyDeclarationBlock>> {
+ fn style_attribute<'a>(&'a self) -> &'a DOMRefCell<Option<PropertyDeclarationBlock>> {
&self.style_attribute
}
}
@@ -402,13 +405,13 @@ pub trait ElementHelpers<'a> {
fn prefix(self) -> &'a Option<DOMString>;
fn attrs(&self) -> Ref<Vec<JS<Attr>>>;
fn attrs_mut(&self) -> RefMut<Vec<JS<Attr>>>;
- fn style_attribute(self) -> &'a DOMRefCell<Option<style::PropertyDeclarationBlock>>;
+ fn style_attribute(self) -> &'a DOMRefCell<Option<PropertyDeclarationBlock>>;
fn summarize(self) -> Vec<AttrInfo>;
fn is_void(self) -> bool;
fn remove_inline_style_property(self, property: DOMString);
- fn update_inline_style(self, property_decl: style::PropertyDeclaration, style_priority: StylePriority);
- fn get_inline_style_declaration(self, property: &Atom) -> Option<style::PropertyDeclaration>;
- fn get_important_inline_style_declaration(self, property: &Atom) -> Option<style::PropertyDeclaration>;
+ fn update_inline_style(self, property_decl: PropertyDeclaration, style_priority: StylePriority);
+ fn get_inline_style_declaration(self, property: &Atom) -> Option<PropertyDeclaration>;
+ fn get_important_inline_style_declaration(self, property: &Atom) -> Option<PropertyDeclaration>;
}
impl<'a> ElementHelpers<'a> for JSRef<'a, Element> {
@@ -446,7 +449,7 @@ impl<'a> ElementHelpers<'a> for JSRef<'a, Element> {
self.extended_deref().attrs.borrow_mut()
}
- fn style_attribute(self) -> &'a DOMRefCell<Option<style::PropertyDeclarationBlock>> {
+ fn style_attribute(self) -> &'a DOMRefCell<Option<PropertyDeclarationBlock>> {
&self.extended_deref().style_attribute
}
@@ -503,7 +506,7 @@ impl<'a> ElementHelpers<'a> for JSRef<'a, Element> {
});
}
- fn update_inline_style(self, property_decl: style::PropertyDeclaration, style_priority: StylePriority) {
+ fn update_inline_style(self, property_decl: PropertyDeclaration, style_priority: StylePriority) {
let mut inline_declarations = self.style_attribute().borrow_mut();
if let &mut Some(ref mut declarations) = &mut *inline_declarations {
let existing_declarations = if style_priority == StylePriority::Important {
@@ -528,13 +531,13 @@ impl<'a> ElementHelpers<'a> for JSRef<'a, Element> {
(vec!(), vec!(property_decl))
};
- *inline_declarations = Some(style::PropertyDeclarationBlock {
+ *inline_declarations = Some(PropertyDeclarationBlock {
important: Arc::new(important),
normal: Arc::new(normal),
});
}
- fn get_inline_style_declaration(self, property: &Atom) -> Option<style::PropertyDeclaration> {
+ fn get_inline_style_declaration(self, property: &Atom) -> Option<PropertyDeclaration> {
let inline_declarations = self.style_attribute.borrow();
inline_declarations.as_ref().and_then(|declarations| {
declarations.normal
@@ -545,7 +548,7 @@ impl<'a> ElementHelpers<'a> for JSRef<'a, Element> {
})
}
- fn get_important_inline_style_declaration(self, property: &Atom) -> Option<style::PropertyDeclaration> {
+ fn get_important_inline_style_declaration(self, property: &Atom) -> Option<PropertyDeclaration> {
let inline_declarations = self.style_attribute.borrow();
inline_declarations.as_ref().and_then(|declarations| {
declarations.important
@@ -1117,7 +1120,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
// http://dom.spec.whatwg.org/#dom-element-matches
fn Matches(self, selectors: DOMString) -> Fallible<bool> {
- match style::parse_author_origin_selector_list_from_str(selectors.as_slice()) {
+ match parse_author_origin_selector_list_from_str(selectors.as_slice()) {
Err(()) => Err(Syntax),
Ok(ref selectors) => {
let root: JSRef<Node> = NodeCast::from_ref(self);
@@ -1128,7 +1131,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
// https://dom.spec.whatwg.org/#dom-element-closest
fn Closest(self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>> {
- match style::parse_author_origin_selector_list_from_str(selectors.as_slice()) {
+ match parse_author_origin_selector_list_from_str(selectors.as_slice()) {
Err(()) => Err(Syntax),
Ok(ref selectors) => {
let root: JSRef<Node> = NodeCast::from_ref(self);
@@ -1173,7 +1176,7 @@ impl<'a> VirtualMethods for JSRef<'a, Element> {
let doc = document_from_node(*self).root();
let base_url = doc.r().url().clone();
let value = attr.value();
- let style = Some(style::parse_style_attribute(value.as_slice(), &base_url));
+ let style = Some(parse_style_attribute(value.as_slice(), &base_url));
*self.style_attribute.borrow_mut() = style;
if node.is_in_doc() {
@@ -1312,7 +1315,7 @@ impl<'a> VirtualMethods for JSRef<'a, Element> {
}
}
-impl<'a> style::TElement<'a> for JSRef<'a, Element> {
+impl<'a> style::node::TElement<'a> for JSRef<'a, Element> {
#[allow(unsafe_blocks)]
fn get_attr(self, namespace: &Namespace, attr: &Atom) -> Option<&'a str> {
self.get_attribute(namespace.clone(), attr).root().map(|attr| {
diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs
index 5769ed56142..e39915ad848 100644
--- a/components/script/dom/htmlstyleelement.rs
+++ b/components/script/dom/htmlstyleelement.rs
@@ -14,7 +14,7 @@ use dom::node::{Node, NodeHelpers, NodeTypeId, window_from_node};
use dom::virtualmethods::VirtualMethods;
use layout_interface::{LayoutChan, Msg};
use util::str::DOMString;
-use style::{StylesheetOrigin, Stylesheet};
+use style::stylesheets::{Origin, Stylesheet};
#[dom_struct]
pub struct HTMLStyleElement {
@@ -55,8 +55,7 @@ impl<'a> StyleElementHelpers for JSRef<'a, HTMLStyleElement> {
let url = win.page().get_url();
let data = node.GetTextContent().expect("Element.textContent must be a string");
- let sheet = Stylesheet::from_str(data.as_slice(), url,
- StylesheetOrigin::Author);
+ let sheet = Stylesheet::from_str(data.as_slice(), url, Origin::Author);
let LayoutChan(ref layout_chan) = win.page().layout_chan;
layout_chan.send(Msg::AddStylesheet(sheet));
}
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 7b68f7ba6b8..38b6846193c 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -48,7 +48,11 @@ use devtools_traits::NodeInfo;
use script_traits::UntrustedNodeAddress;
use util::geometry::Au;
use util::str::{DOMString, null_str_as_empty};
-use style::{matches, SelectorList};
+use style::selectors::{Selector, AttrSelector, NamespaceConstraint};
+use style::selectors::parse_author_origin_selector_list_from_str;
+use style::selector_matching::matches;
+use style::properties::ComputedValues;
+use style;
use js::jsapi::{JSContext, JSObject, JSTracer, JSRuntime};
use js::jsfriendapi;
@@ -60,7 +64,6 @@ use std::cell::{Cell, RefCell, Ref, RefMut};
use std::default::Default;
use std::iter::{FilterMap, Peekable};
use std::mem;
-use style::{self, ComputedValues};
use std::sync::Arc;
use uuid;
use string_cache::QualName;
@@ -376,12 +379,12 @@ impl<'a> PrivateNodeHelpers for JSRef<'a, Node> {
}
pub struct QuerySelectorIterator<'a> {
- selectors: SelectorList,
+ selectors: Vec<Selector>,
iterator: TreeIterator<'a>,
}
impl<'a> QuerySelectorIterator<'a> {
- unsafe fn new(iter: TreeIterator<'a>, selectors: SelectorList) -> QuerySelectorIterator<'a> {
+ unsafe fn new(iter: TreeIterator<'a>, selectors: Vec<Selector>) -> QuerySelectorIterator<'a> {
QuerySelectorIterator {
selectors: selectors,
iterator: iter,
@@ -746,7 +749,7 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
// http://dom.spec.whatwg.org/#dom-parentnode-queryselector
fn query_selector(self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>> {
// Step 1.
- match style::parse_author_origin_selector_list_from_str(selectors.as_slice()) {
+ match parse_author_origin_selector_list_from_str(selectors.as_slice()) {
// Step 2.
Err(()) => return Err(Syntax),
// Step 3.
@@ -768,7 +771,7 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
// Step 1.
let nodes;
let root = self.ancestors().last().unwrap_or(self.clone());
- match style::parse_author_origin_selector_list_from_str(selectors.as_slice()) {
+ match parse_author_origin_selector_list_from_str(selectors.as_slice()) {
// Step 2.
Err(()) => return Err(Syntax),
// Step 3.
@@ -2229,7 +2232,7 @@ impl<'a> VirtualMethods for JSRef<'a, Node> {
}
}
-impl<'a> style::TNode<'a, JSRef<'a, Element>> for JSRef<'a, Node> {
+impl<'a> style::node::TNode<'a, JSRef<'a, Element>> for JSRef<'a, Node> {
fn parent_node(self) -> Option<JSRef<'a, Node>> {
// FIXME(zwarich): Remove this when UFCS lands and there is a better way
// of disambiguating methods.
@@ -2304,7 +2307,7 @@ impl<'a> style::TNode<'a, JSRef<'a, Element>> for JSRef<'a, Node> {
ElementCast::to_ref(self).unwrap()
}
- fn match_attr<F>(self, attr: &style::AttrSelector, test: F) -> bool
+ fn match_attr<F>(self, attr: &AttrSelector, test: F) -> bool
where F: Fn(&str) -> bool
{
let name = {
@@ -2315,11 +2318,11 @@ impl<'a> style::TNode<'a, JSRef<'a, Element>> for JSRef<'a, Node> {
}
};
match attr.namespace {
- style::NamespaceConstraint::Specific(ref ns) => {
+ NamespaceConstraint::Specific(ref ns) => {
self.as_element().get_attribute(ns.clone(), name).root()
.map_or(false, |attr| test(attr.r().value().as_slice()))
},
- style::NamespaceConstraint::Any => {
+ NamespaceConstraint::Any => {
self.as_element().get_attributes(name).into_iter()
.map(|attr| attr.root())
.any(|attr| test(attr.r().value().as_slice()))