mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Don't create identical StyleValueList if absolutization is no-op
This case is actually incredibly common, and this ends up reducing the memory footprint on https://gymgrossisten.com/ by 2.07 MiB.
This commit is contained in:
parent
4f684bb4c9
commit
a056b26e56
Notes:
github-actions[bot]
2025-10-24 06:54:12 +00:00
Author: https://github.com/awesomekling
Commit: a056b26e56
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6561
1 changed files with 10 additions and 1 deletions
|
|
@ -27,8 +27,17 @@ ValueComparingNonnullRefPtr<StyleValue const> StyleValueList::absolutized(Comput
|
|||
StyleValueVector absolutized_style_values;
|
||||
absolutized_style_values.ensure_capacity(m_properties.values.size());
|
||||
|
||||
for (auto const& value : m_properties.values)
|
||||
bool any_absolutized = false;
|
||||
|
||||
for (auto const& value : m_properties.values) {
|
||||
auto absolutized_style_value = value->absolutized(computation_context);
|
||||
if (absolutized_style_value != value)
|
||||
any_absolutized = true;
|
||||
absolutized_style_values.append(value->absolutized(computation_context));
|
||||
}
|
||||
|
||||
if (!any_absolutized)
|
||||
return *this;
|
||||
|
||||
return StyleValueList::create(move(absolutized_style_values), m_properties.separator);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue