mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-05 01:10:24 +00:00
LibWeb: Simplify assemble_coordinated_value_list
We know that all coordinated value list longhands are parsed as `StyleValueList`s
This commit is contained in:
Notes:
github-actions[bot]
2025-12-02 12:48:23 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/38efc39e175 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6997 Reviewed-by: https://github.com/AtkinsSJ ✅
@@ -378,20 +378,11 @@ HashMap<PropertyID, StyleValueVector> ComputedProperties::assemble_coordinated_v
|
|||||||
// - If a coordinating list property has too few values specified, its value list is repeated to add more used
|
// - If a coordinating list property has too few values specified, its value list is repeated to add more used
|
||||||
// values.
|
// values.
|
||||||
// - The computed values of the coordinating list properties are not affected by such truncation or repetition.
|
// - The computed values of the coordinating list properties are not affected by such truncation or repetition.
|
||||||
|
|
||||||
// FIXME: This is required because our animation-* properties are not yet parsed as lists.
|
|
||||||
// Once that is fixed, every value here will be a StyleValueList.
|
|
||||||
auto const get_property_value_as_list = [&](PropertyID property_id) {
|
|
||||||
auto const& value = property(property_id);
|
|
||||||
|
|
||||||
return value.is_value_list() ? value.as_value_list().values() : StyleValueVector { value };
|
|
||||||
};
|
|
||||||
|
|
||||||
HashMap<PropertyID, StyleValueVector> coordinated_value_list;
|
HashMap<PropertyID, StyleValueVector> coordinated_value_list;
|
||||||
|
|
||||||
for (size_t i = 0; i < get_property_value_as_list(base_property_id).size(); i++) {
|
for (size_t i = 0; i < property(base_property_id).as_value_list().size(); i++) {
|
||||||
for (auto property_id : property_ids) {
|
for (auto property_id : property_ids) {
|
||||||
auto const& list = get_property_value_as_list(property_id);
|
auto const& list = property(property_id).as_value_list().values();
|
||||||
|
|
||||||
coordinated_value_list.ensure(property_id).append(list[i % list.size()]);
|
coordinated_value_list.ensure(property_id).append(list[i % list.size()]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user