Import string_cache::Atom into the attributes' macros

This commit is contained in:
Anthony Ramine 2015-05-02 12:52:47 +02:00
parent 8979d77e77
commit 2176aab642
9 changed files with 9 additions and 20 deletions

View file

@ -19,7 +19,6 @@ use dom::virtualmethods::VirtualMethods;
use dom::window::WindowHelpers;
use cssparser::RGBA;
use string_cache::Atom;
use util::str::{self, DOMString};
use std::borrow::ToOwned;

View file

@ -26,7 +26,6 @@ use std::ascii::OwnedAsciiExt;
use std::borrow::ToOwned;
use util::str::DOMString;
use std::cell::Cell;
use string_cache::Atom;
#[jstraceable]
#[derive(PartialEq, Copy, Clone)]

View file

@ -14,7 +14,6 @@ use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
use dom::node::{Node, NodeTypeId};
use util::str::DOMString;
use string_cache::Atom;
use std::borrow::ToOwned;

View file

@ -20,7 +20,6 @@ use dom::validitystate::ValidityState;
use dom::virtualmethods::VirtualMethods;
use util::str::{DOMString, StaticStringVec};
use string_cache::Atom;
#[dom_struct]
pub struct HTMLFieldSetElement {

View file

@ -12,7 +12,6 @@ use dom::element::ElementTypeId;
use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
use dom::node::{Node, NodeTypeId};
use util::str::DOMString;
use string_cache::Atom;
#[dom_struct]
pub struct HTMLMetaElement {

View file

@ -24,7 +24,6 @@ use dom::virtualmethods::VirtualMethods;
use net_traits::image::base::Image;
use util::str::DOMString;
use std::sync::Arc;
use string_cache::Atom;
#[dom_struct]
pub struct HTMLObjectElement {

View file

@ -18,7 +18,6 @@ use dom::node::{DisabledStateHelpers, Node, NodeHelpers, NodeTypeId};
use dom::virtualmethods::VirtualMethods;
use util::str::DOMString;
use string_cache::Atom;
#[dom_struct]
pub struct HTMLOptGroupElement {

View file

@ -22,7 +22,6 @@ use dom::node::{DisabledStateHelpers, Node, NodeHelpers, NodeTypeId};
use dom::virtualmethods::VirtualMethods;
use util::str::{DOMString, split_html_space_chars};
use string_cache::Atom;
#[dom_struct]
pub struct HTMLOptionElement {

View file

@ -8,8 +8,7 @@ macro_rules! make_getter(
fn $attr(self) -> DOMString {
use dom::element::{Element, AttributeHandlers};
use dom::bindings::codegen::InheritTypes::ElementCast;
#[allow(unused_imports)]
use std::ascii::AsciiExt;
use string_cache::Atom;
let element: JSRef<Element> = ElementCast::from_ref(self);
element.get_string_attribute(&Atom::from_slice($htmlname))
}
@ -25,8 +24,7 @@ macro_rules! make_bool_getter(
fn $attr(self) -> bool {
use dom::element::{Element, AttributeHandlers};
use dom::bindings::codegen::InheritTypes::ElementCast;
#[allow(unused_imports)]
use std::ascii::AsciiExt;
use string_cache::Atom;
let element: JSRef<Element> = ElementCast::from_ref(self);
// FIXME(pcwalton): Do this at compile time, not runtime.
element.has_attribute(&Atom::from_slice($htmlname))
@ -43,8 +41,7 @@ macro_rules! make_uint_getter(
fn $attr(self) -> u32 {
use dom::element::{Element, AttributeHandlers};
use dom::bindings::codegen::InheritTypes::ElementCast;
#[allow(unused_imports)]
use std::ascii::AsciiExt;
use string_cache::Atom;
let element: JSRef<Element> = ElementCast::from_ref(self);
// FIXME(pcwalton): Do this at compile time, not runtime.
element.get_uint_attribute(&Atom::from_slice($htmlname), $default)
@ -64,8 +61,7 @@ macro_rules! make_url_getter(
fn $attr(self) -> DOMString {
use dom::element::{Element, AttributeHandlers};
use dom::bindings::codegen::InheritTypes::ElementCast;
#[allow(unused_imports)]
use std::ascii::AsciiExt;
use string_cache::Atom;
let element: JSRef<Element> = ElementCast::from_ref(self);
// FIXME(pcwalton): Do this at compile time, not runtime.
element.get_url_attribute(&Atom::from_slice($htmlname))
@ -84,8 +80,7 @@ macro_rules! make_url_or_base_getter(
use dom::element::{Element, AttributeHandlers};
use dom::bindings::codegen::InheritTypes::ElementCast;
use dom::window::WindowHelpers;
#[allow(unused_imports)]
use std::ascii::AsciiExt;
use string_cache::Atom;
let element: JSRef<Element> = ElementCast::from_ref(self);
let url = element.get_url_attribute(&Atom::from_slice($htmlname));
if url.is_empty() {
@ -107,8 +102,7 @@ macro_rules! make_enumerated_getter(
fn $attr(self) -> DOMString {
use dom::element::{Element, AttributeHandlers};
use dom::bindings::codegen::InheritTypes::ElementCast;
#[allow(unused_imports)]
use std::ascii::AsciiExt;
use string_cache::Atom;
use std::borrow::ToOwned;
let element: JSRef<Element> = ElementCast::from_ref(self);
let val = element.get_string_attribute(&Atom::from_slice($htmlname))
@ -133,6 +127,7 @@ macro_rules! make_setter(
fn $attr(self, value: DOMString) {
use dom::element::{Element, AttributeHandlers};
use dom::bindings::codegen::InheritTypes::ElementCast;
use string_cache::Atom;
let element: JSRef<Element> = ElementCast::from_ref(self);
// FIXME(pcwalton): Do this at compile time, not at runtime.
element.set_string_attribute(&Atom::from_slice($htmlname), value)
@ -146,6 +141,7 @@ macro_rules! make_bool_setter(
fn $attr(self, value: bool) {
use dom::element::{Element, AttributeHandlers};
use dom::bindings::codegen::InheritTypes::ElementCast;
use string_cache::Atom;
let element: JSRef<Element> = ElementCast::from_ref(self);
// FIXME(pcwalton): Do this at compile time, not at runtime.
element.set_bool_attribute(&Atom::from_slice($htmlname), value)
@ -159,6 +155,7 @@ macro_rules! make_uint_setter(
fn $attr(self, value: u32) {
use dom::element::{Element, AttributeHandlers};
use dom::bindings::codegen::InheritTypes::ElementCast;
use string_cache::Atom;
let value = if value > 2147483647 {
$default
} else {