LibWeb: Port painting to use the new Skia-backed Gfx::Path

SVG and and CSS border rendering now sits on top of SkPath instead of
the old Gfx::DeprecatedPath.

Due to an imperceptible (255, 255, 255) vs (255, 254, 255) color diff
in one ref test, I changed that test to not depend on border rendering
for a positive result, since that was incidental.
This commit is contained in:
Andreas Kling 2024-08-09 14:00:10 +02:00 committed by Andreas Kling
commit 137038b185
Notes: github-actions[bot] 2024-08-20 07:38:12 +00:00
37 changed files with 139 additions and 143 deletions

View file

@ -10,6 +10,7 @@
#include <AK/Debug.h>
#include <LibGfx/BoundingBox.h>
#include <LibGfx/Font/ScaledFont.h>
#include <LibGfx/Path.h>
#include <LibGfx/TextLayout.h>
#include <LibWeb/Layout/BlockFormattingContext.h>
#include <LibWeb/Layout/SVGClipBox.h>
@ -301,7 +302,7 @@ void SVGFormattingContext::layout_nested_viewport(Box const& viewport)
nested_context.run(static_cast<Box const&>(viewport), LayoutMode::Normal, *m_available_space);
}
Gfx::DeprecatedPath SVGFormattingContext::compute_path_for_text(SVGTextBox const& text_box)
Gfx::Path SVGFormattingContext::compute_path_for_text(SVGTextBox const& text_box)
{
auto& text_element = static_cast<SVG::SVGTextPositioningElement const&>(text_box.dom_node());
auto& font = text_box.first_available_font();
@ -333,13 +334,13 @@ Gfx::DeprecatedPath SVGFormattingContext::compute_path_for_text(SVGTextBox const
VERIFY_NOT_REACHED();
}
Gfx::DeprecatedPath path;
Gfx::Path path;
path.move_to(text_offset);
path.text(text_utf8, font);
return path;
}
Gfx::DeprecatedPath SVGFormattingContext::compute_path_for_text_path(SVGTextPathBox const& text_path_box)
Gfx::Path SVGFormattingContext::compute_path_for_text_path(SVGTextPathBox const& text_path_box)
{
auto& text_path_element = static_cast<SVG::SVGTextPathElement const&>(text_path_box.dom_node());
auto path_or_shape = text_path_element.path_or_shape();
@ -363,7 +364,7 @@ void SVGFormattingContext::layout_path_like_element(SVGGraphicsBox const& graphi
.multiply(m_current_viewbox_transform)
.multiply(graphics_box_state.computed_svg_transforms()->svg_transform());
Gfx::DeprecatedPath path;
Gfx::Path path;
if (is<SVGGeometryBox>(graphics_box)) {
auto& geometry_box = static_cast<SVGGeometryBox const&>(graphics_box);
path = const_cast<SVGGeometryBox&>(geometry_box).dom_node().get_path(m_viewport_size);