at (10,37.46875) content-size 56.46875x19.46875 table-row children: not-inline
+ BlockContainer <(anonymous)> (not painted) children: inline
+ TextNode <#text>
+ BlockContainer at (11,38.46875) content-size 54.46875x17.46875 table-cell [BFC] children: inline
+ line 0 width: 27.5, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+ frag 0 from TextNode start: 0, length: 4, rect: [11,38.46875 27.5x17.46875]
+ "Cell"
+ TextNode <#text>
+ BlockContainer <(anonymous)> (not painted) children: inline
+ TextNode <#text>
+ BlockContainer <(anonymous)> (not painted) children: inline
+ TextNode <#text>
diff --git a/Tests/LibWeb/Layout/input/table/top-caption-with-padding.html b/Tests/LibWeb/Layout/input/table/top-caption-with-padding.html
new file mode 100644
index 0000000000..ebc09357c5
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/table/top-caption-with-padding.html
@@ -0,0 +1,15 @@
+
+
+
+
+ Caption
+
+
+ Cell |
+
+
\ No newline at end of file
diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
index e4514fa585..eb470c228f 100644
--- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
@@ -91,7 +91,7 @@ CSSPixels TableFormattingContext::run_caption_layout(LayoutMode layout_mode, CSS
caption_context->resolve_vertical_box_model_metrics(child_box);
auto const& caption_state = m_state.get(child_box);
if (phase == CSS::CaptionSide::Top) {
- m_state.get_mutable(table_box()).set_content_y(caption_state.margin_box_height());
+ m_state.get_mutable(table_box()).set_content_y(caption_state.content_height() + caption_state.margin_box_bottom());
} else {
m_state.get_mutable(child_box).set_content_y(
m_state.get(table_box()).margin_box_height() + caption_state.margin_box_top());
|