diff options
author | Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com> | 2022-12-04 22:44:19 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-05 17:47:48 +0100 |
commit | dbf76e8ae1473426f53c6d04336246e5a721b7b6 (patch) | |
tree | 891bb3825b5e922effbadc1777325643031b5fe2 | |
parent | 1c6783cd7e7d6bd80a0a38efbffef42cedf6ae3a (diff) | |
download | serenity-dbf76e8ae1473426f53c6d04336246e5a721b7b6.zip |
LibWeb: Take rowspan into account while table formatting
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/TableCellBox.cpp | 7 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/TableCellBox.h | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp | 2 |
3 files changed, 9 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/TableCellBox.cpp b/Userland/Libraries/LibWeb/Layout/TableCellBox.cpp index ba3e203ae5..4e968059d1 100644 --- a/Userland/Libraries/LibWeb/Layout/TableCellBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/TableCellBox.cpp @@ -29,4 +29,11 @@ size_t TableCellBox::colspan() const return verify_cast<DOM::Element>(*dom_node()).attribute(HTML::AttributeNames::colspan).to_uint().value_or(1); } +size_t TableCellBox::rowspan() const +{ + if (!dom_node()) + return 1; + return verify_cast<DOM::Element>(*dom_node()).attribute(HTML::AttributeNames::rowspan).to_uint().value_or(1); +} + } diff --git a/Userland/Libraries/LibWeb/Layout/TableCellBox.h b/Userland/Libraries/LibWeb/Layout/TableCellBox.h index b63d8c5b1e..df77bd79c5 100644 --- a/Userland/Libraries/LibWeb/Layout/TableCellBox.h +++ b/Userland/Libraries/LibWeb/Layout/TableCellBox.h @@ -22,6 +22,7 @@ public: TableCellBox const* next_cell() const { return next_sibling_of_type<TableCellBox>(); } size_t colspan() const; + size_t rowspan() const; static CSS::Display static_display() { return CSS::Display { CSS::Display::Internal::TableCell }; } }; diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp index c9e5917ea8..81000fbe3e 100644 --- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp @@ -66,7 +66,7 @@ void TableFormattingContext::calculate_row_column_grid(Box const& box) x_width++; const size_t colspan = static_cast<TableCellBox*>(child)->colspan(); - const size_t rowspan = 1; + const size_t rowspan = static_cast<TableCellBox*>(child)->rowspan(); if (x_width < x_current + colspan) x_width = x_current + colspan; |