From 9051a565547642207d88fce11bedf73f63ca2dc2 Mon Sep 17 00:00:00 2001 From: martinfalisse Date: Mon, 26 Sep 2022 11:41:59 +0200 Subject: [PATCH] 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. --- Base/res/html/misc/display-grid.html | 8 ++++++++ .../Libraries/LibWeb/Layout/GridFormattingContext.cpp | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/Base/res/html/misc/display-grid.html b/Base/res/html/misc/display-grid.html index 812d6c9b94..4b50444c51 100644 --- a/Base/res/html/misc/display-grid.html +++ b/Base/res/html/misc/display-grid.html @@ -40,6 +40,14 @@
1
+ +

If you can see this message then the test passed.

+
+
1
+
2
+
3
+
+

Should render a 2x2 grid with columns 50px and 50%

, 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 , only lines with that name are counted. If not enough