LibWeb: Add fast path to calculate invalidations for animated css props

- Compare only the animated properties
- Clone only the hash map containing animated properties, instead of
  the entire StyleProperties.

Reduces `KeyframeEffect::update_style_properties()` from 10% to 3% in
GitHub profiles.
This commit is contained in:
Aliaksandr Kalenik 2024-03-19 12:02:06 +01:00 committed by Andreas Kling
commit cf7c933312
Notes: sideshowbarker 2024-07-16 22:16:50 +09:00
9 changed files with 132 additions and 84 deletions

View file

@ -23,8 +23,6 @@ public:
static NonnullRefPtr<StyleProperties> create() { return adopt_ref(*new StyleProperties); }
NonnullRefPtr<StyleProperties> clone() const;
template<typename Callback>
inline void for_each_property(Callback callback) const
{
@ -55,6 +53,7 @@ public:
auto& properties() { return m_property_values; }
auto const& properties() const { return m_property_values; }
HashMap<CSS::PropertyID, NonnullRefPtr<StyleValue const>> const& animated_property_values() const { return m_animated_property_values; }
void reset_animated_properties();
bool is_property_important(CSS::PropertyID property_id) const;
@ -182,6 +181,8 @@ public:
static NonnullRefPtr<Gfx::Font const> font_fallback(bool monospace, bool bold);
static float resolve_opacity_value(CSS::StyleValue const& value);
private:
friend class StyleComputer;