mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
script: Use atom comparison in more places, especially for attributes.
75% improvement in style recalc for Guardians of the Galaxy.
This commit is contained in:
parent
d168501555
commit
ee2ccc4f87
31 changed files with 305 additions and 237 deletions
|
@ -48,6 +48,7 @@ use std::cmp::{max, min};
|
|||
use std::fmt;
|
||||
use std::from_str::FromStr;
|
||||
use std::num::Zero;
|
||||
use string_cache::Atom;
|
||||
use style::{ComputedValues, TElement, TNode, cascade_anonymous, RGBA};
|
||||
use style::computed_values::{LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||
use style::computed_values::{LengthOrPercentageOrNone};
|
||||
|
@ -220,7 +221,7 @@ impl ImageFragmentInfo {
|
|||
image_url: Url,
|
||||
local_image_cache: Arc<Mutex<LocalImageCache<UntrustedNodeAddress>>>)
|
||||
-> ImageFragmentInfo {
|
||||
fn convert_length(node: &ThreadSafeLayoutNode, name: &str) -> Option<Au> {
|
||||
fn convert_length(node: &ThreadSafeLayoutNode, name: &Atom) -> Option<Au> {
|
||||
let element = node.as_element();
|
||||
element.get_attr(&ns!(""), name).and_then(|string| {
|
||||
let n: Option<int> = FromStr::from_str(string);
|
||||
|
@ -229,8 +230,8 @@ impl ImageFragmentInfo {
|
|||
}
|
||||
|
||||
let is_vertical = node.style().writing_mode.is_vertical();
|
||||
let dom_width = convert_length(node, "width");
|
||||
let dom_height = convert_length(node, "height");
|
||||
let dom_width = convert_length(node, &atom!("width"));
|
||||
let dom_height = convert_length(node, &atom!("height"));
|
||||
|
||||
let opaque_node: OpaqueNode = OpaqueNodeMethods::from_thread_safe_layout_node(node);
|
||||
let untrusted_node: UntrustedNodeAddress = opaque_node.to_untrusted_node_address();
|
||||
|
@ -412,7 +413,7 @@ impl TableColumnFragmentInfo {
|
|||
pub fn new(node: &ThreadSafeLayoutNode) -> TableColumnFragmentInfo {
|
||||
let span = {
|
||||
let element = node.as_element();
|
||||
element.get_attr(&ns!(""), "span").and_then(|string| {
|
||||
element.get_attr(&ns!(""), &atom!("span")).and_then(|string| {
|
||||
let n: Option<int> = FromStr::from_str(string);
|
||||
n
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue