Skip to content

Commit 61114f6

Browse files
LibWeb: Rename PaintContext to DisplayListRecordingContext
PaintContext dates back to a time when display lists didn't exist and it truly represented "paint context". Renaming it to better align with its current role.
1 parent 1001ff2 commit 61114f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+160
-174
lines changed

Libraries/LibWeb/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,7 @@ set(SOURCES
729729
Painting/DisplayList.cpp
730730
Painting/DisplayListPlayerSkia.cpp
731731
Painting/DisplayListRecorder.cpp
732+
Painting/DisplayListRecordingContext.cpp
732733
Painting/FieldSetPaintable.cpp
733734
Painting/GradientPainting.cpp
734735
Painting/ImagePaintable.cpp
@@ -739,7 +740,6 @@ set(SOURCES
739740
Painting/Paintable.cpp
740741
Painting/PaintableBox.cpp
741742
Painting/PaintableFragment.cpp
742-
Painting/PaintContext.cpp
743743
Painting/RadioButtonPaintable.cpp
744744
Painting/ScrollFrame.cpp
745745
Painting/ScrollState.cpp

Libraries/LibWeb/CSS/StyleValues/AbstractImageStyleValue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class AbstractImageStyleValue : public CSSStyleValue {
3737
virtual void resolve_for_size(Layout::NodeWithStyle const&, CSSPixelSize) const { }
3838

3939
virtual bool is_paintable() const = 0;
40-
virtual void paint(PaintContext& context, DevicePixelRect const& dest_rect, ImageRendering) const = 0;
40+
virtual void paint(DisplayListRecordingContext& context, DevicePixelRect const& dest_rect, ImageRendering) const = 0;
4141

4242
virtual Optional<Gfx::Color> color_if_single_pixel_bitmap() const { return {}; }
4343
};

Libraries/LibWeb/CSS/StyleValues/ConicGradientStyleValue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void ConicGradientStyleValue::resolve_for_size(Layout::NodeWithStyle const& node
5656
m_resolved->position = m_properties.position->resolved(node, CSSPixelRect { { 0, 0 }, size });
5757
}
5858

59-
void ConicGradientStyleValue::paint(PaintContext& context, DevicePixelRect const& dest_rect, CSS::ImageRendering) const
59+
void ConicGradientStyleValue::paint(DisplayListRecordingContext& context, DevicePixelRect const& dest_rect, CSS::ImageRendering) const
6060
{
6161
VERIFY(m_resolved.has_value());
6262
auto destination_rect = dest_rect.to_type<int>();

Libraries/LibWeb/CSS/StyleValues/ConicGradientStyleValue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class ConicGradientStyleValue final : public AbstractImageStyleValue {
2626

2727
virtual String to_string(SerializationMode) const override;
2828

29-
void paint(PaintContext&, DevicePixelRect const& dest_rect, CSS::ImageRendering) const override;
29+
void paint(DisplayListRecordingContext&, DevicePixelRect const& dest_rect, CSS::ImageRendering) const override;
3030

3131
virtual bool equals(CSSStyleValue const& other) const override;
3232

Libraries/LibWeb/CSS/StyleValues/CursorStyleValue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Optional<Gfx::ImageCursor> CursorStyleValue::make_image_cursor(Layout::NodeWithS
8484
// Paint the cursor into a bitmap.
8585
auto display_list = Painting::DisplayList::create(document.page().client().device_pixels_per_css_pixel());
8686
Painting::DisplayListRecorder display_list_recorder(display_list);
87-
PaintContext paint_context { display_list_recorder, document.page().palette(), document.page().client().device_pixels_per_css_pixel() };
87+
DisplayListRecordingContext paint_context { display_list_recorder, document.page().palette(), document.page().client().device_pixels_per_css_pixel() };
8888

8989
image.resolve_for_size(layout_node, CSSPixelSize { bitmap.size() });
9090
image.paint(paint_context, DevicePixelRect { bitmap.rect() }, ImageRendering::Auto);

Libraries/LibWeb/CSS/StyleValues/ImageStyleValue.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <LibWeb/HTML/PotentialCORSRequest.h>
1717
#include <LibWeb/HTML/SharedResourceRequest.h>
1818
#include <LibWeb/Painting/DisplayListRecorder.h>
19-
#include <LibWeb/Painting/PaintContext.h>
19+
#include <LibWeb/Painting/DisplayListRecordingContext.h>
2020
#include <LibWeb/Platform/Timer.h>
2121

2222
namespace Web::CSS {
@@ -150,7 +150,7 @@ Optional<CSSPixelFraction> ImageStyleValue::natural_aspect_ratio() const
150150
return {};
151151
}
152152

153-
void ImageStyleValue::paint(PaintContext& context, DevicePixelRect const& dest_rect, CSS::ImageRendering image_rendering) const
153+
void ImageStyleValue::paint(DisplayListRecordingContext& context, DevicePixelRect const& dest_rect, CSS::ImageRendering image_rendering) const
154154
{
155155
if (auto const* b = bitmap(m_current_frame_index, dest_rect.size().to_type<int>()); b != nullptr) {
156156
auto scaling_mode = to_gfx_scaling_mode(image_rendering, b->rect(), dest_rect.to_type<int>());

Libraries/LibWeb/CSS/StyleValues/ImageStyleValue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ImageStyleValue final
5252
Optional<CSSPixelFraction> natural_aspect_ratio() const override;
5353

5454
virtual bool is_paintable() const override;
55-
void paint(PaintContext& context, DevicePixelRect const& dest_rect, CSS::ImageRendering image_rendering) const override;
55+
void paint(DisplayListRecordingContext& context, DevicePixelRect const& dest_rect, CSS::ImageRendering image_rendering) const override;
5656

5757
virtual Optional<Gfx::Color> color_if_single_pixel_bitmap() const override;
5858
Gfx::ImmutableBitmap const* current_frame_bitmap(DevicePixelRect const& dest_rect) const;

Libraries/LibWeb/CSS/StyleValues/LinearGradientStyleValue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ void LinearGradientStyleValue::resolve_for_size(Layout::NodeWithStyle const& nod
131131
}
132132
}
133133

134-
void LinearGradientStyleValue::paint(PaintContext& context, DevicePixelRect const& dest_rect, CSS::ImageRendering) const
134+
void LinearGradientStyleValue::paint(DisplayListRecordingContext& context, DevicePixelRect const& dest_rect, CSS::ImageRendering) const
135135
{
136136
VERIFY(m_resolved.has_value());
137137
context.display_list_recorder().fill_rect_with_linear_gradient(dest_rect.to_type<int>(), m_resolved.value());

Libraries/LibWeb/CSS/StyleValues/LinearGradientStyleValue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class LinearGradientStyleValue final : public AbstractImageStyleValue {
7373
void resolve_for_size(Layout::NodeWithStyle const&, CSSPixelSize) const override;
7474

7575
bool is_paintable() const override { return true; }
76-
void paint(PaintContext& context, DevicePixelRect const& dest_rect, CSS::ImageRendering image_rendering) const override;
76+
void paint(DisplayListRecordingContext& context, DevicePixelRect const& dest_rect, CSS::ImageRendering image_rendering) const override;
7777

7878
private:
7979
LinearGradientStyleValue(GradientDirection direction, Vector<LinearColorStopListElement> color_stop_list, GradientType type, GradientRepeating repeating, Optional<InterpolationMethod> interpolation_method, ColorSyntax color_syntax)

Libraries/LibWeb/CSS/StyleValues/RadialGradientStyleValue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ bool RadialGradientStyleValue::equals(CSSStyleValue const& other) const
246246
return m_properties == other_gradient.m_properties;
247247
}
248248

249-
void RadialGradientStyleValue::paint(PaintContext& context, DevicePixelRect const& dest_rect, CSS::ImageRendering) const
249+
void RadialGradientStyleValue::paint(DisplayListRecordingContext& context, DevicePixelRect const& dest_rect, CSS::ImageRendering) const
250250
{
251251
VERIFY(m_resolved.has_value());
252252
auto center = context.rounded_device_point(m_resolved->center).to_type<int>();

0 commit comments

Comments
 (0)