Skip to content

Commit

Permalink
LibWeb: Treat non-finite containing block width as zero for percentages
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed Jul 1, 2023
1 parent c0a5787 commit 80ff6a6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x33.46875 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 200x17.46875 children: not-inline
BlockContainer <div> at (8,8) content-size 200x17.46875 children: inline
line 0 width: 36.84375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 5, rect: [8,8 36.84375x17.46875]
"hello"
TextNode <#text>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!doctype html><style>
body {
width: max-content;
}
div {
width: 200px;
min-width: 100%;
}
</style><body><div>hello
2 changes: 1 addition & 1 deletion Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,7 @@ CSSPixels FormattingContext::calculate_max_content_height(Layout::Box const& box

CSS::Length FormattingContext::calculate_inner_width(Layout::Box const& box, AvailableSize const& available_width, CSS::Size const& width) const
{
auto width_of_containing_block = available_width.to_px();
auto width_of_containing_block = available_width.to_px_or_zero();
auto width_of_containing_block_as_length_for_resolve = CSS::Length::make_px(width_of_containing_block);
if (width.is_auto()) {
return width.resolved(box, width_of_containing_block_as_length_for_resolve);
Expand Down

0 comments on commit 80ff6a6

Please sign in to comment.