1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 13:47:35 +00:00

LibWeb: Reduce HashMap thrashing during custom property cascade

Build the final custom property map right away instead of first making
a temporary pointer-only map. We also precompute the final needed
capacity for the map to avoid incremental rehashing.
This commit is contained in:
Andreas Kling 2022-03-03 13:40:06 +01:00
parent e4fdb40158
commit 205208db11
3 changed files with 23 additions and 25 deletions

View file

@ -113,13 +113,8 @@ public:
const ShadowRoot* shadow_root() const { return m_shadow_root; }
void set_shadow_root(RefPtr<ShadowRoot>);
void add_custom_property(String custom_property_name, CSS::StyleProperty style_property)
{
m_custom_properties.set(move(custom_property_name), move(style_property));
}
void set_custom_properties(HashMap<FlyString, CSS::StyleProperty> custom_properties) { m_custom_properties = move(custom_properties); }
HashMap<FlyString, CSS::StyleProperty> const& custom_properties() const { return m_custom_properties; }
HashMap<FlyString, CSS::StyleProperty>& custom_properties() { return m_custom_properties; }
void queue_an_element_task(HTML::Task::Source, Function<void()>);