mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +00:00
LibWeb: Report when CanvasFillOrStrokeStyle parsing fails
This commit is contained in:
parent
2ecc1d64d8
commit
c713445253
1 changed files with 7 additions and 1 deletions
|
@ -27,7 +27,13 @@ public:
|
||||||
{
|
{
|
||||||
return style.visit(
|
return style.visit(
|
||||||
[&](String const& string) -> CanvasState::FillOrStrokeStyle {
|
[&](String const& string) -> CanvasState::FillOrStrokeStyle {
|
||||||
return Gfx::Color::from_string(string).value_or(Color::Black);
|
// FIXME: This should parse color strings the same as CSS
|
||||||
|
auto color = Gfx::Color::from_string(string);
|
||||||
|
|
||||||
|
if (!color.has_value())
|
||||||
|
dbgln_if(CANVAS_RENDERING_CONTEXT_2D_DEBUG, "CanvasFillStrokeStyles: Unsupported canvas fill or stroke style \"{}\". Defaulting to Color::Black.", string);
|
||||||
|
|
||||||
|
return color.value_or(Color::Black);
|
||||||
},
|
},
|
||||||
[&](auto fill_or_stroke_style) -> CanvasState::FillOrStrokeStyle {
|
[&](auto fill_or_stroke_style) -> CanvasState::FillOrStrokeStyle {
|
||||||
return fill_or_stroke_style;
|
return fill_or_stroke_style;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue