1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:58:11 +00:00

LibWeb: Allocate custom element reactions queue on demand

This shrinks most DOM elements by 16 bytes.
This commit is contained in:
Andreas Kling 2023-11-19 21:53:58 +01:00
parent ac8bb89f50
commit 7ee47d81ca
3 changed files with 20 additions and 9 deletions

View file

@ -675,12 +675,14 @@ void invoke_custom_element_reactions(Vector<JS::Handle<DOM::Element>>& element_q
auto element = element_queue.take_first();
// 2. Let reactions be element's custom element reaction queue.
auto& reactions = element->custom_element_reaction_queue();
auto* reactions = element->custom_element_reaction_queue();
// 3. Repeat until reactions is empty:
while (!reactions.is_empty()) {
if (!reactions)
continue;
while (!reactions->is_empty()) {
// 1. Remove the first element of reactions, and let reaction be that element. Switch on reaction's type:
auto reaction = reactions.take_first();
auto reaction = reactions->take_first();
auto maybe_exception = reaction.visit(
[&](DOM::CustomElementUpgradeReaction const& custom_element_upgrade_reaction) -> JS::ThrowCompletionOr<void> {