mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibWeb: Apply animations after computing property values
We were unnecessarily computing property values within `collect_animation_into` which we can avoid by ensuring that all calls to `collect_animation_into` happen after property values are computed.
This commit is contained in:
parent
4f5feaf3b6
commit
4fd57f90b3
|
|
@ -973,8 +973,6 @@ void StyleComputer::collect_animation_into(DOM::AbstractElement abstract_element
|
|||
return camel_case_string_from_property_id(a) < camel_case_string_from_property_id(b);
|
||||
};
|
||||
|
||||
compute_font(computed_properties, abstract_element);
|
||||
compute_property_values(computed_properties);
|
||||
Length::FontMetrics font_metrics {
|
||||
computed_properties.font_size(),
|
||||
computed_properties.first_available_computed_font().pixel_metrics(),
|
||||
|
|
@ -2603,6 +2601,18 @@ GC::Ref<ComputedProperties> StyleComputer::compute_properties(DOM::AbstractEleme
|
|||
}
|
||||
}
|
||||
|
||||
// Compute the value of custom properties
|
||||
compute_custom_properties(computed_style, abstract_element);
|
||||
|
||||
// 2. Compute the math-depth property, since that might affect the font-size
|
||||
compute_math_depth(computed_style, abstract_element);
|
||||
|
||||
// 3. Compute the font, since that may be needed for font-relative CSS units
|
||||
compute_font(computed_style, abstract_element);
|
||||
|
||||
// 4. Convert properties into their computed forms
|
||||
compute_property_values(computed_style);
|
||||
|
||||
// Animation declarations [css-animations-2]
|
||||
auto animation_name = [&]() -> Optional<String> {
|
||||
auto const& animation_name = computed_style->property(PropertyID::AnimationName);
|
||||
|
|
@ -2672,18 +2682,6 @@ GC::Ref<ComputedProperties> StyleComputer::compute_properties(DOM::AbstractEleme
|
|||
}
|
||||
}
|
||||
|
||||
// Compute the value of custom properties
|
||||
compute_custom_properties(computed_style, abstract_element);
|
||||
|
||||
// 2. Compute the math-depth property, since that might affect the font-size
|
||||
compute_math_depth(computed_style, abstract_element);
|
||||
|
||||
// 3. Compute the font, since that may be needed for font-relative CSS units
|
||||
compute_font(computed_style, abstract_element);
|
||||
|
||||
// 4. Convert properties into their computed forms
|
||||
compute_property_values(computed_style);
|
||||
|
||||
// 5. Run automatic box type transformations
|
||||
transform_box_type_if_needed(computed_style, abstract_element);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user