Skip to content

Commit

Permalink
Stop crashing when building the flow tree
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Atkinson committed Jun 25, 2013
1 parent 49f80fd commit 427328e
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/components/main/layout/box_builder.rs
Expand Up @@ -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.
Expand All @@ -389,16 +390,28 @@ 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,

// 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)
}

Expand Down

5 comments on commit 427328e

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from pcwalton
at eric93@427328e

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging eric93/servo/floats = 427328e into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eric93/servo/floats = 427328e merged ok, testing candidate = a01f6b9

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = a01f6b9

Please sign in to comment.