mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
Base+LibWeb: Make sure grid positions don't cause out of bounds
Add some tests to the test page to make sure that different combinations of GridTrackPlacement don't cause out of bounds issues.
This commit is contained in:
parent
97230c4ddb
commit
84290ed7c8
2 changed files with 14 additions and 5 deletions
|
@ -46,15 +46,18 @@
|
|||
<div class="grid-item" style="grid-row: span 2 / 1; grid-column: span 2 / 1;">1</div>
|
||||
<div class="grid-item" style="grid-row: span 2 / 1;">2</div>
|
||||
<div class="grid-item" style="grid-column: span 2 / 1;">3</div>
|
||||
<div class="grid-item" style="grid-column-end: 1; grid-row-end: 1;">6</div>
|
||||
</div>
|
||||
|
||||
<!-- 0 positioned grid items -->
|
||||
<!-- 0 positioned grid items and similar inputs -->
|
||||
<p>If you can see this message then the test passed.</p>
|
||||
<div class="grid-container">
|
||||
<div class="grid-item" style="grid-row-end: 0;">1</div>
|
||||
<div class="grid-item" style="grid-row: 0 / 0;">2</div>
|
||||
<div class="grid-item" style="grid-column: 0 / 1;">3</div>
|
||||
<div class="grid-item" style="grid-row: 1 / 0;">4</div>
|
||||
<div class="grid-item" style="grid-row-end: 0;">2</div>
|
||||
<div class="grid-item" style="grid-row: 0 / 0;">3</div>
|
||||
<div class="grid-item" style="grid-column: 0 / 1;">4</div>
|
||||
<div class="grid-item" style="grid-row: 1 / 0;">5</div>
|
||||
<div class="grid-item" style="grid-row-end: 1;">1</div>
|
||||
<div class="grid-item" style="grid-column-end: 1;">6</div>
|
||||
</div>
|
||||
|
||||
<!-- Different column sizes -->
|
||||
|
|
|
@ -251,6 +251,9 @@ void GridFormattingContext::run(Box const& box, LayoutMode, AvailableSpace const
|
|||
if (row_start != row_end)
|
||||
row_span = row_end - row_start;
|
||||
}
|
||||
// FIXME: Have yet to find the spec for this.
|
||||
if (!child_box.computed_values().grid_row_start().is_position() && child_box.computed_values().grid_row_end().is_position() && row_end == 1)
|
||||
row_start = 1;
|
||||
|
||||
// If the placement contains two spans, remove the one contributed by the end grid-placement
|
||||
// property.
|
||||
|
@ -361,6 +364,9 @@ void GridFormattingContext::run(Box const& box, LayoutMode, AvailableSpace const
|
|||
if (column_start < 0)
|
||||
column_start = 1;
|
||||
}
|
||||
// FIXME: Have yet to find the spec for this.
|
||||
if (!child_box.computed_values().grid_column_start().is_position() && child_box.computed_values().grid_column_end().is_position() && column_end == 1)
|
||||
column_start = 1;
|
||||
|
||||
// If a name is given as a <custom-ident>, only lines with that name are counted. If not enough
|
||||
// lines with that name exist, all implicit grid lines on the side of the explicit grid
|
||||
|
|
Loading…
Add table
Reference in a new issue