summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2023-03-23 17:26:13 +0000
committerLinus Groh <mail@linusgroh.de>2023-03-25 16:56:04 +0000
commit777d3e73f9f22c66aed6f631958926fb95e877c8 (patch)
treed29c694b23bf47d0119590e4b7e035bcb549384c /Userland/Libraries
parent36c5afdfb2206a16745ac0ed731ce66a01a5ed02 (diff)
downloadserenity-777d3e73f9f22c66aed6f631958926fb95e877c8.zip
LibWeb: Split AngleStyleValue out of StyleValue.{h,cpp}
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibWeb/CMakeLists.txt1
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp1
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleProperties.cpp3
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleValue.cpp1
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleValue.h24
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.cpp32
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.h37
7 files changed, 74 insertions, 25 deletions
diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt
index e38b852908..76ddc31a33 100644
--- a/Userland/Libraries/LibWeb/CMakeLists.txt
+++ b/Userland/Libraries/LibWeb/CMakeLists.txt
@@ -64,6 +64,7 @@ set(SOURCES
CSS/StyleSheet.cpp
CSS/StyleSheetList.cpp
CSS/StyleValue.cpp
+ CSS/StyleValues/AngleStyleValue.cpp
CSS/Supports.cpp
CSS/SyntaxHighlighter/SyntaxHighlighter.cpp
CSS/Time.cpp
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
index 7d06acbbe8..7362278f3d 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
@@ -29,6 +29,7 @@
#include <LibWeb/CSS/Parser/Rule.h>
#include <LibWeb/CSS/Selector.h>
#include <LibWeb/CSS/StyleValue.h>
+#include <LibWeb/CSS/StyleValues/AngleStyleValue.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/Dump.h>
#include <LibWeb/Infra/Strings.h>
diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
index 4fcfeb819f..470faa05a9 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
@@ -1,6 +1,6 @@
/*
* 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
*/
@@ -9,6 +9,7 @@
#include <LibCore/DirIterator.h>
#include <LibWeb/CSS/Clip.h>
#include <LibWeb/CSS/StyleProperties.h>
+#include <LibWeb/CSS/StyleValues/AngleStyleValue.h>
#include <LibWeb/FontCache.h>
#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/Node.h>
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp
index c6a48aa2ea..77cc6dfa60 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp
@@ -11,6 +11,7 @@
#include <LibGfx/Palette.h>
#include <LibWeb/CSS/Serialize.h>
#include <LibWeb/CSS/StyleValue.h>
+#include <LibWeb/CSS/StyleValues/AngleStyleValue.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/Loader/LoadRequest.h>
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h
index c6e414b6f5..91587cbf35 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleValue.h
+++ b/Userland/Libraries/LibWeb/CSS/StyleValue.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> {
public:
static ValueComparingNonnullRefPtr<BackgroundStyleValue> create(
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.cpp
new file mode 100644
index 0000000000..b3fda65c1e
--- /dev/null
+++ b/Userland/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.cpp
@@ -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;
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.h
new file mode 100644
index 0000000000..13554bb877
--- /dev/null
+++ b/Userland/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.h
@@ -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;
+};
+
+}