mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:17:42 +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
1 changed files with 11 additions and 5 deletions
|
@ -150,6 +150,7 @@ void PathDataParser::parse_moveto()
|
||||||
void PathDataParser::parse_closepath()
|
void PathDataParser::parse_closepath()
|
||||||
{
|
{
|
||||||
bool absolute = consume() == 'Z';
|
bool absolute = consume() == 'Z';
|
||||||
|
parse_whitespace();
|
||||||
m_instructions.append({ PathInstructionType::ClosePath, absolute, {} });
|
m_instructions.append({ PathInstructionType::ClosePath, absolute, {} });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +183,8 @@ void PathDataParser::parse_curveto()
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
m_instructions.append({ PathInstructionType::Curve, absolute, parse_coordinate_pair_triplet() });
|
m_instructions.append({ PathInstructionType::Curve, absolute, parse_coordinate_pair_triplet() });
|
||||||
parse_whitespace();
|
if (match_comma_whitespace())
|
||||||
|
parse_comma_whitespace();
|
||||||
if (!match_coordinate())
|
if (!match_coordinate())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -195,7 +197,8 @@ void PathDataParser::parse_smooth_curveto()
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
m_instructions.append({ PathInstructionType::SmoothCurve, absolute, parse_coordinate_pair_double() });
|
m_instructions.append({ PathInstructionType::SmoothCurve, absolute, parse_coordinate_pair_double() });
|
||||||
parse_whitespace();
|
if (match_comma_whitespace())
|
||||||
|
parse_comma_whitespace();
|
||||||
if (!match_coordinate())
|
if (!match_coordinate())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -208,7 +211,8 @@ void PathDataParser::parse_quadratic_bezier_curveto()
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
m_instructions.append({ PathInstructionType::QuadraticBezierCurve, absolute, parse_coordinate_pair_double() });
|
m_instructions.append({ PathInstructionType::QuadraticBezierCurve, absolute, parse_coordinate_pair_double() });
|
||||||
parse_whitespace();
|
if (match_comma_whitespace())
|
||||||
|
parse_comma_whitespace();
|
||||||
if (!match_coordinate())
|
if (!match_coordinate())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -221,7 +225,8 @@ void PathDataParser::parse_smooth_quadratic_bezier_curveto()
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
m_instructions.append({ PathInstructionType::SmoothQuadraticBezierCurve, absolute, parse_coordinate_pair() });
|
m_instructions.append({ PathInstructionType::SmoothQuadraticBezierCurve, absolute, parse_coordinate_pair() });
|
||||||
parse_whitespace();
|
if (match_comma_whitespace())
|
||||||
|
parse_comma_whitespace();
|
||||||
if (!match_coordinate())
|
if (!match_coordinate())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -234,7 +239,8 @@ void PathDataParser::parse_elliptical_arc()
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
m_instructions.append({ PathInstructionType::EllipticalArc, absolute, parse_elliptical_arg_argument() });
|
m_instructions.append({ PathInstructionType::EllipticalArc, absolute, parse_elliptical_arg_argument() });
|
||||||
parse_whitespace();
|
if (match_comma_whitespace())
|
||||||
|
parse_comma_whitespace();
|
||||||
if (!match_coordinate())
|
if (!match_coordinate())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue