From a8b9130ceb373d2a9865f52c3eeb81317e9d104c Mon Sep 17 00:00:00 2001 From: MacDue Date: Wed, 14 Jun 2023 21:22:13 +0100 Subject: [PATCH] LibWeb: Support SVG vertical/horizontal lineto with multiple parameters This now allows v 1 2 3 or h 1 2 3, which are treated like v 1 v 2 v 3 and h 1 h 2 h 3 respectively. This fixes the freeCodeCamp SVG logo. --- Userland/Libraries/LibWeb/SVG/AttributeParser.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/SVG/AttributeParser.cpp b/Userland/Libraries/LibWeb/SVG/AttributeParser.cpp index 957ce7a5182..d219c97571d 100644 --- a/Userland/Libraries/LibWeb/SVG/AttributeParser.cpp +++ b/Userland/Libraries/LibWeb/SVG/AttributeParser.cpp @@ -188,14 +188,16 @@ void AttributeParser::parse_horizontal_lineto() { bool absolute = consume() == 'H'; parse_whitespace(); - m_instructions.append({ PathInstructionType::HorizontalLine, absolute, parse_coordinate_sequence() }); + for (auto coordinate : parse_coordinate_sequence()) + m_instructions.append({ PathInstructionType::HorizontalLine, absolute, { coordinate } }); } void AttributeParser::parse_vertical_lineto() { bool absolute = consume() == 'V'; parse_whitespace(); - m_instructions.append({ PathInstructionType::VerticalLine, absolute, parse_coordinate_sequence() }); + for (auto coordinate : parse_coordinate_sequence()) + m_instructions.append({ PathInstructionType::VerticalLine, absolute, { coordinate } }); } void AttributeParser::parse_curveto()