diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2023-03-24 16:55:44 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-03-25 16:56:04 +0000 |
commit | 1591352531afa22990066820bb16996ce0e9b0b8 (patch) | |
tree | 5103293708b3ce1e477aea451afcae5df81117bb /Userland/Libraries/LibWeb/CSS | |
parent | 44c9a5b6481d2b8eb0daf34275e6ec3db0a133d9 (diff) | |
download | serenity-1591352531afa22990066820bb16996ce0e9b0b8.zip |
LibWeb: Split InitialStyleValue out of StyleValue.{h,cpp}
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS')
5 files changed, 36 insertions, 20 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 549d62017f..eca8d6b85e 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -52,6 +52,7 @@ #include <LibWeb/CSS/StyleValues/IdentifierStyleValue.h> #include <LibWeb/CSS/StyleValues/ImageStyleValue.h> #include <LibWeb/CSS/StyleValues/InheritStyleValue.h> +#include <LibWeb/CSS/StyleValues/InitialStyleValue.h> #include <LibWeb/CSS/StyleValues/LinearGradientStyleValue.h> #include <LibWeb/CSS/StyleValues/RadialGradientStyleValue.h> #include <LibWeb/DOM/Document.h> diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index bf0a80c54d..1e281556e4 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -23,6 +23,7 @@ #include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h> #include <LibWeb/CSS/StyleValues/GridTrackSizeStyleValue.h> #include <LibWeb/CSS/StyleValues/IdentifierStyleValue.h> +#include <LibWeb/CSS/StyleValues/InitialStyleValue.h> #include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Element.h> #include <LibWeb/Layout/Viewport.h> diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp index ca9fb20112..8fcf7414a0 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp @@ -35,6 +35,7 @@ #include <LibWeb/CSS/StyleValues/IdentifierStyleValue.h> #include <LibWeb/CSS/StyleValues/ImageStyleValue.h> #include <LibWeb/CSS/StyleValues/InheritStyleValue.h> +#include <LibWeb/CSS/StyleValues/InitialStyleValue.h> #include <LibWeb/CSS/StyleValues/LinearGradientStyleValue.h> #include <LibWeb/CSS/StyleValues/RadialGradientStyleValue.h> #include <LibWeb/DOM/Document.h> diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h index 7fa295ecb4..500fcc5d13 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h @@ -627,26 +627,6 @@ private: NonnullOwnPtr<CalcSum> m_expression; }; -class InitialStyleValue final : public StyleValueWithDefaultOperators<InitialStyleValue> { -public: - static ValueComparingNonnullRefPtr<InitialStyleValue> the() - { - static ValueComparingNonnullRefPtr<InitialStyleValue> instance = adopt_ref(*new InitialStyleValue); - return instance; - } - virtual ~InitialStyleValue() override = default; - - ErrorOr<String> to_string() const override { return "initial"_string; } - - bool properties_equal(InitialStyleValue const&) const { return true; } - -private: - InitialStyleValue() - : StyleValueWithDefaultOperators(Type::Initial) - { - } -}; - class LengthStyleValue : public StyleValueWithDefaultOperators<LengthStyleValue> { public: static ValueComparingNonnullRefPtr<LengthStyleValue> create(Length const&); diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/InitialStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/InitialStyleValue.h new file mode 100644 index 0000000000..d26089e8d3 --- /dev/null +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/InitialStyleValue.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2022-2023, Sam Atkins <atkinssj@serenityos.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include <LibWeb/CSS/StyleValue.h> + +namespace Web::CSS { + +class InitialStyleValue final : public StyleValueWithDefaultOperators<InitialStyleValue> { +public: + static ValueComparingNonnullRefPtr<InitialStyleValue> the() + { + static ValueComparingNonnullRefPtr<InitialStyleValue> instance = adopt_ref(*new InitialStyleValue); + return instance; + } + virtual ~InitialStyleValue() override = default; + + ErrorOr<String> to_string() const override { return "initial"_string; } + + bool properties_equal(InitialStyleValue const&) const { return true; } + +private: + InitialStyleValue() + : StyleValueWithDefaultOperators(Type::Initial) + { + } +}; + +} |