LibWeb: Omit nonzero fill rule when serializing polygon()

Gains us ~160 WPT passes
This commit is contained in:
Callum Law
2026-01-06 22:46:08 +13:00
committed by Tim Ledbetter
parent 8a8383d59d
commit 72a00a17cc
Notes: github-actions[bot] 2026-01-06 10:50:56 +00:00
4 changed files with 19 additions and 17 deletions

View File

@@ -199,18 +199,22 @@ String Polygon::to_string(SerializationMode mode) const
{
StringBuilder builder;
builder.append("polygon("sv);
bool first = true;
switch (fill_rule) {
case Gfx::WindingRule::Nonzero:
builder.append("nonzero"sv);
break;
case Gfx::WindingRule::EvenOdd:
first = false;
builder.append("evenodd"sv);
}
for (auto const& point : points) {
builder.appendff(", {} {}", point.x->to_string(mode), point.y->to_string(mode));
if (!first)
builder.append(", "sv);
first = false;
builder.appendff("{} {}", point.x->to_string(mode), point.y->to_string(mode));
}
builder.append(')');
return MUST(builder.to_string());
return builder.to_string_without_validation();
}
Gfx::Path Path::to_path(CSSPixelRect, Layout::Node const&) const