瀏覽代碼

LibWeb: Rename CommandList to DisplayList

Use more widely recognized name among browser engine developers.
Aliaksandr Kalenik 1 年之前
父節點
當前提交
5570e6b648

+ 1 - 1
Meta/gn/secondary/Userland/Libraries/LibWeb/Painting/BUILD.gn

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

+ 1 - 1
Userland/Libraries/LibWeb/CMakeLists.txt

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

+ 3 - 3
Userland/Libraries/LibWeb/HTML/Navigable.cpp

@@ -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();
     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>();
             scroll_offsets_by_frame_id[scrollable_frame->id] = scroll_offset;
         }
-        recording_painter.commands_list().apply_scroll_offsets(scroll_offsets_by_frame_id);
-        recording_painter.commands_list().mark_unnecessary_commands();
+        recording_painter.display_list().apply_scroll_offsets(scroll_offsets_by_frame_id);
+        recording_painter.display_list().mark_unnecessary_commands();
     }
 
     m_needs_repaint = false;

+ 1 - 1
Userland/Libraries/LibWeb/HTML/Navigable.h

@@ -183,7 +183,7 @@ public:
         bool should_show_line_box_borders { 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 const& page() const { return m_page; }

+ 6 - 6
Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp

@@ -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)
 {
-    Painting::CommandList painting_commands;
-    Painting::RecordingPainter recording_painter(painting_commands);
+    Painting::DisplayList display_list;
+    Painting::RecordingPainter recording_painter(display_list);
 
     Gfx::IntRect bitmap_rect { {}, content_rect.size().to_type<int>() };
     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.should_show_line_box_borders = paint_options.should_show_line_box_borders;
     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();
     if (painting_command_executor_type == PaintingCommandExecutorType::GPU) {
 #ifdef HAS_ACCELERATED_GRAPHICS
         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
         static bool has_warned_about_configuration = false;
 
@@ -1203,10 +1203,10 @@ void TraversableNavigable::paint(Web::DevicePixelRect const& content_rect, Gfx::
 #endif
     } else if (painting_command_executor_type == PaintingCommandExecutorType::Skia) {
         Painting::CommandExecutorSkia painting_command_executor(target);
-        painting_commands.execute(painting_command_executor);
+        display_list.execute(painting_command_executor);
     } else {
         Web::Painting::CommandExecutorCPU painting_command_executor(target);
-        painting_commands.execute(painting_command_executor);
+        display_list.execute(painting_command_executor);
     }
 }
 

+ 5 - 5
Userland/Libraries/LibWeb/Painting/CommandList.cpp → Userland/Libraries/LibWeb/Painting/DisplayList.cpp

@@ -4,11 +4,11 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
-#include <LibWeb/Painting/CommandList.h>
+#include <LibWeb/Painting/DisplayList.h>
 
 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) });
 }
@@ -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) {
         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
     // in between them that produce visible output.
@@ -76,7 +76,7 @@ void CommandList::mark_unnecessary_commands()
     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);
 

+ 1 - 1
Userland/Libraries/LibWeb/Painting/CommandList.h → Userland/Libraries/LibWeb/Painting/DisplayList.h

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

+ 1 - 1
Userland/Libraries/LibWeb/Painting/NestedBrowsingContextPaintable.cpp

@@ -60,7 +60,7 @@ void NestedBrowsingContextPaintable::paint(PaintContext& context, PaintPhase pha
         paint_config.paint_overlay = context.should_paint_overlay();
         paint_config.should_show_line_box_borders = context.should_show_line_box_borders();
         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();
 

+ 3 - 3
Userland/Libraries/LibWeb/Painting/RecordingPainter.cpp

@@ -9,7 +9,7 @@
 
 namespace Web::Painting {
 
-RecordingPainter::RecordingPainter(CommandList& command_list)
+RecordingPainter::RecordingPainter(DisplayList& command_list)
     : m_command_list(command_list)
 {
     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)
 {
     m_corner_clip_state_stack.append({ id, border_rect });
-    if (m_corner_clip_state_stack.size() > commands_list().corner_clip_max_depth())
-        commands_list().set_corner_clip_max_depth(m_corner_clip_state_stack.size());
+    if (m_corner_clip_state_stack.size() > display_list().corner_clip_max_depth())
+        display_list().set_corner_clip_max_depth(m_corner_clip_state_stack.size());
     append(SampleUnderCorners {
         id,
         corner_radii,

+ 4 - 4
Userland/Libraries/LibWeb/Painting/RecordingPainter.h

@@ -28,7 +28,7 @@
 #include <LibWeb/Painting/BorderRadiiData.h>
 #include <LibWeb/Painting/BorderRadiusCornerClipper.h>
 #include <LibWeb/Painting/Command.h>
-#include <LibWeb/Painting/CommandList.h>
+#include <LibWeb/Painting/DisplayList.h>
 #include <LibWeb/Painting/GradientData.h>
 #include <LibWeb/Painting/PaintBoxShadowParams.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);
 
-    RecordingPainter(CommandList& commands_list);
+    RecordingPainter(DisplayList&);
     ~RecordingPainter();
 
-    CommandList& commands_list() { return m_command_list; }
+    DisplayList& display_list() { return m_command_list; }
 
     void append(Command&& command);
 
@@ -158,7 +158,7 @@ private:
     Vector<CornerClipState> m_corner_clip_state_stack;
 
     Vector<State> m_state_stack;
-    CommandList& m_command_list;
+    DisplayList& m_command_list;
 };
 
 class RecordingPainterStateSaver {

+ 3 - 3
Userland/Libraries/LibWeb/Painting/SVGMaskable.cpp

@@ -81,15 +81,15 @@ 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();
-        CommandList painting_commands;
-        RecordingPainter recording_painter(painting_commands);
+        DisplayList display_list;
+        RecordingPainter recording_painter(display_list);
         recording_painter.translate(-mask_rect.location().to_type<int>());
         auto paint_context = context.clone(recording_painter);
         paint_context.set_svg_transform(graphics_element.get_transform());
         paint_context.set_draw_svg_geometry_for_clip_path(is<SVGClipPaintable>(paintable));
         StackingContext::paint_node_as_stacking_context(paintable, paint_context);
         CommandExecutorCPU executor { *mask_bitmap };
-        painting_commands.execute(executor);
+        display_list.execute(executor);
         return mask_bitmap;
     };
     RefPtr<Gfx::Bitmap> mask_bitmap = {};

+ 5 - 5
Userland/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp

@@ -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->update_layout();
 
-    Painting::CommandList painting_commands;
-    Painting::RecordingPainter recording_painter(painting_commands);
+    Painting::DisplayList display_list;
+    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();
     switch (painting_command_executor_type) {
     case PaintingCommandExecutorType::CPU:
     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_commands.execute(executor);
+        display_list.execute(executor);
         break;
     }
     case PaintingCommandExecutorType::Skia: {
         Painting::CommandExecutorSkia executor { *bitmap };
-        painting_commands.execute(executor);
+        display_list.execute(executor);
         break;
     }
     default: