diff --git a/Libraries/LibWeb/Layout/Box.h b/Libraries/LibWeb/Layout/Box.h index c08460f6c6..0e53216beb 100644 --- a/Libraries/LibWeb/Layout/Box.h +++ b/Libraries/LibWeb/Layout/Box.h @@ -52,6 +52,12 @@ public: float width() const { return m_size.width(); } float height() const { return m_size.height(); } + float border_box_width() const + { + auto border_box = box_model().border_box(*this); + return width() + border_box.left + border_box.right; + } + float absolute_x() const { return absolute_rect().x(); } float absolute_y() const { return absolute_rect().y(); } Gfx::FloatPoint absolute_position() const { return absolute_rect().location(); } diff --git a/Libraries/LibWeb/Layout/FormattingContext.cpp b/Libraries/LibWeb/Layout/FormattingContext.cpp index 44d1e4bcfb..ba5c7ca610 100644 --- a/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -96,7 +96,7 @@ static float greatest_child_width(const Box& box) } } else { box.for_each_child_of_type([&](auto& child) { - max_width = max(max_width, child.width()); + max_width = max(max_width, child.border_box_width()); }); } return max_width;