diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2014-01-26 18:19:44 -0800 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2014-01-30 08:43:24 -0800 |
commit | 61b030552ef8f5314becf7b1c2f068a96c83a9ae (patch) | |
tree | 03b14c380a2fb3eb2b3240c1e6c4621cef930ac3 /src/components/main/layout/util.rs | |
parent | beb9b9bd92b8d38932583ff4b129293d8cc5d565 (diff) | |
download | servo-61b030552ef8f5314becf7b1c2f068a96c83a9ae.tar.gz servo-61b030552ef8f5314becf7b1c2f068a96c83a9ae.zip |
layout: Small vector optimize CSS selector matching
Diffstat (limited to 'src/components/main/layout/util.rs')
-rw-r--r-- | src/components/main/layout/util.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/components/main/layout/util.rs b/src/components/main/layout/util.rs index 43853e67f80..667968ec753 100644 --- a/src/components/main/layout/util.rs +++ b/src/components/main/layout/util.rs @@ -11,6 +11,7 @@ use script::dom::bindings::utils::Reflectable; use script::dom::node::AbstractNode; use script::layout_interface::{LayoutChan, UntrustedNodeAddress}; use servo_util::range::Range; +use servo_util::smallvec::{SmallVec0, SmallVec16}; use std::cast; use std::cell::{Ref, RefMut}; use std::iter::Enumerate; @@ -129,11 +130,11 @@ impl ElementMapping { /// Data that layout associates with a node. pub struct PrivateLayoutData { /// The results of CSS matching for this node. - before_applicable_declarations: ~[Arc<~[PropertyDeclaration]>], + applicable_declarations: SmallVec16<Arc<~[PropertyDeclaration]>>, - applicable_declarations: ~[Arc<~[PropertyDeclaration]>], + before_applicable_declarations: SmallVec0<Arc<~[PropertyDeclaration]>>, - after_applicable_declarations: ~[Arc<~[PropertyDeclaration]>], + after_applicable_declarations: SmallVec0<Arc<~[PropertyDeclaration]>>, /// The results of CSS styling for this node. before_style: Option<Arc<ComputedValues>>, @@ -154,9 +155,9 @@ impl PrivateLayoutData { /// Creates new layout data. pub fn new() -> PrivateLayoutData { PrivateLayoutData { - applicable_declarations: ~[], - before_applicable_declarations: ~[], - after_applicable_declarations: ~[], + applicable_declarations: SmallVec16::new(), + before_applicable_declarations: SmallVec0::new(), + after_applicable_declarations: SmallVec0::new(), before_style: None, style: None, after_style: None, |