1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00
serenity/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00

31 lines
863 B
C++

/*
* Copyright (c) 2020, Matthew Olsson <matthewcolsson@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/SVG/SVGGraphicsElement.h>
namespace Web::SVG {
SVGGraphicsElement::SVGGraphicsElement(DOM::Document& document, QualifiedName qualified_name)
: SVGElement(document, move(qualified_name))
{
}
void SVGGraphicsElement::parse_attribute(const FlyString& name, const String& value)
{
SVGElement::parse_attribute(name, value);
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();
}
}
}