mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
LibWeb: Fully resolve max-width values on inline-block elements
This fixes an issue where `max-width: fit-content` (and other layout-dependent values) were treated as 0 on inline-blocks.
This commit is contained in:
parent
1f4f750052
commit
2887976ce9
Notes:
sideshowbarker
2024-07-17 01:12:07 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/2887976ce9 Pull-request: https://github.com/SerenityOS/serenity/pull/20035
3 changed files with 18 additions and 1 deletions
|
@ -0,0 +1,10 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x35.46875 [BFC] children: not-inline
|
||||
BlockContainer <body> at (8,8) content-size 784x19.46875 children: inline
|
||||
line 0 width: 102.203125, height: 19.46875, bottom: 19.46875, baseline: 14.53125
|
||||
frag 0 from BlockContainer start: 0, length: 0, rect: [9,9 100.203125x17.46875]
|
||||
BlockContainer <span> at (9,9) content-size 100.203125x17.46875 inline-block [BFC] children: inline
|
||||
line 0 width: 100.203125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
||||
frag 0 from TextNode start: 0, length: 13, rect: [9,9 100.203125x17.46875]
|
||||
"hello friends"
|
||||
TextNode <#text>
|
|
@ -0,0 +1,7 @@
|
|||
<!doctype html><style>
|
||||
span {
|
||||
border: 1px solid black;
|
||||
display: inline-block;
|
||||
max-width: fit-content;
|
||||
}
|
||||
</style><span>hello friends
|
|
@ -150,7 +150,7 @@ void InlineFormattingContext::dimension_box_on_line(Box const& box, LayoutMode l
|
|||
|
||||
CSSPixels width = unconstrained_width;
|
||||
if (!should_treat_max_width_as_none(box, m_available_space->width)) {
|
||||
auto max_width = box.computed_values().max_width().to_px(box, width_of_containing_block);
|
||||
auto max_width = calculate_inner_width(box, m_available_space->width, box.computed_values().max_width()).to_px(box);
|
||||
width = min(width, max_width);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue