diff options
author | Steven Novaryo <65610990+stevennovaryo@users.noreply.github.com> | 2025-05-14 05:10:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-13 21:10:40 +0000 |
commit | a572bf1191f8807e63d6bec4734ecae2b50439c3 (patch) | |
tree | cf9fe4ec07a6943a604d7781357bee27c0613d65 /components/layout | |
parent | c985c0873702474b496836398d3d4173708cea99 (diff) | |
download | servo-a572bf1191f8807e63d6bec4734ecae2b50439c3.tar.gz servo-a572bf1191f8807e63d6bec4734ecae2b50439c3.zip |
layout: Propagate specified info for flex item (#36993)
We should propagate specified info for flex items. This will prevent the
loss of it for boxes that have this info (e.g. table or grid).
Testing: Adding new WPT tests
---------
Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
Diffstat (limited to 'components/layout')
-rw-r--r-- | components/layout/flexbox/layout.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/components/layout/flexbox/layout.rs b/components/layout/flexbox/layout.rs index e69b792e272..3ddbb71ba89 100644 --- a/components/layout/flexbox/layout.rs +++ b/components/layout/flexbox/layout.rs @@ -29,7 +29,9 @@ use super::{FlexContainer, FlexContainerConfig, FlexItemBox, FlexLevelBox}; use crate::cell::ArcRefCell; use crate::context::LayoutContext; use crate::formatting_contexts::{Baselines, IndependentFormattingContextContents}; -use crate::fragment_tree::{BoxFragment, CollapsedBlockMargins, Fragment, FragmentFlags}; +use crate::fragment_tree::{ + BoxFragment, CollapsedBlockMargins, Fragment, FragmentFlags, SpecificLayoutInfo, +}; use crate::geom::{AuOrAuto, LogicalRect, LogicalSides, LogicalVec2, Size, Sizes}; use crate::layout_box_base::CacheableLayoutResult; use crate::positioned::{ @@ -142,6 +144,9 @@ struct FlexItemLayoutResult { // Whether or not this layout had a child that dependeded on block constraints. has_child_which_depends_on_block_constraints: bool, + + // The specific layout info that this flex item had. + specific_layout_info: Option<SpecificLayoutInfo>, } impl FlexItemLayoutResult { @@ -295,7 +300,8 @@ impl FlexLineItem<'_> { .sides_to_flow_relative(item_margin) .to_physical(container_writing_mode), None, /* clearance */ - ); + ) + .with_specific_layout_info(self.layout_result.specific_layout_info); // If this flex item establishes a containing block for absolutely-positioned // descendants, then lay out any relevant absolutely-positioned children. This @@ -1910,6 +1916,7 @@ impl FlexItem<'_> { // size can differ from the hypothetical cross size, we should defer // synthesizing until needed. baseline_relative_to_margin_box: None, + specific_layout_info: None, }) }, IndependentFormattingContextContents::NonReplaced(non_replaced) => { @@ -1944,6 +1951,7 @@ impl FlexItem<'_> { content_block_size, baselines: content_box_baselines, depends_on_block_constraints, + specific_layout_info, .. } = layout; @@ -2012,6 +2020,7 @@ impl FlexItem<'_> { containing_block_block_size: item_as_containing_block.size.block, depends_on_block_constraints, has_child_which_depends_on_block_constraints, + specific_layout_info, }) }, } |