mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:07:34 +00:00
LibWeb: Return StringViews from CSS Token bracket-string getters
These don't need to be full Strings, so let's be lightweight.
This commit is contained in:
parent
562594c416
commit
09f7682feb
2 changed files with 20 additions and 20 deletions
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021, the SerenityOS developers.
|
* 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
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -156,62 +156,62 @@ Token::Type Token::mirror_variant() const
|
||||||
return Type::Invalid;
|
return Type::Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString Token::bracket_string() const
|
StringView Token::bracket_string() const
|
||||||
{
|
{
|
||||||
if (is(Token::Type::OpenCurly)) {
|
if (is(Token::Type::OpenCurly)) {
|
||||||
return "{";
|
return "{"sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is(Token::Type::CloseCurly)) {
|
if (is(Token::Type::CloseCurly)) {
|
||||||
return "}";
|
return "}"sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is(Token::Type::OpenSquare)) {
|
if (is(Token::Type::OpenSquare)) {
|
||||||
return "[";
|
return "["sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is(Token::Type::CloseSquare)) {
|
if (is(Token::Type::CloseSquare)) {
|
||||||
return "]";
|
return "]"sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is(Token::Type::OpenParen)) {
|
if (is(Token::Type::OpenParen)) {
|
||||||
return "(";
|
return "("sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is(Token::Type::CloseParen)) {
|
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)) {
|
if (is(Token::Type::OpenCurly)) {
|
||||||
return "}";
|
return "}"sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is(Token::Type::CloseCurly)) {
|
if (is(Token::Type::CloseCurly)) {
|
||||||
return "{";
|
return "{"sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is(Token::Type::OpenSquare)) {
|
if (is(Token::Type::OpenSquare)) {
|
||||||
return "]";
|
return "]"sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is(Token::Type::CloseSquare)) {
|
if (is(Token::Type::CloseSquare)) {
|
||||||
return "[";
|
return "["sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is(Token::Type::OpenParen)) {
|
if (is(Token::Type::OpenParen)) {
|
||||||
return ")";
|
return ")"sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is(Token::Type::CloseParen)) {
|
if (is(Token::Type::CloseParen)) {
|
||||||
return "(";
|
return "("sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return ""sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021, the SerenityOS developers.
|
* 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
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -142,8 +142,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
Type mirror_variant() const;
|
Type mirror_variant() const;
|
||||||
DeprecatedString bracket_string() const;
|
StringView bracket_string() const;
|
||||||
DeprecatedString bracket_mirror_string() const;
|
StringView bracket_mirror_string() const;
|
||||||
|
|
||||||
DeprecatedString to_deprecated_string() const;
|
DeprecatedString to_deprecated_string() const;
|
||||||
DeprecatedString to_debug_string() const;
|
DeprecatedString to_debug_string() const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue