layout: Stop splitting inline boxes when they contain block-levels#56903
Closed
servo-wpt-sync wants to merge 1 commit intoweb-platform-tests:masterfrom
Closed
layout: Stop splitting inline boxes when they contain block-levels#56903servo-wpt-sync wants to merge 1 commit intoweb-platform-tests:masterfrom
servo-wpt-sync wants to merge 1 commit intoweb-platform-tests:masterfrom
Conversation
wpt-pr-bot
approved these changes
Dec 23, 2025
Collaborator
wpt-pr-bot
left a comment
There was a problem hiding this comment.
The review process for this patch is being conducted in the Servo project.
a966134 to
c54a035
Compare
For an inline box that had already generated some fragment, we were omitting additional fragments that would have had no content, padding, border nor margin. This basically happened when the inline was split by a block, e.g. `<span><div></div></span>`. However, other browsers agree that JS APIs like `getClientRects()` should include these empty fragments, so remove the optimization. Signed-off-by: Oriol Brufau <[email protected]>
c54a035 to
d6f5d52
Compare
Collaborator
Author
|
👋 Downstream pull request (servo/servo#41492) no longer contains any upstreamable changes. Closing pull request without merging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We now follow the same approach as Blink: sequences of block-levels in an inline formatting context get wrapped in an anonymous block, which is treated as a line item. Inline ancestors are no longer split.
This means that inline elements will now generate a single inline box, and the box tree makes more sense in general. This will help for incremental layout.
This also means that block-level elements will now be properly affected by effects like opacity of filters set on inline ancestors.
Recently, WebKit has done some similar work, but without the anonymous blocks. We might also consider removing them in the future.
Google's explainer: https://docs.google.com/document/d/15kgdIHhb9EVNup6Ir5NWwJxpzY5GH0ED7Ld3iMW3HlA/
Testing: Several tests are now passing
Fixes: #39813
Reviewed in servo/servo#41492