diff --git a/Userland/Libraries/LibWeb/PixelUnits.h b/Userland/Libraries/LibWeb/PixelUnits.h index 89b89128c6..01aacf3692 100644 --- a/Userland/Libraries/LibWeb/PixelUnits.h +++ b/Userland/Libraries/LibWeb/PixelUnits.h @@ -262,27 +262,28 @@ private: i32 m_value { 0 }; }; -constexpr bool operator==(CSSPixels left, int right) { return left == CSSPixels(right); } +template +constexpr bool operator==(CSSPixels left, T right) { return left == CSSPixels(right); } inline bool operator==(CSSPixels left, float right) { return left.to_float() == right; } inline bool operator==(CSSPixels left, double right) { return left.to_double() == right; } -constexpr bool operator>(CSSPixels left, int right) { return left > CSSPixels(right); } +template +constexpr bool operator>(CSSPixels left, T right) { return left > CSSPixels(right); } inline bool operator>(CSSPixels left, float right) { return left.to_float() > right; } inline bool operator>(CSSPixels left, double right) { return left.to_double() > right; } -constexpr bool operator<(CSSPixels left, int right) { return left < CSSPixels(right); } +template +constexpr bool operator<(CSSPixels left, T right) { return left < CSSPixels(right); } inline bool operator<(CSSPixels left, float right) { return left.to_float() < right; } inline bool operator<(CSSPixels left, double right) { return left.to_double() < right; } -constexpr CSSPixels operator*(CSSPixels left, int right) { return left * CSSPixels(right); } -constexpr CSSPixels operator*(CSSPixels left, unsigned int right) { return left * CSSPixels(right); } -constexpr CSSPixels operator*(CSSPixels left, unsigned long right) { return left * CSSPixels(right); } +template +constexpr CSSPixels operator*(CSSPixels left, T right) { return left * CSSPixels(right); } inline float operator*(CSSPixels left, float right) { return left.to_float() * right; } inline double operator*(CSSPixels left, double right) { return left.to_double() * right; } -constexpr CSSPixels operator*(int left, CSSPixels right) { return right * CSSPixels(left); } -constexpr CSSPixels operator*(unsigned int left, CSSPixels right) { return right * CSSPixels(left); } -constexpr CSSPixels operator*(unsigned long left, CSSPixels right) { return right * CSSPixels(left); } +template +constexpr CSSPixels operator*(T left, CSSPixels right) { return CSSPixels(left) * right; } inline float operator*(float left, CSSPixels right) { return right.to_float() * left; } inline double operator*(double left, CSSPixels right) { return right.to_double() * left; } @@ -373,9 +374,8 @@ constexpr CSSPixels CSSPixels::operator/(CSSPixelFraction const& other) const return CSSPixels::from_raw(AK::clamp_to_int(wide_value)); } -constexpr CSSPixels operator/(CSSPixels left, int right) { return left / CSSPixels(right); } -constexpr CSSPixels operator/(CSSPixels left, unsigned int right) { return left / CSSPixels(right); } -constexpr CSSPixels operator/(CSSPixels left, unsigned long right) { return left / CSSPixels(right); } +template +constexpr CSSPixels operator/(CSSPixels left, T right) { return left / CSSPixels(right); } inline float operator/(CSSPixels left, float right) { return left.to_float() / right; } inline double operator/(CSSPixels left, double right) { return left.to_double() / right; }