LibWeb: Make BackingStore atomic ref-counted

This is required to make sure rendering thread will keep backing stores
alive in case backing stores reallocation happens during rasterization.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/4164
This commit is contained in:
Aliaksandr Kalenik
2025-04-01 01:44:35 +02:00
committed by Alexander Kalenik
parent a0bb31f7a0
commit e33174fca1
Notes: github-actions[bot] 2025-04-01 01:06:13 +00:00
6 changed files with 28 additions and 17 deletions

View File

@@ -56,7 +56,7 @@ ErrorOr<GC::Ref<HTML::HTMLCanvasElement>, WebDriver::Error> draw_bounding_box_fr
Gfx::IntRect paint_rect { rect.x(), rect.y(), paint_width, paint_height };
auto bitmap = MUST(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, Gfx::AlphaType::Premultiplied, canvas.surface()->size()));
auto backing_store = Web::Painting::BitmapBackingStore(bitmap);
auto backing_store = Painting::BitmapBackingStore::create(bitmap);
IGNORE_USE_IN_ESCAPING_LAMBDA bool did_paint = false;
browsing_context.page().client().start_display_list_rendering(paint_rect.to_type<Web::DevicePixels>(), backing_store, {}, [&did_paint] {
did_paint = true;