mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:07:34 +00:00
LibWeb: Split AngleStyleValue out of StyleValue.{h,cpp}
This commit is contained in:
parent
36c5afdfb2
commit
777d3e73f9
7 changed files with 74 additions and 25 deletions
|
@ -64,6 +64,7 @@ set(SOURCES
|
||||||
CSS/StyleSheet.cpp
|
CSS/StyleSheet.cpp
|
||||||
CSS/StyleSheetList.cpp
|
CSS/StyleSheetList.cpp
|
||||||
CSS/StyleValue.cpp
|
CSS/StyleValue.cpp
|
||||||
|
CSS/StyleValues/AngleStyleValue.cpp
|
||||||
CSS/Supports.cpp
|
CSS/Supports.cpp
|
||||||
CSS/SyntaxHighlighter/SyntaxHighlighter.cpp
|
CSS/SyntaxHighlighter/SyntaxHighlighter.cpp
|
||||||
CSS/Time.cpp
|
CSS/Time.cpp
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <LibWeb/CSS/Parser/Rule.h>
|
#include <LibWeb/CSS/Parser/Rule.h>
|
||||||
#include <LibWeb/CSS/Selector.h>
|
#include <LibWeb/CSS/Selector.h>
|
||||||
#include <LibWeb/CSS/StyleValue.h>
|
#include <LibWeb/CSS/StyleValue.h>
|
||||||
|
#include <LibWeb/CSS/StyleValues/AngleStyleValue.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>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2023, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2023, Andreas Kling <kling@serenityos.org>
|
||||||
* Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org>
|
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -9,6 +9,7 @@
|
||||||
#include <LibCore/DirIterator.h>
|
#include <LibCore/DirIterator.h>
|
||||||
#include <LibWeb/CSS/Clip.h>
|
#include <LibWeb/CSS/Clip.h>
|
||||||
#include <LibWeb/CSS/StyleProperties.h>
|
#include <LibWeb/CSS/StyleProperties.h>
|
||||||
|
#include <LibWeb/CSS/StyleValues/AngleStyleValue.h>
|
||||||
#include <LibWeb/FontCache.h>
|
#include <LibWeb/FontCache.h>
|
||||||
#include <LibWeb/Layout/BlockContainer.h>
|
#include <LibWeb/Layout/BlockContainer.h>
|
||||||
#include <LibWeb/Layout/Node.h>
|
#include <LibWeb/Layout/Node.h>
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <LibGfx/Palette.h>
|
#include <LibGfx/Palette.h>
|
||||||
#include <LibWeb/CSS/Serialize.h>
|
#include <LibWeb/CSS/Serialize.h>
|
||||||
#include <LibWeb/CSS/StyleValue.h>
|
#include <LibWeb/CSS/StyleValue.h>
|
||||||
|
#include <LibWeb/CSS/StyleValues/AngleStyleValue.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>
|
||||||
|
|
|
@ -502,30 +502,6 @@ struct StyleValueWithDefaultOperators : public StyleValue {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class AngleStyleValue : public StyleValueWithDefaultOperators<AngleStyleValue> {
|
|
||||||
public:
|
|
||||||
static ValueComparingNonnullRefPtr<AngleStyleValue> create(Angle angle)
|
|
||||||
{
|
|
||||||
return adopt_ref(*new AngleStyleValue(move(angle)));
|
|
||||||
}
|
|
||||||
virtual ~AngleStyleValue() override { }
|
|
||||||
|
|
||||||
Angle const& angle() const { return m_angle; }
|
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override { return m_angle.to_string(); }
|
|
||||||
|
|
||||||
bool properties_equal(AngleStyleValue const& other) const { return m_angle == other.m_angle; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
explicit AngleStyleValue(Angle angle)
|
|
||||||
: StyleValueWithDefaultOperators(Type::Angle)
|
|
||||||
, m_angle(move(angle))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Angle m_angle;
|
|
||||||
};
|
|
||||||
|
|
||||||
class BackgroundStyleValue final : public StyleValueWithDefaultOperators<BackgroundStyleValue> {
|
class BackgroundStyleValue final : public StyleValueWithDefaultOperators<BackgroundStyleValue> {
|
||||||
public:
|
public:
|
||||||
static ValueComparingNonnullRefPtr<BackgroundStyleValue> create(
|
static ValueComparingNonnullRefPtr<BackgroundStyleValue> create(
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
|
||||||
|
* Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
|
||||||
|
* Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AngleStyleValue.h"
|
||||||
|
|
||||||
|
namespace Web::CSS {
|
||||||
|
|
||||||
|
AngleStyleValue::AngleStyleValue(Angle angle)
|
||||||
|
: StyleValueWithDefaultOperators(Type::Angle)
|
||||||
|
, m_angle(move(angle))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
AngleStyleValue::~AngleStyleValue() = default;
|
||||||
|
|
||||||
|
ErrorOr<String> AngleStyleValue::to_string() const
|
||||||
|
{
|
||||||
|
return m_angle.to_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AngleStyleValue::properties_equal(AngleStyleValue const& other) const
|
||||||
|
{
|
||||||
|
return m_angle == other.m_angle;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
37
Userland/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.h
Normal file
37
Userland/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.h
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* 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/Angle.h>
|
||||||
|
#include <LibWeb/CSS/StyleValue.h>
|
||||||
|
|
||||||
|
namespace Web::CSS {
|
||||||
|
|
||||||
|
class AngleStyleValue : public StyleValueWithDefaultOperators<AngleStyleValue> {
|
||||||
|
public:
|
||||||
|
static ValueComparingNonnullRefPtr<AngleStyleValue> create(Angle angle)
|
||||||
|
{
|
||||||
|
return adopt_ref(*new AngleStyleValue(move(angle)));
|
||||||
|
}
|
||||||
|
virtual ~AngleStyleValue() override;
|
||||||
|
|
||||||
|
Angle const& angle() const { return m_angle; }
|
||||||
|
|
||||||
|
virtual ErrorOr<String> to_string() const override;
|
||||||
|
|
||||||
|
bool properties_equal(AngleStyleValue const& other) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
explicit AngleStyleValue(Angle angle);
|
||||||
|
|
||||||
|
Angle m_angle;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue