aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/construct.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-09-12 13:28:37 -0700
committerPatrick Walton <pcwalton@mimiga.net>2014-10-14 10:32:40 -0700
commitee2ccc4f872ba33a86057d87a99d1015b3c41cf1 (patch)
tree3a7ef263aa401fb3a36e9d48ff5bc8a384ab1f65 /components/layout/construct.rs
parentd1685015559562a42cc440f4e3b7a97d38cc642c (diff)
downloadservo-ee2ccc4f872ba33a86057d87a99d1015b3c41cf1.tar.gz
servo-ee2ccc4f872ba33a86057d87a99d1015b3c41cf1.zip
script: Use atom comparison in more places, especially for attributes.
75% improvement in style recalc for Guardians of the Galaxy.
Diffstat (limited to 'components/layout/construct.rs')
-rw-r--r--components/layout/construct.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/components/layout/construct.rs b/components/layout/construct.rs
index ffdf535874e..82bff208604 100644
--- a/components/layout/construct.rs
+++ b/components/layout/construct.rs
@@ -226,7 +226,7 @@ impl<'a> FlowConstructor<'a> {
//FIXME: would it make more sense to use HTMLInputElement::input_type instead of the raw
// value? definitely for string comparisons.
let elem = node.as_element();
- let data = match elem.get_attr(&ns!(""), "type") {
+ let data = match elem.get_attr(&ns!(""), &atom!("type")) {
Some("checkbox") | Some("radio") => None,
Some("button") | Some("submit") | Some("reset") =>
Some(node.get_input_value().len() as u32),
@@ -1158,7 +1158,7 @@ trait ObjectElement<'a> {
impl<'ln> ObjectElement<'ln> for ThreadSafeLayoutNode<'ln> {
fn get_type_and_data(&self) -> (Option<&'ln str>, Option<&'ln str>) {
let elem = self.as_element();
- (elem.get_attr(&ns!(""), "type"), elem.get_attr(&ns!(""), "data"))
+ (elem.get_attr(&ns!(""), &atom!("type")), elem.get_attr(&ns!(""), &atom!("data")))
}
fn has_object_data(&self) -> bool {