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>
This commit is contained in:
Steven Novaryo 2025-05-14 05:10:40 +08:00 committed by GitHub
parent c985c08737
commit a572bf1191
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 25 additions and 3 deletions

View file

@ -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,
})
},
}

View file

@ -618436,7 +618436,7 @@
]
],
"table-client-props.html": [
"4af06d6bf71f0df75d3710ec0906445e943d340d",
"2895bebebbf1868ef60f947d230ecca96dd6e85a",
[
null,
{}

View file

@ -43,6 +43,19 @@
<tr><td>`,
26, 34,
"Table with collapsed border" ],
[ `<div style="display: flex">
<table style="width: 20px; height: 30px;
border-width: 1px 2px 3px 4px; border-style: solid;
border-collapse: separate; box-sizing: content-box">`,
26, 34,
"Flex-level table with separated border" ],
[ `<div style="display: flex">
<table style="width: 20px; height: 30px;
border-width: 2px 4px 6px 8px; border-style: solid;
border-collapse: collapse; box-sizing: content-box">
<tr><td>`,
26, 34,
"Flex-level table with collapsed border" ],
[ `<table>
<caption style="width: 40px; height: 50px; padding: 1px 2px 3px 4px">`,
46, 54,