summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2021-11-24 13:00:25 +0000
committerAndreas Kling <kling@serenityos.org>2021-11-24 22:57:46 +0100
commit933a271a789aa0ea6defb7dd26c20e537f4646c9 (patch)
tree2f8bbd7409ad79b2a7a2a866090b2ace37d283a6
parentcf07da082ecee03768ad17d124b359f3b5bf4478 (diff)
downloadserenity-933a271a789aa0ea6defb7dd26c20e537f4646c9.zip
LibWeb: Implement StyleComponentValueRule::to_string()
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/StyleComponentValueRule.h1
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/StyleRules.cpp19
2 files changed, 20 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/StyleComponentValueRule.h b/Userland/Libraries/LibWeb/CSS/Parser/StyleComponentValueRule.h
index 5136463d34..c458ebb9f8 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/StyleComponentValueRule.h
+++ b/Userland/Libraries/LibWeb/CSS/Parser/StyleComponentValueRule.h
@@ -52,6 +52,7 @@ public:
Token const& token() const { return m_token; }
operator Token() const { return m_token; }
+ String to_string() const;
String to_debug_string() const;
private:
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/StyleRules.cpp b/Userland/Libraries/LibWeb/CSS/Parser/StyleRules.cpp
index 17ff031368..cd9af5cf66 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/StyleRules.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/StyleRules.cpp
@@ -133,6 +133,25 @@ String StyleBlockRule::to_string() const
return builder.to_string();
}
+String StyleComponentValueRule::to_string() const
+{
+ StringBuilder builder;
+
+ switch (m_type) {
+ case StyleComponentValueRule::ComponentType::Token:
+ builder.append(m_token.to_string());
+ break;
+ case StyleComponentValueRule::ComponentType::Function:
+ builder.append(m_function->to_string());
+ break;
+ case StyleComponentValueRule::ComponentType::Block:
+ builder.append(m_block->to_string());
+ break;
+ }
+
+ return builder.to_string();
+}
+
String StyleComponentValueRule::to_debug_string() const
{
StringBuilder builder;