diff options
author | Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com> | 2023-05-13 12:34:45 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-05-13 12:53:25 +0200 |
commit | d187862f7682b180a87d9ca9ad2bfd8deace8eec (patch) | |
tree | 40dadc44cf8d267148902ef77a567c3103645af3 | |
parent | 644e4f4c992a9f4ff1e7d81f52a796189fb87b16 (diff) | |
download | serenity-d187862f7682b180a87d9ca9ad2bfd8deace8eec.zip |
LibWeb: Return grid container width from automatic_content_width in GFC
automatic_content_width() should return grid container width that is
supposed to be set by determine_intrinsic_size_of_grid_container().
3 files changed, 31 insertions, 1 deletions
diff --git a/Tests/LibWeb/Layout/expected/grid/intrinsic-sized-grid-2.txt b/Tests/LibWeb/Layout/expected/grid/intrinsic-sized-grid-2.txt new file mode 100644 index 0000000000..a510b695f8 --- /dev/null +++ b/Tests/LibWeb/Layout/expected/grid/intrinsic-sized-grid-2.txt @@ -0,0 +1,14 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer <html> at (1,1) content-size 798x30.46875 [BFC] children: not-inline + BlockContainer <body> at (10,10) content-size 780x0 children: not-inline + Box <div.grid> at (11,11) content-size 96.421875x19.46875 floating [GFC] children: not-inline + BlockContainer <div.whee> at (12,12) content-size 35.953125x17.46875 [BFC] children: inline + line 0 width: 37.953125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [12,12 37.953125x17.46875] + "whee" + TextNode <#text> + BlockContainer <div.yeehaw> at (49.953125,12) content-size 56.46875x17.46875 [BFC] children: inline + line 0 width: 54.46875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 6, rect: [49.953125,12 54.46875x17.46875] + "yeehaw" + TextNode <#text> diff --git a/Tests/LibWeb/Layout/input/grid/intrinsic-sized-grid-2.html b/Tests/LibWeb/Layout/input/grid/intrinsic-sized-grid-2.html new file mode 100644 index 0000000000..45a170cc54 --- /dev/null +++ b/Tests/LibWeb/Layout/input/grid/intrinsic-sized-grid-2.html @@ -0,0 +1,16 @@ +<!DOCTYPE html><html><head><style> +* { + border: 1px solid black !important; +} +.grid { + float: left; + display: grid; + grid-template-columns: min-content minmax(0, auto); +} +.whee { + background: pink; +} +.yeehaw { + background: lightskyblue; +} +</style></head><body><div class="grid"><div class="whee">whee</div><div class="yeehaw">yeehaw</div>
\ No newline at end of file diff --git a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp index 821aa2bb0f..4347820202 100644 --- a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp @@ -1521,7 +1521,7 @@ void GridFormattingContext::determine_intrinsic_size_of_grid_container(Available CSSPixels GridFormattingContext::automatic_content_width() const { - return greatest_child_width(context_box()); + return m_state.get(grid_container()).content_width(); } CSSPixels GridFormattingContext::automatic_content_height() const |