Auto merge of #8504 - frewsxcv:more-atoms, r=jdm

Prefer atoms over strs for string comparisons

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8504)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-11-13 10:56:13 +05:30
commit 1763a37e3b
4 changed files with 15 additions and 15 deletions

View file

@ -343,7 +343,7 @@ impl HTMLInputElementMethods for HTMLInputElement {
// https://html.spec.whatwg.org/multipage/#dom-lfe-labels // https://html.spec.whatwg.org/multipage/#dom-lfe-labels
fn Labels(&self) -> Root<NodeList> { fn Labels(&self) -> Root<NodeList> {
if &*self.type_() == "hidden" { if self.type_() == atom!("hidden") {
let window = window_from_node(self); let window = window_from_node(self);
NodeList::empty(&window) NodeList::empty(&window)
} else { } else {
@ -418,14 +418,14 @@ impl HTMLInputElement {
_ => false _ => false
}; };
match &*ty { match ty {
"submit" | "button" | "reset" if !is_submitter => return None, atom!("submit") | atom!("button") | atom!("reset") if !is_submitter => return None,
"radio" | "checkbox" => { atom!("radio") | atom!("checkbox") => {
if !self.Checked() || name.is_empty() { if !self.Checked() || name.is_empty() {
return None; return None;
} }
}, },
"image" | "file" => return None, // Unimplemented atom!("image") | atom!("file") => return None, // Unimplemented
_ => { _ => {
if name.is_empty() { if name.is_empty() {
return None; return None;
@ -434,7 +434,7 @@ impl HTMLInputElement {
} }
let mut value = self.Value(); let mut value = self.Value();
if &*ty == "radio" || &*ty == "checkbox" { if ty == atom!("radio") || ty == atom!("checkbox") {
if value.is_empty() { if value.is_empty() {
value = DOMString::from("on"); value = DOMString::from("on");
} }

View file

@ -1689,7 +1689,7 @@ dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "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_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -1699,12 +1699,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "string_cache_shared" name = "string_cache_shared"
version = "0.1.10" version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",

6
ports/cef/Cargo.lock generated
View file

@ -1648,7 +1648,7 @@ dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "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_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -1658,12 +1658,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "string_cache_shared" name = "string_cache_shared"
version = "0.1.10" version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",

6
ports/gonk/Cargo.lock generated
View file

@ -1626,7 +1626,7 @@ dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "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_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -1636,12 +1636,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "string_cache_shared" name = "string_cache_shared"
version = "0.1.10" version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",