From cc4749373a421c6323dd5c9e5037899775ba015d Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Sat, 7 Mar 2015 17:15:31 +0100 Subject: Add MulticolFlow and use it for multicol elements. It currently "inherits" from BlockFlow and does not override anything. --- components/layout/construct.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'components/layout/construct.rs') diff --git a/components/layout/construct.rs b/components/layout/construct.rs index f945e8bb526..12f9900b088 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -33,6 +33,7 @@ use fragment::{InlineBlockFragmentInfo, SpecificFragmentInfo}; use incremental::{RECONSTRUCT_FLOW, RestyleDamage}; use inline::InlineFlow; use list_item::{ListItemFlow, ListStyleTypeContent}; +use multicol::MulticolFlow; use opaque_node::OpaqueNodeMethods; use parallel; use table::TableFlow; @@ -655,8 +656,12 @@ impl<'a> FlowConstructor<'a> { /// to happen. fn build_flow_for_nonfloated_block(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult { - let flow = box BlockFlow::from_node_and_fragment(node, self.build_fragment_for_block(node)) - as Box; + let fragment = self.build_fragment_for_block(node); + let flow = if node.style().is_multicol() { + box MulticolFlow::from_node_and_fragment(node, fragment) as Box + } else { + box BlockFlow::from_node_and_fragment(node, fragment) as Box + }; self.build_flow_for_block(FlowRef::new(flow), node) } -- cgit v1.2.3 From 544a02a25068a92dfd9e950eb3609713ad9599c7 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 16 Apr 2015 16:51:27 +0200 Subject: Refactor flow construction to make `float` less of a special case. --- components/layout/construct.rs | 62 +++++++++++++----------------------------- 1 file changed, 19 insertions(+), 43 deletions(-) (limited to 'components/layout/construct.rs') diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 12f9900b088..6c4537e8b26 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -331,7 +331,7 @@ impl<'a> FlowConstructor<'a> { if child.is_table() { let fragment = Fragment::new(child_node, SpecificFragmentInfo::TableWrapper); let mut new_child = - FlowRef::new(box TableWrapperFlow::from_node_and_fragment(child_node, fragment)); + FlowRef::new(box TableWrapperFlow::from_node_and_fragment(child_node, fragment, None)); new_child.add_new_child(child.clone()); child.finish(); *child = new_child @@ -602,7 +602,7 @@ impl<'a> FlowConstructor<'a> { /// /// FIXME(pcwalton): It is not clear to me that there isn't a cleaner way to handle /// `