mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Refactor flow construction to make float
less of a special case.
This commit is contained in:
parent
cc4749373a
commit
544a02a250
11 changed files with 48 additions and 125 deletions
|
@ -562,33 +562,20 @@ impl Encodable for BlockFlowFlags {
|
|||
}
|
||||
|
||||
impl BlockFlow {
|
||||
pub fn from_node_and_fragment(node: &ThreadSafeLayoutNode, fragment: Fragment) -> BlockFlow {
|
||||
pub fn from_node_and_fragment(node: &ThreadSafeLayoutNode,
|
||||
fragment: Fragment,
|
||||
float_kind: Option<FloatKind>)
|
||||
-> BlockFlow {
|
||||
let writing_mode = node.style().writing_mode;
|
||||
BlockFlow {
|
||||
base: BaseFlow::new(Some((*node).clone()),
|
||||
writing_mode,
|
||||
ForceNonfloatedFlag::ForceNonfloated),
|
||||
base: BaseFlow::new(Some((*node).clone()), writing_mode, match float_kind {
|
||||
Some(_) => ForceNonfloatedFlag::FloatIfNecessary,
|
||||
None => ForceNonfloatedFlag::ForceNonfloated,
|
||||
}),
|
||||
fragment: fragment,
|
||||
inline_size_of_preceding_left_floats: Au(0),
|
||||
inline_size_of_preceding_right_floats: Au(0),
|
||||
float: None,
|
||||
flags: BlockFlowFlags::empty(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn float_from_node_and_fragment(node: &ThreadSafeLayoutNode,
|
||||
fragment: Fragment,
|
||||
float_kind: FloatKind)
|
||||
-> BlockFlow {
|
||||
let writing_mode = node.style().writing_mode;
|
||||
BlockFlow {
|
||||
base: BaseFlow::new(Some((*node).clone()),
|
||||
writing_mode,
|
||||
ForceNonfloatedFlag::FloatIfNecessary),
|
||||
fragment: fragment,
|
||||
inline_size_of_preceding_left_floats: Au(0),
|
||||
inline_size_of_preceding_right_floats: Au(0),
|
||||
float: Some(box FloatedBlockInfo::new(float_kind)),
|
||||
float: float_kind.map(|kind| box FloatedBlockInfo::new(kind)),
|
||||
flags: BlockFlowFlags::empty(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue