Use static atoms in some places.

This commit is contained in:
Ms2ger 2015-09-14 10:33:16 +02:00
parent d5ee58caf2
commit 9faa2de0fc
3 changed files with 4 additions and 5 deletions

View file

@ -520,7 +520,7 @@ impl VirtualMethods for HTMLInputElement {
self.radio_group_updated( self.radio_group_updated(
mutation.new_value(attr).as_ref().map(|value| &***value)); mutation.new_value(attr).as_ref().map(|value| &***value));
}, },
name if name == &Atom::from_slice("placeholder") => { &atom!(placeholder) => {
let mut placeholder = self.placeholder.borrow_mut(); let mut placeholder = self.placeholder.borrow_mut();
placeholder.clear(); placeholder.clear();
if let AttributeMutation::Set(_) = mutation { if let AttributeMutation::Set(_) = mutation {

View file

@ -45,7 +45,6 @@ use net_traits::{Metadata, AsyncResponseListener, AsyncResponseTarget};
use std::cell::{RefCell, Cell}; use std::cell::{RefCell, Cell};
use std::mem; use std::mem;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use string_cache::Atom;
use url::{Url, UrlParser}; use url::{Url, UrlParser};
use util::str::{DOMString, HTML_SPACE_CHARACTERS, StaticStringVec}; use util::str::{DOMString, HTML_SPACE_CHARACTERS, StaticStringVec};
@ -233,7 +232,7 @@ impl HTMLScriptElement {
// Step 12. // Step 12.
let for_attribute = element.get_attribute(&ns!(""), &atom!("for")); let for_attribute = element.get_attribute(&ns!(""), &atom!("for"));
let event_attribute = element.get_attribute(&ns!(""), &Atom::from_slice("event")); let event_attribute = element.get_attribute(&ns!(""), &atom!("event"));
match (for_attribute.r(), event_attribute.r()) { match (for_attribute.r(), event_attribute.r()) {
(Some(for_attribute), Some(event_attribute)) => { (Some(for_attribute), Some(event_attribute)) => {
let for_value = for_attribute.value().to_ascii_lowercase(); let for_value = for_attribute.value().to_ascii_lowercase();
@ -252,7 +251,7 @@ impl HTMLScriptElement {
} }
// Step 13. // Step 13.
if let Some(ref charset) = element.get_attribute(&ns!(""), &Atom::from_slice("charset")) { if let Some(ref charset) = element.get_attribute(&ns!(""), &atom!("charset")) {
if let Some(encodingRef) = encoding_from_whatwg_label(&charset.r().Value()) { if let Some(encodingRef) = encoding_from_whatwg_label(&charset.r().Value()) {
*self.block_character_encoding.borrow_mut() = encodingRef; *self.block_character_encoding.borrow_mut() = encodingRef;
} }

View file

@ -1759,7 +1759,7 @@ pub mod longhands {
#[inline] #[inline]
pub fn get_initial_value() -> computed_value::T { pub fn get_initial_value() -> computed_value::T {
computed_value::T(vec![FontFamily::FamilyName(Atom::from_slice("serif"))]) computed_value::T(vec![FontFamily::FamilyName(atom!("serif"))])
} }
/// <family-name># /// <family-name>#
/// <family-name> = <string> | [ <ident>+ ] /// <family-name> = <string> | [ <ident>+ ]