Support "replaced" layout
- Dominant language
- Rust
- Stars
- 3.6k
- Forks
- 222
- Avg merge
- 10h 41m
- Merged PRs (30d)
- 40
Description
## What problem does this solve or what need does it fill?
"replaced" layout is the layout mode for "foreign" content like images, videos, form fields, iframes, etc. These elements act a little differently to regular elements, but have standard (or at least interoperable) algorithms for computing their size.
## What solution would you like?
- A new display mode `Display::Replaced`
- 2 new style properties
- `intrinsic_aspect_ratio: Option`
- `intrinsic_size: Size>`
- A new `compute_replaced_layout` function that computes that size of `Display::Replaced` nodes.
- Teach the test generator about replaced nodes (probably starting with images)
## What alternative(s) have you considered?
- Making the replaced "styles" part of the NodeContext instead. I'm not sure if this would be a better design, but I think it would be more complicated to design.
## Additional context
A significant amount of bugs in the [Taffy integration with Servo](https://github.com/servo/servo/pull/32619) are down to the interaction between Taffy algorithms and replaced nodes. I'm currently thinking that making replaced nodes a first-class concept in Taffy would be the best way to fix that.
Contributor guide
Research direction
Start by reading the existing display modes and layout algorithms, then inspect the test generator and how it represents images or other foreign content. Define how Display::Replaced, intrinsic_aspect_ratio, intrinsic_size, and compute_replaced_layout fit together. Done means replaced nodes are supported and covered by generated layout tests, including image-like cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100