mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-26 18:09:45 +00:00
LibWeb: Ignore non-finite arguments to canvas text drawing methods
This commit is contained in:
parent
26b82986c4
commit
303ebc0a67
Notes:
github-actions[bot]
2025-10-20 11:13:27 +00:00
Author: https://github.com/tcl3
Commit: 303ebc0a67
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6516
Reviewed-by: https://github.com/AtkinsSJ ✅
3 changed files with 46 additions and 0 deletions
|
|
@ -310,13 +310,21 @@ Gfx::Path CanvasRenderingContext2D::text_path(Utf16String const& text, float x,
|
|||
return path.copy_transformed(transform);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-filltext
|
||||
void CanvasRenderingContext2D::fill_text(Utf16String const& text, float x, float y, Optional<double> max_width)
|
||||
{
|
||||
if (!isfinite(x) || !isfinite(y) || (max_width.has_value() && !isfinite(max_width.value())))
|
||||
return;
|
||||
|
||||
fill_internal(text_path(text, x, y, max_width), Gfx::WindingRule::Nonzero);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-stroketext
|
||||
void CanvasRenderingContext2D::stroke_text(Utf16String const& text, float x, float y, Optional<double> max_width)
|
||||
{
|
||||
if (!isfinite(x) || !isfinite(y) || (max_width.has_value() && !isfinite(max_width.value())))
|
||||
return;
|
||||
|
||||
stroke_internal(text_path(text, x, y, max_width));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue