From 3645b676fb3923d4417dcc25f9159c37b1251fcc Mon Sep 17 00:00:00 2001 From: Arthur Grillo Date: Wed, 10 Apr 2024 16:21:02 -0300 Subject: [PATCH] LibWeb: Remove `RecordingPainter::paint_frame()` PaintFrame is not primitive painting command, we inherited from OS, that is hard to replicate in GPU-painter or alternative CPU-painter API. We should remove it as a part of refactoring towards simplifying recording painter commands set. Fixes: #23796 --- Tests/LibWeb/Ref/alt-frame.html | 3 +++ Tests/LibWeb/Ref/reference/alt-frame.html | 9 +++++++++ Tests/LibWeb/Ref/reference/images/alt-frame.png | Bin 0 -> 5093 bytes Userland/Libraries/LibWeb/Painting/Command.h | 11 ----------- .../LibWeb/Painting/CommandExecutorCPU.cpp | 6 ------ .../LibWeb/Painting/CommandExecutorCPU.h | 1 - .../LibWeb/Painting/CommandExecutorGPU.cpp | 6 ------ .../LibWeb/Painting/CommandExecutorGPU.h | 1 - .../Libraries/LibWeb/Painting/CommandList.cpp | 3 --- Userland/Libraries/LibWeb/Painting/CommandList.h | 1 - .../Libraries/LibWeb/Painting/ImagePaintable.cpp | 2 +- .../LibWeb/Painting/RecordingPainter.cpp | 5 ----- .../Libraries/LibWeb/Painting/RecordingPainter.h | 2 -- 13 files changed, 13 insertions(+), 37 deletions(-) create mode 100644 Tests/LibWeb/Ref/alt-frame.html create mode 100644 Tests/LibWeb/Ref/reference/alt-frame.html create mode 100644 Tests/LibWeb/Ref/reference/images/alt-frame.png diff --git a/Tests/LibWeb/Ref/alt-frame.html b/Tests/LibWeb/Ref/alt-frame.html new file mode 100644 index 00000000000..838ed9670cd --- /dev/null +++ b/Tests/LibWeb/Ref/alt-frame.html @@ -0,0 +1,3 @@ + + +Hello!! diff --git a/Tests/LibWeb/Ref/reference/alt-frame.html b/Tests/LibWeb/Ref/reference/alt-frame.html new file mode 100644 index 00000000000..812f789753c --- /dev/null +++ b/Tests/LibWeb/Ref/reference/alt-frame.html @@ -0,0 +1,9 @@ + + diff --git a/Tests/LibWeb/Ref/reference/images/alt-frame.png b/Tests/LibWeb/Ref/reference/images/alt-frame.png new file mode 100644 index 0000000000000000000000000000000000000000..f06dd99aa50c8b9e1a9d6f29e44cb1af30fc6b4d GIT binary patch literal 5093 zcmeAS@N?(olHy`uVBq!ia0y~yU{+vYV2a>iV_;yIRn}C%z#zQF)5S5Q;?|qH8+jWH zcw8OrlKxNaz0trX{%5z9Z_HEAX_IEoWM*JUIGD-8z|g?J$iTqDfsOGY{`zcZPp$UH z-69MO5quNW?V{u#oh@f)XwZ*1xai#3b+WG|L|hVO{^u-qQPr|4@sicD@|wHCrPb@D z;0ukZURGLOT2r*V<~_1`r!UGBC0*Ffbgr%xZJ~^S)RCju!`o&ZZg9^;2&>oOm^B>+GF>>(+m*dVB0@ zR_MZj7cZyhn9cT55qed&d*9dmcYF*C3=d8+E{R*8Z6l{W|9tk&n0u|0y_P;Yw)(2q z&X{)(7wS##F55j<`u4no2?5{Qz3Je&FFLv_UD3oM~Oqf8gU*HL%C@MI5Z=_Hna)i@N-=Vh=alwXFu1Uxqv_`YC0!=5*rv zyqlMq+}B^<-6r-r;KrQVHID-|L}J*V7Bg(zt3J8&^}ZWczvq_iUhB5Fu(++n>g~7p z-+%8jWn?+9|J%8HvWHAIxhBfk=a^-xYB-3x%PwGG4OP%Ss95;m03%mGgZ8@8qm4}A z1r{r`xdPU*u&y?5oxl~4XWetfw9{rmUZwrxw>y?b}q+OW6({@wfb{rlTjuTH%`fByXKPoIj; zTiw2W+cx{o-Mf(+Bfgy9yJydhH*eN#jnch+=gyXsCq1q0?ELJkt*mDK>504!ifXpU z<@RD1+w52ba{q}6IR$VWw^(3fXZP#pks~czZ|7Fm)_yhExN+md?_8};&z?ViZSh9q zgp8bA)aILC7#2AcS5;+MTU&cNbTPaCk^-d`0oDmKnp&D%IaF`G(B?U!r>{Tx^XJdS z_N#&xak*J#EMa!Hn$V)vapue!6-JfVk0-c%K(1&rXgD(a@8ZSE`3t*3wWgj~<+1$o z#}5k*EK&&6o4)tgL{XD{lT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h6H`0gS9aorR0eWfi|dlh!0VQKd99!v`xN& olu~2QC6o|d1Zhy?Yj-{4+V?Gpainter(); diff --git a/Userland/Libraries/LibWeb/Painting/CommandExecutorCPU.h b/Userland/Libraries/LibWeb/Painting/CommandExecutorCPU.h index 333d0a6394d..1115f08c09f 100644 --- a/Userland/Libraries/LibWeb/Painting/CommandExecutorCPU.h +++ b/Userland/Libraries/LibWeb/Painting/CommandExecutorCPU.h @@ -35,7 +35,6 @@ public: CommandResult fill_ellipse(Gfx::IntRect const& rect, Color const& color, Gfx::AntiAliasingPainter::BlendMode blend_mode) override; CommandResult draw_line(Color const&, Gfx::IntPoint const& from, Gfx::IntPoint const& to, int thickness, Gfx::Painter::LineStyle style, Color const& alternate_color) override; CommandResult draw_signed_distance_field(Gfx::IntRect const& rect, Color const&, Gfx::GrayscaleBitmap const& sdf, float smoothing) override; - CommandResult paint_frame(Gfx::IntRect const& rect, Palette const&, Gfx::FrameStyle) override; CommandResult apply_backdrop_filter(Gfx::IntRect const& backdrop_region, Web::CSS::ResolvedBackdropFilter const& backdrop_filter) override; CommandResult draw_rect(Gfx::IntRect const& rect, Color const&, bool rough) override; CommandResult paint_radial_gradient(Gfx::IntRect const& rect, Web::Painting::RadialGradientData const& radial_gradient_data, Gfx::IntPoint const& center, Gfx::IntSize const& size, Vector const& clip_paths = {}) override; diff --git a/Userland/Libraries/LibWeb/Painting/CommandExecutorGPU.cpp b/Userland/Libraries/LibWeb/Painting/CommandExecutorGPU.cpp index e21c64df6d4..43b409672b1 100644 --- a/Userland/Libraries/LibWeb/Painting/CommandExecutorGPU.cpp +++ b/Userland/Libraries/LibWeb/Painting/CommandExecutorGPU.cpp @@ -272,12 +272,6 @@ CommandResult CommandExecutorGPU::draw_signed_distance_field(Gfx::IntRect const& return CommandResult::Continue; } -CommandResult CommandExecutorGPU::paint_frame(Gfx::IntRect const&, Palette const&, Gfx::FrameStyle) -{ - // FIXME - return CommandResult::Continue; -} - CommandResult CommandExecutorGPU::apply_backdrop_filter(Gfx::IntRect const&, Web::CSS::ResolvedBackdropFilter const&) { // FIXME diff --git a/Userland/Libraries/LibWeb/Painting/CommandExecutorGPU.h b/Userland/Libraries/LibWeb/Painting/CommandExecutorGPU.h index 8a09d52ab08..60689549292 100644 --- a/Userland/Libraries/LibWeb/Painting/CommandExecutorGPU.h +++ b/Userland/Libraries/LibWeb/Painting/CommandExecutorGPU.h @@ -36,7 +36,6 @@ public: CommandResult fill_ellipse(Gfx::IntRect const& rect, Color const& color, Gfx::AntiAliasingPainter::BlendMode blend_mode) override; CommandResult draw_line(Color const&, Gfx::IntPoint const& from, Gfx::IntPoint const& to, int thickness, Gfx::Painter::LineStyle style, Color const& alternate_color) override; CommandResult draw_signed_distance_field(Gfx::IntRect const& rect, Color const&, Gfx::GrayscaleBitmap const& sdf, float smoothing) override; - CommandResult paint_frame(Gfx::IntRect const& rect, Palette const&, Gfx::FrameStyle) override; CommandResult apply_backdrop_filter(Gfx::IntRect const& backdrop_region, Web::CSS::ResolvedBackdropFilter const& backdrop_filter) override; CommandResult draw_rect(Gfx::IntRect const& rect, Color const&, bool rough) override; CommandResult paint_radial_gradient(Gfx::IntRect const& rect, Web::Painting::RadialGradientData const& radial_gradient_data, Gfx::IntPoint const& center, Gfx::IntSize const& size, Vector const& clip_paths = {}) override; diff --git a/Userland/Libraries/LibWeb/Painting/CommandList.cpp b/Userland/Libraries/LibWeb/Painting/CommandList.cpp index 7bc14df9673..360537f8fcb 100644 --- a/Userland/Libraries/LibWeb/Painting/CommandList.cpp +++ b/Userland/Libraries/LibWeb/Painting/CommandList.cpp @@ -183,9 +183,6 @@ void CommandList::execute(CommandExecutor& executor) return executor.draw_signed_distance_field(command.rect, command.color, command.sdf, command.smoothing); }, - [&](PaintFrame const& command) { - return executor.paint_frame(command.rect, command.palette, command.style); - }, [&](ApplyBackdropFilter const& command) { return executor.apply_backdrop_filter(command.backdrop_region, command.backdrop_filter); }, diff --git a/Userland/Libraries/LibWeb/Painting/CommandList.h b/Userland/Libraries/LibWeb/Painting/CommandList.h index d06569eaf6c..9f08ad5d35a 100644 --- a/Userland/Libraries/LibWeb/Painting/CommandList.h +++ b/Userland/Libraries/LibWeb/Painting/CommandList.h @@ -77,7 +77,6 @@ public: virtual CommandResult fill_ellipse(Gfx::IntRect const&, Color const&, Gfx::AntiAliasingPainter::BlendMode blend_mode) = 0; virtual CommandResult draw_line(Color const& color, Gfx::IntPoint const& from, Gfx::IntPoint const& to, int thickness, Gfx::Painter::LineStyle, Color const& alternate_color) = 0; virtual CommandResult draw_signed_distance_field(Gfx::IntRect const& rect, Color const&, Gfx::GrayscaleBitmap const&, float smoothing) = 0; - virtual CommandResult paint_frame(Gfx::IntRect const& rect, Palette const&, Gfx::FrameStyle) = 0; virtual CommandResult apply_backdrop_filter(Gfx::IntRect const& backdrop_region, Web::CSS::ResolvedBackdropFilter const& backdrop_filter) = 0; virtual CommandResult draw_rect(Gfx::IntRect const& rect, Color const&, bool rough) = 0; virtual CommandResult draw_triangle_wave(Gfx::IntPoint const& p1, Gfx::IntPoint const& p2, Color const& color, int amplitude, int thickness) = 0; diff --git a/Userland/Libraries/LibWeb/Painting/ImagePaintable.cpp b/Userland/Libraries/LibWeb/Painting/ImagePaintable.cpp index 1fd5ac5d1a3..d905646d89a 100644 --- a/Userland/Libraries/LibWeb/Painting/ImagePaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/ImagePaintable.cpp @@ -66,7 +66,7 @@ void ImagePaintable::paint(PaintContext& context, PaintPhase phase) const auto image_rect = context.rounded_device_rect(absolute_rect()); if (m_renders_as_alt_text) { auto enclosing_rect = context.enclosing_device_rect(absolute_rect()).to_type(); - context.recording_painter().paint_frame(enclosing_rect, context.palette(), Gfx::FrameStyle::SunkenContainer); + context.recording_painter().draw_rect(enclosing_rect, Gfx::Color::Black, 1); context.recording_painter().draw_text(enclosing_rect, m_alt_text, Platform::FontPlugin::the().default_font(), Gfx::TextAlignment::Center, computed_values().color(), Gfx::TextElision::Right); } else if (auto bitmap = m_image_provider.current_image_bitmap(image_rect.size().to_type())) { ScopedCornerRadiusClip corner_clip { context, image_rect, normalized_border_radii_data(ShrinkRadiiForBorders::Yes) }; diff --git a/Userland/Libraries/LibWeb/Painting/RecordingPainter.cpp b/Userland/Libraries/LibWeb/Painting/RecordingPainter.cpp index 4cf9f738832..e0c4c0b7743 100644 --- a/Userland/Libraries/LibWeb/Painting/RecordingPainter.cpp +++ b/Userland/Libraries/LibWeb/Painting/RecordingPainter.cpp @@ -290,11 +290,6 @@ void RecordingPainter::pop_stacking_context() append(PopStackingContext {}); } -void RecordingPainter::paint_frame(Gfx::IntRect rect, Palette palette, Gfx::FrameStyle style) -{ - append(PaintFrame { state().translation.map(rect), palette, style }); -} - void RecordingPainter::apply_backdrop_filter(Gfx::IntRect const& backdrop_region, BorderRadiiData const& border_radii_data, CSS::ResolvedBackdropFilter const& backdrop_filter) { append(ApplyBackdropFilter { diff --git a/Userland/Libraries/LibWeb/Painting/RecordingPainter.h b/Userland/Libraries/LibWeb/Painting/RecordingPainter.h index 16d743a6d32..5119d78b3bf 100644 --- a/Userland/Libraries/LibWeb/Painting/RecordingPainter.h +++ b/Userland/Libraries/LibWeb/Painting/RecordingPainter.h @@ -129,8 +129,6 @@ public: void sample_under_corners(u32 id, CornerRadii corner_radii, Gfx::IntRect border_rect, CornerClip corner_clip); void blit_corner_clipping(u32 id, Gfx::IntRect border_rect); - void paint_frame(Gfx::IntRect rect, Palette palette, Gfx::FrameStyle style); - void apply_backdrop_filter(Gfx::IntRect const& backdrop_region, BorderRadiiData const& border_radii_data, CSS::ResolvedBackdropFilter const& backdrop_filter); void paint_outer_box_shadow_params(PaintOuterBoxShadowParams params);