mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:47:44 +00:00
LibWeb: Keep track of CSS property source declarations
This allows us to figure out where a specific CSS property comes from, which is going to be used in a future commit to uniquely identify running animations.
This commit is contained in:
parent
279924242d
commit
b7e3a68bfc
5 changed files with 223 additions and 210 deletions
|
@ -30,17 +30,18 @@ public:
|
|||
inline void for_each_property(Callback callback) const
|
||||
{
|
||||
for (size_t i = 0; i < m_property_values.size(); ++i) {
|
||||
if (m_property_values[i])
|
||||
callback((CSS::PropertyID)i, *m_property_values[i]);
|
||||
if (m_property_values[i].has_value())
|
||||
callback((CSS::PropertyID)i, *m_property_values[i]->style);
|
||||
}
|
||||
}
|
||||
|
||||
auto& properties() { return m_property_values; }
|
||||
auto const& properties() const { return m_property_values; }
|
||||
|
||||
void set_property(CSS::PropertyID, NonnullRefPtr<StyleValue const> value);
|
||||
void set_property(CSS::PropertyID, NonnullRefPtr<StyleValue const> value, CSS::CSSStyleDeclaration const* source_declaration = nullptr);
|
||||
NonnullRefPtr<StyleValue const> property(CSS::PropertyID) const;
|
||||
RefPtr<StyleValue const> maybe_null_property(CSS::PropertyID) const;
|
||||
CSS::CSSStyleDeclaration const* property_source_declaration(CSS::PropertyID) const;
|
||||
|
||||
CSS::Size size_value(CSS::PropertyID) const;
|
||||
LengthPercentage length_percentage_or_fallback(CSS::PropertyID, LengthPercentage const& fallback) const;
|
||||
|
@ -129,7 +130,11 @@ public:
|
|||
private:
|
||||
friend class StyleComputer;
|
||||
|
||||
Array<RefPtr<StyleValue const>, to_underlying(CSS::last_property_id) + 1> m_property_values;
|
||||
struct StyleAndSourceDeclaration {
|
||||
NonnullRefPtr<StyleValue const> style;
|
||||
CSS::CSSStyleDeclaration const* declaration = nullptr;
|
||||
};
|
||||
Array<Optional<StyleAndSourceDeclaration>, to_underlying(CSS::last_property_id) + 1> m_property_values;
|
||||
Optional<CSS::Overflow> overflow(CSS::PropertyID) const;
|
||||
Vector<CSS::ShadowData> shadow(CSS::PropertyID) const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue