mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Use DOMString instead of ~str in a few places.
This commit is contained in:
parent
68f534c45a
commit
ecc07e3b49
4 changed files with 18 additions and 16 deletions
|
@ -14,6 +14,7 @@ use script::layout_interface::LayoutChan;
|
|||
use servo_util::cache::{Cache, LRUCache, SimpleHashCache};
|
||||
use servo_util::namespace::Null;
|
||||
use servo_util::smallvec::{SmallVec, SmallVec0, SmallVec16};
|
||||
use servo_util::str::DOMString;
|
||||
use std::cast;
|
||||
use std::to_bytes;
|
||||
use std::vec::VecIterator;
|
||||
|
@ -161,9 +162,9 @@ struct StyleSharingCandidate {
|
|||
priv parent_style: Arc<ComputedValues>,
|
||||
|
||||
// TODO(pcwalton): Intern.
|
||||
priv local_name: ~str,
|
||||
priv local_name: DOMString,
|
||||
|
||||
priv class: Option<~str>,
|
||||
priv class: Option<DOMString>,
|
||||
}
|
||||
|
||||
impl Eq for StyleSharingCandidate {
|
||||
|
|
|
@ -16,9 +16,9 @@ pub struct DocumentType {
|
|||
}
|
||||
|
||||
impl DocumentType {
|
||||
pub fn new_inherited(name: ~str,
|
||||
public_id: Option<~str>,
|
||||
system_id: Option<~str>,
|
||||
pub fn new_inherited(name: DOMString,
|
||||
public_id: Option<DOMString>,
|
||||
system_id: Option<DOMString>,
|
||||
document: AbstractDocument)
|
||||
-> DocumentType {
|
||||
DocumentType {
|
||||
|
@ -29,9 +29,9 @@ impl DocumentType {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(name: ~str,
|
||||
public_id: Option<~str>,
|
||||
system_id: Option<~str>,
|
||||
pub fn new(name: DOMString,
|
||||
public_id: Option<DOMString>,
|
||||
system_id: Option<DOMString>,
|
||||
document: AbstractDocument)
|
||||
-> AbstractNode {
|
||||
let documenttype = DocumentType::new_inherited(name,
|
||||
|
|
|
@ -31,7 +31,7 @@ use std::unstable::raw::Box;
|
|||
|
||||
pub struct Element {
|
||||
node: Node,
|
||||
tag_name: ~str, // TODO: This should be an atom, not a ~str.
|
||||
tag_name: DOMString, // TODO: This should be an atom, not a DOMString.
|
||||
namespace: Namespace,
|
||||
attrs: ~[@mut Attr],
|
||||
style_attribute: Option<style::PropertyDeclarationBlock>,
|
||||
|
|
|
@ -11,6 +11,7 @@ use std::to_bytes;
|
|||
use servo_util::namespace;
|
||||
use servo_util::smallvec::SmallVec;
|
||||
use servo_util::sort;
|
||||
use servo_util::str::DOMString;
|
||||
|
||||
use media_queries::{Device, Screen};
|
||||
use node::{TElement, TNode};
|
||||
|
@ -31,8 +32,8 @@ static SELECTOR_WHITESPACE: &'static [char] = &'static [' ', '\t', '\n', '\r', '
|
|||
/// string.
|
||||
struct LowercaseAsciiString<'a>(&'a str);
|
||||
|
||||
impl<'a> Equiv<~str> for LowercaseAsciiString<'a> {
|
||||
fn equiv(&self, other: &~str) -> bool {
|
||||
impl<'a> Equiv<DOMString> for LowercaseAsciiString<'a> {
|
||||
fn equiv(&self, other: &DOMString) -> bool {
|
||||
let LowercaseAsciiString(this) = *self;
|
||||
this.eq_ignore_ascii_case(*other)
|
||||
}
|
||||
|
@ -79,9 +80,9 @@ impl<'a> IterBytes for LowercaseAsciiString<'a> {
|
|||
struct SelectorMap {
|
||||
// TODO: Tune the initial capacity of the HashMap
|
||||
// FIXME: Use interned strings
|
||||
id_hash: HashMap<~str, ~[Rule]>,
|
||||
class_hash: HashMap<~str, ~[Rule]>,
|
||||
element_hash: HashMap<~str, ~[Rule]>,
|
||||
id_hash: HashMap<DOMString, ~[Rule]>,
|
||||
class_hash: HashMap<DOMString, ~[Rule]>,
|
||||
element_hash: HashMap<DOMString, ~[Rule]>,
|
||||
// For Rules that don't have ID, class, or element selectors.
|
||||
universal_rules: ~[Rule],
|
||||
/// Whether this hash is empty.
|
||||
|
@ -163,7 +164,7 @@ impl SelectorMap {
|
|||
N:TNode<E>,
|
||||
V:SmallVec<MatchedProperty>>(
|
||||
node: &N,
|
||||
hash: &HashMap<~str,~[Rule]>,
|
||||
hash: &HashMap<DOMString,~[Rule]>,
|
||||
key: &str,
|
||||
matching_rules: &mut V,
|
||||
shareable: &mut bool) {
|
||||
|
@ -179,7 +180,7 @@ impl SelectorMap {
|
|||
N:TNode<E>,
|
||||
V:SmallVec<MatchedProperty>>(
|
||||
node: &N,
|
||||
hash: &HashMap<~str,~[Rule]>,
|
||||
hash: &HashMap<DOMString,~[Rule]>,
|
||||
key: &str,
|
||||
matching_rules: &mut V,
|
||||
shareable: &mut bool) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue