mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-26 09:59:43 +00:00
LibWeb: Ignore non-finite args in CanvasRenderingContext2D::clear_rect()
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This commit is contained in:
parent
b1801c0bc9
commit
7fb65283c2
Notes:
github-actions[bot]
2025-10-17 16:43:13 +00:00
Author: https://github.com/ljamar
Commit: 7fb65283c2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6454
Reviewed-by: https://github.com/Lubrsi ✅
3 changed files with 63 additions and 0 deletions
|
|
@ -100,8 +100,13 @@ void CanvasRenderingContext2D::fill_rect(float x, float y, float width, float he
|
|||
fill_internal(rect_path(x, y, width, height), Gfx::WindingRule::EvenOdd);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-clearrect
|
||||
void CanvasRenderingContext2D::clear_rect(float x, float y, float width, float height)
|
||||
{
|
||||
// 1. If any of the arguments are infinite or NaN, then return.
|
||||
if (!isfinite(x) || !isfinite(y) || !isfinite(width) || !isfinite(height))
|
||||
return;
|
||||
|
||||
if (auto* painter = this->painter()) {
|
||||
auto rect = Gfx::FloatRect(x, y, width, height);
|
||||
painter->clear_rect(rect, clear_color());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue