Update string_cache to 0.2.

Updated string_cache, html5ever, xml5ever and selectors in Cargo.toml files and Cargo.lock.
Removed references to string_cache_plugin.
Import atom! and ns! from string_cache.
Replaced ns!("") by ns!().
Replaced ns!(XML) and co by ns!(xml) and co.
Replaced atom!(foo) by atom!("foo").
Replaced Atom::from_slice by Atom::from.
Replaced atom.as_slice() by &*atom.
This commit is contained in:
Alan Jeffrey 2015-11-24 13:44:59 -06:00
parent e7b1924948
commit 3dec6edd10
68 changed files with 328 additions and 434 deletions

View file

@ -71,8 +71,7 @@ rustc-serialize = "0.3"
libc = "0.1"
selectors = "0.2"
smallvec = "0.1"
string_cache = "0.1"
string_cache_plugin = "0.1"
string_cache = "0.2"
euclid = {version = "0.3", features = ["plugins"]}
serde = "0.6"
serde_macros = "0.6"

View file

@ -1642,7 +1642,7 @@ trait ObjectElement<'a> {
impl<'ln> ObjectElement<'ln> for ServoThreadSafeLayoutNode<'ln> {
fn get_type_and_data(&self) -> (Option<&'ln str>, Option<&'ln str>) {
let elem = self.as_element();
(elem.get_attr(&ns!(""), &atom!("type")), elem.get_attr(&ns!(""), &atom!("data")))
(elem.get_attr(&ns!(), &atom!("type")), elem.get_attr(&ns!(), &atom!("data")))
}
fn has_object_data(&self) -> bool {

View file

@ -166,12 +166,12 @@ fn create_common_style_affecting_attributes_from_element(element: &ServoLayoutEl
for attribute_info in &common_style_affecting_attributes() {
match attribute_info.mode {
CommonStyleAffectingAttributeMode::IsPresent(flag) => {
if element.get_attr(&ns!(""), &attribute_info.atom).is_some() {
if element.get_attr(&ns!(), &attribute_info.atom).is_some() {
flags.insert(flag)
}
}
CommonStyleAffectingAttributeMode::IsEqual(target_value, flag) => {
match element.get_attr(&ns!(""), &attribute_info.atom) {
match element.get_attr(&ns!(), &attribute_info.atom) {
Some(element_value) if element_value == target_value => {
flags.insert(flag)
}
@ -248,7 +248,7 @@ impl StyleSharingCandidate {
style: style,
parent_style: parent_style,
local_name: element.get_local_name().clone(),
class: element.get_attr(&ns!(""), &atom!("class"))
class: element.get_attr(&ns!(), &atom!("class"))
.map(|string| string.to_owned()),
link: element.is_link(),
namespace: (*element.get_namespace()).clone(),
@ -263,7 +263,7 @@ impl StyleSharingCandidate {
}
// FIXME(pcwalton): Use `each_class` here instead of slow string comparison.
match (&self.class, element.get_attr(&ns!(""), &atom!("class"))) {
match (&self.class, element.get_attr(&ns!(), &atom!("class"))) {
(&None, Some(_)) | (&Some(_), None) => return false,
(&Some(ref this_class), Some(element_class)) if
element_class != &**this_class => {
@ -289,12 +289,12 @@ impl StyleSharingCandidate {
match attribute_info.mode {
CommonStyleAffectingAttributeMode::IsPresent(flag) => {
if self.common_style_affecting_attributes.contains(flag) !=
element.get_attr(&ns!(""), &attribute_info.atom).is_some() {
element.get_attr(&ns!(), &attribute_info.atom).is_some() {
return false
}
}
CommonStyleAffectingAttributeMode::IsEqual(target_value, flag) => {
match element.get_attr(&ns!(""), &attribute_info.atom) {
match element.get_attr(&ns!(), &attribute_info.atom) {
Some(ref element_value) if self.common_style_affecting_attributes
.contains(flag) &&
*element_value != target_value => {
@ -313,7 +313,7 @@ impl StyleSharingCandidate {
}
for attribute_name in &rare_style_affecting_attributes() {
if element.get_attr(&ns!(""), attribute_name).is_some() {
if element.get_attr(&ns!(), attribute_name).is_some() {
return false
}
}
@ -621,7 +621,7 @@ impl<'ln> ElementMatchMethods for ServoLayoutElement<'ln> {
if self.style_attribute().is_some() {
return StyleSharingResult::CannotShare
}
if self.get_attr(&ns!(""), &atom!("id")).is_some() {
if self.get_attr(&ns!(), &atom!("id")).is_some() {
return StyleSharingResult::CannotShare
}

View file

@ -351,7 +351,7 @@ impl ImageFragmentInfo {
-> ImageFragmentInfo {
fn convert_length(node: &ServoThreadSafeLayoutNode, name: &Atom) -> Option<Au> {
let element = node.as_element();
element.get_attr(&ns!(""), name)
element.get_attr(&ns!(), name)
.and_then(|string| string.parse().ok())
.map(Au::from_px)
}
@ -760,7 +760,7 @@ impl TableColumnFragmentInfo {
/// Create the information specific to an table column fragment.
pub fn new(node: &ServoThreadSafeLayoutNode) -> TableColumnFragmentInfo {
let element = node.as_element();
let span = element.get_attr(&ns!(""), &atom!("span"))
let span = element.get_attr(&ns!(), &atom!("span"))
.and_then(|string| string.parse().ok())
.unwrap_or(0);
TableColumnFragmentInfo {

View file

@ -16,7 +16,6 @@
#![deny(unsafe_code)]
#![plugin(string_cache_plugin)]
#![plugin(plugins)]
extern crate app_units;
@ -52,7 +51,7 @@ extern crate script_traits;
extern crate serde;
extern crate serde_json;
extern crate smallvec;
extern crate string_cache;
#[macro_use(atom, ns)] extern crate string_cache;
extern crate style;
extern crate unicode_bidi;
extern crate unicode_script;

View file

@ -555,7 +555,7 @@ pub fn process_resolved_style_request(requested_node: ServoLayoutNode,
}
// FIXME: implement used value computation for line-height
ref property => {
style.computed_value_to_string(property.as_slice()).ok()
style.computed_value_to_string(&*property).ok()
}
}
}

View file

@ -662,7 +662,7 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLinkElement)) => {
unsafe {
(*self.element.unsafe_get()).get_attr_val_for_layout(&ns!(""), &atom!("href")).is_some()
(*self.element.unsafe_get()).get_attr_val_for_layout(&ns!(), &atom!("href")).is_some()
}
}
_ => false,
@ -712,7 +712,7 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
#[inline]
fn has_servo_nonzero_border(&self) -> bool {
unsafe {
match (*self.element.unsafe_get()).get_attr_for_layout(&ns!(""), &atom!("border")) {
match (*self.element.unsafe_get()).get_attr_for_layout(&ns!(), &atom!("border")) {
None | Some(&AttrValue::UInt(_, 0)) => false,
_ => true,
}