diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-07-08 07:14:23 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-07-08 07:15:56 +0200 |
commit | 9526b0e13a8c0192d74c8433b5441be86834a415 (patch) | |
tree | e9fc16439d001f63d286b4d326549d0299cd9575 /Libraries/LibHTML/CSS/StyleValue.h | |
parent | 105a97685eb318f04a2e5458c9990649b4257653 (diff) | |
download | serenity-9526b0e13a8c0192d74c8433b5441be86834a415.zip |
LibHTML: Add InheritStyleValue and InitialStyleValue.
These correspond to the 'inherit' and 'initial' CSS values respectively.
Diffstat (limited to 'Libraries/LibHTML/CSS/StyleValue.h')
-rw-r--r-- | Libraries/LibHTML/CSS/StyleValue.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Libraries/LibHTML/CSS/StyleValue.h b/Libraries/LibHTML/CSS/StyleValue.h index 574fd8215d..c5bc72947a 100644 --- a/Libraries/LibHTML/CSS/StyleValue.h +++ b/Libraries/LibHTML/CSS/StyleValue.h @@ -20,6 +20,9 @@ public: Type type() const { return m_type; } + bool is_inherit() const { return type() == Type::Inherit; } + bool is_initial() const { return type() == Type::Initial; } + virtual String to_string() const = 0; protected: @@ -68,3 +71,31 @@ private: Length m_length; }; + +class InitialStyleValue final : public StyleValue { +public: + static NonnullRefPtr<InitialStyleValue> create() { return adopt(*new InitialStyleValue); } + virtual ~InitialStyleValue() override {} + + String to_string() const override { return "initial"; } + +private: + InitialStyleValue() + : StyleValue(Type::Initial) + { + } +}; + +class InheritStyleValue final : public StyleValue { +public: + static NonnullRefPtr<InheritStyleValue> create() { return adopt(*new InheritStyleValue); } + virtual ~InheritStyleValue() override {} + + String to_string() const override { return "inherit"; } + +private: + InheritStyleValue() + : StyleValue(Type::Inherit) + { + } +}; |