1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:37:35 +00:00

LibWeb: Add for CSS fill/stroke/stroke-color properties for SVG

In the spec, `fill` and `stroke` are supposed to be a shorthands for
various properties. But since the spec is still a working draft, and
neither Firefox or Chrome support the `fill-color` or `stroke-color`
properties, we'll stick with `fill` and `stroke` as simple colors for
now.

Also, note that SVG expects things in "user units", and we are assuming
that 1px = 1 user unit for now.
This commit is contained in:
Sam Atkins 2021-09-16 12:28:14 +01:00 committed by Andreas Kling
parent 2c8c56684b
commit 3964b81d2b
5 changed files with 75 additions and 5 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -19,11 +20,11 @@ public:
SVGGraphicsElement(DOM::Document&, QualifiedName);
virtual void parse_attribute(const FlyString& name, const String& value) override;
virtual void parse_attribute(FlyString const& name, String const& value) override;
const Optional<Gfx::Color>& fill_color() const { return m_fill_color; }
const Optional<Gfx::Color>& stroke_color() const { return m_stroke_color; }
const Optional<float>& stroke_width() const { return m_stroke_width; }
Optional<Gfx::Color> fill_color() const;
Optional<Gfx::Color> stroke_color() const;
Optional<float> stroke_width() const;
protected:
Optional<Gfx::Color> m_fill_color;