LibWeb: Rename CommandList to DisplayList

Use more widely recognized name among browser engine developers.
This commit is contained in:
Aliaksandr Kalenik 2024-06-23 18:16:46 +02:00 committed by Alexander Kalenik
commit 5570e6b648
Notes: sideshowbarker 2024-07-17 11:33:34 +09:00
12 changed files with 34 additions and 34 deletions

View file

@ -16,7 +16,7 @@ source_set("Painting") {
"ClippableAndScrollable.cpp", "ClippableAndScrollable.cpp",
"Command.cpp", "Command.cpp",
"CommandExecutorCPU.cpp", "CommandExecutorCPU.cpp",
"CommandList.cpp", "DisplayList.cpp",
"FilterPainting.cpp", "FilterPainting.cpp",
"GradientPainting.cpp", "GradientPainting.cpp",
"ImagePaintable.cpp", "ImagePaintable.cpp",

View file

@ -541,9 +541,9 @@ set(SOURCES
Painting/Command.cpp Painting/Command.cpp
Painting/CommandExecutorCPU.cpp Painting/CommandExecutorCPU.cpp
Painting/CommandExecutorSkia.cpp Painting/CommandExecutorSkia.cpp
Painting/CommandList.cpp
Painting/CheckBoxPaintable.cpp Painting/CheckBoxPaintable.cpp
Painting/ClippableAndScrollable.cpp Painting/ClippableAndScrollable.cpp
Painting/DisplayList.cpp
Painting/GradientPainting.cpp Painting/GradientPainting.cpp
Painting/FilterPainting.cpp Painting/FilterPainting.cpp
Painting/ImagePaintable.cpp Painting/ImagePaintable.cpp

View file

@ -2092,7 +2092,7 @@ void Navigable::inform_the_navigation_api_about_aborting_navigation()
})); }));
} }
void Navigable::record_painting_commands(Painting::RecordingPainter& recording_painter, PaintConfig config) void Navigable::record_display_list(Painting::RecordingPainter& recording_painter, PaintConfig config)
{ {
auto document = active_document(); auto document = active_document();
if (!document) if (!document)
@ -2136,8 +2136,8 @@ void Navigable::record_painting_commands(Painting::RecordingPainter& recording_p
auto scroll_offset = context.rounded_device_point(scrollable_frame->offset).to_type<int>(); auto scroll_offset = context.rounded_device_point(scrollable_frame->offset).to_type<int>();
scroll_offsets_by_frame_id[scrollable_frame->id] = scroll_offset; scroll_offsets_by_frame_id[scrollable_frame->id] = scroll_offset;
} }
recording_painter.commands_list().apply_scroll_offsets(scroll_offsets_by_frame_id); recording_painter.display_list().apply_scroll_offsets(scroll_offsets_by_frame_id);
recording_painter.commands_list().mark_unnecessary_commands(); recording_painter.display_list().mark_unnecessary_commands();
} }
m_needs_repaint = false; m_needs_repaint = false;

View file

@ -183,7 +183,7 @@ public:
bool should_show_line_box_borders { false }; bool should_show_line_box_borders { false };
bool has_focus { false }; bool has_focus { false };
}; };
void record_painting_commands(Painting::RecordingPainter&, PaintConfig); void record_display_list(Painting::RecordingPainter& recording_painter, PaintConfig);
Page& page() { return m_page; } Page& page() { return m_page; }
Page const& page() const { return m_page; } Page const& page() const { return m_page; }

View file

@ -1176,8 +1176,8 @@ JS::GCPtr<DOM::Node> TraversableNavigable::currently_focused_area()
void TraversableNavigable::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& target, Web::PaintOptions paint_options) void TraversableNavigable::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& target, Web::PaintOptions paint_options)
{ {
Painting::CommandList painting_commands; Painting::DisplayList display_list;
Painting::RecordingPainter recording_painter(painting_commands); Painting::RecordingPainter recording_painter(display_list);
Gfx::IntRect bitmap_rect { {}, content_rect.size().to_type<int>() }; Gfx::IntRect bitmap_rect { {}, content_rect.size().to_type<int>() };
recording_painter.fill_rect(bitmap_rect, Web::CSS::SystemColor::canvas()); recording_painter.fill_rect(bitmap_rect, Web::CSS::SystemColor::canvas());
@ -1186,13 +1186,13 @@ void TraversableNavigable::paint(Web::DevicePixelRect const& content_rect, Gfx::
paint_config.paint_overlay = paint_options.paint_overlay == Web::PaintOptions::PaintOverlay::Yes; paint_config.paint_overlay = paint_options.paint_overlay == Web::PaintOptions::PaintOverlay::Yes;
paint_config.should_show_line_box_borders = paint_options.should_show_line_box_borders; paint_config.should_show_line_box_borders = paint_options.should_show_line_box_borders;
paint_config.has_focus = paint_options.has_focus; paint_config.has_focus = paint_options.has_focus;
record_painting_commands(recording_painter, paint_config); record_display_list(recording_painter, paint_config);
auto painting_command_executor_type = page().client().painting_command_executor_type(); auto painting_command_executor_type = page().client().painting_command_executor_type();
if (painting_command_executor_type == PaintingCommandExecutorType::GPU) { if (painting_command_executor_type == PaintingCommandExecutorType::GPU) {
#ifdef HAS_ACCELERATED_GRAPHICS #ifdef HAS_ACCELERATED_GRAPHICS
Web::Painting::CommandExecutorGPU painting_command_executor(*paint_options.accelerated_graphics_context, target); Web::Painting::CommandExecutorGPU painting_command_executor(*paint_options.accelerated_graphics_context, target);
painting_commands.execute(painting_command_executor); display_list.execute(painting_command_executor);
#else #else
static bool has_warned_about_configuration = false; static bool has_warned_about_configuration = false;
@ -1203,10 +1203,10 @@ void TraversableNavigable::paint(Web::DevicePixelRect const& content_rect, Gfx::
#endif #endif
} else if (painting_command_executor_type == PaintingCommandExecutorType::Skia) { } else if (painting_command_executor_type == PaintingCommandExecutorType::Skia) {
Painting::CommandExecutorSkia painting_command_executor(target); Painting::CommandExecutorSkia painting_command_executor(target);
painting_commands.execute(painting_command_executor); display_list.execute(painting_command_executor);
} else { } else {
Web::Painting::CommandExecutorCPU painting_command_executor(target); Web::Painting::CommandExecutorCPU painting_command_executor(target);
painting_commands.execute(painting_command_executor); display_list.execute(painting_command_executor);
} }
} }

View file

@ -4,11 +4,11 @@
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
*/ */
#include <LibWeb/Painting/CommandList.h> #include <LibWeb/Painting/DisplayList.h>
namespace Web::Painting { namespace Web::Painting {
void CommandList::append(Command&& command, Optional<i32> scroll_frame_id) void DisplayList::append(Command&& command, Optional<i32> scroll_frame_id)
{ {
m_commands.append({ scroll_frame_id, move(command) }); m_commands.append({ scroll_frame_id, move(command) });
} }
@ -24,7 +24,7 @@ static Optional<Gfx::IntRect> command_bounding_rectangle(Command const& command)
}); });
} }
void CommandList::apply_scroll_offsets(Vector<Gfx::IntPoint> const& offsets_by_frame_id) void DisplayList::apply_scroll_offsets(Vector<Gfx::IntPoint> const& offsets_by_frame_id)
{ {
for (auto& command_with_scroll_id : m_commands) { for (auto& command_with_scroll_id : m_commands) {
if (command_with_scroll_id.scroll_frame_id.has_value()) { if (command_with_scroll_id.scroll_frame_id.has_value()) {
@ -39,7 +39,7 @@ void CommandList::apply_scroll_offsets(Vector<Gfx::IntPoint> const& offsets_by_f
} }
} }
void CommandList::mark_unnecessary_commands() void DisplayList::mark_unnecessary_commands()
{ {
// The pair sample_under_corners and blit_corner_clipping commands is not needed if there are no painting commands // The pair sample_under_corners and blit_corner_clipping commands is not needed if there are no painting commands
// in between them that produce visible output. // in between them that produce visible output.
@ -76,7 +76,7 @@ void CommandList::mark_unnecessary_commands()
VERIFY(sample_blit_ranges.is_empty()); VERIFY(sample_blit_ranges.is_empty());
} }
void CommandList::execute(CommandExecutor& executor) void DisplayList::execute(CommandExecutor& executor)
{ {
executor.prepare_to_execute(m_corner_clip_max_depth); executor.prepare_to_execute(m_corner_clip_max_depth);

View file

@ -77,7 +77,7 @@ public:
virtual void update_immutable_bitmap_texture_cache(HashMap<u32, Gfx::ImmutableBitmap const*>&) = 0; virtual void update_immutable_bitmap_texture_cache(HashMap<u32, Gfx::ImmutableBitmap const*>&) = 0;
}; };
class CommandList { class DisplayList {
public: public:
void append(Command&& command, Optional<i32> scroll_frame_id); void append(Command&& command, Optional<i32> scroll_frame_id);

View file

@ -60,7 +60,7 @@ void NestedBrowsingContextPaintable::paint(PaintContext& context, PaintPhase pha
paint_config.paint_overlay = context.should_paint_overlay(); paint_config.paint_overlay = context.should_paint_overlay();
paint_config.should_show_line_box_borders = context.should_show_line_box_borders(); paint_config.should_show_line_box_borders = context.should_show_line_box_borders();
paint_config.has_focus = context.has_focus(); paint_config.has_focus = context.has_focus();
const_cast<DOM::Document*>(hosted_document)->navigable()->record_painting_commands(context.recording_painter(), paint_config); const_cast<DOM::Document*>(hosted_document)->navigable()->record_display_list(context.recording_painter(), paint_config);
context.recording_painter().restore(); context.recording_painter().restore();

View file

@ -9,7 +9,7 @@
namespace Web::Painting { namespace Web::Painting {
RecordingPainter::RecordingPainter(CommandList& command_list) RecordingPainter::RecordingPainter(DisplayList& command_list)
: m_command_list(command_list) : m_command_list(command_list)
{ {
m_state_stack.append(State()); m_state_stack.append(State());
@ -28,8 +28,8 @@ void RecordingPainter::append(Command&& command)
void RecordingPainter::sample_under_corners(u32 id, CornerRadii corner_radii, Gfx::IntRect border_rect, CornerClip corner_clip) void RecordingPainter::sample_under_corners(u32 id, CornerRadii corner_radii, Gfx::IntRect border_rect, CornerClip corner_clip)
{ {
m_corner_clip_state_stack.append({ id, border_rect }); m_corner_clip_state_stack.append({ id, border_rect });
if (m_corner_clip_state_stack.size() > commands_list().corner_clip_max_depth()) if (m_corner_clip_state_stack.size() > display_list().corner_clip_max_depth())
commands_list().set_corner_clip_max_depth(m_corner_clip_state_stack.size()); display_list().set_corner_clip_max_depth(m_corner_clip_state_stack.size());
append(SampleUnderCorners { append(SampleUnderCorners {
id, id,
corner_radii, corner_radii,

View file

@ -28,7 +28,7 @@
#include <LibWeb/Painting/BorderRadiiData.h> #include <LibWeb/Painting/BorderRadiiData.h>
#include <LibWeb/Painting/BorderRadiusCornerClipper.h> #include <LibWeb/Painting/BorderRadiusCornerClipper.h>
#include <LibWeb/Painting/Command.h> #include <LibWeb/Painting/Command.h>
#include <LibWeb/Painting/CommandList.h> #include <LibWeb/Painting/DisplayList.h>
#include <LibWeb/Painting/GradientData.h> #include <LibWeb/Painting/GradientData.h>
#include <LibWeb/Painting/PaintBoxShadowParams.h> #include <LibWeb/Painting/PaintBoxShadowParams.h>
#include <LibWeb/Painting/PaintStyle.h> #include <LibWeb/Painting/PaintStyle.h>
@ -135,10 +135,10 @@ public:
void draw_triangle_wave(Gfx::IntPoint a_p1, Gfx::IntPoint a_p2, Color color, int amplitude, int thickness); void draw_triangle_wave(Gfx::IntPoint a_p1, Gfx::IntPoint a_p2, Color color, int amplitude, int thickness);
RecordingPainter(CommandList& commands_list); RecordingPainter(DisplayList&);
~RecordingPainter(); ~RecordingPainter();
CommandList& commands_list() { return m_command_list; } DisplayList& display_list() { return m_command_list; }
void append(Command&& command); void append(Command&& command);
@ -158,7 +158,7 @@ private:
Vector<CornerClipState> m_corner_clip_state_stack; Vector<CornerClipState> m_corner_clip_state_stack;
Vector<State> m_state_stack; Vector<State> m_state_stack;
CommandList& m_command_list; DisplayList& m_command_list;
}; };
class RecordingPainterStateSaver { class RecordingPainterStateSaver {

View file

@ -81,15 +81,15 @@ RefPtr<Gfx::Bitmap> SVGMaskable::calculate_mask_of_svg(PaintContext& context, CS
if (mask_bitmap_or_error.is_error()) if (mask_bitmap_or_error.is_error())
return {}; return {};
mask_bitmap = mask_bitmap_or_error.release_value(); mask_bitmap = mask_bitmap_or_error.release_value();
CommandList painting_commands; DisplayList display_list;
RecordingPainter recording_painter(painting_commands); RecordingPainter recording_painter(display_list);
recording_painter.translate(-mask_rect.location().to_type<int>()); recording_painter.translate(-mask_rect.location().to_type<int>());
auto paint_context = context.clone(recording_painter); auto paint_context = context.clone(recording_painter);
paint_context.set_svg_transform(graphics_element.get_transform()); paint_context.set_svg_transform(graphics_element.get_transform());
paint_context.set_draw_svg_geometry_for_clip_path(is<SVGClipPaintable>(paintable)); paint_context.set_draw_svg_geometry_for_clip_path(is<SVGClipPaintable>(paintable));
StackingContext::paint_node_as_stacking_context(paintable, paint_context); StackingContext::paint_node_as_stacking_context(paintable, paint_context);
CommandExecutorCPU executor { *mask_bitmap }; CommandExecutorCPU executor { *mask_bitmap };
painting_commands.execute(executor); display_list.execute(executor);
return mask_bitmap; return mask_bitmap;
}; };
RefPtr<Gfx::Bitmap> mask_bitmap = {}; RefPtr<Gfx::Bitmap> mask_bitmap = {};

View file

@ -93,22 +93,22 @@ RefPtr<Gfx::Bitmap> SVGDecodedImageData::render(Gfx::IntSize size) const
m_document->navigable()->set_viewport_size(size.to_type<CSSPixels>()); m_document->navigable()->set_viewport_size(size.to_type<CSSPixels>());
m_document->update_layout(); m_document->update_layout();
Painting::CommandList painting_commands; Painting::DisplayList display_list;
Painting::RecordingPainter recording_painter(painting_commands); Painting::RecordingPainter recording_painter(display_list);
m_document->navigable()->record_painting_commands(recording_painter, {}); m_document->navigable()->record_display_list(recording_painter, {});
auto painting_command_executor_type = m_page_client->painting_command_executor_type(); auto painting_command_executor_type = m_page_client->painting_command_executor_type();
switch (painting_command_executor_type) { switch (painting_command_executor_type) {
case PaintingCommandExecutorType::CPU: case PaintingCommandExecutorType::CPU:
case PaintingCommandExecutorType::GPU: { // GPU painter does not have any path rasterization support so we always fall back to CPU painter case PaintingCommandExecutorType::GPU: { // GPU painter does not have any path rasterization support so we always fall back to CPU painter
Painting::CommandExecutorCPU executor { *bitmap }; Painting::CommandExecutorCPU executor { *bitmap };
painting_commands.execute(executor); display_list.execute(executor);
break; break;
} }
case PaintingCommandExecutorType::Skia: { case PaintingCommandExecutorType::Skia: {
Painting::CommandExecutorSkia executor { *bitmap }; Painting::CommandExecutorSkia executor { *bitmap };
painting_commands.execute(executor); display_list.execute(executor);
break; break;
} }
default: default: