mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-16 21:20:18 +00: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
Notes:
github-actions[bot]
2025-09-24 11:00:21 +00:00
Author: https://github.com/Calme1709
Commit: 4fd57f90b3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6267
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/tcl3 ✅
1 changed files with 12 additions and 14 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue