mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:57:45 +00:00
LibWeb: Split InheritStyleValue out of StyleValue.{h,cpp}
This commit is contained in:
parent
e61a5ad180
commit
44c9a5b648
4 changed files with 35 additions and 20 deletions
|
@ -51,6 +51,7 @@
|
|||
#include <LibWeb/CSS/StyleValues/GridTrackSizeStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/IdentifierStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/ImageStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/InheritStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/LinearGradientStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/RadialGradientStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <LibWeb/CSS/StyleValues/GridTrackSizeStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/IdentifierStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/ImageStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/InheritStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/LinearGradientStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/RadialGradientStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
|
|
|
@ -627,26 +627,6 @@ private:
|
|||
NonnullOwnPtr<CalcSum> m_expression;
|
||||
};
|
||||
|
||||
class InheritStyleValue final : public StyleValueWithDefaultOperators<InheritStyleValue> {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<InheritStyleValue> the()
|
||||
{
|
||||
static ValueComparingNonnullRefPtr<InheritStyleValue> instance = adopt_ref(*new InheritStyleValue);
|
||||
return instance;
|
||||
}
|
||||
virtual ~InheritStyleValue() override = default;
|
||||
|
||||
ErrorOr<String> to_string() const override { return "inherit"_string; }
|
||||
|
||||
bool properties_equal(InheritStyleValue const&) const { return true; }
|
||||
|
||||
private:
|
||||
InheritStyleValue()
|
||||
: StyleValueWithDefaultOperators(Type::Inherit)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class InitialStyleValue final : public StyleValueWithDefaultOperators<InitialStyleValue> {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<InitialStyleValue> the()
|
||||
|
|
|
@ -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 InheritStyleValue final : public StyleValueWithDefaultOperators<InheritStyleValue> {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<InheritStyleValue> the()
|
||||
{
|
||||
static ValueComparingNonnullRefPtr<InheritStyleValue> instance = adopt_ref(*new InheritStyleValue);
|
||||
return instance;
|
||||
}
|
||||
virtual ~InheritStyleValue() override = default;
|
||||
|
||||
ErrorOr<String> to_string() const override { return "inherit"_string; }
|
||||
|
||||
bool properties_equal(InheritStyleValue const&) const { return true; }
|
||||
|
||||
private:
|
||||
InheritStyleValue()
|
||||
: StyleValueWithDefaultOperators(Type::Inherit)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue