1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +00:00

LibWeb: Use StringView instead of String in SVG::AttributeParser

This saves copying the string data, since the AttributeParser is always
temporary.
This commit is contained in:
Sam Atkins 2022-02-11 19:10:09 +00:00 committed by Andreas Kling
parent 2fad940b0b
commit ab440b3e50
2 changed files with 3 additions and 3 deletions

View file

@ -11,7 +11,7 @@
namespace Web::SVG {
AttributeParser::AttributeParser(String source)
AttributeParser::AttributeParser(StringView source)
: m_source(move(source))
{
}

View file

@ -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;
};