diff --git a/Userland/Libraries/LibWeb/Layout/Box.cpp b/Userland/Libraries/LibWeb/Layout/Box.cpp index 99717c3a56..85ad404327 100644 --- a/Userland/Libraries/LibWeb/Layout/Box.cpp +++ b/Userland/Libraries/LibWeb/Layout/Box.cpp @@ -305,11 +305,12 @@ Box::BorderRadiusData Box::normalized_border_radius_data() auto top_right_radius = computed_values().border_top_right_radius().resolved_or_zero(*this, width()).to_px(*this); // Scale overlapping curves according to https://www.w3.org/TR/css-backgrounds-3/#corner-overlap + auto bordered_rect = this->bordered_rect(); auto f = 1.0f; - f = min(f, bordered_rect().width() / (float)(top_left_radius + top_right_radius)); - f = min(f, bordered_rect().height() / (float)(top_right_radius + bottom_right_radius)); - f = min(f, bordered_rect().width() / (float)(bottom_left_radius + bottom_right_radius)); - f = min(f, bordered_rect().height() / (float)(top_left_radius + bottom_left_radius)); + f = min(f, bordered_rect.width() / (float)(top_left_radius + top_right_radius)); + f = min(f, bordered_rect.height() / (float)(top_right_radius + bottom_right_radius)); + f = min(f, bordered_rect.width() / (float)(bottom_left_radius + bottom_right_radius)); + f = min(f, bordered_rect.height() / (float)(top_left_radius + bottom_left_radius)); top_left_radius = (int)(top_left_radius * f); top_right_radius = (int)(top_right_radius * f); diff --git a/Userland/Libraries/LibWeb/Layout/Box.h b/Userland/Libraries/LibWeb/Layout/Box.h index 003ddafbe4..ed2f45b6e8 100644 --- a/Userland/Libraries/LibWeb/Layout/Box.h +++ b/Userland/Libraries/LibWeb/Layout/Box.h @@ -34,10 +34,11 @@ public: Gfx::FloatRect padded_rect() const { + auto absolute_rect = this->absolute_rect(); Gfx::FloatRect rect; - rect.set_x(absolute_x() - box_model().padding.left); + rect.set_x(absolute_rect.x() - box_model().padding.left); rect.set_width(width() + box_model().padding.left + box_model().padding.right); - rect.set_y(absolute_y() - box_model().padding.top); + rect.set_y(absolute_rect.y() - box_model().padding.top); rect.set_height(height() + box_model().padding.top + box_model().padding.bottom); return rect; }