aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/flow
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2024-08-14 16:25:09 +0200
committerGitHub <noreply@github.com>2024-08-14 14:25:09 +0000
commit7633bdccd229eeba46bba9508564a96066fd4f91 (patch)
treea07b8d53acc28b03376c0921fedfe3f48a6145e1 /components/layout_2020/flow
parentc059bab6f4aa920326167b861a3ae17f53001070 (diff)
downloadservo-7633bdccd229eeba46bba9508564a96066fd4f91.tar.gz
servo-7633bdccd229eeba46bba9508564a96066fd4f91.zip
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>
Diffstat (limited to 'components/layout_2020/flow')
-rw-r--r--components/layout_2020/flow/inline/mod.rs1
-rw-r--r--components/layout_2020/flow/mod.rs13
2 files changed, 9 insertions, 5 deletions
diff --git a/components/layout_2020/flow/inline/mod.rs b/components/layout_2020/flow/inline/mod.rs
index 88447a87e33..cc444cc3e7e 100644
--- a/components/layout_2020/flow/inline/mod.rs
+++ b/components/layout_2020/flow/inline/mod.rs
@@ -2389,6 +2389,7 @@ impl<'a> ContentSizesComputation<'a> {
let outer = atomic.outer_inline_content_sizes(
self.layout_context,
self.containing_block_writing_mode,
+ Au::zero,
);
if !inline_formatting_context
diff --git a/components/layout_2020/flow/mod.rs b/components/layout_2020/flow/mod.rs
index d6a647c62cb..81d043e4024 100644
--- a/components/layout_2020/flow/mod.rs
+++ b/components/layout_2020/flow/mod.rs
@@ -366,7 +366,7 @@ fn calculate_inline_content_size_for_block_level_boxes(
BlockLevelBox::OutOfFlowFloatBox(ref mut float_box) => {
let size = float_box
.contents
- .outer_inline_content_sizes(layout_context, writing_mode)
+ .outer_inline_content_sizes(layout_context, writing_mode, Au::zero)
.max(ContentSizes::zero());
let style_box = &float_box.contents.style().get_box();
Some((size, style_box.float, style_box.clear))
@@ -374,9 +374,12 @@ fn calculate_inline_content_size_for_block_level_boxes(
BlockLevelBox::SameFormattingContextBlock {
style, contents, ..
} => {
- let size = sizing::outer_inline(style, writing_mode, || {
- contents.inline_content_sizes(layout_context, style.writing_mode)
- })
+ let size = sizing::outer_inline(
+ style,
+ writing_mode,
+ || contents.inline_content_sizes(layout_context, style.writing_mode),
+ Au::zero,
+ )
.max(ContentSizes::zero());
// A block in the same BFC can overlap floats, it's not moved next to them,
// so we shouldn't add its size to the size of the floats.
@@ -385,7 +388,7 @@ fn calculate_inline_content_size_for_block_level_boxes(
},
BlockLevelBox::Independent(ref mut independent) => {
let size = independent
- .outer_inline_content_sizes(layout_context, writing_mode)
+ .outer_inline_content_sizes(layout_context, writing_mode, Au::zero)
.max(ContentSizes::zero());
Some((size, Float::None, independent.style().get_box().clear))
},