1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:47:44 +00:00

LibWeb: Assign a unique ID to each HTML task

And return that ID when queueing an element task. This is required for
some task tracking - specifically, the HTML ToggleTaskTracker struct.
This commit is contained in:
Timothy Flynn 2023-08-31 13:25:27 -04:00 committed by Andreas Kling
parent 5ae9b2fdaf
commit f598a357ad
4 changed files with 15 additions and 4 deletions

View file

@ -759,10 +759,14 @@ void Element::make_html_uppercased_qualified_name()
}
// https://html.spec.whatwg.org/multipage/webappapis.html#queue-an-element-task
void Element::queue_an_element_task(HTML::Task::Source source, JS::SafeFunction<void()> steps)
int Element::queue_an_element_task(HTML::Task::Source source, JS::SafeFunction<void()> steps)
{
auto task = HTML::Task::create(source, &document(), move(steps));
auto id = task->id();
HTML::main_thread_event_loop().task_queue().add(move(task));
return id;
}
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements