mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 12:32:21 +00:00
LibWeb: Ignore setting zero, negative, or non-finite CRC2D.lineWidths
This is part of the spec but was missed. This fixes a crash on: https://www.kevs3d.co.uk/dev/phoria/test1d.html
This commit is contained in:
parent
7fc5fd453e
commit
23d8d217ed
Notes:
sideshowbarker
2024-07-17 17:49:11 +09:00
Author: https://github.com/MacDue
Commit: 23d8d217ed
Pull-request: https://github.com/SerenityOS/serenity/pull/24234
1 changed files with 14 additions and 2 deletions
|
@ -16,8 +16,20 @@ class CanvasPathDrawingStyles {
|
||||||
public:
|
public:
|
||||||
~CanvasPathDrawingStyles() = default;
|
~CanvasPathDrawingStyles() = default;
|
||||||
|
|
||||||
void set_line_width(float line_width) { my_drawing_state().line_width = line_width; }
|
// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-linewidth
|
||||||
float line_width() const { return my_drawing_state().line_width; }
|
void set_line_width(float line_width)
|
||||||
|
{
|
||||||
|
// On setting, zero, negative, infinite, and NaN values must be ignored, leaving the value unchanged;
|
||||||
|
if (line_width <= 0 || !isfinite(line_width))
|
||||||
|
return;
|
||||||
|
// other values must change the current value to the new value.
|
||||||
|
my_drawing_state().line_width = line_width;
|
||||||
|
}
|
||||||
|
float line_width() const
|
||||||
|
{
|
||||||
|
// On getting, it must return the current value.
|
||||||
|
return my_drawing_state().line_width;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CanvasPathDrawingStyles() = default;
|
CanvasPathDrawingStyles() = default;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue