mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-21 16:58:58 +00:00
LibWeb/CSS: Take AbstractElement in start_needed_transitions()
This commit is contained in:
parent
acb211174d
commit
82d194ba99
Notes:
github-actions[bot]
2025-09-11 16:47:43 +00:00
Author: https://github.com/AtkinsSJ
Commit: 82d194ba99
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6118
2 changed files with 8 additions and 5 deletions
|
@ -1310,9 +1310,8 @@ static void compute_transitioned_properties(ComputedProperties const& style, DOM
|
|||
}
|
||||
|
||||
// https://drafts.csswg.org/css-transitions/#starting
|
||||
void StyleComputer::start_needed_transitions(ComputedProperties const& previous_style, ComputedProperties& new_style, DOM::Element& element, Optional<PseudoElement> pseudo_element) const
|
||||
void StyleComputer::start_needed_transitions(ComputedProperties const& previous_style, ComputedProperties& new_style, DOM::AbstractElement abstract_element) const
|
||||
{
|
||||
|
||||
// https://drafts.csswg.org/css-transitions/#transition-combined-duration
|
||||
auto combined_duration = [](Animations::Animatable::TransitionAttributes const& transition_attributes) {
|
||||
// Define the combined duration of the transition as the sum of max(matching transition duration, 0s) and the matching transition delay.
|
||||
|
@ -1322,6 +1321,10 @@ void StyleComputer::start_needed_transitions(ComputedProperties const& previous_
|
|||
// For each element and property, the implementation must act as follows:
|
||||
auto style_change_event_time = m_document->timeline()->current_time().value();
|
||||
|
||||
// FIXME: Add some transition helpers to AbstractElement.
|
||||
auto& element = abstract_element.element();
|
||||
auto pseudo_element = abstract_element.pseudo_element();
|
||||
|
||||
for (auto i = to_underlying(CSS::first_longhand_property_id); i <= to_underlying(CSS::last_longhand_property_id); ++i) {
|
||||
auto property_id = static_cast<CSS::PropertyID>(i);
|
||||
auto matching_transition_properties = element.property_transition_attributes(pseudo_element, property_id);
|
||||
|
@ -1338,7 +1341,7 @@ void StyleComputer::start_needed_transitions(ComputedProperties const& previous_
|
|||
auto transition = CSSTransition::start_a_transition(element, pseudo_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({ element }, as<Animations::KeyframeEffect>(*transition->effect()), new_style);
|
||||
collect_animation_into(abstract_element, as<Animations::KeyframeEffect>(*transition->effect()), new_style);
|
||||
};
|
||||
|
||||
// 1. If all of the following are true:
|
||||
|
@ -2648,7 +2651,7 @@ GC::Ref<ComputedProperties> StyleComputer::compute_properties(DOM::AbstractEleme
|
|||
// Theoretically this should be part of the cascade, but it works with computed values, which we don't have until now.
|
||||
compute_transitioned_properties(computed_style, abstract_element.element(), abstract_element.pseudo_element());
|
||||
if (auto previous_style = abstract_element.computed_properties()) {
|
||||
start_needed_transitions(*previous_style, computed_style, abstract_element.element(), abstract_element.pseudo_element());
|
||||
start_needed_transitions(*previous_style, computed_style, abstract_element);
|
||||
}
|
||||
|
||||
return computed_style;
|
||||
|
|
|
@ -237,7 +237,7 @@ private:
|
|||
RefPtr<Gfx::FontCascadeList const> font_matching_algorithm(FlyString const& family_name, int weight, int slope, float font_size_in_pt) const;
|
||||
void compute_custom_properties(ComputedProperties&, DOM::AbstractElement) const;
|
||||
void compute_math_depth(ComputedProperties&, Optional<DOM::AbstractElement>) const;
|
||||
void start_needed_transitions(ComputedProperties const& old_style, ComputedProperties& new_style, DOM::Element&, Optional<PseudoElement>) const;
|
||||
void start_needed_transitions(ComputedProperties const& old_style, ComputedProperties& new_style, DOM::AbstractElement) const;
|
||||
void resolve_effective_overflow_values(ComputedProperties&) const;
|
||||
void transform_box_type_if_needed(ComputedProperties&, DOM::Element const&, Optional<CSS::PseudoElement>) const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue