1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:17:45 +00:00

LibWeb: Follow image-rendering when painting image style values

This commit is contained in:
MacDue 2022-08-10 16:16:46 +01:00 committed by Andreas Kling
parent 22f7e800d2
commit 1473842b56
7 changed files with 13 additions and 13 deletions

View file

@ -18,7 +18,7 @@
namespace Web::Painting {
// https://www.w3.org/TR/css-backgrounds-3/#backgrounds
void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMetrics const& layout_node, Gfx::FloatRect const& border_rect, Color background_color, Vector<CSS::BackgroundLayerData> const* background_layers, BorderRadiiData const& border_radii)
void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMetrics const& layout_node, Gfx::FloatRect const& border_rect, Color background_color, CSS::ImageRendering image_rendering, Vector<CSS::BackgroundLayerData> const* background_layers, BorderRadiiData const& border_radii)
{
auto& painter = context.painter();
@ -309,7 +309,7 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet
image_rect.set_x(image_x);
auto int_image_rect = image_rect.to_rounded<int>();
if (int_image_rect != last_int_image_rect && int_image_rect.intersects(context.viewport_rect()))
image.paint(context, int_image_rect);
image.paint(context, int_image_rect, image_rendering);
last_int_image_rect = int_image_rect;
if (!repeat_x)
break;

View file

@ -13,6 +13,6 @@
namespace Web::Painting {
void paint_background(PaintContext&, Layout::NodeWithStyleAndBoxModelMetrics const&, Gfx::FloatRect const&, Color background_color, Vector<CSS::BackgroundLayerData> const*, BorderRadiiData const&);
void paint_background(PaintContext&, Layout::NodeWithStyleAndBoxModelMetrics const&, Gfx::FloatRect const&, Color background_color, CSS::ImageRendering, Vector<CSS::BackgroundLayerData> const*, BorderRadiiData const&);
}

View file

@ -55,7 +55,7 @@ void InlinePaintable::paint(PaintContext& context, Painting::PaintPhase phase) c
}
auto border_radii_data = Painting::normalized_border_radii_data(layout_node(), absolute_fragment_rect, top_left_border_radius, top_right_border_radius, bottom_right_border_radius, bottom_left_border_radius);
Painting::paint_background(context, layout_node(), absolute_fragment_rect, computed_values().background_color(), &computed_values().background_layers(), border_radii_data);
Painting::paint_background(context, layout_node(), absolute_fragment_rect, computed_values().background_color(), computed_values().image_rendering(), &computed_values().background_layers(), border_radii_data);
if (auto computed_box_shadow = computed_values().box_shadow(); !computed_box_shadow.is_empty()) {
Vector<Painting::ShadowData> resolved_box_shadow_data;

View file

@ -43,7 +43,7 @@ void MarkerPaintable::paint(PaintContext& context, PaintPhase phase) const
};
image_rect.center_within(enclosing);
list_style_image->resolve_for_size(layout_box(), image_rect.size().to_type<float>());
list_style_image->paint(context, image_rect);
list_style_image->paint(context, image_rect, computed_values().image_rendering());
return;
}

View file

@ -222,7 +222,7 @@ void PaintableBox::paint_background(PaintContext& context) const
if (computed_values().border_top().width || computed_values().border_right().width || computed_values().border_bottom().width || computed_values().border_left().width)
background_rect = absolute_border_box_rect();
Painting::paint_background(context, layout_box(), background_rect, background_color, background_layers, normalized_border_radii_data());
Painting::paint_background(context, layout_box(), background_rect, background_color, computed_values().image_rendering(), background_layers, normalized_border_radii_data());
}
void PaintableBox::paint_box_shadow(PaintContext& context) const