2020-07-23 01:17:39 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, Matthew Olsson <matthewcolsson@gmail.com>
|
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-07-23 01:17:39 +03:00
|
|
|
*/
|
|
|
|
|
2020-07-23 19:44:42 +03:00
|
|
|
#include <LibWeb/SVG/SVGGraphicsElement.h>
|
2020-07-23 01:17:39 +03:00
|
|
|
|
2020-07-23 19:44:42 +03:00
|
|
|
namespace Web::SVG {
|
2020-07-23 01:17:39 +03:00
|
|
|
|
2021-02-07 13:20:15 +03:00
|
|
|
SVGGraphicsElement::SVGGraphicsElement(DOM::Document& document, QualifiedName qualified_name)
|
|
|
|
: SVGElement(document, move(qualified_name))
|
2020-07-23 01:17:39 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-07-23 19:44:42 +03:00
|
|
|
void SVGGraphicsElement::parse_attribute(const FlyString& name, const String& value)
|
2020-07-23 01:17:39 +03:00
|
|
|
{
|
2020-07-23 19:44:42 +03:00
|
|
|
SVGElement::parse_attribute(name, value);
|
2020-07-23 01:17:39 +03:00
|
|
|
|
2020-07-23 19:44:42 +03:00
|
|
|
if (name == "fill") {
|
|
|
|
m_fill_color = Gfx::Color::from_string(value).value_or(Color::Transparent);
|
|
|
|
} else if (name == "stroke") {
|
|
|
|
m_stroke_color = Gfx::Color::from_string(value).value_or(Color::Transparent);
|
|
|
|
} else if (name == "stroke-width") {
|
|
|
|
auto result = value.to_int();
|
|
|
|
if (result.has_value())
|
|
|
|
m_stroke_width = result.value();
|
|
|
|
}
|
2020-07-23 01:17:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|