summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorAliaksandr Kalenik <kalenik.aliaksandr@gmail.com>2023-01-05 18:44:04 +0300
committerAndreas Kling <kling@serenityos.org>2023-01-06 12:01:46 +0100
commit21d89a2153edf49f9debfa2503b8c39553370764 (patch)
tree8938a1f6c88f5308519ec14526850bd15db14613 /Userland/Libraries
parent90b43712e6af774fa2ac73401dccc56034912cf7 (diff)
downloadserenity-21d89a2153edf49f9debfa2503b8c39553370764.zip
LibWeb: Use available space to resolve table cells width
It is not possible to use width of containing block to resolve cells width because by the time compute_table_measures() is called row width is not known yet.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Layout/TableFormattingContext.h2
2 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
index 392436f0ab..b7f21c8a01 100644
--- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
@@ -104,7 +104,7 @@ void TableFormattingContext::calculate_row_column_grid(Box const& box)
void TableFormattingContext::compute_table_measures()
{
for (auto& cell : m_cells) {
- auto width_of_containing_block = m_state.get(*cell.box.containing_block()).content_width();
+ auto width_of_containing_block = m_available_space->width.to_px();
auto width_of_containing_block_as_length = CSS::Length::make_px(width_of_containing_block);
auto& computed_values = cell.box.computed_values();
CSSPixels padding_left = computed_values.padding().left().resolved(cell.box, width_of_containing_block_as_length).to_px(cell.box);
@@ -226,6 +226,8 @@ void TableFormattingContext::determine_intrisic_size_of_table_container(Availabl
void TableFormattingContext::run(Box const& box, LayoutMode, AvailableSpace const& available_space)
{
+ m_available_space = available_space;
+
CSSPixels total_content_height = 0;
// Determine the number of rows/columns the table requires.
diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
index f88272f541..2d4d25f34f 100644
--- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
+++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
@@ -28,6 +28,8 @@ private:
CSSPixels m_automatic_content_height { 0 };
+ Optional<AvailableSpace> m_available_space;
+
struct Column {
CSSPixels left_offset { 0 };
CSSPixels min_width { 0 };