summaryrefslogtreecommitdiff
path: root/Tests/LibWeb/Layout
diff options
context:
space:
mode:
authorAliaksandr Kalenik <kalenik.aliaksandr@gmail.com>2023-04-28 19:26:04 +0300
committerAndreas Kling <kling@serenityos.org>2023-04-29 06:46:45 +0200
commit9fd51a59ffcd6e7982af86991a870324dff2eb4b (patch)
treeaed0c42ab45967875f0d6fce98d1468552f40aa1 /Tests/LibWeb/Layout
parent77a5f40736c658379fdead4284fa2fcaf98ca36f (diff)
downloadserenity-9fd51a59ffcd6e7982af86991a870324dff2eb4b.zip
LibWeb: Fix division by zero in table columns width distribution
If total max columns width (grid_max) is zero then available width should be divided equally between columns. Previously there was division by zero: `column.max_width / grid_max`.
Diffstat (limited to 'Tests/LibWeb/Layout')
-rw-r--r--Tests/LibWeb/Layout/expected/table/zero-columns-gridmax.txt7
-rw-r--r--Tests/LibWeb/Layout/input/table/zero-columns-gridmax.html15
2 files changed, 22 insertions, 0 deletions
diff --git a/Tests/LibWeb/Layout/expected/table/zero-columns-gridmax.txt b/Tests/LibWeb/Layout/expected/table/zero-columns-gridmax.txt
new file mode 100644
index 0000000000..22f0923aa2
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/table/zero-columns-gridmax.txt
@@ -0,0 +1,7 @@
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
+ BlockContainer <html> at (0,0) content-size 800x16 children: not-inline
+ BlockContainer <body> at (8,8) content-size 784x0 children: not-inline
+ TableWrapper <(anonymous)> at (8,8) content-size 200x0 children: not-inline
+ TableBox <div.table> at (8,8) content-size 200x0 children: not-inline
+ TableRowBox <div.row> at (8,8) content-size 200x0 children: not-inline
+ TableCellBox <div.cell> at (8,8) content-size 200x0 children: not-inline
diff --git a/Tests/LibWeb/Layout/input/table/zero-columns-gridmax.html b/Tests/LibWeb/Layout/input/table/zero-columns-gridmax.html
new file mode 100644
index 0000000000..63bfe96918
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/table/zero-columns-gridmax.html
@@ -0,0 +1,15 @@
+<style>
+.table {
+ display: table;
+ width: 200px;
+}
+
+.row {
+ display: table-row;
+}
+
+.cell {
+ display: table-cell;
+}
+</style>
+<div class="table"><div class="row"><div class="cell"></div></div></div> \ No newline at end of file