summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-04-12 11:14:12 +0100
committerAndreas Kling <kling@serenityos.org>2022-04-12 23:03:46 +0200
commitb7453eafbb92f68afaa32c3a92edf5194f79ba3f (patch)
tree8367594961b7bd44da4ecfd206d639a705972327 /Userland/Libraries/LibWeb/CSS
parent8f5d80a41d2aa4ad976344e1e07205511a72fa56 (diff)
downloadserenity-b7453eafbb92f68afaa32c3a92edf5194f79ba3f.zip
LibWeb: Move ComponentValue code into ComponentValue.cpp
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS')
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/ComponentValue.cpp51
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/StyleRules.cpp36
2 files changed, 51 insertions, 36 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/ComponentValue.cpp b/Userland/Libraries/LibWeb/CSS/Parser/ComponentValue.cpp
new file mode 100644
index 0000000000..bc5fbf2644
--- /dev/null
+++ b/Userland/Libraries/LibWeb/CSS/Parser/ComponentValue.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2020-2021, the SerenityOS developers.
+ * Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <LibWeb/CSS/Parser/ComponentValue.h>
+#include <LibWeb/CSS/Parser/StyleBlockRule.h>
+#include <LibWeb/CSS/Parser/StyleFunctionRule.h>
+
+namespace Web::CSS {
+
+ComponentValue::ComponentValue(Token token)
+ : m_value(token)
+{
+}
+ComponentValue::ComponentValue(NonnullRefPtr<StyleFunctionRule> function)
+ : m_value(function)
+{
+}
+ComponentValue::ComponentValue(NonnullRefPtr<StyleBlockRule> block)
+ : m_value(block)
+{
+}
+
+ComponentValue::~ComponentValue() = default;
+
+String ComponentValue::to_string() const
+{
+ return m_value.visit(
+ [](Token const& token) { return token.to_string(); },
+ [](NonnullRefPtr<StyleBlockRule> const& block) { return block->to_string(); },
+ [](NonnullRefPtr<StyleFunctionRule> const& function) { return function->to_string(); });
+}
+
+String ComponentValue::to_debug_string() const
+{
+ return m_value.visit(
+ [](Token const& token) {
+ return String::formatted("Token: {}", token.to_debug_string());
+ },
+ [](NonnullRefPtr<StyleBlockRule> const& block) {
+ return String::formatted("Function: {}", block->to_string());
+ },
+ [](NonnullRefPtr<StyleFunctionRule> const& function) {
+ return String::formatted("Block: {}", function->to_string());
+ });
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/StyleRules.cpp b/Userland/Libraries/LibWeb/CSS/Parser/StyleRules.cpp
index fdbb112c5b..460f3dec00 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/StyleRules.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/StyleRules.cpp
@@ -36,20 +36,6 @@ StyleRule::~StyleRule() = default;
StyleBlockRule::StyleBlockRule() = default;
StyleBlockRule::~StyleBlockRule() = default;
-ComponentValue::ComponentValue(Token token)
- : m_value(token)
-{
-}
-ComponentValue::ComponentValue(NonnullRefPtr<StyleFunctionRule> function)
- : m_value(function)
-{
-}
-ComponentValue::ComponentValue(NonnullRefPtr<StyleBlockRule> block)
- : m_value(block)
-{
-}
-ComponentValue::~ComponentValue() = default;
-
Declaration::Declaration() = default;
Declaration::~Declaration() = default;
@@ -124,28 +110,6 @@ String StyleBlockRule::to_string() const
return builder.to_string();
}
-String ComponentValue::to_string() const
-{
- return m_value.visit(
- [](Token const& token) { return token.to_string(); },
- [](NonnullRefPtr<StyleBlockRule> const& block) { return block->to_string(); },
- [](NonnullRefPtr<StyleFunctionRule> const& function) { return function->to_string(); });
-}
-
-String ComponentValue::to_debug_string() const
-{
- return m_value.visit(
- [](Token const& token) {
- return String::formatted("Token: {}", token.to_debug_string());
- },
- [](NonnullRefPtr<StyleBlockRule> const& block) {
- return String::formatted("Function: {}", block->to_string());
- },
- [](NonnullRefPtr<StyleFunctionRule> const& function) {
- return String::formatted("Block: {}", function->to_string());
- });
-}
-
String Declaration::to_string() const
{
StringBuilder builder;