Skip to content

layout: Allow collecting child fragments with logical rectangles - #49898

Merged
mrobinson merged 1 commit into
servo:mainfrom
mrobinson:layout-allow-collecting-layout-and-logical-rect
Nov 14, 2026
Merged

mrobinson merged 1 commit into
servo:mainfrom
mrobinson:layout-allow-collecting-layout-and-logical-rect

Conversation

@mrobinson

Copy link
Copy Markdown
Member

This change is the first step to allowing the collection of fragments
and their logical rectangles when building BoxFragment and
PositioningFragment. Currently all producers just return a list of
fragments, but we will gradually remove all instances of
FragmentChildren::PhysicalDeprecated.

Testing: This should not change observable behavior, so should
be covered by existing tests.

@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 13, 2026

let mut root_fragments = independent_layout.fragments;

let root_fragments = independent_layout.fragments;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the into_physical_fragments() here to avoid allocating a temporary vector below?

Suggested change
let root_fragments = independent_layout.fragments;
let mut root_fragments = independent_layout.fragments.into_physical_fragments(
self.initial_containing_block_style.writing_mode,
initial_containing_block_size,
);

Comment on lines +486 to +489
let container_size = LogicalVec2 {
inline: containing_block_for_children.inline_size(),
block: resolved_block_size,
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be clearer to name it replaced_size, calculate it first, and then derive widget_cb from it.

Suggested change
let container_size = LogicalVec2 {
inline: containing_block_for_children.inline_size(),
block: resolved_block_size,
};
let replaced_size = LogicalVec2 {
inline: containing_block_for_children.inline_size(),
block: resolved_block_size,
};
let widget_cb = ContainingBlock {
size: ContainingBlockSize::new(
replaced_size.inline,
SizeConstraint::Definite(replaced_size.block),
),
style: &self.base.style,
};

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Nov 13, 2026
This change is the first step to allowing the collection of fragments
and their logical rectangles when building `BoxFragment` and
`PositioningFragment`. Currently all producers just return a list of
fragments, but we will gradually remove all instances of
`FragmentChildren::PhysicalDeprecated`.

Signed-off-by: Martin Robinson <[email protected]>
Co-authored-by: Oriol Brufau <[email protected]>
@mrobinson
mrobinson force-pushed the layout-allow-collecting-layout-and-logical-rect branch from d60de75 to a9bba6a Compare November 14, 2026 09:49
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 14, 2026
@mrobinson
mrobinson enabled auto-merge November 14, 2026 09:50
@mrobinson
mrobinson added this pull request to the merge queue Nov 14, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 14, 2026
Merged via the queue into servo:main with commit a6b1ab9 Nov 14, 2026
38 checks passed
@mrobinson
mrobinson deleted the layout-allow-collecting-layout-and-logical-rect branch November 14, 2026 16:12
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 14, 2026
SimonSapin added a commit to SimonSapin/servo that referenced this pull request Nov 16, 2026
Follow up to servo#49898
Part of servo#2560
Testing: WPT

Signed-off-by: Simon Sapin <[email protected]>
SimonSapin added a commit to SimonSapin/servo that referenced this pull request Nov 17, 2026
Follow up to servo#49898
Part of servo#2560
Testing: WPT

Signed-off-by: Simon Sapin <[email protected]>
mrobinson pushed a commit to SimonSapin/servo that referenced this pull request Nov 18, 2026
Follow up to servo#49898
Part of servo#2560
Testing: WPT

Signed-off-by: Simon Sapin <[email protected]>
willypuzzle pushed a commit to willypuzzle/servo that referenced this pull request Nov 18, 2026
This change continues the conversion of various layout modes to collect
logical rectangles, only converting to physical rectangles when the
final
size of their container is known.

Follow up to servo#49898
Testing: One new WPT failure due to lacking full orthogonal flow
support.

---------

Signed-off-by: Simon Sapin <[email protected]>
Signed-off-by: Martin Robinson <[email protected]>
Co-authored-by: Martin Robinson <[email protected]>
SimonSapin added a commit to SimonSapin/servo that referenced this pull request Nov 23, 2026
Follow up to servo#49898
Part of servo#2560
Testing: WPT

Signed-off-by: Simon Sapin <[email protected]>
RichardTjokroutomo pushed a commit to RichardTjokroutomo/servo that referenced this pull request Nov 25, 2026
…#49968)

Follow up to servo#49898
Part of servo#2560
Testing: WPT

---------

Signed-off-by: Simon Sapin <[email protected]>
mrobinson pushed a commit to mrobinson/servo that referenced this pull request Nov 26, 2026
…o#50065)

Follow up to servo#49898
Part of servo#2560
Closes servo#49968 and closes
servo#50016 (merges them because of
suspected interdependence)
Testing: WPT

---------

Signed-off-by: Simon Sapin <[email protected]>
Signed-off-by: Oriol Brufau <[email protected]>
Co-authored-by: Oriol Brufau <[email protected]>
devin-ai-integration Bot pushed a commit to baigojahanzaib/servo that referenced this pull request Nov 28, 2026
…#49968)

Follow up to servo#49898
Part of servo#2560
Testing: WPT

---------

Signed-off-by: Simon Sapin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants