/src/serenity/Userland/Libraries/LibWeb/SVG/SVGStopElement.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2023, MacDue <macdue@dueutil.tech> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <LibGfx/Color.h> |
10 | | #include <LibWeb/SVG/AttributeParser.h> |
11 | | #include <LibWeb/SVG/SVGAnimatedNumber.h> |
12 | | #include <LibWeb/SVG/SVGElement.h> |
13 | | |
14 | | namespace Web::SVG { |
15 | | |
16 | | class SVGStopElement final : public SVGElement { |
17 | | WEB_PLATFORM_OBJECT(SVGStopElement, SVGElement); |
18 | | JS_DECLARE_ALLOCATOR(SVGStopElement); |
19 | | |
20 | | public: |
21 | | virtual ~SVGStopElement() override = default; |
22 | | |
23 | | virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override; |
24 | | |
25 | | JS::NonnullGCPtr<SVGAnimatedNumber> offset() const; |
26 | | |
27 | | virtual void apply_presentational_hints(CSS::StyleProperties&) const override; |
28 | | |
29 | 0 | NumberPercentage stop_offset() const { return m_offset.value_or(NumberPercentage::create_number(0)); } |
30 | | Gfx::Color stop_color() const; |
31 | | float stop_opacity() const; |
32 | | |
33 | | private: |
34 | | SVGStopElement(DOM::Document&, DOM::QualifiedName); |
35 | | |
36 | | virtual void initialize(JS::Realm&) override; |
37 | | |
38 | | Optional<NumberPercentage> m_offset; |
39 | | Optional<Gfx::Color> m_color; |
40 | | }; |
41 | | |
42 | | } |