LibWeb: Don't store custom name on StyleProperty

This reduces time spent in `~StyleProperty()` from 2.18% to 0.67% on
https://cloudflare.com.
This commit is contained in:
Tim Ledbetter 2025-11-11 20:21:24 +00:00 committed by Jelle Raaijmakers
parent eb21ea890c
commit df23b42b37
Notes: github-actions[bot] 2025-11-12 10:20:48 +00:00
6 changed files with 24 additions and 18 deletions

View file

@ -150,8 +150,7 @@ String CSSStyleProperties::item(size_t index) const
if (index < custom_properties_count) {
auto keys = m_custom_properties.keys();
auto custom_property = m_custom_properties.get(keys[index]);
return custom_property.ptr()->custom_name.to_string();
return keys[index].to_string();
}
return CSS::string_from_property_id(m_properties[index - custom_properties_count].property_id).to_string();
@ -250,7 +249,6 @@ WebIDL::ExceptionOr<void> CSSStyleProperties::set_property_internal(PropertyName
.important = !priority.is_empty() ? Important::Yes : Important::No,
.property_id = property.id(),
.value = component_value_list.release_nonnull(),
.custom_name = property.name(),
};
m_custom_properties.set(property.name(), style_property);
updated = true;
@ -415,8 +413,7 @@ WebIDL::ExceptionOr<void> CSSStyleProperties::set_property_style_value(PropertyN
StyleProperty {
Important::No,
PropertyID::Custom,
style_value,
property.name() });
style_value });
return {};
}
@ -534,7 +531,6 @@ Optional<StyleProperty> CSSStyleProperties::get_direct_property(PropertyNameAndI
return StyleProperty {
.property_id = property_id,
.value = maybe_value.release_nonnull(),
.custom_name = property_name_and_id.name(),
};
}
return {};