1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:48:11 +00:00

LibWeb: Add "object-fit" CSS property into ComputedValues

This commit is contained in:
Aliaksandr Kalenik 2024-02-26 10:46:22 +01:00 committed by Andreas Kling
parent 22da83c295
commit 677a00ed92
3 changed files with 7 additions and 7 deletions

View file

@ -72,7 +72,6 @@ void ImagePaintable::paint(PaintContext& context, PaintPhase phase) const
auto bitmap_rect = bitmap->rect();
auto scaling_mode = to_gfx_scaling_mode(computed_values().image_rendering(), bitmap_rect, image_int_rect);
auto& dom_element = verify_cast<DOM::Element>(*dom_node());
auto object_fit = dom_element.computed_css_values()->object_fit();
auto bitmap_aspect_ratio = (float)bitmap_rect.height() / bitmap_rect.width();
auto image_aspect_ratio = (float)image_rect.height().value() / image_rect.width().value();
@ -80,12 +79,7 @@ void ImagePaintable::paint(PaintContext& context, PaintPhase phase) const
auto scale_y = 0.0f;
Gfx::IntRect bitmap_intersect = bitmap_rect;
auto object_fit_value = CSS::InitialValues::object_fit();
if (object_fit.has_value())
object_fit_value = object_fit.value();
switch (object_fit_value) {
switch (computed_values().object_fit()) {
case CSS::ObjectFit::Fill:
scale_x = (float)image_int_rect.width() / bitmap_rect.width();
scale_y = (float)image_int_rect.height() / bitmap_rect.height();