mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Create FlexFlow's for 'display: flex' nodes.
This commit doesn't implement any flexbox behavior at all. It just constructs FlexFlow's, which act just like the BlockFlow from which they "inherit."
This commit is contained in:
parent
45b7ee9bdb
commit
0488a36862
6 changed files with 286 additions and 1 deletions
|
@ -517,6 +517,7 @@ pub enum FlowClass {
|
|||
TableCaption,
|
||||
TableCell,
|
||||
Multicol,
|
||||
Flex,
|
||||
}
|
||||
|
||||
/// A top-down traversal.
|
||||
|
@ -1173,6 +1174,8 @@ impl<'a> ImmutableFlowUtils for &'a Flow {
|
|||
FlowClass::Table => !child.is_proper_table_child(),
|
||||
FlowClass::TableRowGroup => !child.is_table_row(),
|
||||
FlowClass::TableRow => !child.is_table_cell(),
|
||||
// FIXME(zentner): According to spec, anonymous flex items are only needed for text.
|
||||
FlowClass::Flex => child.is_inline_flow(),
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
|
@ -1210,6 +1213,12 @@ impl<'a> ImmutableFlowUtils for &'a Flow {
|
|||
let hide = node.style().get_inheritedtable().empty_cells == empty_cells::T::hide;
|
||||
Arc::new(TableCellFlow::from_node_fragment_and_visibility_flag(node, fragment, !hide))
|
||||
},
|
||||
FlowClass::Flex => {
|
||||
let fragment =
|
||||
Fragment::new_anonymous_from_specific_info(node,
|
||||
SpecificFragmentInfo::Generic);
|
||||
box BlockFlow::from_fragment(fragment, None) as Box<Flow>
|
||||
},
|
||||
_ => {
|
||||
panic!("no need to generate a missing child")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue