diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2014-09-12 13:28:37 -0700 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2014-09-17 13:17:12 -0700 |
commit | 874db261046d6155b1942efa106d2e0014295d6d (patch) | |
tree | dd766824192dd26a929bd0b2ce0f5e3d9d0b7677 /components/script/page.rs | |
parent | 61642d64b5c06f30fd68961e5ffd21a35dacbc4c (diff) | |
download | servo-874db261046d6155b1942efa106d2e0014295d6d.tar.gz servo-874db261046d6155b1942efa106d2e0014295d6d.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/script/page.rs')
-rw-r--r-- | components/script/page.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/components/script/page.rs b/components/script/page.rs index 6e8f414ef8d..eca24e6d814 100644 --- a/components/script/page.rs +++ b/components/script/page.rs @@ -27,6 +27,7 @@ use servo_msg::compositor_msg::ScriptListener; use servo_msg::constellation_msg::{ConstellationChan, WindowSizeData}; use servo_msg::constellation_msg::{PipelineId, SubpageId}; use servo_net::resource_task::ResourceTask; +use servo_util::atom::Atom; use servo_util::namespace::Null; use servo_util::str::DOMString; use std::cell::{Cell, RefCell, Ref, RefMut}; @@ -373,9 +374,11 @@ impl Page { .filter(|node| node.is_anchor_element()); anchors.find(|node| { let elem: &JSRef<Element> = ElementCast::to_ref(node).unwrap(); - elem.get_attribute(Null, "name").root().map_or(false, |attr| { - attr.deref().value().as_slice() == fragid.as_slice() - }) + elem.get_attribute(Null, &satom!("name")) + .root() + .map_or(false, |attr| { + attr.deref().value().as_slice() == fragid.as_slice() + }) }).map(|node| Temporary::from_rooted(ElementCast::to_ref(&node).unwrap())) } } |