summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2023-02-11 15:54:53 +0000
committerLinus Groh <mail@linusgroh.de>2023-02-13 14:35:40 +0000
commit09f7682febab19b0a320d315fc96cc29ba8569f9 (patch)
tree09ccee3b448e563f4b218aed45b2e6e6ae7b712e /Userland
parent562594c4166c23899ad9512ef06b463ec8bd11dd (diff)
downloadserenity-09f7682febab19b0a320d315fc96cc29ba8569f9.zip
LibWeb: Return StringViews from CSS Token bracket-string getters
These don't need to be full Strings, so let's be lightweight.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Token.cpp34
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Token.h6
2 files changed, 20 insertions, 20 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Token.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Token.cpp
index 172bc09cfb..99ea4fdccb 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Token.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Token.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020-2021, the SerenityOS developers.
- * Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
+ * Copyright (c) 2022-2023, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -156,62 +156,62 @@ Token::Type Token::mirror_variant() const
return Type::Invalid;
}
-DeprecatedString Token::bracket_string() const
+StringView Token::bracket_string() const
{
if (is(Token::Type::OpenCurly)) {
- return "{";
+ return "{"sv;
}
if (is(Token::Type::CloseCurly)) {
- return "}";
+ return "}"sv;
}
if (is(Token::Type::OpenSquare)) {
- return "[";
+ return "["sv;
}
if (is(Token::Type::CloseSquare)) {
- return "]";
+ return "]"sv;
}
if (is(Token::Type::OpenParen)) {
- return "(";
+ return "("sv;
}
if (is(Token::Type::CloseParen)) {
- return ")";
+ return ")"sv;
}
- return "";
+ return ""sv;
}
-DeprecatedString Token::bracket_mirror_string() const
+StringView Token::bracket_mirror_string() const
{
if (is(Token::Type::OpenCurly)) {
- return "}";
+ return "}"sv;
}
if (is(Token::Type::CloseCurly)) {
- return "{";
+ return "{"sv;
}
if (is(Token::Type::OpenSquare)) {
- return "]";
+ return "]"sv;
}
if (is(Token::Type::CloseSquare)) {
- return "[";
+ return "["sv;
}
if (is(Token::Type::OpenParen)) {
- return ")";
+ return ")"sv;
}
if (is(Token::Type::CloseParen)) {
- return "(";
+ return "("sv;
}
- return "";
+ return ""sv;
}
}
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Token.h b/Userland/Libraries/LibWeb/CSS/Parser/Token.h
index f1aed4d13b..776d383e5e 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Token.h
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Token.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020-2021, the SerenityOS developers.
- * Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org>
+ * Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -142,8 +142,8 @@ public:
}
Type mirror_variant() const;
- DeprecatedString bracket_string() const;
- DeprecatedString bracket_mirror_string() const;
+ StringView bracket_string() const;
+ StringView bracket_mirror_string() const;
DeprecatedString to_deprecated_string() const;
DeprecatedString to_debug_string() const;