From 410e82c9fd4a968fd9e51c7d5bb713ad03629a24 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Thu, 10 Jul 2025 19:24:30 +0200 Subject: [PATCH] LibWeb: Rearrange code such that a lot less files include `Command.h` With this change number of recompiled files after modification of `Command.h` goes down from >1000 to <100. --- Libraries/LibWeb/DOM/Document.cpp | 1 + Libraries/LibWeb/Forward.h | 3 + Libraries/LibWeb/HTML/Navigable.cpp | 6 ++ Libraries/LibWeb/HTML/Navigable.h | 2 +- Libraries/LibWeb/HTML/RenderingThread.cpp | 6 ++ Libraries/LibWeb/HTML/RenderingThread.h | 4 +- Libraries/LibWeb/HTML/TraversableNavigable.h | 2 - .../LibWeb/Painting/BackgroundPainting.cpp | 3 +- .../LibWeb/Painting/BackingStoreManager.cpp | 10 ++ .../LibWeb/Painting/BackingStoreManager.h | 9 +- Libraries/LibWeb/Painting/CanvasPaintable.cpp | 1 + Libraries/LibWeb/Painting/Command.h | 6 +- .../LibWeb/Painting/DisplayListPlayerSkia.h | 3 +- .../LibWeb/Painting/DisplayListRecorder.cpp | 96 ++++++++++--------- .../LibWeb/Painting/DisplayListRecorder.h | 14 +-- .../NavigableContainerViewportPaintable.cpp | 1 + Libraries/LibWeb/Painting/StackingContext.cpp | 1 + 17 files changed, 95 insertions(+), 73 deletions(-) diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp index 0fbe79ed016..a02badb4e44 100644 --- a/Libraries/LibWeb/DOM/Document.cpp +++ b/Libraries/LibWeb/DOM/Document.cpp @@ -149,6 +149,7 @@ #include #include #include +#include #include #include #include diff --git a/Libraries/LibWeb/Forward.h b/Libraries/LibWeb/Forward.h index 8d7f7f1264f..05f4ee9f72a 100644 --- a/Libraries/LibWeb/Forward.h +++ b/Libraries/LibWeb/Forward.h @@ -35,7 +35,9 @@ AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(i64, UniqueNodeID, Comparison, Increment, Ca namespace Web::Painting { class BackingStore; + class DisplayList; +class DisplayListPlayerSkia; class DisplayListRecorder; class SVGGradientPaintStyle; using PaintStyle = RefPtr; @@ -840,6 +842,7 @@ class MediaPaintable; class Paintable; class PaintableBox; class PaintableWithLines; +class ScrollStateSnapshot; class StackingContext; class TextPaintable; class VideoPaintable; diff --git a/Libraries/LibWeb/HTML/Navigable.cpp b/Libraries/LibWeb/HTML/Navigable.cpp index 54bce412a71..c864b7ccb12 100644 --- a/Libraries/LibWeb/HTML/Navigable.cpp +++ b/Libraries/LibWeb/HTML/Navigable.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -2620,4 +2621,9 @@ void Navigable::start_display_list_rendering(Gfx::PaintingSurface& painting_surf m_rendering_thread.enqueue_rendering_task(*display_list, move(scroll_state_snapshot), painting_surface, move(callback)); } +RefPtr Navigable::skia_backend_context() const +{ + return m_skia_backend_context; +} + } diff --git a/Libraries/LibWeb/HTML/Navigable.h b/Libraries/LibWeb/HTML/Navigable.h index 3e02da7b1f2..c5af98f72d0 100644 --- a/Libraries/LibWeb/HTML/Navigable.h +++ b/Libraries/LibWeb/HTML/Navigable.h @@ -213,7 +213,7 @@ public: bool needs_repaint() const { return m_needs_repaint; } void set_needs_repaint() { m_needs_repaint = true; } - RefPtr skia_backend_context() const { return m_skia_backend_context; } + RefPtr skia_backend_context() const; void set_pending_set_browser_zoom_request(bool value) { m_pending_set_browser_zoom_request = value; } bool pending_set_browser_zoom_request() const { return m_pending_set_browser_zoom_request; } diff --git a/Libraries/LibWeb/HTML/RenderingThread.cpp b/Libraries/LibWeb/HTML/RenderingThread.cpp index 55b3b3a05cb..4c6a245334a 100644 --- a/Libraries/LibWeb/HTML/RenderingThread.cpp +++ b/Libraries/LibWeb/HTML/RenderingThread.cpp @@ -7,6 +7,7 @@ #include #include #include +#include namespace Web::HTML { @@ -43,6 +44,11 @@ void RenderingThread::start(DisplayListPlayerType display_list_player_type) m_thread->start(); } +void RenderingThread::set_skia_player(OwnPtr&& player) +{ + m_skia_player = move(player); +} + void RenderingThread::rendering_thread_loop() { while (true) { diff --git a/Libraries/LibWeb/HTML/RenderingThread.h b/Libraries/LibWeb/HTML/RenderingThread.h index c499f8cca36..644c8ae4984 100644 --- a/Libraries/LibWeb/HTML/RenderingThread.h +++ b/Libraries/LibWeb/HTML/RenderingThread.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include namespace Web::HTML { @@ -27,7 +27,7 @@ public: ~RenderingThread(); void start(DisplayListPlayerType); - void set_skia_player(OwnPtr&& player) { m_skia_player = move(player); } + void set_skia_player(OwnPtr&& player); void enqueue_rendering_task(NonnullRefPtr, Painting::ScrollStateSnapshot&&, NonnullRefPtr, Function&& callback); private: diff --git a/Libraries/LibWeb/HTML/TraversableNavigable.h b/Libraries/LibWeb/HTML/TraversableNavigable.h index 7d1bc0ac72e..03b246fbdc3 100644 --- a/Libraries/LibWeb/HTML/TraversableNavigable.h +++ b/Libraries/LibWeb/HTML/TraversableNavigable.h @@ -12,11 +12,9 @@ #include #include #include -#include #include #include #include -#include #include #ifdef AK_OS_MACOS diff --git a/Libraries/LibWeb/Painting/BackgroundPainting.cpp b/Libraries/LibWeb/Painting/BackgroundPainting.cpp index 6263edbc90d..a50c5b1b2f2 100644 --- a/Libraries/LibWeb/Painting/BackgroundPainting.cpp +++ b/Libraries/LibWeb/Painting/BackgroundPainting.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -325,7 +326,7 @@ void paint_background(PaintContext& context, PaintableBox const& paintable_box, auto const* bitmap = static_cast(image).current_frame_bitmap(dest_rect); auto scaling_mode = to_gfx_scaling_mode(image_rendering, bitmap->rect(), dest_rect.to_type()); - context.display_list_recorder().draw_repeated_immutable_bitmap(dest_rect.to_type(), clip_rect.to_type(), *bitmap, scaling_mode, { .x = repeat_x, .y = repeat_y }); + context.display_list_recorder().draw_repeated_immutable_bitmap(dest_rect.to_type(), clip_rect.to_type(), *bitmap, scaling_mode, repeat_x, repeat_y); } else { for_each_image_device_rect([&](auto const& image_device_rect) { image.paint(context, image_device_rect, image_rendering); diff --git a/Libraries/LibWeb/Painting/BackingStoreManager.cpp b/Libraries/LibWeb/Painting/BackingStoreManager.cpp index 0d294e34c2c..f67cbc3363e 100644 --- a/Libraries/LibWeb/Painting/BackingStoreManager.cpp +++ b/Libraries/LibWeb/Painting/BackingStoreManager.cpp @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -46,6 +47,15 @@ void BackingStoreManager::restart_resize_timer() m_backing_store_shrink_timer->restart(); } +BackingStoreManager::BackingStore BackingStoreManager::acquire_store_for_next_frame() +{ + BackingStore backing_store; + backing_store.bitmap_id = m_back_bitmap_id; + backing_store.store = m_back_store; + swap_back_and_front(); + return backing_store; +} + void BackingStoreManager::reallocate_backing_stores(Gfx::IntSize size) { auto skia_backend_context = m_navigable->skia_backend_context(); diff --git a/Libraries/LibWeb/Painting/BackingStoreManager.h b/Libraries/LibWeb/Painting/BackingStoreManager.h index ca72057371e..ad34004b8d2 100644 --- a/Libraries/LibWeb/Painting/BackingStoreManager.h +++ b/Libraries/LibWeb/Painting/BackingStoreManager.h @@ -32,14 +32,7 @@ public: RefPtr store; }; - BackingStore acquire_store_for_next_frame() - { - BackingStore backing_store; - backing_store.bitmap_id = m_back_bitmap_id; - backing_store.store = m_back_store; - swap_back_and_front(); - return backing_store; - } + BackingStore acquire_store_for_next_frame(); virtual void visit_edges(Cell::Visitor& visitor) override; diff --git a/Libraries/LibWeb/Painting/CanvasPaintable.cpp b/Libraries/LibWeb/Painting/CanvasPaintable.cpp index 2d655b23cba..8aed75f35dc 100644 --- a/Libraries/LibWeb/Painting/CanvasPaintable.cpp +++ b/Libraries/LibWeb/Painting/CanvasPaintable.cpp @@ -6,6 +6,7 @@ #include #include +#include namespace Web::Painting { diff --git a/Libraries/LibWeb/Painting/Command.h b/Libraries/LibWeb/Painting/Command.h index 005657c084e..efe48e1180b 100644 --- a/Libraries/LibWeb/Painting/Command.h +++ b/Libraries/LibWeb/Painting/Command.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -114,11 +115,6 @@ struct AddClipRect { void translate_by(Gfx::IntPoint const& offset) { rect.translate_by(offset); } }; -struct StackingContextTransform { - Gfx::FloatPoint origin; - Gfx::FloatMatrix4x4 matrix; -}; - struct PushStackingContext { float opacity; Gfx::CompositingAndBlendingOperator compositing_and_blending_operator; diff --git a/Libraries/LibWeb/Painting/DisplayListPlayerSkia.h b/Libraries/LibWeb/Painting/DisplayListPlayerSkia.h index a1cdd3a33e7..918165c239a 100644 --- a/Libraries/LibWeb/Painting/DisplayListPlayerSkia.h +++ b/Libraries/LibWeb/Painting/DisplayListPlayerSkia.h @@ -6,8 +6,9 @@ #pragma once -#include #include +#include +#include #include class GrDirectContext; diff --git a/Libraries/LibWeb/Painting/DisplayListRecorder.cpp b/Libraries/LibWeb/Painting/DisplayListRecorder.cpp index 4ae934f30a2..b1ecc1b636f 100644 --- a/Libraries/LibWeb/Painting/DisplayListRecorder.cpp +++ b/Libraries/LibWeb/Painting/DisplayListRecorder.cpp @@ -4,6 +4,8 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include +#include #include #include @@ -16,34 +18,34 @@ DisplayListRecorder::DisplayListRecorder(DisplayList& command_list) DisplayListRecorder::~DisplayListRecorder() = default; -void DisplayListRecorder::append(Command&& command) -{ - Optional scroll_frame_id; - if (!m_scroll_frame_id_stack.is_empty()) - scroll_frame_id = m_scroll_frame_id_stack.last(); - m_command_list.append(move(command), scroll_frame_id); -} +#define APPEND(...) \ + do { \ + Optional _scroll_frame_id; \ + if (!m_scroll_frame_id_stack.is_empty()) \ + _scroll_frame_id = m_scroll_frame_id_stack.last(); \ + m_command_list.append(__VA_ARGS__, _scroll_frame_id); \ + } while (false) void DisplayListRecorder::paint_nested_display_list(RefPtr display_list, ScrollStateSnapshot&& scroll_state_snapshot, Gfx::IntRect rect) { - append(PaintNestedDisplayList { move(display_list), move(scroll_state_snapshot), rect }); + APPEND(PaintNestedDisplayList { move(display_list), move(scroll_state_snapshot), rect }); } void DisplayListRecorder::add_rounded_rect_clip(CornerRadii corner_radii, Gfx::IntRect border_rect, CornerClip corner_clip) { - append(AddRoundedRectClip { corner_radii, border_rect, corner_clip }); + APPEND(AddRoundedRectClip { corner_radii, border_rect, corner_clip }); } void DisplayListRecorder::add_mask(RefPtr display_list, Gfx::IntRect rect) { - append(AddMask { move(display_list), rect }); + APPEND(AddMask { move(display_list), rect }); } void DisplayListRecorder::fill_rect(Gfx::IntRect const& rect, Color color) { if (rect.is_empty() || color.alpha() == 0) return; - append(FillRect { rect, color }); + APPEND(FillRect { rect, color }); } void DisplayListRecorder::fill_path(FillPathUsingColorParams params) @@ -55,7 +57,7 @@ void DisplayListRecorder::fill_path(FillPathUsingColorParams params) auto path_bounding_int_rect = enclosing_int_rect(path_bounding_rect); if (path_bounding_int_rect.is_empty()) return; - append(FillPathUsingColor { + APPEND(FillPathUsingColor { .path_bounding_rect = path_bounding_int_rect, .path = move(params.path), .color = params.color, @@ -71,7 +73,7 @@ void DisplayListRecorder::fill_path(FillPathUsingPaintStyleParams params) auto path_bounding_int_rect = enclosing_int_rect(path_bounding_rect); if (path_bounding_int_rect.is_empty()) return; - append(FillPathUsingPaintStyle { + APPEND(FillPathUsingPaintStyle { .path_bounding_rect = path_bounding_int_rect, .path = move(params.path), .paint_style = params.paint_style, @@ -92,7 +94,7 @@ void DisplayListRecorder::stroke_path(StrokePathUsingColorParams params) auto path_bounding_int_rect = enclosing_int_rect(path_bounding_rect); if (path_bounding_int_rect.is_empty()) return; - append(StrokePathUsingColor { + APPEND(StrokePathUsingColor { .cap_style = params.cap_style, .join_style = params.join_style, .miter_limit = params.miter_limit, @@ -115,7 +117,7 @@ void DisplayListRecorder::stroke_path(StrokePathUsingPaintStyleParams params) auto path_bounding_int_rect = enclosing_int_rect(path_bounding_rect); if (path_bounding_int_rect.is_empty()) return; - append(StrokePathUsingPaintStyle { + APPEND(StrokePathUsingPaintStyle { .cap_style = params.cap_style, .join_style = params.join_style, .miter_limit = params.miter_limit, @@ -134,7 +136,7 @@ void DisplayListRecorder::draw_ellipse(Gfx::IntRect const& a_rect, Color color, { if (a_rect.is_empty() || color.alpha() == 0) return; - append(DrawEllipse { + APPEND(DrawEllipse { .rect = a_rect, .color = color, .thickness = thickness, @@ -145,21 +147,21 @@ void DisplayListRecorder::fill_ellipse(Gfx::IntRect const& a_rect, Color color) { if (a_rect.is_empty() || color.alpha() == 0) return; - append(FillEllipse { a_rect, color }); + APPEND(FillEllipse { a_rect, color }); } void DisplayListRecorder::fill_rect_with_linear_gradient(Gfx::IntRect const& gradient_rect, LinearGradientData const& data) { if (gradient_rect.is_empty()) return; - append(PaintLinearGradient { gradient_rect, data }); + APPEND(PaintLinearGradient { gradient_rect, data }); } void DisplayListRecorder::fill_rect_with_conic_gradient(Gfx::IntRect const& rect, ConicGradientData const& data, Gfx::IntPoint const& position) { if (rect.is_empty()) return; - append(PaintConicGradient { + APPEND(PaintConicGradient { .rect = rect, .conic_gradient_data = data, .position = position }); @@ -169,7 +171,7 @@ void DisplayListRecorder::fill_rect_with_radial_gradient(Gfx::IntRect const& rec { if (rect.is_empty()) return; - append(PaintRadialGradient { + APPEND(PaintRadialGradient { .rect = rect, .radial_gradient_data = data, .center = center, @@ -180,7 +182,7 @@ void DisplayListRecorder::draw_rect(Gfx::IntRect const& rect, Color color, bool { if (rect.is_empty() || color.alpha() == 0) return; - append(DrawRect { + APPEND(DrawRect { .rect = rect, .color = color, .rough = rough }); @@ -190,7 +192,7 @@ void DisplayListRecorder::draw_painting_surface(Gfx::IntRect const& dst_rect, No { if (dst_rect.is_empty()) return; - append(DrawPaintingSurface { + APPEND(DrawPaintingSurface { .dst_rect = dst_rect, .surface = surface, .src_rect = src_rect, @@ -202,7 +204,7 @@ void DisplayListRecorder::draw_scaled_immutable_bitmap(Gfx::IntRect const& dst_r { if (dst_rect.is_empty()) return; - append(DrawScaledImmutableBitmap { + APPEND(DrawScaledImmutableBitmap { .dst_rect = dst_rect, .clip_rect = clip_rect, .bitmap = bitmap, @@ -210,14 +212,14 @@ void DisplayListRecorder::draw_scaled_immutable_bitmap(Gfx::IntRect const& dst_r }); } -void DisplayListRecorder::draw_repeated_immutable_bitmap(Gfx::IntRect dst_rect, Gfx::IntRect clip_rect, NonnullRefPtr bitmap, Gfx::ScalingMode scaling_mode, DrawRepeatedImmutableBitmap::Repeat repeat) +void DisplayListRecorder::draw_repeated_immutable_bitmap(Gfx::IntRect dst_rect, Gfx::IntRect clip_rect, NonnullRefPtr bitmap, Gfx::ScalingMode scaling_mode, bool repeat_x, bool repeat_y) { - append(DrawRepeatedImmutableBitmap { + APPEND(DrawRepeatedImmutableBitmap { .dst_rect = dst_rect, .clip_rect = clip_rect, .bitmap = move(bitmap), .scaling_mode = scaling_mode, - .repeat = repeat, + .repeat = { repeat_x, repeat_y }, }); } @@ -225,7 +227,7 @@ void DisplayListRecorder::draw_line(Gfx::IntPoint from, Gfx::IntPoint to, Color { if (color.alpha() == 0) return; - append(DrawLine { + APPEND(DrawLine { .color = color, .from = from, .to = to, @@ -261,7 +263,7 @@ void DisplayListRecorder::draw_text_run(Gfx::FloatPoint baseline_start, Gfx::Gly { if (color.alpha() == 0) return; - append(DrawGlyphRun { + APPEND(DrawGlyphRun { .glyph_run = glyph_run, .scale = scale, .rect = rect, @@ -273,30 +275,30 @@ void DisplayListRecorder::draw_text_run(Gfx::FloatPoint baseline_start, Gfx::Gly void DisplayListRecorder::add_clip_rect(Gfx::IntRect const& rect) { - append(AddClipRect { rect }); + APPEND(AddClipRect { rect }); } void DisplayListRecorder::translate(Gfx::IntPoint delta) { - append(Translate { delta }); + APPEND(Translate { delta }); } void DisplayListRecorder::save() { ++m_save_nesting_level; - append(Save {}); + APPEND(Save {}); } void DisplayListRecorder::save_layer() { ++m_save_nesting_level; - append(SaveLayer {}); + APPEND(SaveLayer {}); } void DisplayListRecorder::restore() { --m_save_nesting_level; - append(Restore {}); + APPEND(Restore {}); } void DisplayListRecorder::push_scroll_frame_id(Optional id) @@ -311,7 +313,7 @@ void DisplayListRecorder::pop_scroll_frame_id() void DisplayListRecorder::push_stacking_context(PushStackingContextParams params) { - append(PushStackingContext { + APPEND(PushStackingContext { .opacity = params.opacity, .compositing_and_blending_operator = params.compositing_and_blending_operator, .isolate = params.isolate, @@ -325,14 +327,14 @@ void DisplayListRecorder::push_stacking_context(PushStackingContextParams params void DisplayListRecorder::pop_stacking_context() { - append(PopStackingContext {}); + APPEND(PopStackingContext {}); } void DisplayListRecorder::apply_backdrop_filter(Gfx::IntRect const& backdrop_region, BorderRadiiData const& border_radii_data, Gfx::Filter const& backdrop_filter) { if (backdrop_region.is_empty()) return; - append(ApplyBackdropFilter { + APPEND(ApplyBackdropFilter { .backdrop_region = backdrop_region, .border_radii_data = border_radii_data, .backdrop_filter = backdrop_filter, @@ -341,17 +343,17 @@ void DisplayListRecorder::apply_backdrop_filter(Gfx::IntRect const& backdrop_reg void DisplayListRecorder::paint_outer_box_shadow_params(PaintBoxShadowParams params) { - append(PaintOuterBoxShadow { .box_shadow_params = params }); + APPEND(PaintOuterBoxShadow { .box_shadow_params = params }); } void DisplayListRecorder::paint_inner_box_shadow_params(PaintBoxShadowParams params) { - append(PaintInnerBoxShadow { .box_shadow_params = params }); + APPEND(PaintInnerBoxShadow { .box_shadow_params = params }); } void DisplayListRecorder::paint_text_shadow(int blur_radius, Gfx::IntRect bounding_rect, Gfx::IntRect text_rect, Gfx::GlyphRun const& glyph_run, double glyph_run_scale, Color color, Gfx::FloatPoint draw_location) { - append(PaintTextShadow { + APPEND(PaintTextShadow { .glyph_run = glyph_run, .glyph_run_scale = glyph_run_scale, .shadow_bounding_rect = bounding_rect, @@ -371,7 +373,7 @@ void DisplayListRecorder::fill_rect_with_rounded_corners(Gfx::IntRect const& rec return; } - append(FillRectWithRoundedCorners { + APPEND(FillRectWithRoundedCorners { .rect = rect, .color = color, .corner_radii = { @@ -405,7 +407,7 @@ void DisplayListRecorder::draw_triangle_wave(Gfx::IntPoint a_p1, Gfx::IntPoint a { if (color.alpha() == 0) return; - append(DrawTriangleWave { + APPEND(DrawTriangleWave { .p1 = a_p1, .p2 = a_p2, .color = color, @@ -415,7 +417,7 @@ void DisplayListRecorder::draw_triangle_wave(Gfx::IntPoint a_p1, Gfx::IntPoint a void DisplayListRecorder::paint_scrollbar(int scroll_frame_id, Gfx::IntRect gutter_rect, Gfx::IntRect thumb_rect, CSSPixelFraction scroll_size, Color thumb_color, Color track_color, bool vertical) { - append(PaintScrollBar { + APPEND(PaintScrollBar { .scroll_frame_id = scroll_frame_id, .gutter_rect = gutter_rect, .thumb_rect = thumb_rect, @@ -429,26 +431,26 @@ void DisplayListRecorder::apply_opacity(float opacity) { // Implementation of this item does saveLayer(), so we need to increment the nesting level. ++m_save_nesting_level; - append(ApplyOpacity { .opacity = opacity }); + APPEND(ApplyOpacity { .opacity = opacity }); } void DisplayListRecorder::apply_compositing_and_blending_operator(Gfx::CompositingAndBlendingOperator compositing_and_blending_operator) { // Implementation of this item does saveLayer(), so we need to increment the nesting level. m_save_nesting_level++; - append(ApplyCompositeAndBlendingOperator { .compositing_and_blending_operator = compositing_and_blending_operator }); + APPEND(ApplyCompositeAndBlendingOperator { .compositing_and_blending_operator = compositing_and_blending_operator }); } void DisplayListRecorder::apply_filter(Gfx::Filter filter) { // Implementation of this item does saveLayer(), so we need to increment the nesting level. ++m_save_nesting_level; - append(ApplyFilter { .filter = move(filter) }); + APPEND(ApplyFilter { .filter = move(filter) }); } void DisplayListRecorder::apply_transform(Gfx::FloatPoint origin, Gfx::FloatMatrix4x4 matrix) { - append(ApplyTransform { + APPEND(ApplyTransform { .origin = origin, .matrix = matrix, }); @@ -456,7 +458,7 @@ void DisplayListRecorder::apply_transform(Gfx::FloatPoint origin, Gfx::FloatMatr void DisplayListRecorder::apply_mask_bitmap(Gfx::IntPoint origin, Gfx::ImmutableBitmap const& bitmap, Gfx::Bitmap::MaskKind kind) { - append(ApplyMaskBitmap { + APPEND(ApplyMaskBitmap { .origin = origin, .bitmap = bitmap, .kind = kind, diff --git a/Libraries/LibWeb/Painting/DisplayListRecorder.h b/Libraries/LibWeb/Painting/DisplayListRecorder.h index d520806e0a8..033368a3c2e 100644 --- a/Libraries/LibWeb/Painting/DisplayListRecorder.h +++ b/Libraries/LibWeb/Painting/DisplayListRecorder.h @@ -7,26 +7,30 @@ #pragma once #include -#include #include #include #include #include +#include #include #include #include #include #include #include +#include #include #include -#include -#include #include #include namespace Web::Painting { +struct StackingContextTransform { + Gfx::FloatPoint origin; + Gfx::FloatMatrix4x4 matrix; +}; + class DisplayListRecorder { AK_MAKE_NONCOPYABLE(DisplayListRecorder); AK_MAKE_NONMOVABLE(DisplayListRecorder); @@ -91,7 +95,7 @@ public: void draw_painting_surface(Gfx::IntRect const& dst_rect, NonnullRefPtr, Gfx::IntRect const& src_rect, Gfx::ScalingMode scaling_mode = Gfx::ScalingMode::NearestNeighbor); void draw_scaled_immutable_bitmap(Gfx::IntRect const& dst_rect, Gfx::IntRect const& clip_rect, Gfx::ImmutableBitmap const& bitmap, Gfx::ScalingMode scaling_mode = Gfx::ScalingMode::NearestNeighbor); - void draw_repeated_immutable_bitmap(Gfx::IntRect dst_rect, Gfx::IntRect clip_rect, NonnullRefPtr bitmap, Gfx::ScalingMode scaling_mode, DrawRepeatedImmutableBitmap::Repeat); + void draw_repeated_immutable_bitmap(Gfx::IntRect dst_rect, Gfx::IntRect clip_rect, NonnullRefPtr bitmap, Gfx::ScalingMode scaling_mode, bool repeat_x, bool repeat_y); void draw_line(Gfx::IntPoint from, Gfx::IntPoint to, Color color, int thickness = 1, Gfx::LineStyle style = Gfx::LineStyle::Solid, Color alternate_color = Color::Transparent); @@ -153,8 +157,6 @@ public: DisplayList& display_list() { return m_command_list; } - void append(Command&& command); - int m_save_nesting_level { 0 }; private: diff --git a/Libraries/LibWeb/Painting/NavigableContainerViewportPaintable.cpp b/Libraries/LibWeb/Painting/NavigableContainerViewportPaintable.cpp index 0694d169667..18247487573 100644 --- a/Libraries/LibWeb/Painting/NavigableContainerViewportPaintable.cpp +++ b/Libraries/LibWeb/Painting/NavigableContainerViewportPaintable.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff --git a/Libraries/LibWeb/Painting/StackingContext.cpp b/Libraries/LibWeb/Painting/StackingContext.cpp index 75fcac9c395..a387099a5ce 100644 --- a/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Libraries/LibWeb/Painting/StackingContext.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include