summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAliaksandr Kalenik <kalenik.aliaksandr@gmail.com>2023-01-14 15:05:08 +0100
committerAndreas Kling <kling@serenityos.org>2023-01-14 19:22:08 +0100
commit80578ead45ff6b36f49b96437da2f85485c010e0 (patch)
treeb55bd57e0a0c94b1b1facf2c0a8af0059795e2e4
parent709fe01f523aca754f8e23fc40c53299d0982a94 (diff)
downloadserenity-80578ead45ff6b36f49b96437da2f85485c010e0.zip
LibWeb: Table box width should be relative to wrapper containing block
-rw-r--r--Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Layout/TableFormattingContext.h5
2 files changed, 8 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
index 72c44a527e..a56b3e0ca8 100644
--- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
@@ -210,7 +210,9 @@ void TableFormattingContext::compute_table_width()
auto& computed_values = table_box().computed_values();
- CSSPixels width_of_table_containing_block = m_state.get(*table_box().containing_block()).content_width();
+ // Percentages on 'width' and 'height' on the table are relative to the table wrapper box's containing block,
+ // not the table wrapper box itself.
+ CSSPixels width_of_table_containing_block = m_state.get(*table_wrapper().containing_block()).content_width();
// The row/column-grid width minimum (GRIDMIN) width is the sum of the min-content width
// of all the columns plus cell spacing or borders.
diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
index 4f1adabe4a..a709021976 100644
--- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
+++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
@@ -8,6 +8,7 @@
#include <AK/Forward.h>
#include <LibWeb/Layout/FormattingContext.h>
+#include <LibWeb/Layout/TableWrapper.h>
namespace Web::Layout {
@@ -20,6 +21,10 @@ public:
virtual CSSPixels automatic_content_height() const override;
TableBox const& table_box() const { return static_cast<TableBox const&>(context_box()); }
+ TableWrapper const& table_wrapper() const
+ {
+ return verify_cast<TableWrapper>(*table_box().containing_block());
+ }
private:
void calculate_row_column_grid(Box const&);