mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibWeb: Make DisplayList ref-counted
This change is a preparation for the upcoming changes where display list will be nested and the same display could be owned by multiple display list items.
This commit is contained in:
parent
e8b7c88881
commit
50ab5642cc
Notes:
github-actions[bot]
2024-07-25 12:34:42 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/50ab5642cc1 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/826
4 changed files with 12 additions and 5 deletions
|
@ -1190,7 +1190,7 @@ JS::GCPtr<DOM::Node> TraversableNavigable::currently_focused_area()
|
|||
|
||||
void TraversableNavigable::paint(DevicePixelRect const& content_rect, Painting::BackingStore& target, PaintOptions paint_options)
|
||||
{
|
||||
Painting::DisplayList display_list;
|
||||
auto display_list = Painting::DisplayList::create();
|
||||
Painting::DisplayListRecorder display_list_recorder(display_list);
|
||||
|
||||
Gfx::IntRect bitmap_rect { {}, content_rect.size().to_type<int>() };
|
||||
|
|
|
@ -73,8 +73,13 @@ private:
|
|||
virtual bool would_be_fully_clipped_by_painter(Gfx::IntRect) const = 0;
|
||||
};
|
||||
|
||||
class DisplayList {
|
||||
class DisplayList : public RefCounted<DisplayList> {
|
||||
public:
|
||||
static NonnullRefPtr<DisplayList> create()
|
||||
{
|
||||
return adopt_ref(*new DisplayList());
|
||||
}
|
||||
|
||||
void append(Command&& command, Optional<i32> scroll_frame_id);
|
||||
|
||||
void apply_scroll_offsets(Vector<Gfx::IntPoint> const& offsets_by_frame_id);
|
||||
|
@ -89,6 +94,8 @@ public:
|
|||
AK::SegmentedVector<CommandListItem, 512> const& commands() const { return m_commands; }
|
||||
|
||||
private:
|
||||
DisplayList() = default;
|
||||
|
||||
AK::SegmentedVector<CommandListItem, 512> m_commands;
|
||||
};
|
||||
|
||||
|
|
|
@ -81,8 +81,8 @@ RefPtr<Gfx::Bitmap> SVGMaskable::calculate_mask_of_svg(PaintContext& context, CS
|
|||
if (mask_bitmap_or_error.is_error())
|
||||
return {};
|
||||
mask_bitmap = mask_bitmap_or_error.release_value();
|
||||
DisplayList display_list;
|
||||
DisplayListRecorder display_list_recorder(display_list);
|
||||
auto display_list = DisplayList::create();
|
||||
DisplayListRecorder display_list_recorder(*display_list);
|
||||
display_list_recorder.translate(-mask_rect.location().to_type<int>());
|
||||
auto paint_context = context.clone(display_list_recorder);
|
||||
paint_context.set_svg_transform(graphics_element.get_transform());
|
||||
|
|
|
@ -92,7 +92,7 @@ RefPtr<Gfx::Bitmap> SVGDecodedImageData::render(Gfx::IntSize size) const
|
|||
m_document->navigable()->set_viewport_size(size.to_type<CSSPixels>());
|
||||
m_document->update_layout();
|
||||
|
||||
Painting::DisplayList display_list;
|
||||
auto display_list = Painting::DisplayList::create();
|
||||
Painting::DisplayListRecorder display_list_recorder(display_list);
|
||||
|
||||
m_document->navigable()->record_display_list(display_list_recorder, {});
|
||||
|
|
Loading…
Reference in a new issue