#ifndef CORE_STYLE_BACKGROUND_DATA_H_
#define CORE_STYLE_BACKGROUND_DATA_H_
#include <array>
#include <vector>
#include "base/include/flex_optional.h"
#include "base/include/value/base_value.h"
#include "core/renderer/starlight/style/css_type.h"
#include "core/renderer/starlight/types/nlength.h"
#include "core/style/color.h"
#include "core/style/default_computed_style.h"
namespace lynx {
namespace starlight {
struct BackgroundData {
struct BackgroundImageData {
uint32_t image_count{DefaultComputedStyle::DEFAULT_LONG};
bool clone_image = false;
lepus::Value image;
base::InlineVector<NLength, 1> position;
base::InlineVector<NLength, 1> size;
base::InlineVector<BackgroundRepeatType, 1> repeat;
base::InlineVector<BackgroundOriginType, 1> origin;
base::InlineVector<BackgroundClipType, 1> clip;
base::InlineVector<MaskCompositeType, 1> composite;
bool operator==(const BackgroundImageData& o) const {
return image_count == o.image_count && clone_image == o.clone_image &&
image == o.image && position == o.position && size == o.size &&
repeat == o.repeat && origin == o.origin && clip == o.clip &&
composite == o.composite;
}
bool operator!=(const BackgroundImageData& o) const {
return !(*this == o);
}
};
BackgroundData() = default;
~BackgroundData() = default;
uint32_t color{DefaultColor::DEFAULT_COLOR};
base::flex_optional<BackgroundImageData> image_data;
bool operator==(const BackgroundData& o) const {
return color == o.color && image_data == o.image_data;
}
bool operator!=(const BackgroundData& o) const { return !(*this == o); }
using AlwaysUseFlexOptionalMemSave = bool;
};
}
}
#endif