mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-05 01:10:24 +00:00
LibWeb: Account for transition-{delay,duration} always being a list
This fixes the optimization implemented in46acdbdthat was no longer working aftere937f5d
This commit is contained in:
Notes:
github-actions[bot]
2025-12-02 11:46:54 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/4034ce995a7 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6994 Reviewed-by: https://github.com/AtkinsSJ ✅
@@ -1237,8 +1237,21 @@ static void compute_transitioned_properties(ComputedProperties const& style, DOM
|
||||
auto const& delay = style.property(PropertyID::TransitionDelay);
|
||||
auto const& duration = style.property(PropertyID::TransitionDuration);
|
||||
|
||||
// FIXME: Change this to support the associated StyleValueList values when we update
|
||||
// parse_simple_comma_separated_value_list to always return a StyleValueList.
|
||||
auto const value_is_list_containing_a_single_time_of_zero_seconds = [](StyleValue const& value) -> bool {
|
||||
if (!value.is_value_list())
|
||||
return false;
|
||||
|
||||
auto const& value_list = value.as_value_list().values();
|
||||
|
||||
if (value_list.size() != 1)
|
||||
return false;
|
||||
|
||||
if (!value_list[0]->is_time())
|
||||
return false;
|
||||
|
||||
return value_list[0]->as_time().time().to_seconds() == 0;
|
||||
};
|
||||
|
||||
// OPTIMIZATION: Registered transitions with a "combined duration" of less than or equal to 0s are equivalent to not
|
||||
// having a transition registered at all, except in the case that we already have an associated
|
||||
// transition for that property, so we can skip registering them. This implementation intentionally
|
||||
@@ -1248,8 +1261,8 @@ static void compute_transitioned_properties(ComputedProperties const& style, DOM
|
||||
// gains.
|
||||
if (
|
||||
element.property_ids_with_existing_transitions(pseudo_element).is_empty()
|
||||
&& delay.is_time() && delay.as_time().time().to_seconds() == 0
|
||||
&& duration.is_time() && duration.as_time().time().to_seconds() == 0) {
|
||||
&& value_is_list_containing_a_single_time_of_zero_seconds(delay)
|
||||
&& value_is_list_containing_a_single_time_of_zero_seconds(duration)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user