diff options
author | Linus Groh <mail@linusgroh.de> | 2021-12-27 14:16:17 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-12-27 16:43:23 +0100 |
commit | b32893eb548e82d45a3de1701ca5a3569d0725df (patch) | |
tree | 3014b25fe3e00addd9ff6e2703a11415d9a3d6d0 /Userland | |
parent | 6faaee2bc869854da4f6598e79c79c9a8b75efcb (diff) | |
download | serenity-b32893eb548e82d45a3de1701ca5a3569d0725df.zip |
LibWeb: Let canvas {fill,stroke}Style default to black, not transparent
I don't know if the original author simply missed this or thought the
default color of Gfx::Color is black, but this meant that drawing on a
canvas without explicitly setting a fillStyle or strokeStyle first would
be drawn in transparent color and therefore be invisible.
In the spec this is indicated by a small comment in the IDL definition:
attribute ... strokeStyle; // (default black)
attribute ... fillStyle; // (default black)
I'm starting to question whether Gfx::Color actually *should* have a
default constructor.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h index 1896e336b0..40f9831960 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h +++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h @@ -81,8 +81,8 @@ private: WeakPtr<HTMLCanvasElement> m_element; Gfx::AffineTransform m_transform; - Gfx::Color m_fill_style; - Gfx::Color m_stroke_style; + Gfx::Color m_fill_style { Gfx::Color::Black }; + Gfx::Color m_stroke_style { Gfx::Color::Black }; float m_line_width { 1 }; Gfx::Path m_path; |