diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-01-28 21:18:53 -0700 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-01-28 21:18:53 -0700 |
commit | 221a343883f510c7743908136438f5ed40bd17ed (patch) | |
tree | df633509ee5fa3e699aec0242d200ef0d742d699 /components/layout/construct.rs | |
parent | c8e68fa45c43856f7ffbdde25b6e68571ad288bf (diff) | |
parent | d891c677aa28270fd2002b357f7e2d11eb1e6195 (diff) | |
download | servo-221a343883f510c7743908136438f5ed40bd17ed.tar.gz servo-221a343883f510c7743908136438f5ed40bd17ed.zip |
auto merge of #4458 : pcwalton/servo/floated-lists, r=mbrubeck
This patch also makes Servo not crash when
`generated_containing_block_rect()` is called on a list item (as, for
example, GitHub does), and for good measure I added the fix to other
flows as well.
r? @mbrubeck
Diffstat (limited to 'components/layout/construct.rs')
-rw-r--r-- | components/layout/construct.rs | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 421f4e25f3f..58fe265d54d 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -860,8 +860,8 @@ impl<'a> FlowConstructor<'a> { /// Builds a flow for a node with `display: table`. This yields a `TableWrapperFlow` with /// possibly other `TableCaptionFlow`s or `TableFlow`s underneath it. - fn build_flow_for_table_wrapper(&mut self, node: &ThreadSafeLayoutNode, - float_value: float::T) -> ConstructionResult { + fn build_flow_for_table_wrapper(&mut self, node: &ThreadSafeLayoutNode, float_value: float::T) + -> ConstructionResult { let fragment = Fragment::new_from_specific_info(node, SpecificFragmentInfo::TableWrapper); let wrapper_flow = match float_value { float::T::none => box TableWrapperFlow::from_node_and_fragment(node, fragment), @@ -974,7 +974,12 @@ impl<'a> FlowConstructor<'a> { /// Builds a flow for a node with `display: list-item`. This yields a `ListItemFlow` with /// possibly other `BlockFlow`s or `InlineFlow`s underneath it. - fn build_flow_for_list_item(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult { + fn build_flow_for_list_item(&mut self, node: &ThreadSafeLayoutNode, flotation: float::T) + -> ConstructionResult { + let flotation = match flotation { + float::T::none => None, + flotation => Some(FloatKind::from_property(flotation)), + }; let marker_fragment = match node.style().get_list().list_style_image { Some(ref url) => { Some(Fragment::new_from_specific_info( @@ -1012,11 +1017,17 @@ impl<'a> FlowConstructor<'a> { let initial_fragment; match node.style().get_list().list_style_position { list_style_position::T::outside => { - flow = box ListItemFlow::from_node_and_marker(self, node, marker_fragment); + flow = box ListItemFlow::from_node_marker_and_flotation(self, + node, + marker_fragment, + flotation); initial_fragment = None; } list_style_position::T::inside => { - flow = box ListItemFlow::from_node_and_marker(self, node, None); + flow = box ListItemFlow::from_node_marker_and_flotation(self, + node, + None, + flotation); initial_fragment = marker_fragment; } } @@ -1181,8 +1192,9 @@ impl<'a> PostorderNodeMutTraversal for FlowConstructor<'a> { } // List items contribute their own special flows. - (display::T::list_item, _, _) => { - node.set_flow_construction_result(self.build_flow_for_list_item(node)) + (display::T::list_item, float_value, _) => { + node.set_flow_construction_result(self.build_flow_for_list_item(node, + float_value)) } // Inline items that are absolutely-positioned contribute inline fragment construction |