diff options
author | Eric Atkinson <eatkinson@mozilla.com> | 2013-06-25 11:12:29 -0700 |
---|---|---|
committer | Eric Atkinson <eatkinson@mozilla.com> | 2013-06-25 11:12:29 -0700 |
commit | 427328e8e4851aaf2f2c0ceeb0fef85bf8b43306 (patch) | |
tree | 68ab58e7491044088ced5be647547d53db2a7364 /src/components | |
parent | 49f80fd894e9fce5ad49f0d55772c101746b5a36 (diff) | |
download | servo-427328e8e4851aaf2f2c0ceeb0fef85bf8b43306.tar.gz servo-427328e8e4851aaf2f2c0ceeb0fef85bf8b43306.zip |
Stop crashing when building the flow tree
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/main/layout/box_builder.rs | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/components/main/layout/box_builder.rs b/src/components/main/layout/box_builder.rs index 0e478ba2654..8d5134b7c4e 100644 --- a/src/components/main/layout/box_builder.rs +++ b/src/components/main/layout/box_builder.rs @@ -379,7 +379,8 @@ pub impl LayoutTreeBuilder { let new_generator = match (display, parent_generator.flow, sibling_flow) { (CSSDisplayBlock, BlockFlow(_), _) if is_float => { self.create_child_generator(node, parent_generator, Flow_Float) - }, + } + (CSSDisplayBlock, BlockFlow(info), _) => match (info.is_root, node.parent_node()) { // If this is the root node, then use the root flow's // context. Otherwise, make a child block context. @@ -389,6 +390,11 @@ pub impl LayoutTreeBuilder { self.create_child_generator(node, parent_generator, Flow_Block) } }, + + (CSSDisplayBlock, FloatFlow(*), _) => { + self.create_child_generator(node, parent_generator, Flow_Block) + } + // Inlines that are children of inlines are part of the same flow (CSSDisplayInline, InlineFlow(*), _) => parent_generator, (CSSDisplayInlineBlock, InlineFlow(*), _) => parent_generator, @@ -396,9 +402,16 @@ pub impl LayoutTreeBuilder { // Inlines that are children of blocks create new flows if their // previous sibling was a block. (CSSDisplayInline, BlockFlow(*), Some(BlockFlow(*))) | - (CSSDisplayInlineBlock, BlockFlow(*), Some(BlockFlow(*))) | - (CSSDisplayInline, BlockFlow(*), Some(FloatFlow(*))) | - (CSSDisplayInlineBlock, BlockFlow(*), Some(FloatFlow(*))) => { + (CSSDisplayInlineBlock, BlockFlow(*), Some(BlockFlow(*))) => { + self.create_child_generator(node, parent_generator, Flow_Inline) + } + + // FIXME(eatkinson): this is bogus. Floats should not be able to split + // inlines. They should be appended as children of the inline flow. + (CSSDisplayInline, _, Some(FloatFlow(*))) | + (CSSDisplayInlineBlock, _, Some(FloatFlow(*))) | + (CSSDisplayInline, FloatFlow(*), _) | + (CSSDisplayInlineBlock, FloatFlow(*), _) => { self.create_child_generator(node, parent_generator, Flow_Inline) } |