summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-08-07 20:33:03 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-07 20:35:05 +0200
commit62ec42c1126e1e2e4402a95631ac9f2ee567e5a7 (patch)
tree738f71fd0dd811cc3fa39fd32913ac2beb99b70b
parent498845ea2f356bd9e66225fa457436d348913025 (diff)
downloadserenity-62ec42c1126e1e2e4402a95631ac9f2ee567e5a7.zip
LibWeb: Remove some unnecessary throwaway strings in the CSS parser
We've had StringView::ends_with(..., CaseSensitivity) for a while, so let's use it to avoid creating a bunch of unnecessary strings here.
-rw-r--r--Libraries/LibWeb/CSS/Parser/CSSParser.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Libraries/LibWeb/CSS/Parser/CSSParser.cpp b/Libraries/LibWeb/CSS/Parser/CSSParser.cpp
index 162eca30d2..517cc556b1 100644
--- a/Libraries/LibWeb/CSS/Parser/CSSParser.cpp
+++ b/Libraries/LibWeb/CSS/Parser/CSSParser.cpp
@@ -272,19 +272,19 @@ static CSS::Length parse_length(const CSS::ParsingContext& context, const String
if (view.ends_with('%')) {
type = CSS::Length::Type::Percentage;
value = try_parse_float(view.substring_view(0, view.length() - 1));
- } else if (view.to_string().to_lowercase().ends_with("px")) {
+ } else if (view.ends_with("px", CaseSensitivity::CaseInsensitive)) {
type = CSS::Length::Type::Px;
value = try_parse_float(view.substring_view(0, view.length() - 2));
- } else if (view.to_string().to_lowercase().ends_with("pt")) {
+ } else if (view.ends_with("pt", CaseSensitivity::CaseInsensitive)) {
type = CSS::Length::Type::Pt;
value = try_parse_float(view.substring_view(0, view.length() - 2));
- } else if (view.to_string().to_lowercase().ends_with("rem")) {
+ } else if (view.ends_with("rem", CaseSensitivity::CaseInsensitive)) {
type = CSS::Length::Type::Rem;
value = try_parse_float(view.substring_view(0, view.length() - 3));
- } else if (view.to_string().to_lowercase().ends_with("em")) {
+ } else if (view.ends_with("em", CaseSensitivity::CaseInsensitive)) {
type = CSS::Length::Type::Em;
value = try_parse_float(view.substring_view(0, view.length() - 2));
- } else if (view.to_string().to_lowercase().ends_with("ex")) {
+ } else if (view.ends_with("ex", CaseSensitivity::CaseInsensitive)) {
type = CSS::Length::Type::Ex;
value = try_parse_float(view.substring_view(0, view.length() - 2));
} else if (view == "0") {