mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
LibWeb: Add AnimationEffect::target_properties()
This commit is contained in:
parent
10fddb99fc
commit
ee4abacde6
2 changed files with 9 additions and 3 deletions
|
@ -141,6 +141,8 @@ public:
|
|||
Optional<double> current_iteration() const;
|
||||
Optional<double> transformed_progress() const;
|
||||
|
||||
HashTable<CSS::PropertyID> const& target_properties() const { return m_target_properties; }
|
||||
|
||||
virtual DOM::Element* target() const { return {}; }
|
||||
virtual bool is_keyframe_effect() const { return false; }
|
||||
|
||||
|
@ -183,6 +185,10 @@ protected:
|
|||
// Used for calculating transitions in StyleComputer
|
||||
Phase m_previous_phase { Phase::Idle };
|
||||
double m_previous_current_iteration { 0.0 };
|
||||
|
||||
// https://www.w3.org/TR/web-animations-1/#target-property
|
||||
// Note: Only modified by child classes
|
||||
HashTable<CSS::PropertyID> m_target_properties;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -817,7 +817,7 @@ WebIDL::ExceptionOr<void> KeyframeEffect::set_keyframes(Optional<JS::Handle<JS::
|
|||
compute_missing_keyframe_offsets(m_keyframes);
|
||||
|
||||
auto keyframe_set = adopt_ref(*new KeyFrameSet);
|
||||
HashTable<CSS::PropertyID> animated_properties;
|
||||
m_target_properties.clear();
|
||||
|
||||
for (auto& keyframe : m_keyframes) {
|
||||
Animations::KeyframeEffect::KeyFrameSet::ResolvedKeyFrame resolved_keyframe;
|
||||
|
@ -825,14 +825,14 @@ WebIDL::ExceptionOr<void> KeyframeEffect::set_keyframes(Optional<JS::Handle<JS::
|
|||
auto key = static_cast<u64>(keyframe.computed_offset.value() * 100 * AnimationKeyFrameKeyScaleFactor);
|
||||
|
||||
for (auto const& [property_id, property_value] : keyframe.parsed_properties()) {
|
||||
animated_properties.set(property_id);
|
||||
m_target_properties.set(property_id);
|
||||
resolved_keyframe.resolved_properties.set(property_id, property_value);
|
||||
}
|
||||
|
||||
keyframe_set->keyframes_by_key.insert(key, resolved_keyframe);
|
||||
}
|
||||
|
||||
generate_initial_and_final_frames(keyframe_set, animated_properties);
|
||||
generate_initial_and_final_frames(keyframe_set, m_target_properties);
|
||||
m_key_frame_set = keyframe_set;
|
||||
|
||||
return {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue