mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Size box as normal if it has aspect ratio but auto sizes
Otherwise we apply `calculate_stretch_fit_width()` instead of calculating width based on the content inside the box, like other browsers do.
This commit is contained in:
parent
006f276cab
commit
fc45121b70
Notes:
github-actions[bot]
2025-03-27 23:38:46 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: fc45121b70
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4124
3 changed files with 40 additions and 5 deletions
|
@ -1895,11 +1895,9 @@ bool box_is_sized_as_replaced_element(Box const& box)
|
|||
// However, it is suggested that, if the containing block’s width does not itself depend on the replaced element’s width,
|
||||
// then the used value of width is calculated from the constraint equation used for block-level, non-replaced elements in normal flow.
|
||||
|
||||
// AD-HOC: For inline-level boxes, we don't want to end up in a situation where we apply stretch-fit sizing,
|
||||
// since that would not match other browsers. Because of that, we specifically reject this case here
|
||||
// instead of allowing it to proceed.
|
||||
if (box.display().is_inline_outside()
|
||||
&& box.computed_values().height().is_auto()
|
||||
// AD-HOC: If box has preferred aspect ratio but width and height are not specified, then we should
|
||||
// size it as a normal box to match other browsers.
|
||||
if (box.computed_values().height().is_auto()
|
||||
&& box.computed_values().width().is_auto()
|
||||
&& !box.has_natural_width()
|
||||
&& !box.has_natural_height()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue