summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-02-11 19:10:09 +0000
committerAndreas Kling <kling@serenityos.org>2022-02-11 21:38:27 +0100
commitab440b3e5010d08e6e88bd10813a311f46507dd0 (patch)
tree6217a5dacadae0f13a94c13d9bdd8ba2bf180b94 /Userland/Libraries/LibWeb
parent2fad940b0b6f5bfe6eb8ec626fad0e17f2ca754d (diff)
downloadserenity-ab440b3e5010d08e6e88bd10813a311f46507dd0.zip
LibWeb: Use StringView instead of String in SVG::AttributeParser
This saves copying the string data, since the AttributeParser is always temporary.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/SVG/AttributeParser.cpp2
-rw-r--r--Userland/Libraries/LibWeb/SVG/AttributeParser.h4
2 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/SVG/AttributeParser.cpp b/Userland/Libraries/LibWeb/SVG/AttributeParser.cpp
index 41d0acecdb..fcefba110c 100644
--- a/Userland/Libraries/LibWeb/SVG/AttributeParser.cpp
+++ b/Userland/Libraries/LibWeb/SVG/AttributeParser.cpp
@@ -11,7 +11,7 @@
namespace Web::SVG {
-AttributeParser::AttributeParser(String source)
+AttributeParser::AttributeParser(StringView source)
: m_source(move(source))
{
}
diff --git a/Userland/Libraries/LibWeb/SVG/AttributeParser.h b/Userland/Libraries/LibWeb/SVG/AttributeParser.h
index 126ed3f942..55b152750c 100644
--- a/Userland/Libraries/LibWeb/SVG/AttributeParser.h
+++ b/Userland/Libraries/LibWeb/SVG/AttributeParser.h
@@ -35,7 +35,7 @@ struct PathInstruction {
class AttributeParser final {
public:
- AttributeParser(String source);
+ AttributeParser(StringView source);
~AttributeParser() = default;
Vector<PathInstruction> parse_path_data();
@@ -85,7 +85,7 @@ private:
char ch() const { return m_source[m_cursor]; }
char consume() { return m_source[m_cursor++]; }
- String m_source;
+ StringView m_source;
size_t m_cursor { 0 };
Vector<PathInstruction> m_instructions;
};