mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 12:37:43 +00:00
LibWeb: Split UnsetStyleValue out of StyleValue.{h,cpp}
This commit is contained in:
parent
1d948f7462
commit
4bf59c59bb
4 changed files with 38 additions and 20 deletions
|
@ -68,6 +68,7 @@
|
||||||
#include <LibWeb/CSS/StyleValues/TimeStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/TimeStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/TransformationStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/TransformationStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/UnresolvedStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/UnresolvedStyleValue.h>
|
||||||
|
#include <LibWeb/CSS/StyleValues/UnsetStyleValue.h>
|
||||||
#include <LibWeb/DOM/Document.h>
|
#include <LibWeb/DOM/Document.h>
|
||||||
#include <LibWeb/Dump.h>
|
#include <LibWeb/Dump.h>
|
||||||
#include <LibWeb/Infra/Strings.h>
|
#include <LibWeb/Infra/Strings.h>
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
#include <LibWeb/CSS/StyleValues/TimeStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/TimeStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/TransformationStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/TransformationStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/UnresolvedStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/UnresolvedStyleValue.h>
|
||||||
|
#include <LibWeb/CSS/StyleValues/UnsetStyleValue.h>
|
||||||
#include <LibWeb/DOM/Document.h>
|
#include <LibWeb/DOM/Document.h>
|
||||||
#include <LibWeb/HTML/BrowsingContext.h>
|
#include <LibWeb/HTML/BrowsingContext.h>
|
||||||
#include <LibWeb/Loader/LoadRequest.h>
|
#include <LibWeb/Loader/LoadRequest.h>
|
||||||
|
|
|
@ -622,26 +622,6 @@ private:
|
||||||
NonnullOwnPtr<CalcSum> m_expression;
|
NonnullOwnPtr<CalcSum> m_expression;
|
||||||
};
|
};
|
||||||
|
|
||||||
class UnsetStyleValue final : public StyleValueWithDefaultOperators<UnsetStyleValue> {
|
|
||||||
public:
|
|
||||||
static ValueComparingNonnullRefPtr<UnsetStyleValue> the()
|
|
||||||
{
|
|
||||||
static ValueComparingNonnullRefPtr<UnsetStyleValue> instance = adopt_ref(*new UnsetStyleValue);
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
virtual ~UnsetStyleValue() override = default;
|
|
||||||
|
|
||||||
ErrorOr<String> to_string() const override { return "unset"_string; }
|
|
||||||
|
|
||||||
bool properties_equal(UnsetStyleValue const&) const { return true; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
UnsetStyleValue()
|
|
||||||
: StyleValueWithDefaultOperators(Type::Unset)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class StyleValueList final : public StyleValueWithDefaultOperators<StyleValueList> {
|
class StyleValueList final : public StyleValueWithDefaultOperators<StyleValueList> {
|
||||||
public:
|
public:
|
||||||
enum class Separator {
|
enum class Separator {
|
||||||
|
|
36
Userland/Libraries/LibWeb/CSS/StyleValues/UnsetStyleValue.h
Normal file
36
Userland/Libraries/LibWeb/CSS/StyleValues/UnsetStyleValue.h
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
|
||||||
|
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
|
||||||
|
* Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <LibWeb/CSS/StyleValue.h>
|
||||||
|
|
||||||
|
namespace Web::CSS {
|
||||||
|
|
||||||
|
class UnsetStyleValue final : public StyleValueWithDefaultOperators<UnsetStyleValue> {
|
||||||
|
public:
|
||||||
|
static ValueComparingNonnullRefPtr<UnsetStyleValue> the()
|
||||||
|
{
|
||||||
|
static ValueComparingNonnullRefPtr<UnsetStyleValue> instance = adopt_ref(*new UnsetStyleValue);
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
virtual ~UnsetStyleValue() override = default;
|
||||||
|
|
||||||
|
ErrorOr<String> to_string() const override { return "unset"_string; }
|
||||||
|
|
||||||
|
bool properties_equal(UnsetStyleValue const&) const { return true; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
UnsetStyleValue()
|
||||||
|
: StyleValueWithDefaultOperators(Type::Unset)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue