From d127eb5117cab96dbed00ae45ae7e9fc72ce2ade Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Mon, 15 Sep 2025 12:15:57 +0100 Subject: [PATCH] LibWeb/Geometry: Correct typos in DOMMatrix "not 0 or -0" checks Assuming 0 and -0 are distinct values, `a != 0 || a != -0` is always true. --- Libraries/LibWeb/Geometry/DOMMatrix.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Libraries/LibWeb/Geometry/DOMMatrix.cpp b/Libraries/LibWeb/Geometry/DOMMatrix.cpp index 8999d15f2fe..327098145a9 100644 --- a/Libraries/LibWeb/Geometry/DOMMatrix.cpp +++ b/Libraries/LibWeb/Geometry/DOMMatrix.cpp @@ -423,7 +423,7 @@ GC::Ref DOMMatrix::translate_self(Optional tx, Optional { tx.value_or(0), ty.value_or(0), tz.value_or(0) }); // 2. If tz is specified and not 0 or -0, set is 2D of the current matrix to false. - if (tz.has_value() && (tz != 0 || tz != -0)) + if (tz.has_value() && (tz != 0 && tz != -0)) m_is_2d = false; // 3. Return the current matrix. @@ -494,7 +494,7 @@ GC::Ref DOMMatrix::rotate_self(Optional rot_x, Optional DOMMatrix::rotate_axis_angle_self(Optional x, Optiona m_matrix = m_matrix * Gfx::rotation_matrix(Vector3 { x.value_or(0), y.value_or(0), z.value_or(0) }.normalized(), AK::to_radians(angle.value())); // 2. If x or y are not 0 or -0, set is 2D of the current matrix to false. - if (x != 0 || x != -0 || y != 0 || y != -0) + if ((x != 0 && x != -0) || (y != 0 && y != -0)) m_is_2d = false; // 3. Return the current matrix.