LibWeb: Use shape-rendering to control anti aliasing for SVG paths
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

Anti-aliasing is disabled if `shape-rendering` is set to
`optimizeSpeed` or `crispEdges`.
This commit is contained in:
Tim Ledbetter 2025-08-18 16:21:09 +01:00 committed by Sam Atkins
commit cfc6439c12
Notes: github-actions[bot] 2025-08-19 08:48:50 +00:00
10 changed files with 43 additions and 4 deletions

View file

@ -33,4 +33,12 @@ CSSPixelRect SVGPaintable::compute_absolute_rect() const
return PaintableBox::compute_absolute_rect();
}
ShouldAntiAlias SVGPaintable::should_anti_alias() const
{
auto shape_rendering = computed_values().shape_rendering();
if (first_is_one_of(shape_rendering, CSS::ShapeRendering::Optimizespeed, CSS::ShapeRendering::Crispedges))
return ShouldAntiAlias::No;
return ShouldAntiAlias::Yes;
}
}