mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
layout: Initial implementation of flex-direction: column
and column-reverse
(#33031)
This change removes restrictions on using the column layout mode of flexbox and adds an initial implementation of sizing for that flex direction. There's a lot of missing pieces still, but in some cases this does render column flexbox. In particular, there are now two code paths for preferred widths (intrinsic size) calcuation: one in the main axis (row) and one in the cross axis (column) corresponding to the flex direciton with horizontal writing modes. In addition, `FlexItemBox::inline_content_sizes` is removed in favor of making `sizing::outer_inline` / `IndependentFormattingContext::outer_inline_content_sizes` generic enough to handle using a different value for auto minimum sizes, which flexbox needs. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
c059bab6f4
commit
7633bdccd2
124 changed files with 541 additions and 605 deletions
|
@ -189,23 +189,20 @@ impl IndependentFormattingContext {
|
|||
&mut self,
|
||||
layout_context: &LayoutContext,
|
||||
containing_block_writing_mode: WritingMode,
|
||||
get_auto_minimum: impl FnOnce() -> Au,
|
||||
) -> ContentSizes {
|
||||
match self {
|
||||
Self::NonReplaced(non_replaced) => {
|
||||
let style = &non_replaced.style;
|
||||
let content_sizes = &mut non_replaced.content_sizes;
|
||||
let contents = &mut non_replaced.contents;
|
||||
sizing::outer_inline(style, containing_block_writing_mode, || {
|
||||
*content_sizes.get_or_insert_with(|| {
|
||||
contents.inline_content_sizes(layout_context, style.writing_mode)
|
||||
})
|
||||
})
|
||||
},
|
||||
Self::Replaced(replaced) => {
|
||||
sizing::outer_inline(&replaced.style, containing_block_writing_mode, || {
|
||||
replaced.contents.inline_content_sizes(&replaced.style)
|
||||
})
|
||||
},
|
||||
Self::NonReplaced(non_replaced) => non_replaced.outer_inline_content_sizes(
|
||||
layout_context,
|
||||
containing_block_writing_mode,
|
||||
get_auto_minimum,
|
||||
),
|
||||
Self::Replaced(replaced) => sizing::outer_inline(
|
||||
&replaced.style,
|
||||
containing_block_writing_mode,
|
||||
|| replaced.contents.inline_content_sizes(&replaced.style),
|
||||
get_auto_minimum,
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -246,6 +243,25 @@ impl NonReplacedFormattingContext {
|
|||
.content_sizes
|
||||
.get_or_insert_with(|| contents.inline_content_sizes(layout_context, writing_mode))
|
||||
}
|
||||
|
||||
pub fn outer_inline_content_sizes(
|
||||
&mut self,
|
||||
layout_context: &LayoutContext,
|
||||
containing_block_writing_mode: WritingMode,
|
||||
get_auto_minimum: impl FnOnce() -> Au,
|
||||
) -> ContentSizes {
|
||||
sizing::outer_inline(
|
||||
&self.style,
|
||||
containing_block_writing_mode,
|
||||
|| {
|
||||
*self.content_sizes.get_or_insert_with(|| {
|
||||
self.contents
|
||||
.inline_content_sizes(layout_context, self.style.writing_mode)
|
||||
})
|
||||
},
|
||||
get_auto_minimum,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl NonReplacedFormattingContextContents {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue