Remove IndependentFormattingContext::layout

Callers should handle replaced v.s. not separately
This commit is contained in:
Simon Sapin 2019-12-03 11:33:44 +01:00
parent c056e5b6b0
commit efa1885e1b
2 changed files with 17 additions and 26 deletions

View file

@ -91,24 +91,6 @@ impl IndependentFormattingContext {
Contents::Flow(f) => Err(NR(Kind::Flow(f))), Contents::Flow(f) => Err(NR(Kind::Flow(f))),
} }
} }
pub fn layout<'a>(
&'a self,
layout_context: &LayoutContext,
containing_block: &ContainingBlock,
tree_rank: usize,
absolutely_positioned_fragments: &mut Vec<AbsolutelyPositionedFragment<'a>>,
) -> IndependentLayout {
match self.as_replaced() {
Ok(replaced) => replaced.layout(&self.style, containing_block),
Err(ifc) => ifc.layout(
layout_context,
containing_block,
tree_rank,
absolutely_positioned_fragments,
),
}
}
} }
impl<'a> NonReplacedIFC<'a> { impl<'a> NonReplacedIFC<'a> {

View file

@ -292,14 +292,23 @@ impl<'a> AbsolutelyPositionedFragment<'a> {
containing_block.mode, containing_block_for_children.mode, containing_block.mode, containing_block_for_children.mode,
"Mixed writing modes are not supported yet" "Mixed writing modes are not supported yet"
); );
let dummy_tree_rank = 0; let mut absolutely_positioned_fragments = Vec::new();
let mut absolutely_positioned_fragments = vec![]; let mut independent_layout = match self.absolutely_positioned_box.contents.as_replaced() {
let mut independent_layout = self.absolutely_positioned_box.contents.layout( // FIXME: implement https://drafts.csswg.org/css2/visudet.html#abs-replaced-width
layout_context, Ok(replaced) => replaced.layout(
&containing_block_for_children, &self.absolutely_positioned_box.contents.style,
dummy_tree_rank, &containing_block_for_children,
&mut absolutely_positioned_fragments, ),
); Err(non_replaced) => {
let dummy_tree_rank = 0;
non_replaced.layout(
layout_context,
&containing_block_for_children,
dummy_tree_rank,
&mut absolutely_positioned_fragments,
)
},
};
let inline_start = match inline_anchor { let inline_start = match inline_anchor {
Anchor::Start(start) => start + pb.inline_start + margin.inline_start, Anchor::Start(start) => start + pb.inline_start + margin.inline_start,