1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:37:35 +00:00

LibWeb: Convert images to common AbstractImageStyleValue base

This commit moves both the ImageStyleValue and LinearGradientStyleValue
to a common base class of AbstractImageStyleValue. This abstracts
getting the natural_width/height, loading/resolving, and painting
the image.

Now for 'free' you get:

 - Linear gradients working with the various background sizing/repeat
   properties.
 - Linear gradients working as list-markers :^) -- best feature ever!

P.s. This commit is a little large as it's tricky to make this change
incrementally without breaking things.
This commit is contained in:
MacDue 2022-07-31 01:11:59 +01:00 committed by Andreas Kling
parent 264543b90a
commit 6a6475673f
13 changed files with 140 additions and 70 deletions

View file

@ -166,7 +166,7 @@ public:
Gfx::Font const& font() const { return *m_font; }
float line_height() const { return m_line_height; }
Vector<CSS::BackgroundLayerData> const& background_layers() const { return computed_values().background_layers(); }
const CSS::ImageStyleValue* list_style_image() const { return m_list_style_image; }
const CSS::AbstractImageStyleValue* list_style_image() const { return m_list_style_image; }
NonnullRefPtr<NodeWithStyle> create_anonymous_wrapper() const;
@ -180,7 +180,7 @@ private:
CSS::ComputedValues m_computed_values;
RefPtr<Gfx::Font> m_font;
float m_line_height { 0 };
RefPtr<CSS::ImageStyleValue> m_list_style_image;
RefPtr<CSS::AbstractImageStyleValue> m_list_style_image;
};
class NodeWithStyleAndBoxModelMetrics : public NodeWithStyle {