diff --git a/components/layout/block.rs b/components/layout/block.rs index 4c50adb3e6a..c21d3123bc7 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -562,33 +562,20 @@ impl Encodable for BlockFlowFlags { } impl BlockFlow { - pub fn from_node_and_fragment(node: &ThreadSafeLayoutNode, fragment: Fragment) -> BlockFlow { + pub fn from_node_and_fragment(node: &ThreadSafeLayoutNode, + fragment: Fragment, + float_kind: Option) + -> BlockFlow { let writing_mode = node.style().writing_mode; BlockFlow { - base: BaseFlow::new(Some((*node).clone()), - writing_mode, - ForceNonfloatedFlag::ForceNonfloated), + base: BaseFlow::new(Some((*node).clone()), writing_mode, match float_kind { + Some(_) => ForceNonfloatedFlag::FloatIfNecessary, + None => ForceNonfloatedFlag::ForceNonfloated, + }), fragment: fragment, inline_size_of_preceding_left_floats: Au(0), inline_size_of_preceding_right_floats: Au(0), - float: None, - flags: BlockFlowFlags::empty(), - } - } - - pub fn float_from_node_and_fragment(node: &ThreadSafeLayoutNode, - fragment: Fragment, - float_kind: FloatKind) - -> BlockFlow { - let writing_mode = node.style().writing_mode; - BlockFlow { - base: BaseFlow::new(Some((*node).clone()), - writing_mode, - ForceNonfloatedFlag::FloatIfNecessary), - fragment: fragment, - inline_size_of_preceding_left_floats: Au(0), - inline_size_of_preceding_right_floats: Au(0), - float: Some(box FloatedBlockInfo::new(float_kind)), + float: float_kind.map(|kind| box FloatedBlockInfo::new(kind)), flags: BlockFlowFlags::empty(), } } @@ -1379,7 +1366,8 @@ impl BlockFlow { FormattingContextType::Other } _ if style.get_box().overflow_x != overflow_x::T::visible || - style.get_box().overflow_y != overflow_y::T(overflow_x::T::visible) => { + style.get_box().overflow_y != overflow_y::T(overflow_x::T::visible) || + style.is_multicol() => { FormattingContextType::Block } _ => FormattingContextType::None, diff --git a/components/layout/construct.rs b/components/layout/construct.rs index f945e8bb526..6c4537e8b26 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; @@ -330,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 @@ -601,7 +602,7 @@ impl<'a> FlowConstructor<'a> { /// /// FIXME(pcwalton): It is not clear to me that there isn't a cleaner way to handle /// `