mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-20 16:28:54 +00:00
LibWeb: Take AbstractElement in start_a_transition()
This commit is contained in:
parent
e6bb0ab000
commit
524a161a51
Notes:
github-actions[bot]
2025-09-11 16:46:43 +00:00
Author: https://github.com/AtkinsSJ
Commit: 524a161a51
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6118
3 changed files with 14 additions and 14 deletions
|
@ -19,12 +19,12 @@ namespace Web::CSS {
|
|||
|
||||
GC_DEFINE_ALLOCATOR(CSSTransition);
|
||||
|
||||
GC::Ref<CSSTransition> CSSTransition::start_a_transition(DOM::Element& element, Optional<PseudoElement> pseudo_element, PropertyID property_id,
|
||||
GC::Ref<CSSTransition> CSSTransition::start_a_transition(DOM::AbstractElement abstract_element, PropertyID property_id,
|
||||
size_t transition_generation, double delay, double start_time, double end_time, NonnullRefPtr<StyleValue const> start_value,
|
||||
NonnullRefPtr<StyleValue const> end_value, NonnullRefPtr<StyleValue const> reversing_adjusted_start_value, double reversing_shortening_factor)
|
||||
{
|
||||
auto& realm = element.realm();
|
||||
return realm.create<CSSTransition>(realm, element, pseudo_element, property_id, transition_generation, delay, start_time, end_time, start_value, end_value, reversing_adjusted_start_value, reversing_shortening_factor);
|
||||
auto& realm = abstract_element.element().realm();
|
||||
return realm.create<CSSTransition>(realm, abstract_element, property_id, transition_generation, delay, start_time, end_time, start_value, end_value, reversing_adjusted_start_value, reversing_shortening_factor);
|
||||
}
|
||||
|
||||
Animations::AnimationClass CSSTransition::animation_class() const
|
||||
|
@ -75,7 +75,7 @@ Optional<int> CSSTransition::class_specific_composite_order(GC::Ref<Animations::
|
|||
return {};
|
||||
}
|
||||
|
||||
CSSTransition::CSSTransition(JS::Realm& realm, DOM::Element& element, Optional<PseudoElement> pseudo_element, PropertyID property_id, size_t transition_generation,
|
||||
CSSTransition::CSSTransition(JS::Realm& realm, DOM::AbstractElement abstract_element, PropertyID property_id, size_t transition_generation,
|
||||
double delay, double start_time, double end_time, NonnullRefPtr<StyleValue const> start_value, NonnullRefPtr<StyleValue const> end_value,
|
||||
NonnullRefPtr<StyleValue const> reversing_adjusted_start_value, double reversing_shortening_factor)
|
||||
: Animations::Animation(realm)
|
||||
|
@ -96,12 +96,12 @@ CSSTransition::CSSTransition(JS::Realm& realm, DOM::Element& element, Optional<P
|
|||
// that have been disassociated from their owning element but are still idle do not have a defined composite order.
|
||||
|
||||
// Construct a KeyframesEffect for our animation
|
||||
m_keyframe_effect->set_target(&element);
|
||||
if (pseudo_element.has_value())
|
||||
m_keyframe_effect->set_pseudo_element(Selector::PseudoElementSelector { pseudo_element.value() });
|
||||
m_keyframe_effect->set_target(&abstract_element.element());
|
||||
if (abstract_element.pseudo_element().has_value())
|
||||
m_keyframe_effect->set_pseudo_element(Selector::PseudoElementSelector { abstract_element.pseudo_element().value() });
|
||||
m_keyframe_effect->set_start_delay(delay);
|
||||
m_keyframe_effect->set_iteration_duration(end_time - start_time);
|
||||
m_keyframe_effect->set_timing_function(element.property_transition_attributes(pseudo_element, property_id)->timing_function);
|
||||
m_keyframe_effect->set_timing_function(abstract_element.element().property_transition_attributes(abstract_element.pseudo_element(), property_id)->timing_function);
|
||||
|
||||
auto key_frame_set = adopt_ref(*new Animations::KeyframeEffect::KeyFrameSet);
|
||||
Animations::KeyframeEffect::KeyFrameSet::ResolvedKeyFrame initial_keyframe;
|
||||
|
@ -114,10 +114,10 @@ CSSTransition::CSSTransition(JS::Realm& realm, DOM::Element& element, Optional<P
|
|||
key_frame_set->keyframes_by_key.insert(100 * Animations::KeyframeEffect::AnimationKeyFrameKeyScaleFactor, final_keyframe);
|
||||
|
||||
m_keyframe_effect->set_key_frame_set(key_frame_set);
|
||||
set_timeline(element.document().timeline());
|
||||
set_owning_element(element);
|
||||
set_timeline(abstract_element.document().timeline());
|
||||
set_owning_element(abstract_element.element());
|
||||
set_effect(m_keyframe_effect);
|
||||
element.set_transition(pseudo_element, m_transition_property, *this);
|
||||
abstract_element.element().set_transition(abstract_element.pseudo_element(), m_transition_property, *this);
|
||||
|
||||
HTML::TemporaryExecutionContext context(realm);
|
||||
play().release_value_but_fixme_should_propagate_errors();
|
||||
|
|
|
@ -22,7 +22,7 @@ class CSSTransition : public Animations::Animation {
|
|||
GC_DECLARE_ALLOCATOR(CSSTransition);
|
||||
|
||||
public:
|
||||
static GC::Ref<CSSTransition> start_a_transition(DOM::Element&, Optional<PseudoElement>, PropertyID,
|
||||
static GC::Ref<CSSTransition> start_a_transition(DOM::AbstractElement, PropertyID,
|
||||
size_t transition_generation, double delay, double start_time, double end_time, NonnullRefPtr<StyleValue const> start_value,
|
||||
NonnullRefPtr<StyleValue const> end_value, NonnullRefPtr<StyleValue const> reversing_adjusted_start_value, double reversing_shortening_factor);
|
||||
|
||||
|
@ -52,7 +52,7 @@ public:
|
|||
void set_previous_phase(Phase phase) { m_previous_phase = phase; }
|
||||
|
||||
private:
|
||||
CSSTransition(JS::Realm&, DOM::Element&, Optional<PseudoElement>, PropertyID, size_t transition_generation,
|
||||
CSSTransition(JS::Realm&, DOM::AbstractElement, PropertyID, size_t transition_generation,
|
||||
double delay, double start_time, double end_time, NonnullRefPtr<StyleValue const> start_value, NonnullRefPtr<StyleValue const> end_value,
|
||||
NonnullRefPtr<StyleValue const> reversing_adjusted_start_value, double reversing_shortening_factor);
|
||||
|
||||
|
|
|
@ -1341,7 +1341,7 @@ void StyleComputer::start_needed_transitions(ComputedProperties const& previous_
|
|||
auto start_a_transition = [&](auto delay, auto start_time, auto end_time, auto const& start_value, auto const& end_value, auto const& reversing_adjusted_start_value, auto reversing_shortening_factor) {
|
||||
dbgln_if(CSS_TRANSITIONS_DEBUG, "Starting a transition of {} from {} to {}", string_from_property_id(property_id), start_value->to_string(), end_value->to_string());
|
||||
|
||||
auto transition = CSSTransition::start_a_transition(element, pseudo_element, property_id,
|
||||
auto transition = CSSTransition::start_a_transition(abstract_element, property_id,
|
||||
document().transition_generation(), delay, start_time, end_time, start_value, end_value, reversing_adjusted_start_value, reversing_shortening_factor);
|
||||
// Immediately set the property's value to the transition's current value, to prevent single-frame jumps.
|
||||
collect_animation_into(abstract_element, as<Animations::KeyframeEffect>(*transition->effect()), new_style);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue