Auto merge of #6546 - michaelwu:slim-layoutdatawrapper, r=Ms2ger

Remove LayoutChan from LayoutDataWrapper

Saves 32 bytes in Node.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6546)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-07-05 21:39:12 -06:00
commit cc73aad447
5 changed files with 17 additions and 27 deletions

View file

@ -7,7 +7,6 @@ use incremental::RestyleDamage;
use msg::constellation_msg::ConstellationChan;
use parallel::DomParallelInfo;
use script::dom::node::SharedLayoutData;
use script::layout_interface::LayoutChan;
use std::sync::Arc;
use style::properties::ComputedValues;
@ -61,7 +60,6 @@ bitflags! {
}
pub struct LayoutDataWrapper {
pub chan: Option<LayoutChan>,
pub shared_data: SharedLayoutData,
pub data: Box<PrivateLayoutData>,
}

View file

@ -132,7 +132,7 @@ impl<'a> PreorderDomTraversal for RecalcStyleForNode<'a> {
//
// FIXME(pcwalton): Stop allocating here. Ideally this should just be done by the HTML
// parser.
node.initialize_layout_data(self.layout_context.shared.layout_chan.clone());
node.initialize_layout_data();
// Get the parent node.
let parent_opt = node.layout_parent_node(self.layout_context.shared);

View file

@ -56,7 +56,6 @@ use script::dom::node::{Node, NodeTypeId};
use script::dom::node::{LayoutNodeHelpers, RawLayoutNodeHelpers, SharedLayoutData};
use script::dom::node::{HAS_CHANGED, IS_DIRTY, HAS_DIRTY_SIBLINGS, HAS_DIRTY_DESCENDANTS};
use script::dom::text::Text;
use script::layout_interface::LayoutChan;
use smallvec::VecLike;
use msg::constellation_msg::{PipelineId, SubpageId};
use util::str::is_whitespace;
@ -179,12 +178,11 @@ impl<'ln> LayoutNode<'ln> {
/// Resets layout data and styles for the node.
///
/// FIXME(pcwalton): Do this as part of fragment building instead of in a traversal.
pub fn initialize_layout_data(self, chan: LayoutChan) {
pub fn initialize_layout_data(self) {
let mut layout_data_ref = self.mutate_layout_data();
match *layout_data_ref {
None => {
*layout_data_ref = Some(LayoutDataWrapper {
chan: Some(chan),
shared_data: SharedLayoutData { style: None },
data: box PrivateLayoutData::new(),
});