mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibWeb: Do not floor SVG offset in SVGPathPaintable
Resolves a FIXME and improves the visuals of https://tweakers.net :^)
This commit is contained in:
parent
c96c5e45ff
commit
e4533e5595
Notes:
github-actions[bot]
2024-10-22 11:38:50 +00:00
Author: https://github.com/gmta
Commit: e4533e5595
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1909
4 changed files with 26 additions and 2 deletions
BIN
Tests/LibWeb/Screenshot/images/svg-path-offset-rounding-ref.png
Normal file
BIN
Tests/LibWeb/Screenshot/images/svg-path-offset-rounding-ref.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -0,0 +1,9 @@
|
|||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
}
|
||||
body {
|
||||
background-color: white;
|
||||
}
|
||||
</style>
|
||||
<img src="../images/svg-path-offset-rounding-ref.png">
|
16
Tests/LibWeb/Screenshot/svg-path-offset-rounding.html
Normal file
16
Tests/LibWeb/Screenshot/svg-path-offset-rounding.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
<!doctype html>
|
||||
<link rel="match" href="reference/svg-path-offset-rounding-ref.html" />
|
||||
<style>
|
||||
body {
|
||||
padding-left: 10.6px;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<svg width="34" height="22" viewBox="0 0 34 22">
|
||||
<path
|
||||
d="M -0.2 0 L 34 0 L 34 22 L -0.2 22 Z"
|
||||
fill="none"
|
||||
stroke="#000000"
|
||||
></path>
|
||||
</svg>
|
||||
</body>
|
|
@ -65,10 +65,9 @@ void SVGPathPaintable::paint(PaintContext& context, PaintPhase phase) const
|
|||
auto const* svg_node = layout_box().first_ancestor_of_type<Layout::SVGSVGBox>();
|
||||
auto svg_element_rect = svg_node->paintable_box()->absolute_rect();
|
||||
|
||||
// FIXME: This should not be trucated to an int.
|
||||
DisplayListRecorderStateSaver save_painter { context.display_list_recorder() };
|
||||
|
||||
auto offset = context.floored_device_point(svg_element_rect.location()).to_type<int>().to_type<float>();
|
||||
auto offset = context.rounded_device_point(svg_element_rect.location()).to_type<int>().to_type<float>();
|
||||
auto maybe_view_box = svg_node->dom_node().view_box();
|
||||
|
||||
auto paint_transform = computed_transforms().svg_to_device_pixels_transform(context);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue