summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAliaksandr Kalenik <kalenik.aliaksandr@gmail.com>2023-05-29 14:11:19 +0300
committerAndreas Kling <kling@serenityos.org>2023-05-29 14:12:29 +0200
commit258f3ea95234d9229cdb8376b1aa256e4b312912 (patch)
tree88fb17eeb4bd58b23e43c98161dbea54030cdc34
parent269310268d1e8b3108d2754d29004509d0523f3c (diff)
downloadserenity-258f3ea95234d9229cdb8376b1aa256e4b312912.zip
LibWeb: Remove Layout::TableBox
Solves conflict in layout tree "type system" when elements <label> (or <button>) can't have `display: table` because Box can't be Layout::Label (or Layout::ButtonBox) and Layout::TableBox at the same time.
-rw-r--r--Tests/LibWeb/Layout/expected/blockify-layout-internal-box-without-crashing.txt2
-rw-r--r--Tests/LibWeb/Layout/expected/css-pseudo-element-should-not-be-affected-by-presentational-hints.txt2
-rw-r--r--Tests/LibWeb/Layout/expected/display-table-inline-children.txt2
-rw-r--r--Tests/LibWeb/Layout/expected/table/auto-height.txt4
-rw-r--r--Tests/LibWeb/Layout/expected/table/auto-margins.txt2
-rw-r--r--Tests/LibWeb/Layout/expected/table/basic.txt4
-rw-r--r--Tests/LibWeb/Layout/expected/table/borders.txt8
-rw-r--r--Tests/LibWeb/Layout/expected/table/cell-px-height.txt2
-rw-r--r--Tests/LibWeb/Layout/expected/table/columns-width-distribution-1.txt2
-rw-r--r--Tests/LibWeb/Layout/expected/table/fixed-margins.txt2
-rw-r--r--Tests/LibWeb/Layout/expected/table/in-auto-height-flex-item.txt2
-rw-r--r--Tests/LibWeb/Layout/expected/table/inline-table-width.txt2
-rw-r--r--Tests/LibWeb/Layout/expected/table/row-px-height.txt2
-rw-r--r--Tests/LibWeb/Layout/expected/table/rows-height-distribution-1.txt2
-rw-r--r--Tests/LibWeb/Layout/expected/table/rows-height-distribution-2.txt2
-rw-r--r--Tests/LibWeb/Layout/expected/table/rows-height-distribution-3.txt2
-rw-r--r--Tests/LibWeb/Layout/expected/table/rows-height-distribution-4.txt2
-rw-r--r--Tests/LibWeb/Layout/expected/table/rowspan.txt2
-rw-r--r--Tests/LibWeb/Layout/expected/table/size.txt2
-rw-r--r--Tests/LibWeb/Layout/expected/table/table-width.txt2
-rw-r--r--Tests/LibWeb/Layout/expected/table/zero-columns-gridmax.txt2
-rw-r--r--Userland/Libraries/LibWeb/CMakeLists.txt1
-rw-r--r--Userland/Libraries/LibWeb/DOM/Element.cpp3
-rw-r--r--Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp12
-rw-r--r--Userland/Libraries/LibWeb/Layout/FormattingContext.cpp5
-rw-r--r--Userland/Libraries/LibWeb/Layout/Node.cpp3
-rw-r--r--Userland/Libraries/LibWeb/Layout/Node.h1
-rw-r--r--Userland/Libraries/LibWeb/Layout/TableBox.cpp24
-rw-r--r--Userland/Libraries/LibWeb/Layout/TableBox.h35
-rw-r--r--Userland/Libraries/LibWeb/Layout/TableCellBox.h2
-rw-r--r--Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp3
-rw-r--r--Userland/Libraries/LibWeb/Layout/TableFormattingContext.h5
-rw-r--r--Userland/Libraries/LibWeb/Layout/TableRowBox.h2
-rw-r--r--Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp25
34 files changed, 55 insertions, 118 deletions
diff --git a/Tests/LibWeb/Layout/expected/blockify-layout-internal-box-without-crashing.txt b/Tests/LibWeb/Layout/expected/blockify-layout-internal-box-without-crashing.txt
index 72466180d2..9e00c423c9 100644
--- a/Tests/LibWeb/Layout/expected/blockify-layout-internal-box-without-crashing.txt
+++ b/Tests/LibWeb/Layout/expected/blockify-layout-internal-box-without-crashing.txt
@@ -2,7 +2,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x16 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x0 children: not-inline
TableWrapper <(anonymous)> at (8,8) content-size 0x0 [BFC] children: not-inline
- TableBox <table> at (8,8) content-size 0x0 [TFC] children: not-inline
+ Box <table> at (8,8) content-size 0x0 [TFC] children: not-inline
TableRowGroupBox <tbody> at (8,8) content-size 0x0 children: not-inline
TableRowBox <tr> at (8,8) content-size 0x0 children: not-inline
TableCellBox <(anonymous)> at (8,8) content-size 0x0 [BFC] children: not-inline
diff --git a/Tests/LibWeb/Layout/expected/css-pseudo-element-should-not-be-affected-by-presentational-hints.txt b/Tests/LibWeb/Layout/expected/css-pseudo-element-should-not-be-affected-by-presentational-hints.txt
index 53c53ad226..3f7f4e8b36 100644
--- a/Tests/LibWeb/Layout/expected/css-pseudo-element-should-not-be-affected-by-presentational-hints.txt
+++ b/Tests/LibWeb/Layout/expected/css-pseudo-element-should-not-be-affected-by-presentational-hints.txt
@@ -2,7 +2,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (1,1) content-size 798x120 [BFC] children: not-inline
BlockContainer <body> at (10,10) content-size 780x102 children: not-inline
TableWrapper <(anonymous)> at (10,10) content-size 102x102 [BFC] children: not-inline
- TableBox <table> at (11,11) content-size 100x100 [TFC] children: not-inline
+ Box <table> at (11,11) content-size 100x100 [TFC] children: not-inline
TableRowGroupBox <tbody> at (11,11) content-size 100x100 children: not-inline
TableRowBox <tr> at (11,11) content-size 100x100 children: not-inline
TableCellBox <td> at (13,49.082031) content-size 96x23.835937 [BFC] children: not-inline
diff --git a/Tests/LibWeb/Layout/expected/display-table-inline-children.txt b/Tests/LibWeb/Layout/expected/display-table-inline-children.txt
index bedca064bd..a0e04968e1 100644
--- a/Tests/LibWeb/Layout/expected/display-table-inline-children.txt
+++ b/Tests/LibWeb/Layout/expected/display-table-inline-children.txt
@@ -6,7 +6,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <(anonymous)> at (8,8) content-size 784x0 children: inline
TextNode <#text>
TableWrapper <(anonymous)> at (8,8) content-size 784x600 [BFC] children: not-inline
- TableBox <div.aligncenter.block-image> at (8,8) content-size 1200x600 [TFC] children: inline
+ Box <div.aligncenter.block-image> at (8,8) content-size 1200x600 [TFC] children: inline
TableRowBox <(anonymous)> at (8,8) content-size 1200x600 children: inline
TableCellBox <(anonymous)> at (8,8) content-size 1200x600 [BFC] children: inline
line 0 width: 1200, height: 600, bottom: 600, baseline: 600
diff --git a/Tests/LibWeb/Layout/expected/table/auto-height.txt b/Tests/LibWeb/Layout/expected/table/auto-height.txt
index 3d018b8b84..1ca86e8a8d 100644
--- a/Tests/LibWeb/Layout/expected/table/auto-height.txt
+++ b/Tests/LibWeb/Layout/expected/table/auto-height.txt
@@ -3,7 +3,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <body> at (10,10) content-size 780x42.9375 children: not-inline
BlockContainer <div> at (11,11) content-size 778x19.46875 children: not-inline
TableWrapper <(anonymous)> at (11,11) content-size 29.15625x19.46875 [BFC] children: not-inline
- TableBox <(anonymous)> at (11,11) content-size 29.15625x19.46875 [TFC] children: not-inline
+ Box <(anonymous)> at (11,11) content-size 29.15625x19.46875 [TFC] children: not-inline
TableRowBox <(anonymous)> at (11,11) content-size 29.15625x19.46875 children: not-inline
TableCellBox <span> at (12,12) content-size 27.15625x17.46875 [BFC] children: inline
line 0 width: 27.15625, height: 17.46875, bottom: 17.46875, baseline: 13.53125
@@ -12,7 +12,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
TextNode <#text>
BlockContainer <div> at (11,32.46875) content-size 778x19.46875 children: not-inline
TableWrapper <(anonymous)> at (11,32.46875) content-size 29.640625x19.46875 [BFC] children: not-inline
- TableBox <(anonymous)> at (11,32.46875) content-size 29.640625x19.46875 [TFC] children: not-inline
+ Box <(anonymous)> at (11,32.46875) content-size 29.640625x19.46875 [TFC] children: not-inline
TableRowBox <(anonymous)> at (11,32.46875) content-size 29.640625x19.46875 children: not-inline
TableCellBox <span> at (12,33.46875) content-size 27.640625x17.46875 [BFC] children: inline
line 0 width: 27.640625, height: 17.46875, bottom: 17.46875, baseline: 13.53125
diff --git a/Tests/LibWeb/Layout/expected/table/auto-margins.txt b/Tests/LibWeb/Layout/expected/table/auto-margins.txt
index e0dd558f26..9d79082375 100644
--- a/Tests/LibWeb/Layout/expected/table/auto-margins.txt
+++ b/Tests/LibWeb/Layout/expected/table/auto-margins.txt
@@ -3,7 +3,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <body> at (8,8) content-size 784x17.46875 children: not-inline
BlockContainer <div.wrapper> at (8,8) content-size 784x17.46875 children: not-inline
TableWrapper <(anonymous)> at (235.265625,8) content-size 329.46875x17.46875 [BFC] children: not-inline
- TableBox <div.box> at (235.265625,8) content-size 329.46875x17.46875 [TFC] children: not-inline
+ Box <div.box> at (235.265625,8) content-size 329.46875x17.46875 [TFC] children: not-inline
TableRowBox <(anonymous)> at (235.265625,8) content-size 329.46875x17.46875 children: not-inline
TableCellBox <div.cell> at (235.265625,8) content-size 329.46875x17.46875 [BFC] children: inline
line 0 width: 329.46875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
diff --git a/Tests/LibWeb/Layout/expected/table/basic.txt b/Tests/LibWeb/Layout/expected/table/basic.txt
index ceca965598..f6e6fb2293 100644
--- a/Tests/LibWeb/Layout/expected/table/basic.txt
+++ b/Tests/LibWeb/Layout/expected/table/basic.txt
@@ -2,12 +2,12 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x58.40625 children: not-inline
TableWrapper <(anonymous)> at (8,8) content-size 0x0 [BFC] children: not-inline
- TableBox <table#empty-table> at (8,8) content-size 0x0 [TFC] children: not-inline
+ Box <table#empty-table> at (8,8) content-size 0x0 [TFC] children: not-inline
BlockContainer <(anonymous)> at (8,8) content-size 784x0 children: inline
TextNode <#text>
TextNode <#text>
TableWrapper <(anonymous)> at (8,8) content-size 95.171875x58.40625 [BFC] children: not-inline
- TableBox <table#full-table> at (8,8) content-size 95.171875x58.40625 [TFC] children: not-inline
+ Box <table#full-table> at (8,8) content-size 95.171875x58.40625 [TFC] children: not-inline
BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline
TextNode <#text>
BlockContainer <caption> at (8,8) content-size 0x0 [BFC] children: inline
diff --git a/Tests/LibWeb/Layout/expected/table/borders.txt b/Tests/LibWeb/Layout/expected/table/borders.txt
index 382f437e3a..92461e72e8 100644
--- a/Tests/LibWeb/Layout/expected/table/borders.txt
+++ b/Tests/LibWeb/Layout/expected/table/borders.txt
@@ -2,7 +2,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x277.625 children: not-inline
TableWrapper <(anonymous)> at (8,8) content-size 164.296875x66.40625 [BFC] children: not-inline
- TableBox <table.table-border-black> at (9,9) content-size 164.296875x64.40625 [TFC] children: not-inline
+ Box <table.table-border-black> at (9,9) content-size 164.296875x64.40625 [TFC] children: not-inline
BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline
TextNode <#text>
TableRowGroupBox <tbody> at (9,9) content-size 166.296875x64.40625 children: not-inline
@@ -67,7 +67,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
TextNode <#text>
TextNode <#text>
TableWrapper <(anonymous)> at (8,74.40625) content-size 164.296875x62.40625 [BFC] children: not-inline
- TableBox <table.table-border-black> at (8,74.40625) content-size 164.296875x62.40625 [TFC] children: not-inline
+ Box <table.table-border-black> at (8,74.40625) content-size 164.296875x62.40625 [TFC] children: not-inline
BlockContainer <(anonymous)> at (8,74.40625) content-size 0x0 children: inline
TextNode <#text>
TableRowGroupBox <tbody> at (8,74.40625) content-size 164.296875x62.40625 children: not-inline
@@ -132,7 +132,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
TextNode <#text>
TextNode <#text>
TableWrapper <(anonymous)> at (8,136.8125) content-size 160.296875x56.40625 [BFC] children: not-inline
- TableBox <div.table.border-black> at (8,136.8125) content-size 160.296875x56.40625 [TFC] children: not-inline
+ Box <div.table.border-black> at (8,136.8125) content-size 160.296875x56.40625 [TFC] children: not-inline
BlockContainer <(anonymous)> at (8,136.8125) content-size 0x0 children: inline
TextNode <#text>
TableRowBox <div.table-row.border-black> at (8,136.8125) content-size 160.296875x18.46875 children: not-inline
@@ -196,7 +196,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
TextNode <#text>
TextNode <#text>
TableWrapper <(anonymous)> at (8,193.21875) content-size 178.296875x92.40625 [BFC] children: not-inline
- TableBox <div.table.thick-border-black> at (8,193.21875) content-size 178.296875x92.40625 [TFC] children: not-inline
+ Box <div.table.thick-border-black> at (8,193.21875) content-size 178.296875x92.40625 [TFC] children: not-inline
BlockContainer <(anonymous)> at (8,193.21875) content-size 0x0 children: inline
TextNode <#text>
TableRowBox <div.table-row.thick-border-black> at (8,193.21875) content-size 178.296875x27.46875 children: not-inline
diff --git a/Tests/LibWeb/Layout/expected/table/cell-px-height.txt b/Tests/LibWeb/Layout/expected/table/cell-px-height.txt
index c5298c30e2..2a09e4b2f9 100644
--- a/Tests/LibWeb/Layout/expected/table/cell-px-height.txt
+++ b/Tests/LibWeb/Layout/expected/table/cell-px-height.txt
@@ -1,6 +1,6 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
TableWrapper <(anonymous)> at (8,8) content-size 102x100 [BFC] children: not-inline
- TableBox <body> at (8,8) content-size 102x100 [TFC] children: not-inline
+ Box <body> at (8,8) content-size 102x100 [TFC] children: not-inline
TableRowBox <div.row> at (8,8) content-size 102x100 children: not-inline
TableCellBox <div.cell> at (9,9) content-size 100x0 [BFC] children: not-inline
diff --git a/Tests/LibWeb/Layout/expected/table/columns-width-distribution-1.txt b/Tests/LibWeb/Layout/expected/table/columns-width-distribution-1.txt
index b791987063..07b71f65c7 100644
--- a/Tests/LibWeb/Layout/expected/table/columns-width-distribution-1.txt
+++ b/Tests/LibWeb/Layout/expected/table/columns-width-distribution-1.txt
@@ -2,7 +2,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x92.21875 children: not-inline
TableWrapper <(anonymous)> at (8,8) content-size 782x92.21875 [BFC] children: not-inline
- TableBox <table.ambox> at (9,9) content-size 780x90.21875 [TFC] children: not-inline
+ Box <table.ambox> at (9,9) content-size 780x90.21875 [TFC] children: not-inline
BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline
TextNode <#text>
TableRowGroupBox <tbody> at (9,9) content-size 780x90.21875 children: not-inline
diff --git a/Tests/LibWeb/Layout/expected/table/fixed-margins.txt b/Tests/LibWeb/Layout/expected/table/fixed-margins.txt
index 3bfb62b044..dc85ba7157 100644
--- a/Tests/LibWeb/Layout/expected/table/fixed-margins.txt
+++ b/Tests/LibWeb/Layout/expected/table/fixed-margins.txt
@@ -3,7 +3,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <body> at (8,8) content-size 784x35.40625 children: not-inline
BlockContainer <div.wrapper> at (8,8) content-size 784x35.40625 children: not-inline
TableWrapper <(anonymous)> at (108,8) content-size 584x35.40625 [BFC] children: not-inline
- TableBox <div.box> at (108,8) content-size 584x35.40625 [TFC] children: not-inline
+ Box <div.box> at (108,8) content-size 584x35.40625 [TFC] children: not-inline
TableRowBox <(anonymous)> at (108,8) content-size 584x35.40625 children: not-inline
TableCellBox <div.cell> at (108,8) content-size 584x35.40625 [BFC] children: inline
line 0 width: 569.859375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
diff --git a/Tests/LibWeb/Layout/expected/table/in-auto-height-flex-item.txt b/Tests/LibWeb/Layout/expected/table/in-auto-height-flex-item.txt
index 8286cb8d25..a34d70e029 100644
--- a/Tests/LibWeb/Layout/expected/table/in-auto-height-flex-item.txt
+++ b/Tests/LibWeb/Layout/expected/table/in-auto-height-flex-item.txt
@@ -3,7 +3,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
Box <body> at (10,10) content-size 780x21.46875 flex-container(row) [FFC] children: not-inline
BlockContainer <div.upper> at (11,11) content-size 41.78125x19.46875 flex-item [BFC] children: not-inline
TableWrapper <(anonymous)> at (11,11) content-size 41.78125x19.46875 [BFC] children: not-inline
- TableBox <(anonymous)> at (11,11) content-size 41.78125x19.46875 [TFC] children: not-inline
+ Box <(anonymous)> at (11,11) content-size 41.78125x19.46875 [TFC] children: not-inline
TableRowBox <(anonymous)> at (11,11) content-size 41.78125x19.46875 children: not-inline
TableCellBox <div.cell> at (12,12) content-size 39.78125x17.46875 [BFC] children: inline
line 0 width: 39.78125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
diff --git a/Tests/LibWeb/Layout/expected/table/inline-table-width.txt b/Tests/LibWeb/Layout/expected/table/inline-table-width.txt
index bb647a77b9..042f2d7384 100644
--- a/Tests/LibWeb/Layout/expected/table/inline-table-width.txt
+++ b/Tests/LibWeb/Layout/expected/table/inline-table-width.txt
@@ -5,7 +5,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
frag 0 from BlockContainer start: 0, length: 0, rect: [9,9 129.984375x38.9375]
BlockContainer <table> at (9,9) content-size 129.984375x38.9375 inline-block [BFC] children: not-inline
TableWrapper <(anonymous)> at (9,9) content-size 129.984375x38.9375 inline-block [BFC] children: not-inline
- TableBox <(anonymous)> at (9,9) content-size 129.984375x38.9375 inline-table [TFC] children: not-inline
+ Box <(anonymous)> at (9,9) content-size 129.984375x38.9375 inline-table [TFC] children: not-inline
TableRowGroupBox <tbody> at (9,9) content-size 129.984375x38.9375 children: not-inline
TableRowBox <tr> at (9,9) content-size 129.984375x19.46875 children: not-inline
TableCellBox <td> at (10,10) content-size 87.90625x17.46875 [BFC] children: inline
diff --git a/Tests/LibWeb/Layout/expected/table/row-px-height.txt b/Tests/LibWeb/Layout/expected/table/row-px-height.txt
index c5298c30e2..2a09e4b2f9 100644
--- a/Tests/LibWeb/Layout/expected/table/row-px-height.txt
+++ b/Tests/LibWeb/Layout/expected/table/row-px-height.txt
@@ -1,6 +1,6 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
TableWrapper <(anonymous)> at (8,8) content-size 102x100 [BFC] children: not-inline
- TableBox <body> at (8,8) content-size 102x100 [TFC] children: not-inline
+ Box <body> at (8,8) content-size 102x100 [TFC] children: not-inline
TableRowBox <div.row> at (8,8) content-size 102x100 children: not-inline
TableCellBox <div.cell> at (9,9) content-size 100x0 [BFC] children: not-inline
diff --git a/Tests/LibWeb/Layout/expected/table/rows-height-distribution-1.txt b/Tests/LibWeb/Layout/expected/table/rows-height-distribution-1.txt
index 45f3072004..79e166313a 100644
--- a/Tests/LibWeb/Layout/expected/table/rows-height-distribution-1.txt
+++ b/Tests/LibWeb/Layout/expected/table/rows-height-distribution-1.txt
@@ -2,7 +2,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x150 children: not-inline
TableWrapper <(anonymous)> at (8,8) content-size 200x150 [BFC] children: not-inline
- TableBox <div.table> at (8,8) content-size 200x150 [TFC] children: not-inline
+ Box <div.table> at (8,8) content-size 200x150 [TFC] children: not-inline
TableRowBox <div.row.a> at (8,8) content-size 200x50 children: not-inline
TableCellBox <div.cell> at (8,8) content-size 200x0 [BFC] children: not-inline
TableRowBox <div.row.b> at (8,58) content-size 200x100 children: not-inline
diff --git a/Tests/LibWeb/Layout/expected/table/rows-height-distribution-2.txt b/Tests/LibWeb/Layout/expected/table/rows-height-distribution-2.txt
index 98426bd7e6..5cff315942 100644
--- a/Tests/LibWeb/Layout/expected/table/rows-height-distribution-2.txt
+++ b/Tests/LibWeb/Layout/expected/table/rows-height-distribution-2.txt
@@ -2,7 +2,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x300 children: not-inline
TableWrapper <(anonymous)> at (8,8) content-size 200x300 [BFC] children: not-inline
- TableBox <div.table> at (8,8) content-size 200x300 [TFC] children: not-inline
+ Box <div.table> at (8,8) content-size 200x300 [TFC] children: not-inline
TableRowBox <div.row.a> at (8,8) content-size 200x150 children: not-inline
TableCellBox <div.cell> at (8,8) content-size 200x0 [BFC] children: not-inline
TableRowBox <div.row.b> at (8,158) content-size 200x150 children: not-inline
diff --git a/Tests/LibWeb/Layout/expected/table/rows-height-distribution-3.txt b/Tests/LibWeb/Layout/expected/table/rows-height-distribution-3.txt
index 9c28369eed..3f0dca092a 100644
--- a/Tests/LibWeb/Layout/expected/table/rows-height-distribution-3.txt
+++ b/Tests/LibWeb/Layout/expected/table/rows-height-distribution-3.txt
@@ -2,7 +2,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x300 children: not-inline
TableWrapper <(anonymous)> at (8,8) content-size 200x300 [BFC] children: not-inline
- TableBox <div.table> at (8,8) content-size 200x300 [TFC] children: not-inline
+ Box <div.table> at (8,8) content-size 200x300 [TFC] children: not-inline
TableRowBox <div.row.a> at (8,8) content-size 200x150 children: not-inline
TableCellBox <div.cell> at (8,8) content-size 200x17.46875 [BFC] children: inline
line 0 width: 9.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
diff --git a/Tests/LibWeb/Layout/expected/table/rows-height-distribution-4.txt b/Tests/LibWeb/Layout/expected/table/rows-height-distribution-4.txt
index 8dfecad89c..5fe8943b9c 100644
--- a/Tests/LibWeb/Layout/expected/table/rows-height-distribution-4.txt
+++ b/Tests/LibWeb/Layout/expected/table/rows-height-distribution-4.txt
@@ -2,7 +2,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x300 children: not-inline
TableWrapper <(anonymous)> at (8,8) content-size 200x300 [BFC] children: not-inline
- TableBox <div.table> at (8,8) content-size 200x300 [TFC] children: not-inline
+ Box <div.table> at (8,8) content-size 200x300 [TFC] children: not-inline
TableRowBox <div.row.a> at (8,8) content-size 200x100 children: not-inline
TableCellBox <div.cell> at (8,8) content-size 200x17.46875 [BFC] children: inline
line 0 width: 9.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
diff --git a/Tests/LibWeb/Layout/expected/table/rowspan.txt b/Tests/LibWeb/Layout/expected/table/rowspan.txt
index bfc997fdf5..0d725c00c3 100644
--- a/Tests/LibWeb/Layout/expected/table/rowspan.txt
+++ b/Tests/LibWeb/Layout/expected/table/rowspan.txt
@@ -6,7 +6,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <(anonymous)> at (8,8) content-size 784x0 children: inline
TextNode <#text>
TableWrapper <(anonymous)> at (8,8) content-size 221.359375x77.875 [BFC] children: not-inline
- TableBox <table> at (8,8) content-size 221.359375x77.875 [TFC] children: not-inline
+ Box <table> at (8,8) content-size 221.359375x77.875 [TFC] children: not-inline
BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline
TextNode <#text>
TableRowGroupBox <tbody> at (8,8) content-size 221.359375x77.875 children: not-inline
diff --git a/Tests/LibWeb/Layout/expected/table/size.txt b/Tests/LibWeb/Layout/expected/table/size.txt
index 7f1406dfbb..2d411df51e 100644
--- a/Tests/LibWeb/Layout/expected/table/size.txt
+++ b/Tests/LibWeb/Layout/expected/table/size.txt
@@ -2,7 +2,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x17.46875 children: not-inline
TableWrapper <(anonymous)> at (350,8) content-size 100x17.46875 [BFC] children: not-inline
- TableBox <div> at (350,8) content-size 100x17.46875 [TFC] children: not-inline
+ Box <div> at (350,8) content-size 100x17.46875 [TFC] children: not-inline
TableRowBox <(anonymous)> at (350,8) content-size 2000x17.46875 children: not-inline
TableCellBox <(anonymous)> at (350,8) content-size 2000x17.46875 [BFC] children: not-inline
BlockContainer <(anonymous)> at (350,8) content-size 2000x0 children: inline
diff --git a/Tests/LibWeb/Layout/expected/table/table-width.txt b/Tests/LibWeb/Layout/expected/table/table-width.txt
index 195b8e1bfd..4f35b43ef1 100644
--- a/Tests/LibWeb/Layout/expected/table/table-width.txt
+++ b/Tests/LibWeb/Layout/expected/table/table-width.txt
@@ -2,7 +2,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x210 children: not-inline
TableWrapper <(anonymous)> at (8,8) content-size 584x210 [BFC] children: not-inline
- TableBox <table.table> at (108,108) content-size 584x10 [TFC] children: not-inline
+ Box <table.table> at (108,108) content-size 584x10 [TFC] children: not-inline
TableRowGroupBox <tbody> at (108,108) content-size 584x10 children: not-inline
TableRowBox <tr> at (108,108) content-size 584x10 children: not-inline
TableCellBox <td.cell> at (109,113) content-size 582x0 [BFC] children: not-inline
diff --git a/Tests/LibWeb/Layout/expected/table/zero-columns-gridmax.txt b/Tests/LibWeb/Layout/expected/table/zero-columns-gridmax.txt
index 9d968c6283..e8e31c0e53 100644
--- a/Tests/LibWeb/Layout/expected/table/zero-columns-gridmax.txt
+++ b/Tests/LibWeb/Layout/expected/table/zero-columns-gridmax.txt
@@ -2,6 +2,6 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x0 children: not-inline
TableWrapper <(anonymous)> at (8,8) content-size 200x0 [BFC] children: not-inline
- TableBox <div.table> at (8,8) content-size 200x0 [TFC] children: not-inline
+ Box <div.table> at (8,8) content-size 200x0 [TFC] children: not-inline
TableRowBox <div.row> at (8,8) content-size 200x0 children: not-inline
TableCellBox <div.cell> at (8,8) content-size 200x0 [BFC] children: not-inline
diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt
index 8d9e79f8e0..de3ba9a909 100644
--- a/Userland/Libraries/LibWeb/CMakeLists.txt
+++ b/Userland/Libraries/LibWeb/CMakeLists.txt
@@ -418,7 +418,6 @@ set(SOURCES
Layout/SVGGeometryBox.cpp
Layout/SVGGraphicsBox.cpp
Layout/SVGSVGBox.cpp
- Layout/TableBox.cpp
Layout/TableCellBox.cpp
Layout/TableFormattingContext.cpp
Layout/TableRowBox.cpp
diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp
index 18daa1d700..5dd627e7f9 100644
--- a/Userland/Libraries/LibWeb/DOM/Element.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Element.cpp
@@ -49,7 +49,6 @@
#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/InlineNode.h>
#include <LibWeb/Layout/ListItemBox.h>
-#include <LibWeb/Layout/TableBox.h>
#include <LibWeb/Layout/TableCellBox.h>
#include <LibWeb/Layout/TableRowBox.h>
#include <LibWeb/Layout/TableRowGroupBox.h>
@@ -326,7 +325,7 @@ JS::GCPtr<Layout::Node> Element::create_layout_node(NonnullRefPtr<CSS::StyleProp
JS::GCPtr<Layout::Node> Element::create_layout_node_for_display_type(DOM::Document& document, CSS::Display const& display, NonnullRefPtr<CSS::StyleProperties> style, Element* element)
{
if (display.is_table_inside())
- return document.heap().allocate_without_realm<Layout::TableBox>(document, element, move(style));
+ return document.heap().allocate_without_realm<Layout::Box>(document, element, move(style));
if (display.is_list_item())
return document.heap().allocate_without_realm<Layout::ListItemBox>(document, element, move(style));
diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
index cf50bf9d3f..78d1a314ce 100644
--- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
@@ -18,7 +18,6 @@
#include <LibWeb/Layout/ListItemMarkerBox.h>
#include <LibWeb/Layout/ReplacedBox.h>
#include <LibWeb/Layout/SVGSVGBox.h>
-#include <LibWeb/Layout/TableBox.h>
#include <LibWeb/Layout/TableWrapper.h>
#include <LibWeb/Layout/Viewport.h>
@@ -385,7 +384,16 @@ CSSPixels BlockFormattingContext::compute_table_box_width_inside_table_wrapper(B
auto context = create_independent_formatting_context_if_needed(throwaway_state, box);
VERIFY(context);
context->run(box, LayoutMode::IntrinsicSizing, m_state.get(box).available_inner_space_or_constraints_from(available_space));
- auto const* table_box = box.first_child_of_type<TableBox>();
+
+ Optional<Box const&> table_box;
+ box.for_each_in_subtree_of_type<Box>([&](Box const& child_box) {
+ if (child_box.display().is_table_inside()) {
+ table_box = child_box;
+ return IterationDecision::Break;
+ }
+ return IterationDecision::Continue;
+ });
+ VERIFY(table_box.has_value());
auto table_used_width = throwaway_state.get(*table_box).content_width();
return table_used_width > available_width ? available_width : table_used_width;
diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
index 3a7cefe457..b9f5a5deef 100644
--- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
@@ -13,7 +13,6 @@
#include <LibWeb/Layout/ReplacedBox.h>
#include <LibWeb/Layout/SVGFormattingContext.h>
#include <LibWeb/Layout/SVGSVGBox.h>
-#include <LibWeb/Layout/TableBox.h>
#include <LibWeb/Layout/TableCellBox.h>
#include <LibWeb/Layout/TableFormattingContext.h>
#include <LibWeb/Layout/Viewport.h>
@@ -192,7 +191,7 @@ OwnPtr<FormattingContext> FormattingContext::create_independent_formatting_conte
case Type::Grid:
return make<GridFormattingContext>(state, child_box, this);
case Type::Table:
- return make<TableFormattingContext>(state, verify_cast<TableBox>(child_box), this);
+ return make<TableFormattingContext>(state, child_box, this);
case Type::InternalReplaced:
return make<ReplacedFormattingContext>(state, child_box);
case Type::InternalDummy:
@@ -1230,7 +1229,7 @@ CSSPixels FormattingContext::calculate_max_content_width(Layout::Box const& box)
CSSPixels FormattingContext::calculate_min_content_height(Layout::Box const& box, AvailableSize const& available_width) const
{
// For block containers, tables, and inline boxes, this is equivalent to the max-content block size.
- if (box.is_block_container() || box.is_table())
+ if (box.is_block_container() || box.display().is_table_inside())
return calculate_max_content_height(box, available_width);
if (box.has_intrinsic_height())
diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp
index 86665dbadb..ac172c9406 100644
--- a/Userland/Libraries/LibWeb/Layout/Node.cpp
+++ b/Userland/Libraries/LibWeb/Layout/Node.cpp
@@ -22,7 +22,6 @@
#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/FormattingContext.h>
#include <LibWeb/Layout/Node.h>
-#include <LibWeb/Layout/TableBox.h>
#include <LibWeb/Layout/TextNode.h>
#include <LibWeb/Layout/Viewport.h>
#include <LibWeb/Platform/FontPlugin.h>
@@ -759,7 +758,7 @@ JS::NonnullGCPtr<NodeWithStyle> NodeWithStyle::create_anonymous_wrapper() const
void NodeWithStyle::reset_table_box_computed_values_used_by_wrapper_to_init_values()
{
- VERIFY(is<TableBox>(*this));
+ VERIFY(this->display().is_table_inside());
CSS::MutableComputedValues& mutable_computed_values = static_cast<CSS::MutableComputedValues&>(m_computed_values);
mutable_computed_values.set_position(CSS::Position::Static);
diff --git a/Userland/Libraries/LibWeb/Layout/Node.h b/Userland/Libraries/LibWeb/Layout/Node.h
index 0919077882..4c33cc38bc 100644
--- a/Userland/Libraries/LibWeb/Layout/Node.h
+++ b/Userland/Libraries/LibWeb/Layout/Node.h
@@ -95,7 +95,6 @@ public:
virtual bool is_list_item_box() const { return false; }
virtual bool is_list_item_marker_box() const { return false; }
virtual bool is_table_wrapper() const { return false; }
- virtual bool is_table() const { return false; }
virtual bool is_node_with_style_and_box_model_metrics() const { return false; }
template<typename T>
diff --git a/Userland/Libraries/LibWeb/Layout/TableBox.cpp b/Userland/Libraries/LibWeb/Layout/TableBox.cpp
deleted file mode 100644
index 469d41e973..0000000000
--- a/Userland/Libraries/LibWeb/Layout/TableBox.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include <LibWeb/DOM/Element.h>
-#include <LibWeb/Layout/TableBox.h>
-
-namespace Web::Layout {
-
-TableBox::TableBox(DOM::Document& document, DOM::Element* element, NonnullRefPtr<CSS::StyleProperties> style)
- : Layout::Box(document, element, move(style))
-{
-}
-
-TableBox::TableBox(DOM::Document& document, DOM::Element* element, CSS::ComputedValues computed_values)
- : Layout::Box(document, element, move(computed_values))
-{
-}
-
-TableBox::~TableBox() = default;
-
-}
diff --git a/Userland/Libraries/LibWeb/Layout/TableBox.h b/Userland/Libraries/LibWeb/Layout/TableBox.h
deleted file mode 100644
index 2fc6c12dd1..0000000000
--- a/Userland/Libraries/LibWeb/Layout/TableBox.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <LibWeb/Layout/Box.h>
-
-namespace Web::Layout {
-
-class TableBox final : public Layout::Box {
- JS_CELL(TableBox, Box);
-
-public:
- TableBox(DOM::Document&, DOM::Element*, NonnullRefPtr<CSS::StyleProperties>);
- TableBox(DOM::Document&, DOM::Element*, CSS::ComputedValues);
- virtual ~TableBox() override;
-
- static CSS::Display static_display(bool inline_outside)
- {
- if (inline_outside)
- return CSS::Display::from_short(CSS::Display::Short::InlineTable);
- return CSS::Display::from_short(CSS::Display::Short::Table);
- }
-
-private:
- virtual bool is_table() const override { return true; }
-};
-
-template<>
-inline bool Node::fast_is<TableBox>() const { return is_table(); }
-
-}
diff --git a/Userland/Libraries/LibWeb/Layout/TableCellBox.h b/Userland/Libraries/LibWeb/Layout/TableCellBox.h
index b0b9297230..dc4324aa5f 100644
--- a/Userland/Libraries/LibWeb/Layout/TableCellBox.h
+++ b/Userland/Libraries/LibWeb/Layout/TableCellBox.h
@@ -20,8 +20,6 @@ public:
size_t colspan() const;
size_t rowspan() const;
-
- static CSS::Display static_display(bool) { return CSS::Display { CSS::Display::Internal::TableCell }; }
};
}
diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
index f48e51461c..3dbba9e0e1 100644
--- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
@@ -8,7 +8,6 @@
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/Layout/Box.h>
#include <LibWeb/Layout/InlineFormattingContext.h>
-#include <LibWeb/Layout/TableBox.h>
#include <LibWeb/Layout/TableCellBox.h>
#include <LibWeb/Layout/TableFormattingContext.h>
#include <LibWeb/Layout/TableRowBox.h>
@@ -36,7 +35,7 @@ struct Traits<GridPosition> : public GenericTraits<GridPosition> {
namespace Web::Layout {
-TableFormattingContext::TableFormattingContext(LayoutState& state, TableBox const& root, FormattingContext* parent)
+TableFormattingContext::TableFormattingContext(LayoutState& state, Box const& root, FormattingContext* parent)
: FormattingContext(Type::Table, state, root, parent)
{
}
diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
index 5b4d726c45..96db737717 100644
--- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
+++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
@@ -8,21 +8,20 @@
#include <AK/Forward.h>
#include <LibWeb/Layout/FormattingContext.h>
-#include <LibWeb/Layout/TableBox.h>
#include <LibWeb/Layout/TableWrapper.h>
namespace Web::Layout {
class TableFormattingContext final : public FormattingContext {
public:
- explicit TableFormattingContext(LayoutState&, TableBox const&, FormattingContext* parent);
+ explicit TableFormattingContext(LayoutState&, Box const&, FormattingContext* parent);
~TableFormattingContext();
virtual void run(Box const&, LayoutMode, AvailableSpace const&) override;
virtual CSSPixels automatic_content_width() const override;
virtual CSSPixels automatic_content_height() const override;
- TableBox const& table_box() const { return static_cast<TableBox const&>(context_box()); }
+ Box const& table_box() const { return context_box(); }
TableWrapper const& table_wrapper() const
{
return verify_cast<TableWrapper>(*table_box().containing_block());
diff --git a/Userland/Libraries/LibWeb/Layout/TableRowBox.h b/Userland/Libraries/LibWeb/Layout/TableRowBox.h
index 015a9c58fe..8623b5dadb 100644
--- a/Userland/Libraries/LibWeb/Layout/TableRowBox.h
+++ b/Userland/Libraries/LibWeb/Layout/TableRowBox.h
@@ -17,8 +17,6 @@ public:
TableRowBox(DOM::Document&, DOM::Element*, NonnullRefPtr<CSS::StyleProperties>);
TableRowBox(DOM::Document&, DOM::Element*, CSS::ComputedValues);
virtual ~TableRowBox() override;
-
- static CSS::Display static_display(bool) { return CSS::Display { CSS::Display::Internal::TableRow }; }
};
}
diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
index 21a897269b..bfa973ae53 100644
--- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
+++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
@@ -24,7 +24,6 @@
#include <LibWeb/Layout/ListItemMarkerBox.h>
#include <LibWeb/Layout/Node.h>
#include <LibWeb/Layout/Progress.h>
-#include <LibWeb/Layout/TableBox.h>
#include <LibWeb/Layout/TableCellBox.h>
#include <LibWeb/Layout/TableRowBox.h>
#include <LibWeb/Layout/TableWrapper.h>
@@ -503,12 +502,12 @@ static void for_each_sequence_of_consecutive_children_matching(NodeWithStyle& pa
}
template<typename WrapperBoxType>
-static void wrap_in_anonymous(Vector<JS::Handle<Node>>& sequence, Node* nearest_sibling)
+static void wrap_in_anonymous(Vector<JS::Handle<Node>>& sequence, Node* nearest_sibling, CSS::Display display)
{
VERIFY(!sequence.is_empty());
auto& parent = *sequence.first()->parent();
auto computed_values = parent.computed_values().clone_inherited_values();
- static_cast<CSS::MutableComputedValues&>(computed_values).set_display(WrapperBoxType::static_display(parent.display().is_inline_outside()));
+ static_cast<CSS::MutableComputedValues&>(computed_values).set_display(display);
auto wrapper = parent.heap().template allocate_without_realm<WrapperBoxType>(parent.document(), nullptr, move(computed_values));
for (auto& child : sequence) {
parent.remove_child(*child);
@@ -526,65 +525,65 @@ void TreeBuilder::generate_missing_child_wrappers(NodeWithStyle& root)
// An anonymous table-row box must be generated around each sequence of consecutive children of a table-root box which are not proper table child boxes.
for_each_in_tree_with_inside_display<CSS::Display::Inside::Table>(root, [&](auto& parent) {
for_each_sequence_of_consecutive_children_matching(parent, is_not_proper_table_child, [&](auto sequence, auto nearest_sibling) {
- wrap_in_anonymous<TableRowBox>(sequence, nearest_sibling);
+ wrap_in_anonymous<TableRowBox>(sequence, nearest_sibling, CSS::Display { CSS::Display::Internal::TableRow });
});
});
// An anonymous table-row box must be generated around each sequence of consecutive children of a table-row-group box which are not table-row boxes.
for_each_in_tree_with_internal_display<CSS::Display::Internal::TableRowGroup>(root, [&](auto& parent) {
for_each_sequence_of_consecutive_children_matching(parent, is_not_table_row, [&](auto& sequence, auto nearest_sibling) {
- wrap_in_anonymous<TableRowBox>(sequence, nearest_sibling);
+ wrap_in_anonymous<TableRowBox>(sequence, nearest_sibling, CSS::Display { CSS::Display::Internal::TableRow });
});
});
// Unless explicitly mentioned otherwise, mentions of table-row-groups in this spec also encompass the specialized
// table-header-groups and table-footer-groups.
for_each_in_tree_with_internal_display<CSS::Display::Internal::TableHeaderGroup>(root, [&](auto& parent) {
for_each_sequence_of_consecutive_children_matching(parent, is_not_table_row, [&](auto& sequence, auto nearest_sibling) {
- wrap_in_anonymous<TableRowBox>(sequence, nearest_sibling);
+ wrap_in_anonymous<TableRowBox>(sequence, nearest_sibling, CSS::Display { CSS::Display::Internal::TableRow });
});
});
for_each_in_tree_with_internal_display<CSS::Display::Internal::TableFooterGroup>(root, [&](auto& parent) {
for_each_sequence_of_consecutive_children_matching(parent, is_not_table_row, [&](auto& sequence, auto nearest_sibling) {
- wrap_in_anonymous<TableRowBox>(sequence, nearest_sibling);
+ wrap_in_anonymous<TableRowBox>(sequence, nearest_sibling, CSS::Display { CSS::Display::Internal::TableRow });
});
});
// An anonymous table-cell box must be generated around each sequence of consecutive children of a table-row box which are not table-cell boxes. !Testcase
for_each_in_tree_with_internal_display<CSS::Display::Internal::TableRow>(root, [&](auto& parent) {
for_each_sequence_of_consecutive_children_matching(parent, is_not_table_cell, [&](auto& sequence, auto nearest_sibling) {
- wrap_in_anonymous<TableCellBox>(sequence, nearest_sibling);
+ wrap_in_anonymous<TableCellBox>(sequence, nearest_sibling, CSS::Display { CSS::Display::Internal::TableCell });
});
});
}
void TreeBuilder::generate_missing_parents(NodeWithStyle& root)
{
- Vector<JS::Handle<TableBox>> table_roots_to_wrap;
+ Vector<JS::Handle<Box>> table_roots_to_wrap;
root.for_each_in_inclusive_subtree_of_type<Box>([&](auto& parent) {
// An anonymous table-row box must be generated around each sequence of consecutive table-cell boxes whose parent is not a table-row.
if (is_not_table_row(parent)) {
for_each_sequence_of_consecutive_children_matching(parent, is_table_cell, [&](auto& sequence, auto nearest_sibling) {
- wrap_in_anonymous<TableRowBox>(sequence, nearest_sibling);
+ wrap_in_anonymous<TableRowBox>(sequence, nearest_sibling, CSS::Display { CSS::Display::Internal::TableRow });
});
}
// A table-row is misparented if its parent is neither a table-row-group nor a table-root box.
if (!parent.display().is_table_inside() && !is_proper_table_child(parent)) {
for_each_sequence_of_consecutive_children_matching(parent, is_table_row, [&](auto& sequence, auto nearest_sibling) {
- wrap_in_anonymous<TableBox>(sequence, nearest_sibling);
+ wrap_in_anonymous<Box>(sequence, nearest_sibling, CSS::Display::from_short(parent.display().is_inline_outside() ? CSS::Display::Short::InlineTable : CSS::Display::Short::Table));
});
}
// A table-row-group, table-column-group, or table-caption box is misparented if its parent is not a table-root box.
if (!parent.display().is_table_inside() && !is_proper_table_child(parent)) {
for_each_sequence_of_consecutive_children_matching(parent, is_proper_table_child, [&](auto& sequence, auto nearest_sibling) {
- wrap_in_anonymous<TableBox>(sequence, nearest_sibling);
+ wrap_in_anonymous<Box>(sequence, nearest_sibling, CSS::Display::from_short(parent.display().is_inline_outside() ? CSS::Display::Short::InlineTable : CSS::Display::Short::Table));
});
}
// An anonymous table-wrapper box must be generated around each table-root.
if (parent.display().is_table_inside()) {
- table_roots_to_wrap.append(static_cast<TableBox&>(parent));
+ table_roots_to_wrap.append(parent);
}
return IterationDecision::Continue;