servo: Merge #8667 - Update string cache (from asajeffrey:update-string-cache); r=SimonSapin

Updated string_cache to 0.2, and updated the dependencies that depend on string_cache.
Removed references to string_cache_plugin.
Import atom! and ns! from string_cache.
Replaced ns!("") by ns!().
Replaced ns!(XML) and co by ns!(xml) and co.
Replaced Atom::from_slice by Atom::from.
Replaced atom.as_slice() by &*atom.

r? @SimonSapin

Source-Repo: https://github.com/servo/servo
Source-Revision: 188fa9378c103093f1f8dac24bff0d9d237fd2bc
This commit is contained in:
Alan Jeffrey 2015-11-25 23:41:39 +05:01
Родитель 95f8c3c02e
Коммит f4ab2bfdb5
68 изменённых файлов: 328 добавлений и 434 удалений

Просмотреть файл

@ -22,7 +22,7 @@ rustc-serialize = "0.3"
serde = "0.6"
serde_macros = "0.6"
smallvec = "0.1"
string_cache = "0.1"
string_cache = "0.2"
time = "0.1.12"
unicode-script = { version = "0.1", features = ["harfbuzz"] }

Просмотреть файл

@ -174,7 +174,7 @@ impl FontCache {
Source::Local(ref local_family_name) => {
let family = &mut self.web_families.get_mut(&family_name).unwrap();
for_each_variation(&local_family_name, |path| {
family.add_template(Atom::from_slice(&path), None);
family.add_template(Atom::from(&*path), None);
});
result.send(()).unwrap();
}
@ -182,7 +182,7 @@ impl FontCache {
}
Command::AddDownloadedWebFont(family_name, url, bytes, result) => {
let family = &mut self.web_families.get_mut(&family_name).unwrap();
family.add_template(Atom::from_slice(&url.to_string()), Some(bytes));
family.add_template(Atom::from(&*url.to_string()), Some(bytes));
drop(result.send(()));
}
Command::Exit(result) => {
@ -221,7 +221,7 @@ impl FontCache {
if s.templates.is_empty() {
for_each_variation(family_name, |path| {
s.add_template(Atom::from_slice(&path), None);
s.add_template(Atom::from(&*path), None);
});
}

Просмотреть файл

@ -24,7 +24,7 @@ impl FontTemplateData {
},
None => {
// TODO: Handle file load failure!
let mut file = File::open(identifier.as_slice()).unwrap();
let mut file = File::open(&*identifier).unwrap();
let mut buffer = vec![];
file.read_to_end(&mut buffer).unwrap();
buffer

Просмотреть файл

@ -57,7 +57,7 @@ impl FontTemplateData {
Err(_) => None
}
}
None => core_text::font::new_from_name(self.identifier.as_slice(), 0.0).ok(),
None => core_text::font::new_from_name(&*self.identifier, 0.0).ok(),
}
}
ctfont.as_ref().map(|ctfont| (*ctfont).clone())

Просмотреть файл

@ -71,8 +71,7 @@ rustc-serialize = "0.3"
libc = "0.1"
selectors = "0.2"
smallvec = "0.1"
string_cache = "0.1"
string_cache_plugin = "0.1"
string_cache = "0.2"
euclid = {version = "0.3", features = ["plugins"]}
serde = "0.6"
serde_macros = "0.6"

Просмотреть файл

@ -1642,7 +1642,7 @@ trait ObjectElement<'a> {
impl<'ln> ObjectElement<'ln> for ServoThreadSafeLayoutNode<'ln> {
fn get_type_and_data(&self) -> (Option<&'ln str>, Option<&'ln str>) {
let elem = self.as_element();
(elem.get_attr(&ns!(""), &atom!("type")), elem.get_attr(&ns!(""), &atom!("data")))
(elem.get_attr(&ns!(), &atom!("type")), elem.get_attr(&ns!(), &atom!("data")))
}
fn has_object_data(&self) -> bool {

Просмотреть файл

@ -166,12 +166,12 @@ fn create_common_style_affecting_attributes_from_element(element: &ServoLayoutEl
for attribute_info in &common_style_affecting_attributes() {
match attribute_info.mode {
CommonStyleAffectingAttributeMode::IsPresent(flag) => {
if element.get_attr(&ns!(""), &attribute_info.atom).is_some() {
if element.get_attr(&ns!(), &attribute_info.atom).is_some() {
flags.insert(flag)
}
}
CommonStyleAffectingAttributeMode::IsEqual(target_value, flag) => {
match element.get_attr(&ns!(""), &attribute_info.atom) {
match element.get_attr(&ns!(), &attribute_info.atom) {
Some(element_value) if element_value == target_value => {
flags.insert(flag)
}
@ -248,7 +248,7 @@ impl StyleSharingCandidate {
style: style,
parent_style: parent_style,
local_name: element.get_local_name().clone(),
class: element.get_attr(&ns!(""), &atom!("class"))
class: element.get_attr(&ns!(), &atom!("class"))
.map(|string| string.to_owned()),
link: element.is_link(),
namespace: (*element.get_namespace()).clone(),
@ -263,7 +263,7 @@ impl StyleSharingCandidate {
}
// FIXME(pcwalton): Use `each_class` here instead of slow string comparison.
match (&self.class, element.get_attr(&ns!(""), &atom!("class"))) {
match (&self.class, element.get_attr(&ns!(), &atom!("class"))) {
(&None, Some(_)) | (&Some(_), None) => return false,
(&Some(ref this_class), Some(element_class)) if
element_class != &**this_class => {
@ -289,12 +289,12 @@ impl StyleSharingCandidate {
match attribute_info.mode {
CommonStyleAffectingAttributeMode::IsPresent(flag) => {
if self.common_style_affecting_attributes.contains(flag) !=
element.get_attr(&ns!(""), &attribute_info.atom).is_some() {
element.get_attr(&ns!(), &attribute_info.atom).is_some() {
return false
}
}
CommonStyleAffectingAttributeMode::IsEqual(target_value, flag) => {
match element.get_attr(&ns!(""), &attribute_info.atom) {
match element.get_attr(&ns!(), &attribute_info.atom) {
Some(ref element_value) if self.common_style_affecting_attributes
.contains(flag) &&
*element_value != target_value => {
@ -313,7 +313,7 @@ impl StyleSharingCandidate {
}
for attribute_name in &rare_style_affecting_attributes() {
if element.get_attr(&ns!(""), attribute_name).is_some() {
if element.get_attr(&ns!(), attribute_name).is_some() {
return false
}
}
@ -621,7 +621,7 @@ impl<'ln> ElementMatchMethods for ServoLayoutElement<'ln> {
if self.style_attribute().is_some() {
return StyleSharingResult::CannotShare
}
if self.get_attr(&ns!(""), &atom!("id")).is_some() {
if self.get_attr(&ns!(), &atom!("id")).is_some() {
return StyleSharingResult::CannotShare
}

Просмотреть файл

@ -351,7 +351,7 @@ impl ImageFragmentInfo {
-> ImageFragmentInfo {
fn convert_length(node: &ServoThreadSafeLayoutNode, name: &Atom) -> Option<Au> {
let element = node.as_element();
element.get_attr(&ns!(""), name)
element.get_attr(&ns!(), name)
.and_then(|string| string.parse().ok())
.map(Au::from_px)
}
@ -760,7 +760,7 @@ impl TableColumnFragmentInfo {
/// Create the information specific to an table column fragment.
pub fn new(node: &ServoThreadSafeLayoutNode) -> TableColumnFragmentInfo {
let element = node.as_element();
let span = element.get_attr(&ns!(""), &atom!("span"))
let span = element.get_attr(&ns!(), &atom!("span"))
.and_then(|string| string.parse().ok())
.unwrap_or(0);
TableColumnFragmentInfo {

Просмотреть файл

@ -16,7 +16,6 @@
#![deny(unsafe_code)]
#![plugin(string_cache_plugin)]
#![plugin(plugins)]
extern crate app_units;
@ -52,7 +51,7 @@ extern crate script_traits;
extern crate serde;
extern crate serde_json;
extern crate smallvec;
extern crate string_cache;
#[macro_use(atom, ns)] extern crate string_cache;
extern crate style;
extern crate unicode_bidi;
extern crate unicode_script;

Просмотреть файл

@ -555,7 +555,7 @@ pub fn process_resolved_style_request(requested_node: ServoLayoutNode,
}
// FIXME: implement used value computation for line-height
ref property => {
style.computed_value_to_string(property.as_slice()).ok()
style.computed_value_to_string(&*property).ok()
}
}
}

Просмотреть файл

@ -662,7 +662,7 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLinkElement)) => {
unsafe {
(*self.element.unsafe_get()).get_attr_val_for_layout(&ns!(""), &atom!("href")).is_some()
(*self.element.unsafe_get()).get_attr_val_for_layout(&ns!(), &atom!("href")).is_some()
}
}
_ => false,
@ -712,7 +712,7 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
#[inline]
fn has_servo_nonzero_border(&self) -> bool {
unsafe {
match (*self.element.unsafe_get()).get_attr_for_layout(&ns!(""), &atom!("border")) {
match (*self.element.unsafe_get()).get_attr_for_layout(&ns!(), &atom!("border")) {
None | Some(&AttrValue::UInt(_, 0)) => false,
_ => true,
}

Просмотреть файл

@ -84,8 +84,7 @@ uuid = "0.1.16"
smallvec = "0.1"
html5ever = { version = "0.2.1", features = ["unstable"] }
selectors = "0.2"
string_cache = { version = "0.1.15", features = ["unstable"] }
string_cache_plugin = "0.1"
string_cache = { version = "0.2", features = ["unstable"] }
euclid = {version = "0.3", features = ["plugins"]}
tendril = "0.1.1"
rand = "0.3"

Просмотреть файл

@ -170,7 +170,7 @@ impl Attr {
assert!(Some(owner) == self.owner().r());
owner.will_mutate_attr();
mem::swap(&mut *self.value.borrow_mut(), &mut value);
if self.identifier.namespace == ns!("") {
if self.identifier.namespace == ns!() {
vtable_for(owner.upcast())
.attribute_mutated(self, AttributeMutation::Set(Some(&value)));
}

Просмотреть файл

@ -57,25 +57,25 @@ pub fn validate_and_extract(namespace: Option<DOMString>,
debug_assert!(!local_name.contains(colon));
match (namespace, maybe_prefix) {
(ns!(""), Some(_)) => {
(ns!(), Some(_)) => {
// Step 6.
Err(Error::Namespace)
},
(ref ns, Some("xml")) if ns != &ns!(XML) => {
(ref ns, Some("xml")) if ns != &ns!(xml) => {
// Step 7.
Err(Error::Namespace)
},
(ref ns, p) if ns != &ns!(XMLNS) && (qualified_name == "xmlns" || p == Some("xmlns")) => {
(ref ns, p) if ns != &ns!(xmlns) && (qualified_name == "xmlns" || p == Some("xmlns")) => {
// Step 8.
Err(Error::Namespace)
},
(ns!(XMLNS), p) if qualified_name != "xmlns" && p != Some("xmlns") => {
(ns!(xmlns), p) if qualified_name != "xmlns" && p != Some("xmlns") => {
// Step 9.
Err(Error::Namespace)
},
(ns, p) => {
// Step 10.
Ok((ns, p.map(Atom::from_slice), Atom::from_slice(local_name)))
Ok((ns, p.map(Atom::from), Atom::from(local_name)))
}
}
}
@ -171,7 +171,7 @@ pub fn xml_name_type(name: &str) -> XMLName {
/// If the URL is None, returns the empty namespace.
pub fn namespace_from_domstring(url: Option<DOMString>) -> Namespace {
match url {
None => ns!(""),
Some(ref s) => Namespace(Atom::from_slice(s)),
None => ns!(),
Some(s) => Namespace(Atom::from(&*s)),
}
}

Просмотреть файл

@ -86,7 +86,7 @@ pub fn create_element(name: QualName,
let prefix = prefix.map(|p| DOMString::from(&*p));
if name.ns != ns!(HTML) {
if name.ns != ns!(html) {
return Element::new(DOMString::from(&*name.local), name.ns, prefix, document);
}

Просмотреть файл

@ -145,7 +145,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
// Step 1
property.make_ascii_lowercase();
let property = Atom::from_slice(&property);
let property = Atom::from(&*property);
if self.readonly {
// Readonly style declarations are used for getComputedStyle.
@ -160,7 +160,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
// Step 2.2
for longhand in shorthand.longhands() {
// Step 2.2.1
let declaration = owner.get_inline_style_declaration(&Atom::from_slice(&longhand));
let declaration = owner.get_inline_style_declaration(&Atom::from(*longhand));
// Step 2.2.2 & 2.2.3
match declaration {
@ -185,7 +185,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
fn GetPropertyPriority(&self, mut property: DOMString) -> DOMString {
// Step 1
property.make_ascii_lowercase();
let property = Atom::from_slice(&property);
let property = Atom::from(&*property);
// Step 2
if let Some(shorthand) = Shorthand::from_name(&property) {

Просмотреть файл

@ -478,10 +478,10 @@ impl Document {
/// Attempt to find a named element in this page's document.
/// https://html.spec.whatwg.org/multipage/#the-indicated-part-of-the-document
pub fn find_fragment_node(&self, fragid: &str) -> Option<Root<Element>> {
self.get_element_by_id(&Atom::from_slice(fragid)).or_else(|| {
self.get_element_by_id(&Atom::from(fragid)).or_else(|| {
let check_anchor = |node: &HTMLAnchorElement| {
let elem = node.upcast::<Element>();
elem.get_attribute(&ns!(""), &atom!("name"))
elem.get_attribute(&ns!(), &atom!("name"))
.map_or(false, |attr| &**attr.value() == fragid)
};
let doc_node = self.upcast::<Node>();
@ -1037,7 +1037,7 @@ impl Document {
pub fn set_body_attribute(&self, local_name: &Atom, value: DOMString) {
if let Some(ref body) = self.GetBody().and_then(Root::downcast::<HTMLBodyElement>) {
let body = body.upcast::<Element>();
let value = body.parse_attribute(&ns!(""), &local_name, value);
let value = body.parse_attribute(&ns!(), &local_name, value);
body.set_attribute(local_name, value);
}
}
@ -1700,13 +1700,13 @@ impl DocumentMethods for Document {
// https://dom.spec.whatwg.org/#dom-document-getelementsbytagname
fn GetElementsByTagName(&self, tag_name: DOMString) -> Root<HTMLCollection> {
let tag_atom = Atom::from_slice(&tag_name);
let tag_atom = Atom::from(&*tag_name);
match self.tag_map.borrow_mut().entry(tag_atom.clone()) {
Occupied(entry) => Root::from_ref(entry.get()),
Vacant(entry) => {
let mut tag_copy = tag_name;
tag_copy.make_ascii_lowercase();
let ascii_lower_tag = Atom::from_slice(&tag_copy);
let ascii_lower_tag = Atom::from(&*tag_copy);
let result = HTMLCollection::by_atomic_tag_name(&self.window,
self.upcast(),
tag_atom,
@ -1723,7 +1723,7 @@ impl DocumentMethods for Document {
tag_name: DOMString)
-> Root<HTMLCollection> {
let ns = namespace_from_domstring(maybe_ns);
let local = Atom::from_slice(&tag_name);
let local = Atom::from(&*tag_name);
let qname = QualName::new(ns, local);
match self.tagns_map.borrow_mut().entry(qname.clone()) {
Occupied(entry) => Root::from_ref(entry.get()),
@ -1738,7 +1738,7 @@ impl DocumentMethods for Document {
// https://dom.spec.whatwg.org/#dom-document-getelementsbyclassname
fn GetElementsByClassName(&self, classes: DOMString) -> Root<HTMLCollection> {
let class_atoms: Vec<Atom> = split_html_space_chars(&classes)
.map(Atom::from_slice)
.map(Atom::from)
.collect();
match self.classes_map.borrow_mut().entry(class_atoms.clone()) {
Occupied(entry) => Root::from_ref(entry.get()),
@ -1754,7 +1754,7 @@ impl DocumentMethods for Document {
// https://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid
fn GetElementById(&self, id: DOMString) -> Option<Root<Element>> {
self.get_element_by_id(&Atom::from_slice(&id))
self.get_element_by_id(&Atom::from(&*id))
}
// https://dom.spec.whatwg.org/#dom-document-createelement
@ -1766,7 +1766,7 @@ impl DocumentMethods for Document {
if self.is_html_document {
local_name.make_ascii_lowercase();
}
let name = QualName::new(ns!(HTML), Atom::from_slice(&local_name));
let name = QualName::new(ns!(html), Atom::from(&*local_name));
Ok(Element::create(name, None, self, ElementCreator::ScriptCreated))
}
@ -1788,12 +1788,12 @@ impl DocumentMethods for Document {
return Err(Error::InvalidCharacter);
}
let name = Atom::from_slice(&local_name);
let name = Atom::from(&*local_name);
// repetition used because string_cache::atom::Atom is non-copyable
let l_name = Atom::from_slice(&local_name);
let l_name = Atom::from(&*local_name);
let value = AttrValue::String(DOMString::new());
Ok(Attr::new(&self.window, name, value, l_name, ns!(""), None, None))
Ok(Attr::new(&self.window, name, value, l_name, ns!(), None, None))
}
// https://dom.spec.whatwg.org/#dom-document-createattributens
@ -1804,7 +1804,7 @@ impl DocumentMethods for Document {
let (namespace, prefix, local_name) = try!(validate_and_extract(namespace,
&qualified_name));
let value = AttrValue::String(DOMString::new());
let qualified_name = Atom::from_slice(&qualified_name);
let qualified_name = Atom::from(&*qualified_name);
Ok(Attr::new(&self.window,
local_name,
value,
@ -1964,12 +1964,12 @@ impl DocumentMethods for Document {
// https://html.spec.whatwg.org/multipage/#document.title
fn Title(&self) -> DOMString {
let title = self.GetDocumentElement().and_then(|root| {
if root.namespace() == &ns!(SVG) && root.local_name() == &atom!("svg") {
if root.namespace() == &ns!(svg) && root.local_name() == &atom!("svg") {
// Step 1.
root.upcast::<Node>()
.child_elements()
.find(|node| {
node.namespace() == &ns!(SVG) && node.local_name() == &atom!("title")
node.namespace() == &ns!(svg) && node.local_name() == &atom!("title")
})
.map(Root::upcast::<Node>)
} else {
@ -1997,14 +1997,14 @@ impl DocumentMethods for Document {
None => return,
};
let elem = if root.namespace() == &ns!(SVG) && root.local_name() == &atom!("svg") {
let elem = if root.namespace() == &ns!(svg) && root.local_name() == &atom!("svg") {
let elem = root.upcast::<Node>().child_elements().find(|node| {
node.namespace() == &ns!(SVG) && node.local_name() == &atom!("title")
node.namespace() == &ns!(svg) && node.local_name() == &atom!("title")
});
match elem {
Some(elem) => Root::upcast::<Node>(elem),
None => {
let name = QualName::new(ns!(SVG), atom!("title"));
let name = QualName::new(ns!(svg), atom!("title"));
let elem = Element::create(name, None, self, ElementCreator::ScriptCreated);
let parent = root.upcast::<Node>();
let child = elem.upcast::<Node>();
@ -2012,7 +2012,7 @@ impl DocumentMethods for Document {
.unwrap()
}
}
} else if root.namespace() == &ns!(HTML) {
} else if root.namespace() == &ns!(html) {
let elem = root.upcast::<Node>()
.traverse_preorder()
.find(|node| node.is::<HTMLTitleElement>());
@ -2021,7 +2021,7 @@ impl DocumentMethods for Document {
None => {
match self.GetHead() {
Some(head) => {
let name = QualName::new(ns!(HTML), atom!("title"));
let name = QualName::new(ns!(html), atom!("title"));
let elem = Element::create(name,
None,
self,
@ -2113,10 +2113,10 @@ impl DocumentMethods for Document {
Some(element) => element,
None => return false,
};
if element.namespace() != &ns!(HTML) {
if element.namespace() != &ns!(html) {
return false;
}
element.get_attribute(&ns!(""), &atom!("name"))
element.get_attribute(&ns!(), &atom!("name"))
.map_or(false, |attr| &**attr.value() == &*name)
})
}
@ -2299,10 +2299,10 @@ impl DocumentMethods for Document {
};
match html_elem_type {
HTMLElementTypeId::HTMLAppletElement => {
match elem.get_attribute(&ns!(""), &atom!("name")) {
match elem.get_attribute(&ns!(), &atom!("name")) {
Some(ref attr) if attr.value().as_atom() == name => true,
_ => {
match elem.get_attribute(&ns!(""), &atom!("id")) {
match elem.get_attribute(&ns!(), &atom!("id")) {
Some(ref attr) => attr.value().as_atom() == name,
None => false,
}
@ -2310,18 +2310,18 @@ impl DocumentMethods for Document {
}
},
HTMLElementTypeId::HTMLFormElement => {
match elem.get_attribute(&ns!(""), &atom!("name")) {
match elem.get_attribute(&ns!(), &atom!("name")) {
Some(ref attr) => attr.value().as_atom() == name,
None => false,
}
},
HTMLElementTypeId::HTMLImageElement => {
match elem.get_attribute(&ns!(""), &atom!("name")) {
match elem.get_attribute(&ns!(), &atom!("name")) {
Some(ref attr) => {
if attr.value().as_atom() == name {
true
} else {
match elem.get_attribute(&ns!(""), &atom!("id")) {
match elem.get_attribute(&ns!(), &atom!("id")) {
Some(ref attr) => attr.value().as_atom() == name,
None => false,
}
@ -2334,7 +2334,7 @@ impl DocumentMethods for Document {
_ => false,
}
}
let name = Atom::from_slice(&name);
let name = Atom::from(&*name);
let root = self.upcast::<Node>();
{
// Step 1.

Просмотреть файл

@ -55,9 +55,9 @@ impl DocumentFragmentMethods for DocumentFragment {
// https://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid
fn GetElementById(&self, id: DOMString) -> Option<Root<Element>> {
let node = self.upcast::<Node>();
let id = Atom::from_slice(&id);
let id = Atom::from(&*id);
node.traverse_preorder().filter_map(Root::downcast::<Element>).find(|descendant| {
match descendant.get_attribute(&ns!(""), &atom!(id)) {
match descendant.get_attribute(&ns!(), &atom!("id")) {
None => false,
Some(attr) => *attr.value().as_atom() == id,
}

Просмотреть файл

@ -38,14 +38,14 @@ impl DOMTokenList {
}
fn attribute(&self) -> Option<Root<Attr>> {
self.element.get_attribute(&ns!(""), &self.local_name)
self.element.get_attribute(&ns!(), &self.local_name)
}
fn check_token_exceptions(&self, token: &str) -> Fallible<Atom> {
match token {
"" => Err(Error::Syntax),
slice if slice.find(HTML_SPACE_CHARACTERS).is_some() => Err(Error::InvalidCharacter),
slice => Ok(Atom::from_slice(slice)),
slice => Ok(Atom::from(slice)),
}
}
}

Просмотреть файл

@ -138,7 +138,7 @@ impl Element {
-> Element {
Element {
node: Node::new_inherited(document),
local_name: Atom::from_slice(&local_name),
local_name: Atom::from(&*local_name),
namespace: namespace,
prefix: prefix,
attrs: DOMRefCell::new(vec![]),
@ -241,7 +241,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
#[allow(unsafe_code)]
#[inline]
unsafe fn has_class_for_layout(&self, name: &Atom) -> bool {
get_attr_for_layout(&*self.unsafe_get(), &ns!(""), &atom!("class")).map_or(false, |attr| {
get_attr_for_layout(&*self.unsafe_get(), &ns!(), &atom!("class")).map_or(false, |attr| {
attr.value_tokens_forever().unwrap().iter().any(|atom| atom == name)
})
}
@ -249,7 +249,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
#[allow(unsafe_code)]
#[inline]
unsafe fn get_classes_for_layout(&self) -> Option<&'static [Atom]> {
get_attr_for_layout(&*self.unsafe_get(), &ns!(""), &atom!("class"))
get_attr_for_layout(&*self.unsafe_get(), &ns!(), &atom!("class"))
.map(|attr| attr.value_tokens_forever().unwrap())
}
@ -364,7 +364,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
// FIXME(pcwalton): More use of atoms, please!
// FIXME(Ms2ger): this is nonsense! Invalid values also end up as
// a text field
match (*self.unsafe_get()).get_attr_val_for_layout(&ns!(""), &atom!("type")) {
match (*self.unsafe_get()).get_attr_val_for_layout(&ns!(), &atom!("type")) {
Some("text") | Some("password") => {
match this.get_size_for_layout() {
0 => None,
@ -517,7 +517,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
#[inline]
#[allow(unsafe_code)]
unsafe fn html_element_in_html_document_for_layout(&self) -> bool {
if (*self.unsafe_get()).namespace != ns!(HTML) {
if (*self.unsafe_get()).namespace != ns!(html) {
return false;
}
self.upcast::<Node>().owner_doc_for_layout().is_html_document_for_layout()
@ -593,7 +593,7 @@ pub enum StylePriority {
impl Element {
pub fn html_element_in_html_document(&self) -> bool {
self.namespace == ns!(HTML) && self.upcast::<Node>().is_in_html_doc()
self.namespace == ns!(html) && self.upcast::<Node>().is_in_html_doc()
}
pub fn local_name(&self) -> &Atom {
@ -604,7 +604,7 @@ impl Element {
if self.html_element_in_html_document() {
name.make_ascii_lowercase();
}
Atom::from_slice(&name)
Atom::from(&*name)
}
pub fn namespace(&self) -> &Namespace {
@ -630,15 +630,17 @@ impl Element {
}
pub fn is_void(&self) -> bool {
if self.namespace != ns!(HTML) {
if self.namespace != ns!(html) {
return false
}
match self.local_name {
/* List of void elements from
https://html.spec.whatwg.org/multipage/#html-fragment-serialisation-algorithm */
atom!(area) | atom!(base) | atom!(basefont) | atom!(bgsound) | atom!(br) | atom!(col) | atom!(embed) |
atom!(frame) | atom!(hr) | atom!(img) | atom!(input) | atom!(keygen) | atom!(link) | atom!(menuitem) |
atom!(meta) | atom!(param) | atom!(source) | atom!(track) | atom!(wbr) => true,
atom!("area") | atom!("base") | atom!("basefont") | atom!("bgsound") | atom!("br") |
atom!("col") | atom!("embed") | atom!("frame") | atom!("hr") | atom!("img") |
atom!("input") | atom!("keygen") | atom!("link") | atom!("menuitem") | atom!("meta") |
atom!("param") | atom!("source") | atom!("track") | atom!("wbr") => true,
_ => false
}
}
@ -855,7 +857,7 @@ impl Element {
prefix: Option<Atom>) {
self.will_mutate_attr();
let window = window_from_node(self);
let in_empty_ns = namespace == ns!("");
let in_empty_ns = namespace == ns!();
let attr = Attr::new(&window,
local_name,
value,
@ -899,7 +901,7 @@ impl Element {
None => qname.local.clone(),
Some(ref prefix) => {
let name = format!("{}:{}", &**prefix, &*qname.local);
Atom::from_slice(&name)
Atom::from(&*name)
},
};
let value = self.parse_attribute(&qname.ns, &qname.local, value);
@ -913,7 +915,7 @@ impl Element {
self.set_first_matching_attribute(name.clone(),
value,
name.clone(),
ns!(""),
ns!(),
None,
|attr| attr.local_name() == name);
}
@ -927,15 +929,15 @@ impl Element {
}
// Steps 2-5.
let name = Atom::from_slice(&name);
let value = self.parse_attribute(&ns!(""), &name, value);
let name = Atom::from(&*name);
let value = self.parse_attribute(&ns!(), &name, value);
self.set_first_matching_attribute(name.clone(),
value,
name.clone(),
ns!(""),
ns!(),
None,
|attr| {
*attr.name() == name && *attr.namespace() == ns!("")
*attr.name() == name && *attr.namespace() == ns!()
});
Ok(())
}
@ -966,7 +968,7 @@ impl Element {
local_name: &Atom,
value: DOMString)
-> AttrValue {
if *namespace == ns!("") {
if *namespace == ns!() {
vtable_for(self.upcast()).parse_plain_attribute(local_name, value)
} else {
AttrValue::String(value)
@ -993,7 +995,7 @@ impl Element {
let attr = Root::from_ref(&*(*self.attrs.borrow())[idx]);
self.attrs.borrow_mut().remove(idx);
attr.set_owner(None);
if attr.namespace() == &ns!("") {
if attr.namespace() == &ns!() {
vtable_for(self.upcast()).attribute_mutated(&attr, AttributeMutation::Removed);
}
attr
@ -1008,7 +1010,7 @@ impl Element {
Quirks => lhs.eq_ignore_ascii_case(&rhs),
}
};
self.get_attribute(&ns!(""), &atom!("class"))
self.get_attribute(&ns!(), &atom!("class"))
.map(|attr| attr.value().as_tokens().iter().any(|atom| is_equal(name, atom)))
.unwrap_or(false)
}
@ -1024,7 +1026,7 @@ impl Element {
self.attrs
.borrow()
.iter()
.any(|attr| attr.local_name() == local_name && attr.namespace() == &ns!(""))
.any(|attr| attr.local_name() == local_name && attr.namespace() == &ns!())
}
pub fn set_bool_attribute(&self, local_name: &Atom, value: bool) {
@ -1034,7 +1036,7 @@ impl Element {
if value {
self.set_string_attribute(local_name, DOMString::new());
} else {
self.remove_attribute(&ns!(""), local_name);
self.remove_attribute(&ns!(), local_name);
}
}
@ -1058,7 +1060,7 @@ impl Element {
}
pub fn get_string_attribute(&self, local_name: &Atom) -> DOMString {
match self.get_attribute(&ns!(""), local_name) {
match self.get_attribute(&ns!(), local_name) {
Some(x) => x.Value(),
None => DOMString::new(),
}
@ -1069,7 +1071,7 @@ impl Element {
}
pub fn get_tokenlist_attribute(&self, local_name: &Atom) -> Vec<Atom> {
self.get_attribute(&ns!(""), local_name).map(|attr| {
self.get_attribute(&ns!(), local_name).map(|attr| {
attr.r()
.value()
.as_tokens()
@ -1089,7 +1091,7 @@ impl Element {
pub fn get_uint_attribute(&self, local_name: &Atom, default: u32) -> u32 {
assert!(local_name.chars().all(|ch| !ch.is_ascii() || ch.to_ascii_lowercase() == ch));
let attribute = self.get_attribute(&ns!(""), local_name);
let attribute = self.get_attribute(&ns!(), local_name);
match attribute {
Some(ref attribute) => {
match *attribute.value() {
@ -1201,7 +1203,7 @@ impl ElementMethods for Element {
local_name: DOMString)
-> Option<Root<Attr>> {
let namespace = &namespace_from_domstring(namespace);
self.get_attribute(namespace, &Atom::from_slice(&local_name))
self.get_attribute(namespace, &Atom::from(&*local_name))
}
// https://dom.spec.whatwg.org/#dom-element-setattribute
@ -1215,9 +1217,9 @@ impl ElementMethods for Element {
let name = self.parsed_name(name);
// Step 3-5.
let value = self.parse_attribute(&ns!(""), &name, value);
let value = self.parse_attribute(&ns!(), &name, value);
self.set_first_matching_attribute(
name.clone(), value, name.clone(), ns!(""), None,
name.clone(), value, name.clone(), ns!(), None,
|attr| *attr.name() == name);
Ok(())
}
@ -1229,7 +1231,7 @@ impl ElementMethods for Element {
value: DOMString) -> ErrorResult {
let (namespace, prefix, local_name) =
try!(validate_and_extract(namespace, &qualified_name));
let qualified_name = Atom::from_slice(&qualified_name);
let qualified_name = Atom::from(&*qualified_name);
let value = self.parse_attribute(&namespace, &local_name, value);
self.set_first_matching_attribute(
local_name.clone(), value, qualified_name, namespace.clone(), prefix,
@ -1246,7 +1248,7 @@ impl ElementMethods for Element {
// https://dom.spec.whatwg.org/#dom-element-removeattributens
fn RemoveAttributeNS(&self, namespace: Option<DOMString>, local_name: DOMString) {
let namespace = namespace_from_domstring(namespace);
let local_name = Atom::from_slice(&local_name);
let local_name = Atom::from(&*local_name);
self.remove_attribute(&namespace, &local_name);
}
@ -1372,7 +1374,7 @@ impl ElementMethods for Element {
// Step 4.
NodeTypeId::DocumentFragment => {
let body_elem = Element::create(QualName::new(ns!(HTML), atom!(body)),
let body_elem = Element::create(QualName::new(ns!(html), atom!("body")),
None, context_document.r(),
ElementCreator::ScriptCreated);
Root::upcast(body_elem)
@ -1508,7 +1510,7 @@ impl VirtualMethods for Element {
let node = self.upcast::<Node>();
let doc = node.owner_doc();
match attr.local_name() {
&atom!(style) => {
&atom!("style") => {
// Modifying the `style` attribute might change style.
*self.style_attribute.borrow_mut() =
mutation.new_value(attr).map(|value| {
@ -1518,7 +1520,7 @@ impl VirtualMethods for Element {
doc.content_changed(node, NodeDamage::NodeStyleDamaged);
}
},
&atom!(id) => {
&atom!("id") => {
*self.id_attribute.borrow_mut() =
mutation.new_value(attr).and_then(|value| {
let value = value.as_atom();
@ -1548,7 +1550,7 @@ impl VirtualMethods for Element {
}
}
},
_ if attr.namespace() == &ns!("") => {
_ if attr.namespace() == &ns!() => {
if fragment_affecting_attributes().iter().any(|a| a == attr.local_name()) ||
common_style_affecting_attributes().iter().any(|a| &a.atom == attr.local_name()) ||
rare_style_affecting_attributes().iter().any(|a| a == attr.local_name())
@ -1691,7 +1693,7 @@ impl<'a> ::selectors::Element for Root<Element> {
fn each_class<F>(&self, mut callback: F)
where F: FnMut(&Atom)
{
if let Some(ref attr) = self.get_attribute(&ns!(""), &atom!("class")) {
if let Some(ref attr) = self.get_attribute(&ns!(), &atom!("class")) {
let tokens = attr.value();
let tokens = tokens.as_tokens();
for token in tokens {

Просмотреть файл

@ -234,7 +234,7 @@ impl EventMethods for Event {
self.canceled.set(false);
self.trusted.set(false);
self.target.set(None);
*self.type_.borrow_mut() = Atom::from_slice(&type_);
*self.type_.borrow_mut() = Atom::from(&*type_);
self.bubbles.set(bubbles);
self.cancelable.set(cancelable);
}

Просмотреть файл

@ -309,7 +309,7 @@ impl EventTarget {
let event_listener = listener.map(|listener|
CommonEventHandler::EventHandler(
EventHandlerNonNull::new(listener.callback())));
self.set_inline_event_listener(Atom::from_slice(ty), event_listener);
self.set_inline_event_listener(Atom::from(ty), event_listener);
}
pub fn set_error_event_handler<T: CallbackContainer>(
@ -318,11 +318,11 @@ impl EventTarget {
let event_listener = listener.map(|listener|
CommonEventHandler::ErrorEventHandler(
OnErrorEventHandlerNonNull::new(listener.callback())));
self.set_inline_event_listener(Atom::from_slice(ty), event_listener);
self.set_inline_event_listener(Atom::from(ty), event_listener);
}
pub fn get_event_handler_common<T: CallbackContainer>(&self, ty: &str) -> Option<Rc<T>> {
let listener = self.get_inline_event_listener(&Atom::from_slice(ty));
let listener = self.get_inline_event_listener(&Atom::from(ty));
listener.map(|listener| CallbackContainer::new(listener.parent().callback()))
}
@ -340,7 +340,7 @@ impl EventTargetMethods for EventTarget {
match listener {
Some(listener) => {
let mut handlers = self.handlers.borrow_mut();
let entry = match handlers.entry(Atom::from_slice(&ty)) {
let entry = match handlers.entry(Atom::from(&*ty)) {
Occupied(entry) => entry.into_mut(),
Vacant(entry) => entry.insert(vec!()),
};
@ -366,7 +366,7 @@ impl EventTargetMethods for EventTarget {
match listener {
Some(ref listener) => {
let mut handlers = self.handlers.borrow_mut();
let entry = handlers.get_mut(&Atom::from_slice(&ty));
let entry = handlers.get_mut(&Atom::from(&*ty));
for entry in entry {
let phase = if capture { ListenerPhase::Capturing } else { ListenerPhase::Bubbling };
let old_entry = EventListenerEntry {

Просмотреть файл

@ -176,7 +176,7 @@ fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option<String>) {
// Step 3: target browsing context.
// Step 4.
let attribute = subject.get_attribute(&ns!(""), &atom!("href")).unwrap();
let attribute = subject.get_attribute(&ns!(), &atom!("href")).unwrap();
let mut href = attribute.Value();
// Step 6.

Просмотреть файл

@ -36,7 +36,7 @@ impl HTMLBaseElement {
/// https://html.spec.whatwg.org/multipage/#frozen-base-url
pub fn frozen_base_url(&self) -> Url {
let href = self.upcast::<Element>().get_attribute(&ns!(""), &atom!("href"))
let href = self.upcast::<Element>().get_attribute(&ns!(), &atom!("href"))
.expect("The frozen base url is only defined for base elements \
that have a base url.");
let document = document_from_node(self);
@ -66,7 +66,7 @@ impl VirtualMethods for HTMLBaseElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation);
if *attr.local_name() == atom!(href) {
if *attr.local_name() == atom!("href") {
document_from_node(self).refresh_base_element();
}
}

Просмотреть файл

@ -97,7 +97,7 @@ impl HTMLBodyElementLayoutHelpers for LayoutJS<HTMLBodyElement> {
fn get_background_color(&self) -> Option<RGBA> {
unsafe {
(*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("bgcolor"))
.get_attr_for_layout(&ns!(), &atom!("bgcolor"))
.and_then(AttrValue::as_color)
.cloned()
}
@ -107,7 +107,7 @@ impl HTMLBodyElementLayoutHelpers for LayoutJS<HTMLBodyElement> {
fn get_color(&self) -> Option<RGBA> {
unsafe {
(*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("text"))
.get_attr_for_layout(&ns!(), &atom!("text"))
.and_then(AttrValue::as_color)
.cloned()
}
@ -153,7 +153,7 @@ impl VirtualMethods for HTMLBodyElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
let do_super_mutate = match (attr.local_name(), mutation) {
(&atom!(background), _) => {
(&atom!("background"), _) => {
*self.background.borrow_mut() = mutation.new_value(attr).and_then(|value| {
let document = document_from_node(self);
let base = document.url();
@ -169,11 +169,11 @@ impl VirtualMethods for HTMLBodyElement {
// https://html.spec.whatwg.org/multipage/
// #event-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-3
match name {
&atom!(onfocus) | &atom!(onload) | &atom!(onscroll) | &atom!(onafterprint) |
&atom!(onbeforeprint) | &atom!(onbeforeunload) | &atom!(onhashchange) |
&atom!(onlanguagechange) | &atom!(onmessage) | &atom!(onoffline) | &atom!(ononline) |
&atom!(onpagehide) | &atom!(onpageshow) | &atom!(onpopstate) | &atom!(onstorage) |
&atom!(onresize) | &atom!(onunload) | &atom!(onerror)
&atom!("onfocus") | &atom!("onload") | &atom!("onscroll") | &atom!("onafterprint") |
&atom!("onbeforeprint") | &atom!("onbeforeunload") | &atom!("onhashchange") |
&atom!("onlanguagechange") | &atom!("onmessage") | &atom!("onoffline") | &atom!("ononline") |
&atom!("onpagehide") | &atom!("onpageshow") | &atom!("onpopstate") | &atom!("onstorage") |
&atom!("onresize") | &atom!("onunload") | &atom!("onerror")
=> {
let evtarget = window.upcast::<EventTarget>(); // forwarded event
evtarget.set_event_handler_uncompiled(cx, url, reflector,

Просмотреть файл

@ -138,7 +138,7 @@ impl VirtualMethods for HTMLButtonElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() {
&atom!(disabled) => {
&atom!("disabled") => {
let el = self.upcast::<Element>();
match mutation {
AttributeMutation::Set(Some(_)) => {}

Просмотреть файл

@ -120,8 +120,8 @@ impl LayoutHTMLCanvasElementHelpers for LayoutJS<HTMLCanvasElement> {
None => (None, None),
};
let width_attr = canvas.upcast::<Element>().get_attr_for_layout(&ns!(""), &atom!(width));
let height_attr = canvas.upcast::<Element>().get_attr_for_layout(&ns!(""), &atom!(height));
let width_attr = canvas.upcast::<Element>().get_attr_for_layout(&ns!(), &atom!("width"));
let height_attr = canvas.upcast::<Element>().get_attr_for_layout(&ns!(), &atom!("height"));
HTMLCanvasData {
renderer_id: renderer_id,
ipc_renderer: ipc_renderer,
@ -292,7 +292,7 @@ impl VirtualMethods for HTMLCanvasElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() {
&atom!(width) | &atom!(height) => self.recreate_contexts(),
&atom!("width") | &atom!("height") => self.recreate_contexts(),
_ => (),
};
}

Просмотреть файл

@ -161,9 +161,9 @@ impl HTMLCollection {
pub fn by_tag_name(window: &Window, root: &Node, mut tag: DOMString)
-> Root<HTMLCollection> {
let tag_atom = Atom::from_slice(&tag);
let tag_atom = Atom::from(&*tag); // FIXME(ajeffrey): Convert directly from DOMString to Atom
tag.make_ascii_lowercase();
let ascii_lower_tag = Atom::from_slice(&tag);
let ascii_lower_tag = Atom::from(&*tag); // FIXME(ajeffrey): Convert directly from DOMString to Atom
HTMLCollection::by_atomic_tag_name(window, root, tag_atom, ascii_lower_tag)
}
@ -194,7 +194,7 @@ impl HTMLCollection {
pub fn by_tag_name_ns(window: &Window, root: &Node, tag: DOMString,
maybe_ns: Option<DOMString>) -> Root<HTMLCollection> {
let local = Atom::from_slice(&tag);
let local = Atom::from(&*tag); // FIXME(ajeffrey): Convert directly from DOMString to Atom
let ns = namespace_from_domstring(maybe_ns);
let qname = QualName::new(ns, local);
HTMLCollection::by_qual_tag_name(window, root, qname)
@ -219,7 +219,7 @@ impl HTMLCollection {
pub fn by_class_name(window: &Window, root: &Node, classes: DOMString)
-> Root<HTMLCollection> {
let class_atoms = split_html_space_chars(&classes).map(Atom::from_slice).collect();
let class_atoms = split_html_space_chars(&classes).map(Atom::from).collect();
HTMLCollection::by_atomic_class_name(window, root, class_atoms)
}
@ -370,7 +370,7 @@ impl HTMLCollectionMethods for HTMLCollection {
}
// Step 2.2
let name_attr = elem.get_string_attribute(&atom!("name"));
if !name_attr.is_empty() && !result.contains(&name_attr) && *elem.namespace() == ns!(HTML) {
if !name_attr.is_empty() && !result.contains(&name_attr) && *elem.namespace() == ns!(html) {
result.push(name_attr)
}
}

Просмотреть файл

@ -64,7 +64,7 @@ impl HTMLElement {
-> HTMLElement {
HTMLElement {
element:
Element::new_inherited_with_state(state, tag_name, ns!(HTML), prefix, document),
Element::new_inherited_with_state(state, tag_name, ns!(html), prefix, document),
style_decl: Default::default(),
dataset: Default::default(),
}
@ -100,7 +100,7 @@ impl HTMLElement {
}
},
_ => {
if let Some(attr) = element.get_attribute(&ns!(""), &atom!("draggable")) {
if let Some(attr) = element.get_attribute(&ns!(), &atom!("draggable")) {
let attr = attr.r();
let value = attr.value();
let is_true = match *value {
@ -328,15 +328,17 @@ impl HTMLElement {
}
pub fn get_custom_attr(&self, local_name: DOMString) -> Option<DOMString> {
let local_name = Atom::from_slice(&to_snake_case(local_name));
self.upcast::<Element>().get_attribute(&ns!(""), &local_name).map(|attr| {
// FIXME(ajeffrey): Convert directly from DOMString to Atom
let local_name = Atom::from(&*to_snake_case(local_name));
self.upcast::<Element>().get_attribute(&ns!(), &local_name).map(|attr| {
DOMString::from(&**attr.value()) // FIXME(ajeffrey): Convert directly from AttrValue to DOMString
})
}
pub fn delete_custom_attr(&self, local_name: DOMString) {
let local_name = Atom::from_slice(&to_snake_case(local_name));
self.upcast::<Element>().remove_attribute(&ns!(""), &local_name);
// FIXME(ajeffrey): Convert directly from DOMString to Atom
let local_name = Atom::from(&*to_snake_case(local_name));
self.upcast::<Element>().remove_attribute(&ns!(), &local_name);
}
// https://html.spec.whatwg.org/multipage/#category-label

Просмотреть файл

@ -87,7 +87,7 @@ impl VirtualMethods for HTMLFieldSetElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() {
&atom!(disabled) => {
&atom!("disabled") => {
let disabled_state = match mutation {
AttributeMutation::Set(None) => true,
AttributeMutation::Set(Some(_)) => {

Просмотреть файл

@ -92,7 +92,7 @@ impl HTMLFontElementLayoutHelpers for LayoutJS<HTMLFontElement> {
fn get_color(&self) -> Option<RGBA> {
unsafe {
(*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("color"))
.get_attr_for_layout(&ns!(), &atom!("color"))
.and_then(AttrValue::as_color)
.cloned()
}
@ -102,7 +102,7 @@ impl HTMLFontElementLayoutHelpers for LayoutJS<HTMLFontElement> {
fn get_face(&self) -> Option<Atom> {
unsafe {
(*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("face"))
.get_attr_for_layout(&ns!(), &atom!("face"))
.map(AttrValue::as_atom)
.cloned()
}
@ -112,7 +112,7 @@ impl HTMLFontElementLayoutHelpers for LayoutJS<HTMLFontElement> {
fn get_size(&self) -> Option<specified::Length> {
unsafe {
(*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("size"))
.get_attr_for_layout(&ns!(), &atom!("size"))
.and_then(AttrValue::as_length)
.cloned()
}

Просмотреть файл

@ -60,7 +60,7 @@ impl HTMLHRLayoutHelpers for LayoutJS<HTMLHRElement> {
fn get_color(&self) -> Option<RGBA> {
unsafe {
(&*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("color"))
.get_attr_for_layout(&ns!(), &atom!("color"))
.and_then(AttrValue::as_color)
.cloned()
}
@ -70,7 +70,7 @@ impl HTMLHRLayoutHelpers for LayoutJS<HTMLHRElement> {
fn get_width(&self) -> LengthOrPercentageOrAuto {
unsafe {
(&*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("width"))
.get_attr_for_layout(&ns!(), &atom!("width"))
.map(AttrValue::as_dimension)
.cloned()
.unwrap_or(LengthOrPercentageOrAuto::Auto)

Просмотреть файл

@ -68,7 +68,7 @@ impl HTMLIFrameElement {
pub fn get_url(&self) -> Option<Url> {
let element = self.upcast::<Element>();
element.get_attribute(&ns!(""), &atom!("src")).and_then(|src| {
element.get_attribute(&ns!(), &atom!("src")).and_then(|src| {
let url = src.value();
if url.is_empty() {
None
@ -210,7 +210,7 @@ impl HTMLIFrameElementLayoutMethods for LayoutJS<HTMLIFrameElement> {
fn get_width(&self) -> LengthOrPercentageOrAuto {
unsafe {
(*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("width"))
.get_attr_for_layout(&ns!(), &atom!("width"))
.map(|attribute| str::parse_length(&attribute))
.unwrap_or(LengthOrPercentageOrAuto::Auto)
}
@ -220,7 +220,7 @@ impl HTMLIFrameElementLayoutMethods for LayoutJS<HTMLIFrameElement> {
fn get_height(&self) -> LengthOrPercentageOrAuto {
unsafe {
(*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("height"))
.get_attr_for_layout(&ns!(), &atom!("height"))
.map(|attribute| str::parse_length(&attribute))
.unwrap_or(LengthOrPercentageOrAuto::Auto)
}
@ -398,7 +398,7 @@ impl VirtualMethods for HTMLIFrameElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() {
&atom!(sandbox) => {
&atom!("sandbox") => {
self.sandbox.set(mutation.new_value(attr).map(|value| {
let mut modes = SandboxAllowance::AllowNothing as u8;
for token in value.as_tokens() {
@ -415,7 +415,7 @@ impl VirtualMethods for HTMLIFrameElement {
modes
}));
},
&atom!(src) => {
&atom!("src") => {
if let AttributeMutation::Set(_) = mutation {
if self.upcast::<Node>().is_in_doc() {
self.process_the_iframe_attributes();

Просмотреть файл

@ -292,7 +292,7 @@ impl VirtualMethods for HTMLImageElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() {
&atom!(src) => {
&atom!("src") => {
self.update_image(mutation.new_value(attr).map(|value| {
// FIXME(ajeffrey): convert directly from AttrValue to DOMString
(DOMString::from(&**value), window_from_node(self).get_url())

Просмотреть файл

@ -131,7 +131,7 @@ impl HTMLInputElement {
pub fn type_(&self) -> Atom {
self.upcast::<Element>()
.get_attribute(&ns!(""), &atom!("type"))
.get_attribute(&ns!(), &atom!("type"))
.map_or_else(|| atom!(""), |a| a.value().as_atom().to_owned())
}
}
@ -166,7 +166,7 @@ impl LayoutHTMLInputElementHelpers for LayoutJS<HTMLInputElement> {
unsafe fn get_raw_attr_value(input: LayoutJS<HTMLInputElement>, default: &str) -> String {
let elem = input.upcast::<Element>();
let value = (*elem.unsafe_get())
.get_attr_val_for_layout(&ns!(""), &atom!("value"))
.get_attr_val_for_layout(&ns!(), &atom!("value"))
.unwrap_or(default);
String::from(value)
}
@ -451,7 +451,7 @@ impl HTMLInputElement {
fn get_radio_group_name(&self) -> Option<Atom> {
//TODO: determine form owner
self.upcast::<Element>()
.get_attribute(&ns!(""), &atom!("name"))
.get_attribute(&ns!(), &atom!("name"))
.map(|name| name.value().as_atom().clone())
}
@ -507,7 +507,7 @@ impl VirtualMethods for HTMLInputElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() {
&atom!(disabled) => {
&atom!("disabled") => {
let disabled_state = match mutation {
AttributeMutation::Set(None) => true,
AttributeMutation::Set(Some(_)) => {
@ -521,7 +521,7 @@ impl VirtualMethods for HTMLInputElement {
el.set_enabled_state(!disabled_state);
el.check_ancestors_disabled_state_for_form_control();
},
&atom!(checked) if !self.checked_changed.get() => {
&atom!("checked") if !self.checked_changed.get() => {
let checked_state = match mutation {
AttributeMutation::Set(None) => true,
AttributeMutation::Set(Some(_)) => {
@ -532,13 +532,13 @@ impl VirtualMethods for HTMLInputElement {
};
self.update_checked_state(checked_state, false);
},
&atom!(size) => {
&atom!("size") => {
let size = mutation.new_value(attr).map(|value| {
value.as_uint()
});
self.size.set(size.unwrap_or(DEFAULT_INPUT_SIZE));
}
&atom!(type) => {
&atom!("type") => {
match mutation {
AttributeMutation::Set(_) => {
let value = match &**attr.value() {
@ -567,16 +567,16 @@ impl VirtualMethods for HTMLInputElement {
}
}
},
&atom!(value) if !self.value_changed.get() => {
&atom!("value") if !self.value_changed.get() => {
let value = mutation.new_value(attr).map(|value| (**value).to_owned());
self.textinput.borrow_mut().set_content(
value.map(DOMString::from).unwrap_or(DOMString::from("")));
},
&atom!(name) if self.input_type.get() == InputType::InputRadio => {
&atom!("name") if self.input_type.get() == InputType::InputRadio => {
self.radio_group_updated(
mutation.new_value(attr).as_ref().map(|name| name.as_atom()));
},
&atom!(placeholder) => {
&atom!("placeholder") => {
// FIXME(ajeffrey): Should we do in-place mutation of the placeholder?
let mut placeholder = self.placeholder.borrow_mut();
placeholder.clear();
@ -591,9 +591,9 @@ impl VirtualMethods for HTMLInputElement {
fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue {
match name {
&atom!(name) => AttrValue::from_atomic(value),
&atom!("name") => AttrValue::from_atomic(value),
&atom!("size") => AttrValue::from_limited_u32(value, DEFAULT_INPUT_SIZE),
&atom!(type) => AttrValue::from_atomic(value),
&atom!("type") => AttrValue::from_atomic(value),
_ => self.super_type().unwrap().parse_plain_attribute(name, value),
}
}

Просмотреть файл

@ -95,7 +95,7 @@ impl HTMLLabelElementMethods for HTMLLabelElement {
return None;
}
let for_attr = match self.upcast::<Element>().get_attribute(&ns!(""), &atom!("for")) {
let for_attr = match self.upcast::<Element>().get_attribute(&ns!(), &atom!("for")) {
Some(for_attr) => for_attr,
None => return self.first_labelable_descendant(),
};

Просмотреть файл

@ -78,7 +78,7 @@ impl HTMLLinkElement {
}
fn get_attr(element: &Element, local_name: &Atom) -> Option<String> {
let elem = element.get_attribute(&ns!(""), local_name);
let elem = element.get_attribute(&ns!(), local_name);
elem.map(|e| {
let value = e.value();
(**value).to_owned()
@ -119,9 +119,9 @@ impl VirtualMethods for HTMLLinkElement {
return;
}
let rel = get_attr(self.upcast(), &atom!(rel));
let rel = get_attr(self.upcast(), &atom!("rel"));
match attr.local_name() {
&atom!(href) => {
&atom!("href") => {
if string_is_stylesheet(&rel) {
self.handle_stylesheet_url(&attr.value());
} else if is_favicon(&rel) {
@ -136,7 +136,7 @@ impl VirtualMethods for HTMLLinkElement {
}
}
},
&atom!(media) => {
&atom!("media") => {
if string_is_stylesheet(&rel) {
self.handle_stylesheet_url(&attr.value());
}
@ -186,7 +186,7 @@ impl HTMLLinkElement {
Ok(url) => {
let element = self.upcast::<Element>();
let mq_attribute = element.get_attribute(&ns!(""), &atom!("media"));
let mq_attribute = element.get_attribute(&ns!(), &atom!("media"));
let value = mq_attribute.r().map(|a| a.value());
let mq_str = match value {
Some(ref value) => &***value,

Просмотреть файл

@ -48,7 +48,7 @@ impl HTMLMetaElement {
fn process_attributes(&self) {
let element = self.upcast::<Element>();
if let Some(name) = element.get_attribute(&ns!(""), &atom!("name")).r() {
if let Some(name) = element.get_attribute(&ns!(), &atom!("name")).r() {
let name = name.value().to_ascii_lowercase();
let name = name.trim_matches(HTML_SPACE_CHARACTERS);
@ -64,7 +64,7 @@ impl HTMLMetaElement {
return;
}
let element = self.upcast::<Element>();
if let Some(content) = element.get_attribute(&ns!(""), &atom!("content")).r() {
if let Some(content) = element.get_attribute(&ns!(), &atom!("content")).r() {
let content = content.value();
if !content.is_empty() {
if let Some(translated_rule) = ViewportRule::from_meta(&**content) {

Просмотреть файл

@ -56,8 +56,8 @@ impl<'a> ProcessDataURL for &'a HTMLObjectElement {
let elem = self.upcast::<Element>();
// TODO: support other values
match (elem.get_attribute(&ns!(""), &atom!("type")),
elem.get_attribute(&ns!(""), &atom!("data"))) {
match (elem.get_attribute(&ns!(), &atom!("type")),
elem.get_attribute(&ns!(), &atom!("data"))) {
(None, Some(_uri)) => {
// TODO(gw): Prefetch the image here.
}
@ -98,7 +98,7 @@ impl VirtualMethods for HTMLObjectElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() {
&atom!(data) => {
&atom!("data") => {
if let AttributeMutation::Set(_) = mutation {
self.process_data_url();
}

Просмотреть файл

@ -57,7 +57,7 @@ impl VirtualMethods for HTMLOptGroupElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() {
&atom!(disabled) => {
&atom!("disabled") => {
let disabled_state = match mutation {
AttributeMutation::Set(None) => true,
AttributeMutation::Set(Some(_)) => {

Просмотреть файл

@ -72,7 +72,7 @@ impl HTMLOptionElement {
// FIXME(ajeffrey): Provide a way of buffering DOMStrings other than using Strings
fn collect_text(element: &Element, value: &mut String) {
let svg_script = *element.namespace() == ns!(SVG) && element.local_name() == &atom!("script");
let svg_script = *element.namespace() == ns!(svg) && element.local_name() == &atom!("script");
let html_script = element.is::<HTMLScriptElement>();
if svg_script || html_script {
return;
@ -162,7 +162,7 @@ impl VirtualMethods for HTMLOptionElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() {
&atom!(disabled) => {
&atom!("disabled") => {
let el = self.upcast::<Element>();
match mutation {
AttributeMutation::Set(_) => {
@ -176,7 +176,7 @@ impl VirtualMethods for HTMLOptionElement {
}
}
},
&atom!(selected) => {
&atom!("selected") => {
match mutation {
AttributeMutation::Set(_) => {
// https://html.spec.whatwg.org/multipage/#concept-option-selectedness

Просмотреть файл

@ -216,8 +216,8 @@ impl HTMLScriptElement {
}
// Step 12.
let for_attribute = element.get_attribute(&ns!(""), &atom!("for"));
let event_attribute = element.get_attribute(&ns!(""), &atom!("event"));
let for_attribute = element.get_attribute(&ns!(), &atom!("for"));
let event_attribute = element.get_attribute(&ns!(), &atom!("event"));
match (for_attribute.r(), event_attribute.r()) {
(Some(for_attribute), Some(event_attribute)) => {
let for_value = for_attribute.value().to_ascii_lowercase();
@ -236,7 +236,7 @@ impl HTMLScriptElement {
}
// Step 13.
if let Some(ref charset) = element.get_attribute(&ns!(""), &atom!("charset")) {
if let Some(ref charset) = element.get_attribute(&ns!(), &atom!("charset")) {
if let Some(encodingRef) = encoding_from_whatwg_label(&charset.Value()) {
*self.block_character_encoding.borrow_mut() = encodingRef;
}
@ -248,7 +248,7 @@ impl HTMLScriptElement {
let base_url = window.get_url();
let deferred = element.has_attribute(&atom!("defer"));
let is_external = match element.get_attribute(&ns!(""), &atom!("src")) {
let is_external = match element.get_attribute(&ns!(), &atom!("src")) {
// Step 14.
Some(ref src) => {
// Step 14.1
@ -500,7 +500,7 @@ impl HTMLScriptElement {
pub fn is_javascript(&self) -> bool {
let element = self.upcast::<Element>();
let type_attr = element.get_attribute(&ns!(""), &atom!("type"));
let type_attr = element.get_attribute(&ns!(), &atom!("type"));
let is_js = match type_attr.as_ref().map(|s| s.value()) {
Some(ref s) if s.is_empty() => {
// type attr exists, but empty means js
@ -513,7 +513,7 @@ impl HTMLScriptElement {
},
None => {
debug!("no script type");
let language_attr = element.get_attribute(&ns!(""), &atom!("language"));
let language_attr = element.get_attribute(&ns!(), &atom!("language"));
let is_js = match language_attr.as_ref().map(|s| s.value()) {
Some(ref s) if s.is_empty() => {
debug!("script language empty, inferring js");

Просмотреть файл

@ -172,7 +172,7 @@ impl VirtualMethods for HTMLSelectElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation);
if attr.local_name() == &atom!(disabled) {
if attr.local_name() == &atom!("disabled") {
let el = self.upcast::<Element>();
match mutation {
AttributeMutation::Set(_) => {

Просмотреть файл

@ -51,7 +51,7 @@ impl HTMLStyleElement {
let win = window_from_node(node);
let url = win.get_url();
let mq_attribute = element.get_attribute(&ns!(""), &atom!("media"));
let mq_attribute = element.get_attribute(&ns!(), &atom!("media"));
let mq_str = match mq_attribute {
Some(a) => String::from(&**a.value()),
None => String::new(),

Просмотреть файл

@ -85,7 +85,7 @@ impl HTMLTableCellElementLayoutHelpers for LayoutJS<HTMLTableCellElement> {
fn get_background_color(&self) -> Option<RGBA> {
unsafe {
(&*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("bgcolor"))
.get_attr_for_layout(&ns!(), &atom!("bgcolor"))
.and_then(AttrValue::as_color)
.cloned()
}
@ -94,7 +94,7 @@ impl HTMLTableCellElementLayoutHelpers for LayoutJS<HTMLTableCellElement> {
fn get_colspan(&self) -> Option<u32> {
unsafe {
(&*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("colspan"))
.get_attr_for_layout(&ns!(), &atom!("colspan"))
.map(AttrValue::as_uint)
}
}
@ -114,7 +114,7 @@ impl VirtualMethods for HTMLTableCellElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation);
match *attr.local_name() {
atom!(width) => {
atom!("width") => {
let width = mutation.new_value(attr).map(|value| {
str::parse_length(&value)
});

Просмотреть файл

@ -156,7 +156,7 @@ impl HTMLTableElementLayoutHelpers for LayoutJS<HTMLTableElement> {
fn get_width(&self) -> LengthOrPercentageOrAuto {
unsafe {
(*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("width"))
.get_attr_for_layout(&ns!(), &atom!("width"))
.map(AttrValue::as_dimension)
.cloned()
.unwrap_or(LengthOrPercentageOrAuto::Auto)
@ -172,18 +172,18 @@ impl VirtualMethods for HTMLTableElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation);
match *attr.local_name() {
atom!(bgcolor) => {
atom!("bgcolor") => {
self.background_color.set(mutation.new_value(attr).and_then(|value| {
str::parse_legacy_color(&value).ok()
}));
},
atom!(border) => {
atom!("border") => {
// According to HTML5 § 14.3.9, invalid values map to 1px.
self.border.set(mutation.new_value(attr).map(|value| {
str::parse_unsigned_integer(value.chars()).unwrap_or(1)
}));
}
atom!(cellspacing) => {
atom!("cellspacing") => {
self.cellspacing.set(mutation.new_value(attr).and_then(|value| {
str::parse_unsigned_integer(value.chars())
}));

Просмотреть файл

@ -98,7 +98,7 @@ impl HTMLTableRowElementLayoutHelpers for LayoutJS<HTMLTableRowElement> {
fn get_background_color(&self) -> Option<RGBA> {
unsafe {
(&*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("bgcolor"))
.get_attr_for_layout(&ns!(), &atom!("bgcolor"))
.and_then(AttrValue::as_color)
.cloned()
}

Просмотреть файл

@ -83,7 +83,7 @@ impl HTMLTableSectionElementLayoutHelpers for LayoutJS<HTMLTableSectionElement>
fn get_background_color(&self) -> Option<RGBA> {
unsafe {
(&*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("bgcolor"))
.get_attr_for_layout(&ns!(), &atom!("bgcolor"))
.and_then(AttrValue::as_color)
.cloned()
}

Просмотреть файл

@ -254,7 +254,7 @@ impl VirtualMethods for HTMLTextAreaElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation);
match *attr.local_name() {
atom!(disabled) => {
atom!("disabled") => {
let el = self.upcast::<Element>();
match mutation {
AttributeMutation::Set(_) => {
@ -268,13 +268,13 @@ impl VirtualMethods for HTMLTextAreaElement {
}
}
},
atom!(cols) => {
atom!("cols") => {
let cols = mutation.new_value(attr).map(|value| {
value.as_uint()
});
self.cols.set(cols.unwrap_or(DEFAULT_COLS));
},
atom!(rows) => {
atom!("rows") => {
let rows = mutation.new_value(attr).map(|value| {
value.as_uint()
});

Просмотреть файл

@ -10,7 +10,7 @@ macro_rules! make_getter(
use dom::element::Element;
use string_cache::Atom;
let element = self.upcast::<Element>();
element.get_string_attribute(&Atom::from_slice($htmlname))
element.get_string_attribute(&Atom::from($htmlname))
}
);
($attr:ident) => {
@ -27,7 +27,7 @@ macro_rules! make_bool_getter(
use string_cache::Atom;
let element = self.upcast::<Element>();
// FIXME(pcwalton): Do this at compile time, not runtime.
element.has_attribute(&Atom::from_slice($htmlname))
element.has_attribute(&Atom::from($htmlname))
}
);
($attr:ident) => {
@ -44,7 +44,7 @@ macro_rules! make_uint_getter(
use string_cache::Atom;
let element = self.upcast::<Element>();
// FIXME(pcwalton): Do this at compile time, not runtime.
element.get_uint_attribute(&Atom::from_slice($htmlname), $default)
element.get_uint_attribute(&Atom::from($htmlname), $default)
}
);
($attr:ident, $htmlname:expr) => {
@ -64,7 +64,7 @@ macro_rules! make_url_getter(
use string_cache::Atom;
let element = self.upcast::<Element>();
// FIXME(pcwalton): Do this at compile time, not runtime.
element.get_url_attribute(&Atom::from_slice($htmlname))
element.get_url_attribute(&Atom::from($htmlname))
}
);
($attr:ident) => {
@ -81,7 +81,7 @@ macro_rules! make_url_or_base_getter(
use dom::element::Element;
use string_cache::Atom;
let element = self.upcast::<Element>();
let url = element.get_url_attribute(&Atom::from_slice($htmlname));
let url = element.get_url_attribute(&Atom::from($htmlname));
if url.is_empty() {
let window = window_from_node(self);
DOMString::from(window.get_url().serialize())
@ -104,7 +104,7 @@ macro_rules! make_enumerated_getter(
use std::ascii::AsciiExt;
use string_cache::Atom;
let element = self.upcast::<Element>();
let mut val = element.get_string_attribute(&Atom::from_slice($htmlname));
let mut val = element.get_string_attribute(&Atom::from(*$htmlname));
val.make_ascii_lowercase();
// https://html.spec.whatwg.org/multipage/#attr-fs-method
match &*val {
@ -129,7 +129,7 @@ macro_rules! make_setter(
use string_cache::Atom;
let element = self.upcast::<Element>();
// FIXME(pcwalton): Do this at compile time, not at runtime.
element.set_string_attribute(&Atom::from_slice($htmlname), value)
element.set_string_attribute(&Atom::from($htmlname), value)
}
);
);
@ -143,7 +143,7 @@ macro_rules! make_bool_setter(
use string_cache::Atom;
let element = self.upcast::<Element>();
// FIXME(pcwalton): Do this at compile time, not at runtime.
element.set_bool_attribute(&Atom::from_slice($htmlname), value)
element.set_bool_attribute(&Atom::from($htmlname), value)
}
);
);
@ -163,7 +163,7 @@ macro_rules! make_uint_setter(
};
let element = self.upcast::<Element>();
// FIXME(pcwalton): Do this at compile time, not at runtime.
element.set_uint_attribute(&Atom::from_slice($htmlname), value)
element.set_uint_attribute(&Atom::from($htmlname), value)
}
);
($attr:ident, $htmlname:expr) => {
@ -188,7 +188,7 @@ macro_rules! make_limited_uint_setter(
};
let element = self.upcast::<Element>();
// FIXME(pcwalton): Do this at compile time, not runtime.
element.set_uint_attribute(&Atom::from_slice($htmlname), value);
element.set_uint_attribute(&Atom::from($htmlname), value);
Ok(())
}
);
@ -209,7 +209,7 @@ macro_rules! make_atomic_setter(
use string_cache::Atom;
let element = self.upcast::<Element>();
// FIXME(pcwalton): Do this at compile time, not at runtime.
element.set_atomic_attribute(&Atom::from_slice($htmlname), value)
element.set_atomic_attribute(&Atom::from($htmlname), value)
}
);
);
@ -225,7 +225,7 @@ macro_rules! make_legacy_color_setter(
let element = self.upcast::<Element>();
let value = AttrValue::from_legacy_color(value);
// FIXME(pcwalton): Do this at compile time, not at runtime.
element.set_attribute(&Atom::from_slice($htmlname), value)
element.set_attribute(&Atom::from($htmlname), value)
}
);
);
@ -240,7 +240,7 @@ macro_rules! make_dimension_setter(
let element = self.upcast::<Element>();
let value = AttrValue::from_dimension(value);
// FIXME(pcwalton): Do this at compile time, not at runtime.
element.set_attribute(&Atom::from_slice($htmlname), value)
element.set_attribute(&Atom::from($htmlname), value)
}
);
);

Просмотреть файл

@ -55,7 +55,7 @@ impl NamedNodeMapMethods for NamedNodeMap {
fn GetNamedItemNS(&self, namespace: Option<DOMString>, local_name: DOMString)
-> Option<Root<Attr>> {
let ns = namespace_from_domstring(namespace);
self.owner.get_attribute(&ns, &Atom::from_slice(&local_name))
self.owner.get_attribute(&ns, &Atom::from(&*local_name))
}
// https://dom.spec.whatwg.org/#dom-namednodemap-removenameditem
@ -68,7 +68,7 @@ impl NamedNodeMapMethods for NamedNodeMap {
fn RemoveNamedItemNS(&self, namespace: Option<DOMString>, local_name: DOMString)
-> Fallible<Root<Attr>> {
let ns = namespace_from_domstring(namespace);
self.owner.remove_attribute(&ns, &Atom::from_slice(&local_name))
self.owner.remove_attribute(&ns, &Atom::from(&*local_name))
.ok_or(Error::NotFound)
}

Просмотреть файл

@ -1631,7 +1631,7 @@ impl Node {
local: element.local_name().clone()
};
let element = Element::create(name,
element.prefix().as_ref().map(|p| Atom::from_slice(&p)),
element.prefix().as_ref().map(|p| Atom::from(&**p)),
document.r(), ElementCreator::ScriptCreated);
Root::upcast::<Node>(element)
},
@ -1707,7 +1707,7 @@ impl Node {
pub fn namespace_to_string(namespace: Namespace) -> Option<DOMString> {
match namespace {
ns!("") => None,
ns!() => None,
// FIXME(ajeffrey): convert directly from &Atom to DOMString
Namespace(ref ns) => Some(DOMString::from(&**ns))
}
@ -1717,7 +1717,7 @@ impl Node {
pub fn locate_namespace(node: &Node, prefix: Option<DOMString>) -> Namespace {
fn attr_defines_namespace(attr: &Attr,
prefix: &Option<Atom>) -> bool {
*attr.namespace() == ns!(XMLNS) &&
*attr.namespace() == ns!(xmlns) &&
match (attr.prefix(), prefix) {
(&Some(ref attr_prefix), &Some(ref prefix)) =>
attr_prefix == &atom!("xmlns") &&
@ -1731,12 +1731,12 @@ impl Node {
NodeTypeId::Element(_) => {
let element = node.downcast::<Element>().unwrap();
// Step 1.
if *element.namespace() != ns!("") && *element.prefix() == prefix {
if *element.namespace() != ns!() && *element.prefix() == prefix {
return element.namespace().clone()
}
let prefix_atom = prefix.as_ref().map(|s| Atom::from_slice(s));
// FIXME(ajeffrey): directly convert DOMString to Atom
let prefix_atom = prefix.as_ref().map(|s| Atom::from(&**s));
// Step 2.
let attrs = element.attrs();
@ -1751,7 +1751,7 @@ impl Node {
match node.GetParentElement() {
// Step 3.
None => ns!(""),
None => ns!(),
// Step 4.
Some(parent) => Node::locate_namespace(parent.upcast(), prefix)
}
@ -1759,18 +1759,18 @@ impl Node {
NodeTypeId::Document => {
match node.downcast::<Document>().unwrap().GetDocumentElement().r() {
// Step 1.
None => ns!(""),
None => ns!(),
// Step 2.
Some(document_element) => {
Node::locate_namespace(document_element.upcast(), prefix)
}
}
},
NodeTypeId::DocumentType => ns!(""),
NodeTypeId::DocumentFragment => ns!(""),
NodeTypeId::DocumentType => ns!(),
NodeTypeId::DocumentFragment => ns!(),
_ => match node.GetParentElement() {
// Step 1.
None => ns!(""),
None => ns!(),
// Step 2.
Some(parent) => Node::locate_namespace(parent.upcast(), prefix)
}
@ -2270,7 +2270,7 @@ impl NodeMethods for Node {
let namespace = namespace_from_domstring(namespace);
// Step 1.
if namespace == ns!("") {
if namespace == ns!() {
return None;
}

Просмотреть файл

@ -31,7 +31,6 @@
#![doc = "The script crate contains all matters DOM."]
#![plugin(string_cache_plugin)]
#![plugin(plugins)]
extern crate app_units;
@ -72,7 +71,7 @@ extern crate script_traits;
#[macro_use(state_pseudo_classes)] extern crate selectors;
extern crate serde;
extern crate smallvec;
extern crate string_cache;
#[macro_use(atom, ns)] extern crate string_cache;
extern crate tendril;
extern crate time;
extern crate unicase;

Просмотреть файл

@ -1183,7 +1183,7 @@ impl ScriptTask {
// Checks if the html element has reftest-wait attribute present.
// See http://testthewebforward.org/docs/reftests.html
let html_element = doc.GetDocumentElement();
let reftest_wait = html_element.map_or(false, |elem| elem.has_class(&Atom::from_slice("reftest-wait")));
let reftest_wait = html_element.map_or(false, |elem| elem.has_class(&Atom::from("reftest-wait")));
if reftest_wait {
return ScriptState::DocumentLoading;
}
@ -1810,7 +1810,7 @@ impl ScriptTask {
// Notify Constellation about the topmost anchor mouse over target.
for target in &*mouse_over_targets {
if target.is::<HTMLAnchorElement>() {
let status = target.get_attribute(&ns!(""), &atom!("href"))
let status = target.get_attribute(&ns!(), &atom!("href"))
.and_then(|href| {
let value = href.value();
let url = document.url();

81
servo/components/servo/Cargo.lock сгенерированный
Просмотреть файл

@ -673,7 +673,7 @@ dependencies = [
"simd 0.1.0 (git+https://github.com/huonw/simd)",
"skia 0.0.20130412 (git+https://github.com/servo/skia)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -861,30 +861,20 @@ dependencies = [
[[package]]
name = "html5ever"
version = "0.2.6"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"html5ever_macros 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "html5ever_macros"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "httparse"
version = "1.0.0"
@ -1031,13 +1021,12 @@ dependencies = [
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script 0.0.1",
"script_traits 0.0.1",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"unicode-bidi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1540,7 +1529,7 @@ dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
@ -1556,11 +1545,10 @@ dependencies = [
"rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script_traits 0.0.1",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1603,7 +1591,7 @@ dependencies = [
[[package]]
name = "selectors"
version = "0.2.1"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1612,8 +1600,7 @@ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1716,33 +1703,14 @@ dependencies = [
[[package]]
name = "string_cache"
version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "string_cache_plugin"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "string_cache_shared"
version = "0.1.12"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_generator 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_shared 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1761,12 +1729,11 @@ dependencies = [
"num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
@ -1780,9 +1747,8 @@ dependencies = [
"cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"style_traits 0.0.1",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1800,7 +1766,7 @@ dependencies = [
"num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1932,7 +1898,7 @@ dependencies = [
"cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
"js 0.1.1 (git+https://github.com/servo/rust-mozjs)",
@ -1945,11 +1911,11 @@ dependencies = [
"plugins 0.0.1",
"rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
"uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -2096,7 +2062,7 @@ dependencies = [
[[package]]
name = "xml5ever"
version = "0.1.0"
source = "git+https://github.com/Ygg01/xml5ever#0c36f2d93532b2d7b1ccfbd6019a6d53a1fcac69"
source = "git+https://github.com/Ygg01/xml5ever#9da3b1628bfcb69a48420f7aef69739d6706aa6a"
dependencies = [
"log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2104,8 +2070,7 @@ dependencies = [
"phf_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
]

Просмотреть файл

@ -35,8 +35,7 @@ num = "0.1.24"
lazy_static = "0.1.10"
selectors = { version = "0.2", features = ["unstable"] }
smallvec = "0.1"
string_cache = "0.1"
string_cache_plugin = "0.1"
string_cache = "0.2"
euclid = {version = "0.3", features = ["plugins"]}
serde = "0.6"
serde_macros = "0.6"

Просмотреть файл

@ -27,7 +27,7 @@ impl AttrValue {
pub fn from_serialized_tokenlist(tokens: DOMString) -> AttrValue {
let atoms =
split_html_space_chars(&tokens)
.map(Atom::from_slice)
.map(Atom::from)
.fold(vec![], |mut acc, atom| {
if !acc.contains(&atom) { acc.push(atom) }
acc
@ -64,7 +64,8 @@ impl AttrValue {
}
pub fn from_atomic(string: DOMString) -> AttrValue {
let value = Atom::from_slice(&string);
// FIXME(ajeffrey): convert directly from DOMString to Atom
let value = Atom::from(&*string);
AttrValue::Atom(value)
}

Просмотреть файл

@ -286,7 +286,7 @@ fn parse_var_function<'i, 't>(input: &mut Parser<'i, 't>,
}));
}
if let Some(ref mut refs) = *references {
refs.insert(Atom::from_slice(name));
refs.insert(Atom::from(name));
}
Ok(())
}
@ -510,7 +510,7 @@ fn substitute_block<F>(input: &mut Parser,
try!(input.parse_nested_block(|input| {
// parse_var_function() ensures neither .unwrap() will fail.
let name = input.expect_ident().unwrap();
let name = Atom::from_slice(parse_name(&name).unwrap());
let name = Atom::from(parse_name(&name).unwrap());
if let Ok(last) = substitute_one(&name, partial_computed_value) {
last_token_type = last;

Просмотреть файл

@ -12,7 +12,6 @@
#![feature(vec_push_all)]
#![plugin(serde_macros)]
#![plugin(string_cache_plugin)]
#![plugin(serde_macros)]
#![plugin(plugins)]
@ -37,7 +36,7 @@ extern crate rustc_serialize;
#[macro_use(state_pseudo_classes)] extern crate selectors;
extern crate serde;
extern crate smallvec;
extern crate string_cache;
#[macro_use(atom, ns)] extern crate string_cache;
extern crate url;
extern crate util;

Просмотреть файл

@ -1721,14 +1721,14 @@ pub mod longhands {
#[inline]
pub fn name(&self) -> &str {
match *self {
FontFamily::FamilyName(ref name) => name.as_slice(),
FontFamily::FamilyName(ref name) => &*name,
}
}
}
impl ToCss for FontFamily {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
match *self {
FontFamily::FamilyName(ref name) => dest.write_str(name.as_slice()),
FontFamily::FamilyName(ref name) => dest.write_str(&*name),
}
}
}
@ -1759,7 +1759,7 @@ pub mod longhands {
}
pub fn parse_one_family(input: &mut Parser) -> Result<FontFamily, ()> {
if let Ok(value) = input.try(|input| input.expect_string()) {
return Ok(FontFamily::FamilyName(Atom::from_slice(&value)))
return Ok(FontFamily::FamilyName(Atom::from(&*value)))
}
let first_ident = try!(input.expect_ident());
// match_ignore_ascii_case! { first_ident,
@ -1775,7 +1775,7 @@ pub mod longhands {
value.push_str(" ");
value.push_str(&ident);
}
Ok(FontFamily::FamilyName(Atom::from_slice(&value)))
Ok(FontFamily::FamilyName(Atom::from(&*value)))
}
</%self:longhand>
@ -6006,7 +6006,7 @@ impl PropertyDeclaration {
Err(()) => return PropertyDeclarationParseResult::InvalidValue,
}
};
result_list.push(PropertyDeclaration::Custom(Atom::from_slice(name), value));
result_list.push(PropertyDeclaration::Custom(Atom::from(name), value));
return PropertyDeclarationParseResult::ValidOrIgnoredDeclaration;
}
match_ignore_ascii_case! { name,
@ -6317,7 +6317,7 @@ impl ComputedValues {
_ => {
let name = try!(::custom_properties::parse_name(name));
let map = try!(self.custom_properties.as_ref().ok_or(()));
let value = try!(map.get(&Atom::from_slice(name)).ok_or(()));
let value = try!(map.get(&Atom::from(name)).ok_or(()));
Ok(value.to_css_string())
}
}

Просмотреть файл

@ -137,13 +137,13 @@ impl<'a, E> Element for ElementWrapper<'a, E> where E: Element {
}
fn get_id(&self) -> Option<Atom> {
match self.snapshot.attrs {
Some(_) => self.snapshot.get_attr(&ns!(""), &atom!("id")).map(|value| value.as_atom().clone()),
Some(_) => self.snapshot.get_attr(&ns!(), &atom!("id")).map(|value| value.as_atom().clone()),
None => self.element.get_id(),
}
}
fn has_class(&self, name: &Atom) -> bool {
match self.snapshot.attrs {
Some(_) => self.snapshot.get_attr(&ns!(""), &atom!("class"))
Some(_) => self.snapshot.get_attr(&ns!(), &atom!("class"))
.map_or(false, |v| { v.as_tokens().iter().any(|atom| atom == name) }),
None => self.element.has_class(name),
}
@ -180,7 +180,7 @@ impl<'a, E> Element for ElementWrapper<'a, E> where E: Element {
fn each_class<F>(&self, mut callback: F) where F: FnMut(&Atom) {
match self.snapshot.attrs {
Some(_) => {
if let Some(v) = self.snapshot.get_attr(&ns!(""), &atom!("class")) {
if let Some(v) = self.snapshot.get_attr(&ns!(), &atom!("class")) {
for c in v.as_tokens() { callback(c) }
}
}

Просмотреть файл

@ -385,7 +385,7 @@ impl<'a> AtRuleParser for TopLevelRuleParser<'a> {
self.state.set(State::Namespaces);
let prefix = input.try(|input| input.expect_ident()).ok().map(|p| p.into_owned());
let url = Namespace(Atom::from_slice(&*try!(input.expect_url_or_string())));
let url = Namespace(Atom::from(&*try!(input.expect_url_or_string())));
return Ok(AtRuleType::WithoutBlock(CSSRule::Namespace(prefix, url)))
} else {
return Err(()) // "@namespace must be before any rule but @charset and @import"

Просмотреть файл

@ -52,7 +52,7 @@ euclid = {version = "0.3", features = ["plugins"]}
selectors = "0.2"
serde = "0.6"
serde_macros = "0.6"
string_cache = "0.1"
string_cache = "0.2"
lazy_static = "0.1"
getopts = "0.2.11"
hyper = "0.6"

76
servo/ports/cef/Cargo.lock сгенерированный
Просмотреть файл

@ -629,7 +629,7 @@ dependencies = [
"simd 0.1.0 (git+https://github.com/huonw/simd)",
"skia 0.0.20130412 (git+https://github.com/servo/skia)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -810,30 +810,20 @@ dependencies = [
[[package]]
name = "html5ever"
version = "0.2.6"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"html5ever_macros 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "html5ever_macros"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "httparse"
version = "1.0.0"
@ -980,13 +970,12 @@ dependencies = [
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script 0.0.1",
"script_traits 0.0.1",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"unicode-bidi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1454,7 +1443,7 @@ dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
@ -1470,11 +1459,10 @@ dependencies = [
"rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script_traits 0.0.1",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1508,7 +1496,7 @@ dependencies = [
[[package]]
name = "selectors"
version = "0.2.1"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1517,8 +1505,7 @@ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1657,33 +1644,14 @@ dependencies = [
[[package]]
name = "string_cache"
version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "string_cache_plugin"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "string_cache_shared"
version = "0.1.12"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_generator 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_shared 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1702,12 +1670,11 @@ dependencies = [
"num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
@ -1724,7 +1691,7 @@ dependencies = [
"num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1856,7 +1823,7 @@ dependencies = [
"cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
"js 0.1.1 (git+https://github.com/servo/rust-mozjs)",
@ -1869,11 +1836,11 @@ dependencies = [
"plugins 0.0.1",
"rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
"uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -2009,7 +1976,7 @@ dependencies = [
[[package]]
name = "xml5ever"
version = "0.1.0"
source = "git+https://github.com/Ygg01/xml5ever#0c36f2d93532b2d7b1ccfbd6019a6d53a1fcac69"
source = "git+https://github.com/Ygg01/xml5ever#9da3b1628bfcb69a48420f7aef69739d6706aa6a"
dependencies = [
"log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2017,8 +1984,7 @@ dependencies = [
"phf_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
]

76
servo/ports/gonk/Cargo.lock сгенерированный
Просмотреть файл

@ -631,7 +631,7 @@ dependencies = [
"simd 0.1.0 (git+https://github.com/huonw/simd)",
"skia 0.0.20130412 (git+https://github.com/servo/skia)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -790,30 +790,20 @@ dependencies = [
[[package]]
name = "html5ever"
version = "0.2.6"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"html5ever_macros 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "html5ever_macros"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "httparse"
version = "1.0.0"
@ -960,13 +950,12 @@ dependencies = [
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script 0.0.1",
"script_traits 0.0.1",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"unicode-bidi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1434,7 +1423,7 @@ dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
@ -1450,11 +1439,10 @@ dependencies = [
"rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script_traits 0.0.1",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1488,7 +1476,7 @@ dependencies = [
[[package]]
name = "selectors"
version = "0.2.1"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1497,8 +1485,7 @@ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1635,33 +1622,14 @@ dependencies = [
[[package]]
name = "string_cache"
version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "string_cache_plugin"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "string_cache_shared"
version = "0.1.12"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_generator 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_shared 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1680,12 +1648,11 @@ dependencies = [
"num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
@ -1702,7 +1669,7 @@ dependencies = [
"num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1834,7 +1801,7 @@ dependencies = [
"cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
"js 0.1.1 (git+https://github.com/servo/rust-mozjs)",
@ -1847,11 +1814,11 @@ dependencies = [
"plugins 0.0.1",
"rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
"uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1957,7 +1924,7 @@ dependencies = [
[[package]]
name = "xml5ever"
version = "0.1.0"
source = "git+https://github.com/Ygg01/xml5ever#0c36f2d93532b2d7b1ccfbd6019a6d53a1fcac69"
source = "git+https://github.com/Ygg01/xml5ever#9da3b1628bfcb69a48420f7aef69739d6706aa6a"
dependencies = [
"log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1965,8 +1932,7 @@ dependencies = [
"phf_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
]

Просмотреть файл

@ -25,6 +25,5 @@ app_units = {version = "0.1", features = ["plugins"]}
url = "0.2"
cssparser = "0.4"
selectors = "0.2"
string_cache = "0.1"
string_cache_plugin = "0.1"
string_cache = "0.2"
euclid = {version = "0.3", features = ["plugins"]}

Просмотреть файл

@ -4,14 +4,13 @@
#![feature(plugin)]
#![cfg_attr(test, feature(core_intrinsics))]
#![plugin(string_cache_plugin)]
#![plugin(plugins)]
extern crate app_units;
extern crate cssparser;
extern crate euclid;
extern crate selectors;
extern crate string_cache;
#[macro_use(atom, ns)] extern crate string_cache;
extern crate style;
extern crate style_traits;
extern crate url;

Просмотреть файл

@ -26,21 +26,21 @@ fn test_parse_stylesheet() {
origin: Origin::UserAgent,
media: None,
rules: vec![
CSSRule::Namespace(None, ns!(HTML)),
CSSRule::Namespace(None, ns!(html)),
CSSRule::Style(StyleRule {
selectors: vec![
Selector {
compound_selectors: Arc::new(CompoundSelector {
simple_selectors: vec![
SimpleSelector::Namespace(ns!(HTML)),
SimpleSelector::Namespace(ns!(html)),
SimpleSelector::LocalName(LocalName {
name: atom!(input),
lower_name: atom!(input),
name: atom!("input"),
lower_name: atom!("input"),
}),
SimpleSelector::AttrEqual(AttrSelector {
name: atom!(type),
lower_name: atom!(type),
namespace: NamespaceConstraint::Specific(ns!("")),
name: atom!("type"),
lower_name: atom!("type"),
namespace: NamespaceConstraint::Specific(ns!()),
}, "hidden".to_owned(), CaseSensitivity::CaseInsensitive)
],
next: None,
@ -62,10 +62,10 @@ fn test_parse_stylesheet() {
Selector {
compound_selectors: Arc::new(CompoundSelector {
simple_selectors: vec![
SimpleSelector::Namespace(ns!(HTML)),
SimpleSelector::Namespace(ns!(html)),
SimpleSelector::LocalName(LocalName {
name: atom!(html),
lower_name: atom!(html),
name: atom!("html"),
lower_name: atom!("html"),
}),
],
next: None,
@ -76,10 +76,10 @@ fn test_parse_stylesheet() {
Selector {
compound_selectors: Arc::new(CompoundSelector {
simple_selectors: vec![
SimpleSelector::Namespace(ns!(HTML)),
SimpleSelector::Namespace(ns!(html)),
SimpleSelector::LocalName(LocalName {
name: atom!(body),
lower_name: atom!(body),
name: atom!("body"),
lower_name: atom!("body"),
}),
],
next: None,
@ -101,11 +101,11 @@ fn test_parse_stylesheet() {
Selector {
compound_selectors: Arc::new(CompoundSelector {
simple_selectors: vec![
SimpleSelector::Class(Atom::from_slice("ok")),
SimpleSelector::Class(Atom::from("ok")),
],
next: Some((Arc::new(CompoundSelector {
simple_selectors: vec![
SimpleSelector::ID(Atom::from_slice("d1")),
SimpleSelector::ID(Atom::from("d1")),
],
next: None,
}), Combinator::Child)),