From a01a2f712ec7eebc30d80868fd4f12fc5a55e2d3 Mon Sep 17 00:00:00 2001 From: MacDue Date: Sat, 5 Aug 2023 01:45:50 +0100 Subject: [PATCH] LibWeb: Fix calculating the corner radius values for SVG Previously, this would treat having both rx and ry set as if just rx was set. The checks are now updated to match the spec comments above them :). --- Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp index 0164d024d7..1ff1fcb52a 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp @@ -132,12 +132,12 @@ Gfx::FloatSize SVGRectElement::calculate_used_corner_radius_values() const ry = 0; } // 3. Otherwise, if a properly specified value is provided for ‘rx’, but not for ‘ry’, then set both rx and ry to the value of ‘rx’. - else if (m_radius_x.has_value()) { + else if (m_radius_x.has_value() && !m_radius_y.has_value()) { rx = m_radius_x.value(); ry = m_radius_x.value(); } // 4. Otherwise, if a properly specified value is provided for ‘ry’, but not for ‘rx’, then set both rx and ry to the value of ‘ry’. - else if (m_radius_y.has_value()) { + else if (m_radius_y.has_value() && !m_radius_x.has_value()) { rx = m_radius_y.value(); ry = m_radius_y.value(); }