mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-19 08:51:57 +00:00
LibWeb: Apply clip rect before painting images
Previously, the clip property was ignored when painting images.
This commit is contained in:
parent
212d748ded
commit
2ff9e1d038
Notes:
github-actions[bot]
2025-06-24 11:57:59 +00:00
Author: https://github.com/tcl3
Commit: 2ff9e1d038
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5185
Reviewed-by: https://github.com/AtkinsSJ ✅
2 changed files with 16 additions and 0 deletions
|
@ -152,7 +152,9 @@ void ImagePaintable::paint(PaintContext& context, PaintPhase phase) const
|
||||||
context.rounded_device_pixels(scaled_bitmap_height).value()
|
context.rounded_device_pixels(scaled_bitmap_height).value()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
apply_own_clip_rect(context, phase);
|
||||||
context.display_list_recorder().draw_scaled_immutable_bitmap(draw_rect, image_int_rect_device_pixels, *bitmap, scaling_mode);
|
context.display_list_recorder().draw_scaled_immutable_bitmap(draw_rect, image_int_rect_device_pixels, *bitmap, scaling_mode);
|
||||||
|
clear_own_clip_rect(context, phase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
14
Tests/LibWeb/Ref/input/css/css-masking/clip-image.html
Normal file
14
Tests/LibWeb/Ref/input/css/css-masking/clip-image.html
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<link rel="match" href="../../../../Assets/blank.html" />
|
||||||
|
<style>
|
||||||
|
img {
|
||||||
|
position: absolute;
|
||||||
|
clip: rect(0px, 0px, 0px, 0px)
|
||||||
|
}
|
||||||
|
.translated {
|
||||||
|
translate: 120px 120px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div>blank page</div>
|
||||||
|
<img alt="This shouldn't be visible" src="../../../../Assets/120.png">
|
||||||
|
<img class="translated" alt="This also shouldn't be visible" src="../../../../Assets/120.png">
|
Loading…
Add table
Add a link
Reference in a new issue