summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/ComputedValues.h
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2021-11-12 12:11:01 +0000
committerAndreas Kling <kling@serenityos.org>2021-11-17 22:20:01 +0100
commitcdeac132dca9bacdaed2ce9f49751c71830f5a19 (patch)
tree71dc13ef28f9aa0b87d83adf326be144fbda2ef1 /Userland/Libraries/LibWeb/CSS/ComputedValues.h
parent64d805a027f3ae7bdd6a29ae1f7bf9bbf72fd1fa (diff)
downloadserenity-cdeac132dca9bacdaed2ce9f49751c71830f5a19.zip
LibWeb: Store background layers in ComputedValues
Instead of storing these as individual `background-foo` properties, we combine them together into layers, since that is how they will be painted. It also makes it more convenient to pass them around.
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/ComputedValues.h')
-rw-r--r--Userland/Libraries/LibWeb/CSS/ComputedValues.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/ComputedValues.h b/Userland/Libraries/LibWeb/CSS/ComputedValues.h
index a15f1cec15..b72172b2e1 100644
--- a/Userland/Libraries/LibWeb/CSS/ComputedValues.h
+++ b/Userland/Libraries/LibWeb/CSS/ComputedValues.h
@@ -39,6 +39,12 @@ public:
static float opacity() { return 1.0f; }
};
+struct BackgroundLayerData {
+ RefPtr<CSS::ImageStyleValue> image;
+ CSS::Repeat repeat_x;
+ CSS::Repeat repeat_y;
+};
+
struct BorderData {
public:
Color color { Color::Transparent };
@@ -119,6 +125,7 @@ public:
Color color() const { return m_inherited.color; }
Color background_color() const { return m_noninherited.background_color; }
+ Vector<BackgroundLayerData> const& background_layers() const { return m_noninherited.background_layers; }
BackgroundRepeatData background_repeat() const { return m_noninherited.background_repeat; }
CSS::ListStyleType list_style_type() const { return m_inherited.list_style_type; }
@@ -176,6 +183,7 @@ protected:
Length border_top_left_radius;
Length border_top_right_radius;
Color background_color { InitialValues::background_color() };
+ Vector<BackgroundLayerData> background_layers;
BackgroundRepeatData background_repeat { InitialValues::background_repeat(), InitialValues::background_repeat() };
CSS::FlexDirection flex_direction { InitialValues::flex_direction() };
CSS::FlexWrap flex_wrap { InitialValues::flex_wrap() };
@@ -203,6 +211,7 @@ public:
void set_pointer_events(CSS::PointerEvents value) { m_inherited.pointer_events = value; }
void set_background_color(const Color& color) { m_noninherited.background_color = color; }
void set_background_repeat(BackgroundRepeatData repeat) { m_noninherited.background_repeat = repeat; }
+ void set_background_layers(Vector<BackgroundLayerData>&& layers) { m_noninherited.background_layers = move(layers); }
void set_float(CSS::Float value) { m_noninherited.float_ = value; }
void set_clear(CSS::Clear value) { m_noninherited.clear = value; }
void set_z_index(Optional<int> value) { m_noninherited.z_index = value; }