mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 14:14:45 +03:00
Base+LibWeb: Stub out negative spans
Ensure that when a grid item is passed with a span and a fixed end position, that if the resulting start of this item is less than 0 then it won't throw. This is a temporary measure until the correct functionality is implemented.
This commit is contained in:
parent
a764e43db3
commit
9051a56554
Notes:
sideshowbarker
2024-07-17 06:12:20 +09:00
Author: https://github.com/martinfalisse Commit: https://github.com/SerenityOS/serenity/commit/9051a56554 Pull-request: https://github.com/SerenityOS/serenity/pull/15271 Reviewed-by: https://github.com/MacDue
@ -40,6 +40,14 @@
|
||||
<div class="grid-item">1</div>
|
||||
</div>
|
||||
|
||||
<!-- Spans causing positions outside the inherit grid. (span 2 with an end position of 1 causes the start to be -1) -->
|
||||
<p>If you can see this message then the test passed.</p>
|
||||
<div class="grid-container">
|
||||
<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>
|
||||
|
||||
<!-- Different column sizes -->
|
||||
<p>Should render a 2x2 grid with columns 50px and 50%</p>
|
||||
<div
|
||||
|
@ -225,6 +225,9 @@ void GridFormattingContext::run(Box const& box, LayoutMode, AvailableSpace const
|
||||
if (child_box.computed_values().grid_row_end().is_position() && child_box.computed_values().grid_row_start().is_span()) {
|
||||
row_span = child_box.computed_values().grid_row_start().raw_value();
|
||||
row_start = row_end - row_span;
|
||||
// FIXME: Remove me once have implemented spans overflowing into negative indexes, e.g., grid-row: span 2 / 1
|
||||
if (row_start < 0)
|
||||
row_start = 1;
|
||||
}
|
||||
|
||||
// If a name is given as a <custom-ident>, only lines with that name are counted. If not enough
|
||||
@ -354,6 +357,9 @@ void GridFormattingContext::run(Box const& box, LayoutMode, AvailableSpace const
|
||||
if (child_box.computed_values().grid_column_end().is_position() && child_box.computed_values().grid_column_start().is_span()) {
|
||||
column_span = child_box.computed_values().grid_column_start().raw_value();
|
||||
column_start = column_end - column_span;
|
||||
// FIXME: Remove me once have implemented spans overflowing into negative indexes, e.g., grid-column: span 2 / 1
|
||||
if (column_start < 0)
|
||||
column_start = 1;
|
||||
}
|
||||
|
||||
// If a name is given as a <custom-ident>, only lines with that name are counted. If not enough
|
||||
|
Loading…
Reference in New Issue
Block a user