/* * Copyright (c) 2020, Matthew Olsson * Copyright (c) 2021-2022, Sam Atkins * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include #include #include #include namespace Web::SVG { class SVGGraphicsElement : public SVGElement { WEB_PLATFORM_OBJECT(SVGGraphicsElement, SVGElement); public: virtual void apply_presentational_hints(CSS::StyleProperties&) const override; virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override; Optional fill_color() const; Optional fill_rule() const; Optional stroke_color() const; Optional stroke_width() const; Optional fill_opacity() const; Optional stroke_opacity() const; float visible_stroke_width() const { if (auto color = stroke_color(); color.has_value() && color->alpha() > 0) return stroke_width().value_or(0); return 0; } Gfx::AffineTransform get_transform() const; Optional fill_paint_style(SVGPaintContext const&) const; Optional stroke_paint_style(SVGPaintContext const&) const; Optional view_box() const; protected: SVGGraphicsElement(DOM::Document&, DOM::QualifiedName); virtual JS::ThrowCompletionOr initialize(JS::Realm&) override; Optional svg_paint_computed_value_to_gfx_paint_style(SVGPaintContext const& paint_context, Optional const& paint_value) const; Gfx::AffineTransform m_transform = {}; }; Gfx::AffineTransform transform_from_transform_list(ReadonlySpan transform_list); }