mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-27 01:50:24 +00:00
LibWeb: SVG: draw commands can also be repeated after a comma
Consume comma or whitespace to make it possible to also parse commands that use comma separation.
This commit is contained in:
parent
6e61532e06
commit
772fcba814
Notes:
sideshowbarker
2024-07-19 02:50:23 +09:00
Author: https://github.com/danners Commit: https://github.com/SerenityOS/serenity/commit/772fcba8144 Pull-request: https://github.com/SerenityOS/serenity/pull/3434
1 changed files with 11 additions and 5 deletions
|
@ -150,6 +150,7 @@ void PathDataParser::parse_moveto()
|
|||
void PathDataParser::parse_closepath()
|
||||
{
|
||||
bool absolute = consume() == 'Z';
|
||||
parse_whitespace();
|
||||
m_instructions.append({ PathInstructionType::ClosePath, absolute, {} });
|
||||
}
|
||||
|
||||
|
@ -182,7 +183,8 @@ void PathDataParser::parse_curveto()
|
|||
|
||||
while (true) {
|
||||
m_instructions.append({ PathInstructionType::Curve, absolute, parse_coordinate_pair_triplet() });
|
||||
parse_whitespace();
|
||||
if (match_comma_whitespace())
|
||||
parse_comma_whitespace();
|
||||
if (!match_coordinate())
|
||||
break;
|
||||
}
|
||||
|
@ -195,7 +197,8 @@ void PathDataParser::parse_smooth_curveto()
|
|||
|
||||
while (true) {
|
||||
m_instructions.append({ PathInstructionType::SmoothCurve, absolute, parse_coordinate_pair_double() });
|
||||
parse_whitespace();
|
||||
if (match_comma_whitespace())
|
||||
parse_comma_whitespace();
|
||||
if (!match_coordinate())
|
||||
break;
|
||||
}
|
||||
|
@ -208,7 +211,8 @@ void PathDataParser::parse_quadratic_bezier_curveto()
|
|||
|
||||
while (true) {
|
||||
m_instructions.append({ PathInstructionType::QuadraticBezierCurve, absolute, parse_coordinate_pair_double() });
|
||||
parse_whitespace();
|
||||
if (match_comma_whitespace())
|
||||
parse_comma_whitespace();
|
||||
if (!match_coordinate())
|
||||
break;
|
||||
}
|
||||
|
@ -221,7 +225,8 @@ void PathDataParser::parse_smooth_quadratic_bezier_curveto()
|
|||
|
||||
while (true) {
|
||||
m_instructions.append({ PathInstructionType::SmoothQuadraticBezierCurve, absolute, parse_coordinate_pair() });
|
||||
parse_whitespace();
|
||||
if (match_comma_whitespace())
|
||||
parse_comma_whitespace();
|
||||
if (!match_coordinate())
|
||||
break;
|
||||
}
|
||||
|
@ -234,7 +239,8 @@ void PathDataParser::parse_elliptical_arc()
|
|||
|
||||
while (true) {
|
||||
m_instructions.append({ PathInstructionType::EllipticalArc, absolute, parse_elliptical_arg_argument() });
|
||||
parse_whitespace();
|
||||
if (match_comma_whitespace())
|
||||
parse_comma_whitespace();
|
||||
if (!match_coordinate())
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue