mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:27:45 +00:00
LibWeb: Make SVG AttributeParser::parse_path_data() static
This is mostly a style thing, but it matches the other APIs.
This commit is contained in:
parent
ab440b3e50
commit
44b64cb8b0
3 changed files with 14 additions and 12 deletions
|
@ -16,14 +16,17 @@ AttributeParser::AttributeParser(StringView source)
|
|||
{
|
||||
}
|
||||
|
||||
Vector<PathInstruction> AttributeParser::parse_path_data()
|
||||
Vector<PathInstruction> AttributeParser::parse_path_data(StringView input)
|
||||
{
|
||||
parse_whitespace();
|
||||
while (!done())
|
||||
parse_drawto();
|
||||
if (!m_instructions.is_empty() && m_instructions[0].type != PathInstructionType::Move)
|
||||
VERIFY_NOT_REACHED();
|
||||
return m_instructions;
|
||||
AttributeParser parser { input };
|
||||
parser.parse_whitespace();
|
||||
while (!parser.done())
|
||||
parser.parse_drawto();
|
||||
if (!parser.m_instructions.is_empty() && parser.m_instructions[0].type != PathInstructionType::Move) {
|
||||
// Invalid. "A path data segment (if there is one) must begin with a "moveto" command."
|
||||
return {};
|
||||
}
|
||||
return parser.m_instructions;
|
||||
}
|
||||
|
||||
Optional<float> AttributeParser::parse_coordinate(StringView input)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue