diff --git a/Userland/Libraries/LibWeb/HTML/Canvas/CanvasTransform.h b/Userland/Libraries/LibWeb/HTML/Canvas/CanvasTransform.h
index 3c137ab4aa6..1c59062c498 100644
--- a/Userland/Libraries/LibWeb/HTML/Canvas/CanvasTransform.h
+++ b/Userland/Libraries/LibWeb/HTML/Canvas/CanvasTransform.h
@@ -24,7 +24,8 @@ public:
void scale(float sx, float sy)
{
dbgln_if(CANVAS_RENDERING_CONTEXT_2D_DEBUG, "CanvasTransform::scale({}, {})", sx, sy);
-
+ if (!isfinite(sx) || !isfinite(sy))
+ return;
my_drawing_state().transform.scale(sx, sy);
flush_transform();
}
@@ -32,6 +33,8 @@ public:
void translate(float tx, float ty)
{
dbgln_if(CANVAS_RENDERING_CONTEXT_2D_DEBUG, "CanvasTransform::translate({}, {})", tx, ty);
+ if (!isfinite(tx) || !isfinite(ty))
+ return;
my_drawing_state().transform.translate(tx, ty);
flush_transform();
}
@@ -39,6 +42,8 @@ public:
void rotate(float radians)
{
dbgln_if(CANVAS_RENDERING_CONTEXT_2D_DEBUG, "CanvasTransform::rotate({})", radians);
+ if (!isfinite(radians))
+ return;
my_drawing_state().transform.rotate_radians(radians);
flush_transform();
}
diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp
index 3c78857bd9f..0506b941e7c 100644
--- a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp
+++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp
@@ -89,7 +89,7 @@ Gfx::Path CanvasRenderingContext2D::rect_path(float x, float y, float width, flo
void CanvasRenderingContext2D::fill_rect(float x, float y, float width, float height)
{
- return fill_internal(rect_path(x, y, width, height), Gfx::WindingRule::EvenOdd);
+ fill_internal(rect_path(x, y, width, height), Gfx::WindingRule::EvenOdd);
}
void CanvasRenderingContext2D::clear_rect(float x, float y, float width, float height)
@@ -312,7 +312,7 @@ void CanvasRenderingContext2D::fill_internal(Gfx::Path const& path, Gfx::Winding
void CanvasRenderingContext2D::fill(StringView fill_rule)
{
- return fill_internal(path(), parse_fill_rule(fill_rule));
+ fill_internal(path(), parse_fill_rule(fill_rule));
}
void CanvasRenderingContext2D::fill(Path2D& path, StringView fill_rule)