ladybird/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.h
Sam Atkins 3964b81d2b 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.
2021-09-16 22:30:33 +02:00

35 lines
862 B
C++

/*
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGfx/Path.h>
#include <LibWeb/DOM/Node.h>
#include <LibWeb/SVG/SVGElement.h>
#include <LibWeb/SVG/TagNames.h>
namespace Web::SVG {
class SVGGraphicsElement : public SVGElement {
public:
using WrapperType = Bindings::SVGGraphicsElementWrapper;
SVGGraphicsElement(DOM::Document&, QualifiedName);
virtual void parse_attribute(FlyString const& name, String const& value) override;
Optional<Gfx::Color> fill_color() const;
Optional<Gfx::Color> stroke_color() const;
Optional<float> stroke_width() const;
protected:
Optional<Gfx::Color> m_fill_color;
Optional<Gfx::Color> m_stroke_color;
Optional<float> m_stroke_width;
};
}