Optimize reflow by changing enums to traits and inlining more

This commit is contained in:
Patrick Walton 2013-10-24 16:57:42 -07:00
parent 81f5ba7d05
commit 42092921c1
44 changed files with 2725 additions and 2362 deletions

View file

@ -882,7 +882,7 @@ pub struct DisplayBoxes {
/// Data that layout associates with a node.
pub struct LayoutData {
/// The results of CSS matching for this node.
applicable_declarations: ~[@[PropertyDeclaration]],
applicable_declarations: ~[Arc<~[PropertyDeclaration]>],
/// The results of CSS styling for this node.
style: Option<ComputedValues>,
@ -902,11 +902,21 @@ impl LayoutData {
applicable_declarations: ~[],
style: None,
restyle_damage: None,
boxes: DisplayBoxes { display_list: None, range: None },
boxes: DisplayBoxes {
display_list: None,
range: None,
},
}
}
}
// This serves as a static assertion that layout data remains sendable. If this is not done, then
// we can have memory unsafety, which usually manifests as shutdown crashes.
fn assert_is_sendable<T:Send>(_: T) {}
fn assert_layout_data_is_sendable() {
assert_is_sendable(LayoutData::new())
}
impl AbstractNode<LayoutView> {
// These accessors take a continuation rather than returning a reference, because
// an AbstractNode doesn't have a lifetime parameter relating to the underlying