mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +00:00
LibWeb: Lazily allocate data required to run CSS animations
Some checks are pending
Push notes / build (push) Waiting to run
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Some checks are pending
Push notes / build (push) Waiting to run
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Instead of reserving space for data required to run animations in every DOM element, we now allocate it lazily only if element actually has some animations. This allows us to save 336 bytes on non-animated DOM elements.
This commit is contained in:
parent
6b6d3b32a4
commit
6b9e8cf40c
Notes:
github-actions[bot]
2025-03-24 23:16:28 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 6b9e8cf40c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4072
2 changed files with 99 additions and 43 deletions
|
@ -53,8 +53,8 @@ public:
|
|||
GC::Ptr<Animations::Animation> cached_animation_name_animation(Optional<CSS::PseudoElement>) const;
|
||||
void set_cached_animation_name_animation(GC::Ptr<Animations::Animation> value, Optional<CSS::PseudoElement>);
|
||||
|
||||
GC::Ptr<CSS::CSSStyleDeclaration const> cached_transition_property_source() const { return m_cached_transition_property_source; }
|
||||
void set_cached_transition_property_source(GC::Ptr<CSS::CSSStyleDeclaration const> value) { m_cached_transition_property_source = value; }
|
||||
GC::Ptr<CSS::CSSStyleDeclaration const> cached_transition_property_source() const;
|
||||
void set_cached_transition_property_source(GC::Ptr<CSS::CSSStyleDeclaration const> value);
|
||||
|
||||
void add_transitioned_properties(Vector<Vector<CSS::PropertyID>> properties, CSS::StyleValueVector delays, CSS::StyleValueVector durations, CSS::StyleValueVector timing_functions);
|
||||
Optional<TransitionAttributes const&> property_transition_attributes(CSS::PropertyID) const;
|
||||
|
@ -67,16 +67,21 @@ protected:
|
|||
void visit_edges(JS::Cell::Visitor&);
|
||||
|
||||
private:
|
||||
Vector<GC::Ref<Animation>> m_associated_animations;
|
||||
bool m_is_sorted_by_composite_order { true };
|
||||
struct Impl {
|
||||
Vector<GC::Ref<Animation>> associated_animations;
|
||||
bool is_sorted_by_composite_order { true };
|
||||
|
||||
Array<GC::Ptr<CSS::CSSStyleDeclaration const>, to_underlying(CSS::PseudoElement::KnownPseudoElementCount) + 1> m_cached_animation_name_source;
|
||||
Array<GC::Ptr<Animations::Animation>, to_underlying(CSS::PseudoElement::KnownPseudoElementCount) + 1> m_cached_animation_name_animation;
|
||||
Array<GC::Ptr<CSS::CSSStyleDeclaration const>, to_underlying(CSS::PseudoElement::KnownPseudoElementCount) + 1> cached_animation_name_source;
|
||||
Array<GC::Ptr<Animation>, to_underlying(CSS::PseudoElement::KnownPseudoElementCount) + 1> cached_animation_name_animation;
|
||||
|
||||
HashMap<CSS::PropertyID, size_t> m_transition_attribute_indices;
|
||||
Vector<TransitionAttributes> m_transition_attributes;
|
||||
GC::Ptr<CSS::CSSStyleDeclaration const> m_cached_transition_property_source;
|
||||
HashMap<CSS::PropertyID, GC::Ref<CSS::CSSTransition>> m_associated_transitions;
|
||||
HashMap<CSS::PropertyID, size_t> transition_attribute_indices;
|
||||
Vector<TransitionAttributes> transition_attributes;
|
||||
GC::Ptr<CSS::CSSStyleDeclaration const> cached_transition_property_source;
|
||||
HashMap<CSS::PropertyID, GC::Ref<CSS::CSSTransition>> associated_transitions;
|
||||
};
|
||||
Impl& ensure_impl();
|
||||
|
||||
OwnPtr<Impl> m_impl;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue