Update selectors to 0.10, with ToCss serialization.

This commit is contained in:
Simon Sapin 2016-08-18 14:25:24 +02:00
parent 4e7c689a81
commit d690bd2382
20 changed files with 186 additions and 62 deletions

View file

@ -33,7 +33,7 @@ range = {path = "../range"}
rustc-serialize = "0.3" rustc-serialize = "0.3"
script_layout_interface = {path = "../script_layout_interface"} script_layout_interface = {path = "../script_layout_interface"}
script_traits = {path = "../script_traits"} script_traits = {path = "../script_traits"}
selectors = {version = "0.9", features = ["heap_size"]} selectors = {version = "0.10", features = ["heap_size"]}
serde_macros = "0.8" serde_macros = "0.8"
smallvec = "0.1" smallvec = "0.1"
string_cache = {version = "0.2.23", features = ["heap_size"]} string_cache = {version = "0.2.23", features = ["heap_size"]}

View file

@ -65,7 +65,7 @@ regex = "0.1.43"
rustc-serialize = "0.3" rustc-serialize = "0.3"
script_layout_interface = {path = "../script_layout_interface"} script_layout_interface = {path = "../script_layout_interface"}
script_traits = {path = "../script_traits"} script_traits = {path = "../script_traits"}
selectors = {version = "0.9", features = ["heap_size"]} selectors = {version = "0.10", features = ["heap_size"]}
serde = "0.8" serde = "0.8"
smallvec = "0.1" smallvec = "0.1"
string_cache = {version = "0.2.23", features = ["heap_size", "unstable"]} string_cache = {version = "0.2.23", features = ["heap_size", "unstable"]}

View file

@ -2250,7 +2250,7 @@ impl<'a> ::selectors::MatchAttrGeneric for Root<Element> {
}; };
match attr.namespace { match attr.namespace {
NamespaceConstraint::Specific(ref ns) => { NamespaceConstraint::Specific(ref ns) => {
self.get_attribute(ns, local_name) self.get_attribute(&ns.url, local_name)
.map_or(false, |attr| { .map_or(false, |attr| {
test(&attr.value()) test(&attr.value())
}) })

View file

@ -483,7 +483,7 @@ impl<'le> ::selectors::MatchAttrGeneric for ServoLayoutElement<'le> {
}; };
match attr.namespace { match attr.namespace {
NamespaceConstraint::Specific(ref ns) => { NamespaceConstraint::Specific(ref ns) => {
self.get_attr(ns, name).map_or(false, |attr| test(attr)) self.get_attr(&ns.url, name).map_or(false, |attr| test(attr))
}, },
NamespaceConstraint::Any => { NamespaceConstraint::Any => {
let attrs = unsafe { let attrs = unsafe {
@ -970,7 +970,7 @@ impl<'le> ::selectors::MatchAttrGeneric for ServoThreadSafeLayoutElement<'le> {
where F: Fn(&str) -> bool { where F: Fn(&str) -> bool {
match attr.namespace { match attr.namespace {
NamespaceConstraint::Specific(ref ns) => { NamespaceConstraint::Specific(ref ns) => {
self.get_attr(ns, &attr.name).map_or(false, |attr| test(attr)) self.get_attr(&ns.url, &attr.name).map_or(false, |attr| test(attr))
}, },
NamespaceConstraint::Any => { NamespaceConstraint::Any => {
unsafe { unsafe {

View file

@ -27,7 +27,7 @@ plugins = {path = "../plugins"}
profile_traits = {path = "../profile_traits"} profile_traits = {path = "../profile_traits"}
range = {path = "../range"} range = {path = "../range"}
script_traits = {path = "../script_traits"} script_traits = {path = "../script_traits"}
selectors = {version = "0.9", features = ["heap_size"]} selectors = {version = "0.10", features = ["heap_size"]}
string_cache = {version = "0.2.23", features = ["heap_size"]} string_cache = {version = "0.2.23", features = ["heap_size"]}
style = {path = "../style"} style = {path = "../style"}
url = {version = "1.2", features = ["heap_size"]} url = {version = "1.2", features = ["heap_size"]}

View file

@ -790,7 +790,7 @@ dependencies = [
"servo-fontconfig 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "servo-fontconfig 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"simd 0.1.0 (git+https://github.com/huonw/simd)", "simd 0.1.0 (git+https://github.com/huonw/simd)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
@ -956,7 +956,7 @@ dependencies = [
"phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1162,10 +1162,10 @@ dependencies = [
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"script_layout_interface 0.0.1", "script_layout_interface 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1931,10 +1931,10 @@ dependencies = [
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"script_layout_interface 0.0.1", "script_layout_interface 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"tinyfiledialogs 0.1.0 (git+https://github.com/jdm/tinyfiledialogs)", "tinyfiledialogs 0.1.0 (git+https://github.com/jdm/tinyfiledialogs)",
@ -1968,8 +1968,8 @@ dependencies = [
"profile_traits 0.0.1", "profile_traits 0.0.1",
"range 0.0.1", "range 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1", "util 0.0.1",
@ -2017,7 +2017,7 @@ dependencies = [
[[package]] [[package]]
name = "selectors" name = "selectors"
version = "0.9.0" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2028,7 +2028,7 @@ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "quickersort 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -2205,7 +2205,7 @@ dependencies = [
[[package]] [[package]]
name = "string_cache" name = "string_cache"
version = "0.2.23" version = "0.2.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2239,11 +2239,11 @@ dependencies = [
"plugins 0.0.1", "plugins 0.0.1",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1", "style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2259,8 +2259,8 @@ dependencies = [
"cssparser 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2710,7 +2710,7 @@ dependencies = [
"phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
] ]

View file

@ -38,11 +38,11 @@ num-traits = "0.1.32"
ordered-float = "0.2.2" ordered-float = "0.2.2"
rand = "0.3" rand = "0.3"
rustc-serialize = "0.3" rustc-serialize = "0.3"
selectors = "0.9" selectors = "0.10.1"
serde = {version = "0.8", optional = true} serde = {version = "0.8", optional = true}
serde_macros = {version = "0.8", optional = true} serde_macros = {version = "0.8", optional = true}
smallvec = "0.1" smallvec = "0.1"
string_cache = {version = "0.2.23", features = ["heap_size"], optional = true} string_cache = {version = "0.2.24", features = ["heap_size"], optional = true}
style_traits = {path = "../style_traits"} style_traits = {path = "../style_traits"}
time = "0.1" time = "0.1"
url = "1.2" url = "1.2"

View file

@ -2,10 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::ToCss;
use element_state::ElementState; use element_state::ElementState;
use selector_impl::PseudoElementCascadeType; use selector_impl::PseudoElementCascadeType;
use selector_impl::{attr_exists_selector_is_shareable, attr_equals_selector_is_shareable}; use selector_impl::{attr_exists_selector_is_shareable, attr_equals_selector_is_shareable};
use selectors::parser::{ParserContext, SelectorImpl, AttrSelector}; use selectors::parser::{ParserContext, SelectorImpl, AttrSelector};
use std::fmt;
use string_cache::{Atom, WeakAtom, Namespace, WeakNamespace}; use string_cache::{Atom, WeakAtom, Namespace, WeakNamespace};
use stylesheets::Stylesheet; use stylesheets::Stylesheet;
@ -93,6 +95,16 @@ impl PseudoElement {
} }
} }
impl ToCss for PseudoElement {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
// FIXME: why does the atom contain one colon? Pseudo-element has two
debug_assert!(self.0.as_slice().starts_with(&[b':' as u16]) &&
!self.0.as_slice().starts_with(&[b':' as u16, b':' as u16]));
try!(dest.write_char(':'));
write!(dest, "{}", self.0)
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)] #[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum NonTSPseudoClass { pub enum NonTSPseudoClass {
AnyLink, AnyLink,
@ -109,6 +121,26 @@ pub enum NonTSPseudoClass {
ReadOnly, ReadOnly,
} }
impl ToCss for NonTSPseudoClass {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
use self::NonTSPseudoClass::*;
dest.write_str(match *self {
AnyLink => ":any-link",
Link => ":link",
Visited => ":visited",
Active => ":active",
Focus => ":focus",
Hover => ":hover",
Enabled => ":enabled",
Disabled => ":disabled",
Checked => ":checked",
Indeterminate => ":indeterminate",
ReadWrite => ":read-write",
ReadOnly => ":read-only",
})
}
}
impl NonTSPseudoClass { impl NonTSPseudoClass {
pub fn state_flag(&self) -> ElementState { pub fn state_flag(&self) -> ElementState {
use element_state::*; use element_state::*;
@ -135,8 +167,9 @@ impl SelectorImpl for GeckoSelectorImpl {
type Identifier = Atom; type Identifier = Atom;
type ClassName = Atom; type ClassName = Atom;
type LocalName = Atom; type LocalName = Atom;
type Namespace = Namespace; type NamespacePrefix = String;
type BorrowedNamespace = WeakNamespace; type NamespaceUrl = Namespace;
type BorrowedNamespaceUrl = WeakNamespace;
type BorrowedLocalName = WeakAtom; type BorrowedLocalName = WeakAtom;
type PseudoElement = PseudoElement; type PseudoElement = PseudoElement;

View file

@ -220,7 +220,7 @@ impl<'a, E> Element for ElementWrapper<'a, E>
self.element.get_local_name() self.element.get_local_name()
} }
fn get_namespace(&self) -> &<Self::Impl as SelectorImpl>::BorrowedNamespace { fn get_namespace(&self) -> &<Self::Impl as SelectorImpl>::BorrowedNamespaceUrl {
self.element.get_namespace() self.element.get_namespace()
} }

View file

@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use attr::{AttrIdentifier, AttrValue}; use attr::{AttrIdentifier, AttrValue};
use cssparser::ToCss;
use element_state::ElementState; use element_state::ElementState;
use error_reporting::StdoutErrorReporter; use error_reporting::StdoutErrorReporter;
use parser::ParserContextExtraData; use parser::ParserContextExtraData;
@ -11,6 +12,7 @@ use selector_impl::{ElementExt, PseudoElementCascadeType, TheSelectorImpl};
use selector_impl::{attr_exists_selector_is_shareable, attr_equals_selector_is_shareable}; use selector_impl::{attr_exists_selector_is_shareable, attr_equals_selector_is_shareable};
use selectors::parser::{AttrSelector, ParserContext, SelectorImpl}; use selectors::parser::{AttrSelector, ParserContext, SelectorImpl};
use selectors::{Element, MatchAttrGeneric}; use selectors::{Element, MatchAttrGeneric};
use std::fmt;
use std::process; use std::process;
use string_cache::{Atom, Namespace}; use string_cache::{Atom, Namespace};
use stylesheets::{Stylesheet, Origin}; use stylesheets::{Stylesheet, Origin};
@ -28,6 +30,20 @@ pub enum PseudoElement {
DetailsContent, DetailsContent,
} }
impl ToCss for PseudoElement {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
use self::PseudoElement::*;
dest.write_str(match *self {
Before => "::before",
After => "::after",
Selection => "::selection",
DetailsSummary => "::-servo-details-summary",
DetailsContent => "::-servo-details-content",
})
}
}
impl PseudoElement { impl PseudoElement {
#[inline] #[inline]
pub fn is_before_or_after(&self) -> bool { pub fn is_before_or_after(&self) -> bool {
@ -70,6 +86,29 @@ pub enum NonTSPseudoClass {
Target, Target,
} }
impl ToCss for NonTSPseudoClass {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
use self::NonTSPseudoClass::*;
dest.write_str(match *self {
AnyLink => ":any-link",
Link => ":link",
Visited => ":visited",
Active => ":active",
Focus => ":focus",
Hover => ":hover",
Enabled => ":enabled",
Disabled => ":disabled",
Checked => ":checked",
Indeterminate => ":indeterminate",
ReadWrite => ":read-write",
ReadOnly => ":read-only",
PlaceholderShown => ":placeholder-shown",
Target => ":target",
ServoNonZeroBorder => ":-servo-nonzero-border",
})
}
}
impl NonTSPseudoClass { impl NonTSPseudoClass {
pub fn state_flag(&self) -> ElementState { pub fn state_flag(&self) -> ElementState {
use element_state::*; use element_state::*;
@ -106,9 +145,10 @@ impl SelectorImpl for ServoSelectorImpl {
type Identifier = Atom; type Identifier = Atom;
type ClassName = Atom; type ClassName = Atom;
type LocalName = Atom; type LocalName = Atom;
type Namespace = Namespace; type NamespacePrefix = String;
type NamespaceUrl = Namespace;
type BorrowedLocalName = Atom; type BorrowedLocalName = Atom;
type BorrowedNamespace = Namespace; type BorrowedNamespaceUrl = Namespace;
fn attr_exists_selector_is_shareable(attr_selector: &AttrSelector<Self>) -> bool { fn attr_exists_selector_is_shareable(attr_selector: &AttrSelector<Self>) -> bool {
attr_exists_selector_is_shareable(attr_selector) attr_exists_selector_is_shareable(attr_selector)
@ -283,7 +323,7 @@ impl MatchAttrGeneric for ServoElementSnapshot {
let html = self.is_html_element_in_html_document; let html = self.is_html_element_in_html_document;
let local_name = if html { &attr.lower_name } else { &attr.name }; let local_name = if html { &attr.lower_name } else { &attr.name };
match attr.namespace { match attr.namespace {
NamespaceConstraint::Specific(ref ns) => self.get_attr(ns, local_name), NamespaceConstraint::Specific(ref ns) => self.get_attr(&ns.url, local_name),
NamespaceConstraint::Any => self.get_attr_ignore_ns(local_name), NamespaceConstraint::Any => self.get_attr_ignore_ns(local_name),
}.map_or(false, |v| test(v)) }.map_or(false, |v| test(v))
} }

28
ports/cef/Cargo.lock generated
View file

@ -707,7 +707,7 @@ dependencies = [
"servo-fontconfig 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "servo-fontconfig 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"simd 0.1.0 (git+https://github.com/huonw/simd)", "simd 0.1.0 (git+https://github.com/huonw/simd)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
@ -864,7 +864,7 @@ dependencies = [
"phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1070,10 +1070,10 @@ dependencies = [
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"script_layout_interface 0.0.1", "script_layout_interface 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1783,10 +1783,10 @@ dependencies = [
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"script_layout_interface 0.0.1", "script_layout_interface 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"tinyfiledialogs 0.1.0 (git+https://github.com/jdm/tinyfiledialogs)", "tinyfiledialogs 0.1.0 (git+https://github.com/jdm/tinyfiledialogs)",
@ -1820,8 +1820,8 @@ dependencies = [
"profile_traits 0.0.1", "profile_traits 0.0.1",
"range 0.0.1", "range 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1", "util 0.0.1",
@ -1859,7 +1859,7 @@ dependencies = [
[[package]] [[package]]
name = "selectors" name = "selectors"
version = "0.9.0" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1870,7 +1870,7 @@ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "quickersort 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -2088,7 +2088,7 @@ dependencies = [
[[package]] [[package]]
name = "string_cache" name = "string_cache"
version = "0.2.23" version = "0.2.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2122,11 +2122,11 @@ dependencies = [
"plugins 0.0.1", "plugins 0.0.1",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1", "style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2570,7 +2570,7 @@ dependencies = [
"phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
] ]

View file

@ -11,7 +11,7 @@ dependencies = [
"libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -170,7 +170,7 @@ dependencies = [
"gecko_bindings 0.0.1", "gecko_bindings 0.0.1",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -311,7 +311,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "selectors" name = "selectors"
version = "0.9.0" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -320,7 +320,7 @@ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "quickersort 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -335,7 +335,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "string_cache" name = "string_cache"
version = "0.2.23" version = "0.2.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -367,7 +367,7 @@ dependencies = [
"ordered-float 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "ordered-float 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1", "style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -19,7 +19,7 @@ lazy_static = "0.2"
libc = "0.2" libc = "0.2"
log = {version = "0.3.5", features = ["release_max_level_info"]} log = {version = "0.3.5", features = ["release_max_level_info"]}
num_cpus = "0.2.2" num_cpus = "0.2.2"
selectors = "0.9" selectors = "0.10"
style = {path = "../../components/style", features = ["gecko"]} style = {path = "../../components/style", features = ["gecko"]}
style_traits = {path = "../../components/style_traits"} style_traits = {path = "../../components/style_traits"}
url = "1.2" url = "1.2"

View file

@ -14,5 +14,5 @@ cfg-if = "0.1.0"
gecko_bindings = {version = "0.0.1", path = "../gecko_bindings"} gecko_bindings = {version = "0.0.1", path = "../gecko_bindings"}
heapsize = "0.3.5" heapsize = "0.3.5"
libc = "0.2" libc = "0.2"
selectors = "0.9" selectors = "0.10"
serde = "0.8" serde = "0.8"

View file

@ -5,6 +5,7 @@
use gecko_bindings::structs::nsIAtom; use gecko_bindings::structs::nsIAtom;
use selectors::bloom::BloomHash; use selectors::bloom::BloomHash;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::fmt;
use std::ops::Deref; use std::ops::Deref;
use {Atom, WeakAtom}; use {Atom, WeakAtom};
@ -29,6 +30,12 @@ impl Deref for Namespace {
} }
} }
impl fmt::Display for Namespace {
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
self.0.fmt(w)
}
}
impl Borrow<WeakNamespace> for Namespace { impl Borrow<WeakNamespace> for Namespace {
#[inline] #[inline]
fn borrow(&self) -> &WeakNamespace { fn borrow(&self) -> &WeakNamespace {

View file

@ -592,7 +592,7 @@ impl AttrSelectorHelpers for AttrSelector<GeckoSelectorImpl> {
fn ns_or_null(&self) -> *mut nsIAtom { fn ns_or_null(&self) -> *mut nsIAtom {
match self.namespace { match self.namespace {
NamespaceConstraint::Any => ptr::null_mut(), NamespaceConstraint::Any => ptr::null_mut(),
NamespaceConstraint::Specific(ref ns) => ns.0.as_ptr(), NamespaceConstraint::Specific(ref ns) => ns.url.0.as_ptr(),
} }
} }

View file

@ -14,7 +14,7 @@ app_units = "0.3"
cssparser = {version = "0.5.7", features = ["heap_size"]} cssparser = {version = "0.5.7", features = ["heap_size"]}
euclid = "0.9" euclid = "0.9"
rustc-serialize = "0.3" rustc-serialize = "0.3"
selectors = {version = "0.9", features = ["heap_size"]} selectors = {version = "0.10", features = ["heap_size"]}
string_cache = {version = "0.2.23", features = ["heap_size"]} string_cache = {version = "0.2.23", features = ["heap_size"]}
style = {path = "../../../components/style"} style = {path = "../../../components/style"}
style_traits = {path = "../../../components/style_traits"} style_traits = {path = "../../../components/style_traits"}

View file

@ -15,6 +15,9 @@ fn parse<T, F: Fn(&mut Parser) -> Result<T, ()>>(f: F, s: &str) -> Result<T, ()>
// This is a macro so that the file/line information // This is a macro so that the file/line information
// is preserved in the panic // is preserved in the panic
macro_rules! assert_roundtrip { macro_rules! assert_roundtrip {
($fun:expr, $string:expr) => {
assert_roundtrip!($fun, $string, $string);
};
($fun:expr, $input:expr, $output:expr) => { ($fun:expr, $input:expr, $output:expr) => {
let parsed = $crate::parsing::parse($fun, $input) let parsed = $crate::parsing::parse($fun, $input)
.expect(&format!("Failed to parse {}", $input)); .expect(&format!("Failed to parse {}", $input));
@ -31,3 +34,4 @@ macro_rules! assert_roundtrip {
mod basic_shape; mod basic_shape;
mod position; mod position;
mod selectors;

View file

@ -0,0 +1,22 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::Parser;
use selectors::parser::{Selector, ParserContext, parse_selector_list};
use style::selector_impl::TheSelectorImpl;
fn parse(input: &mut Parser) -> Result<Selector<TheSelectorImpl>, ()> {
let mut context = ParserContext::new();
context.in_user_agent_stylesheet = true;
context.namespace_prefixes.insert("svg".into(), ns!(svg));
parse_selector_list(&context, input).map(|mut vec| vec.pop().unwrap())
}
#[test]
fn test_selectors() {
assert_roundtrip!(parse, "div");
assert_roundtrip!(parse, "svg|circle");
assert_roundtrip!(parse, "p:before", "p::before");
assert_roundtrip!(parse, "[border = \"0\"]:-servo-nonzero-border ~ ::-servo-details-summary");
}

View file

@ -8,7 +8,7 @@ use selectors::parser::*;
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::sync::Arc; use std::sync::Arc;
use std::sync::Mutex; use std::sync::Mutex;
use string_cache::{Atom, Namespace}; use string_cache::{Atom, Namespace as NsAtom};
use style::error_reporting::ParseErrorReporter; use style::error_reporting::ParseErrorReporter;
use style::keyframes::{Keyframe, KeyframeSelector, KeyframePercentage}; use style::keyframes::{Keyframe, KeyframeSelector, KeyframePercentage};
use style::parser::ParserContextExtraData; use style::parser::ParserContextExtraData;
@ -38,13 +38,16 @@ fn test_parse_stylesheet() {
media: None, media: None,
dirty_on_viewport_size_change: false, dirty_on_viewport_size_change: false,
rules: vec![ rules: vec![
CSSRule::Namespace(None, Namespace(Atom::from("http://www.w3.org/1999/xhtml"))), CSSRule::Namespace(None, NsAtom(Atom::from("http://www.w3.org/1999/xhtml"))),
CSSRule::Style(StyleRule { CSSRule::Style(StyleRule {
selectors: vec![ selectors: vec![
Selector { Selector {
compound_selectors: Arc::new(CompoundSelector { compound_selectors: Arc::new(CompoundSelector {
simple_selectors: vec![ simple_selectors: vec![
SimpleSelector::Namespace(Namespace(Atom::from("http://www.w3.org/1999/xhtml"))), SimpleSelector::Namespace(Namespace {
prefix: None,
url: NsAtom(Atom::from("http://www.w3.org/1999/xhtml"))
}),
SimpleSelector::LocalName(LocalName { SimpleSelector::LocalName(LocalName {
name: atom!("input"), name: atom!("input"),
lower_name: atom!("input"), lower_name: atom!("input"),
@ -52,7 +55,10 @@ fn test_parse_stylesheet() {
SimpleSelector::AttrEqual(AttrSelector { SimpleSelector::AttrEqual(AttrSelector {
name: atom!("type"), name: atom!("type"),
lower_name: atom!("type"), lower_name: atom!("type"),
namespace: NamespaceConstraint::Specific(ns!()), namespace: NamespaceConstraint::Specific(Namespace {
prefix: None,
url: ns!()
}),
}, "hidden".to_owned(), CaseSensitivity::CaseInsensitive) }, "hidden".to_owned(), CaseSensitivity::CaseInsensitive)
], ],
next: None, next: None,
@ -74,7 +80,10 @@ fn test_parse_stylesheet() {
Selector { Selector {
compound_selectors: Arc::new(CompoundSelector { compound_selectors: Arc::new(CompoundSelector {
simple_selectors: vec![ simple_selectors: vec![
SimpleSelector::Namespace(Namespace(Atom::from("http://www.w3.org/1999/xhtml"))), SimpleSelector::Namespace(Namespace {
prefix: None,
url: NsAtom(Atom::from("http://www.w3.org/1999/xhtml"))
}),
SimpleSelector::LocalName(LocalName { SimpleSelector::LocalName(LocalName {
name: atom!("html"), name: atom!("html"),
lower_name: atom!("html"), lower_name: atom!("html"),
@ -88,7 +97,10 @@ fn test_parse_stylesheet() {
Selector { Selector {
compound_selectors: Arc::new(CompoundSelector { compound_selectors: Arc::new(CompoundSelector {
simple_selectors: vec![ simple_selectors: vec![
SimpleSelector::Namespace(Namespace(Atom::from("http://www.w3.org/1999/xhtml"))), SimpleSelector::Namespace(Namespace {
prefix: None,
url: NsAtom(Atom::from("http://www.w3.org/1999/xhtml"))
}),
SimpleSelector::LocalName(LocalName { SimpleSelector::LocalName(LocalName {
name: atom!("body"), name: atom!("body"),
lower_name: atom!("body"), lower_name: atom!("body"),
@ -113,12 +125,18 @@ fn test_parse_stylesheet() {
Selector { Selector {
compound_selectors: Arc::new(CompoundSelector { compound_selectors: Arc::new(CompoundSelector {
simple_selectors: vec![ simple_selectors: vec![
SimpleSelector::Namespace(Namespace(Atom::from("http://www.w3.org/1999/xhtml"))), SimpleSelector::Namespace(Namespace {
prefix: None,
url: NsAtom(Atom::from("http://www.w3.org/1999/xhtml"))
}),
SimpleSelector::Class(Atom::from("ok")), SimpleSelector::Class(Atom::from("ok")),
], ],
next: Some((Arc::new(CompoundSelector { next: Some((Arc::new(CompoundSelector {
simple_selectors: vec![ simple_selectors: vec![
SimpleSelector::Namespace(Namespace(Atom::from("http://www.w3.org/1999/xhtml"))), SimpleSelector::Namespace(Namespace {
prefix: None,
url: NsAtom(Atom::from("http://www.w3.org/1999/xhtml"))
}),
SimpleSelector::ID(Atom::from("d1")), SimpleSelector::ID(Atom::from("d1")),
], ],
next: None, next: None,