mirror of
https://github.com/servo/servo.git
synced 2025-06-25 01:24:37 +01:00
Stop crashing when building the flow tree
This commit is contained in:
parent
49f80fd894
commit
427328e8e4
1 changed files with 17 additions and 4 deletions
|
@ -379,7 +379,8 @@ pub impl LayoutTreeBuilder {
|
||||||
let new_generator = match (display, parent_generator.flow, sibling_flow) {
|
let new_generator = match (display, parent_generator.flow, sibling_flow) {
|
||||||
(CSSDisplayBlock, BlockFlow(_), _) if is_float => {
|
(CSSDisplayBlock, BlockFlow(_), _) if is_float => {
|
||||||
self.create_child_generator(node, parent_generator, Flow_Float)
|
self.create_child_generator(node, parent_generator, Flow_Float)
|
||||||
},
|
}
|
||||||
|
|
||||||
(CSSDisplayBlock, BlockFlow(info), _) => match (info.is_root, node.parent_node()) {
|
(CSSDisplayBlock, BlockFlow(info), _) => match (info.is_root, node.parent_node()) {
|
||||||
// If this is the root node, then use the root flow's
|
// If this is the root node, then use the root flow's
|
||||||
// context. Otherwise, make a child block context.
|
// context. Otherwise, make a child block context.
|
||||||
|
@ -389,6 +390,11 @@ pub impl LayoutTreeBuilder {
|
||||||
self.create_child_generator(node, parent_generator, Flow_Block)
|
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
|
// Inlines that are children of inlines are part of the same flow
|
||||||
(CSSDisplayInline, InlineFlow(*), _) => parent_generator,
|
(CSSDisplayInline, InlineFlow(*), _) => parent_generator,
|
||||||
(CSSDisplayInlineBlock, 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
|
// Inlines that are children of blocks create new flows if their
|
||||||
// previous sibling was a block.
|
// previous sibling was a block.
|
||||||
(CSSDisplayInline, BlockFlow(*), Some(BlockFlow(*))) |
|
(CSSDisplayInline, BlockFlow(*), Some(BlockFlow(*))) |
|
||||||
(CSSDisplayInlineBlock, BlockFlow(*), Some(BlockFlow(*))) |
|
(CSSDisplayInlineBlock, BlockFlow(*), Some(BlockFlow(*))) => {
|
||||||
(CSSDisplayInline, BlockFlow(*), Some(FloatFlow(*))) |
|
self.create_child_generator(node, parent_generator, Flow_Inline)
|
||||||
(CSSDisplayInlineBlock, BlockFlow(*), Some(FloatFlow(*))) => {
|
}
|
||||||
|
|
||||||
|
// 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)
|
self.create_child_generator(node, parent_generator, Flow_Inline)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue