Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pseudo element build flow and box #1496

Closed

Add initialize_layout_data without a channel

  • Loading branch information
sammykim committed Feb 10, 2014
commit 5e144453ab5556b52fdd34c8f3b226d1adcb65be
@@ -642,12 +642,7 @@ impl<'fc> FlowConstructor<'fc> {
let layout_data_ref = p.borrow_layout_data();
let pseudo_parent_ldw = layout_data_ref.get().get_ref();

match pseudo_parent_ldw.chan {
Some(ref chan) => {
ThreadSafeLayoutNode::to_pseudo_layout_node(pseudo_parent_node).initialize_layout_data(chan.clone());
}
None => {}
}
ThreadSafeLayoutNode::to_pseudo_layout_node(pseudo_parent_node).initialize_layout_data_no_chan();

if pseudo_element == Before {
insert_layout_data(&pseudo_parent_node, ~PrivateLayoutData::new_with_style(pseudo_parent_ldw.data.before_style.clone()));
@@ -668,12 +663,7 @@ impl<'fc> FlowConstructor<'fc> {
let mut layout_data_ref = node.mutate_layout_data();
let pseudo_child_ldw = layout_data_ref.get().get_mut_ref();

match pseudo_child_ldw.chan {
Some(ref chan) => {
ThreadSafeLayoutNode::to_pseudo_layout_node(pseudo_node).initialize_layout_data(chan.clone());
}
None => {}
}
ThreadSafeLayoutNode::to_pseudo_layout_node(pseudo_node).initialize_layout_data_no_chan();

if pseudo_element == Before {
insert_layout_data(&pseudo_node, ~PrivateLayoutData::new_with_style(pseudo_parent_ldw.data.before_style.clone()));
@@ -10,11 +10,28 @@ use script::layout_interface::LayoutChan;

/// Functionality useful for querying the layout-specific data on DOM nodes.
pub trait LayoutAuxMethods {
fn initialize_layout_data_no_chan(self);
fn initialize_layout_data(self, chan: LayoutChan);
fn initialize_style_for_subtree(self, chan: LayoutChan);
}

impl<'ln> LayoutAuxMethods for LayoutNode<'ln> {
/// Resets layout data and styles without a channel for the node.
///
/// FIXME(pcwalton): Do this as part of box building instead of in a traversal.
fn initialize_layout_data_no_chan(self) {
let mut layout_data_ref = self.mutate_layout_data();
match *layout_data_ref.get() {
None => {
*layout_data_ref.get() = Some(LayoutDataWrapper {
chan: None,
data: ~PrivateLayoutData::new(),
});
}
Some(_) => {}
}
}

/// Resets layout data and styles for the node.
///
/// FIXME(pcwalton): Do this as part of box building instead of in a traversal.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.