summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/EventLoop
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-09-19 17:46:34 +0200
committerAndreas Kling <kling@serenityos.org>2022-09-20 10:32:13 +0200
commit4ee5dfbe4b269157643d418de9eb97bf3ceaea3c (patch)
tree427ae5d3f0918095c97899351c260b6f55004f4a /Userland/Libraries/LibWeb/HTML/EventLoop
parente5f6d36616275f2dd69fb8893478df13a93d4bde (diff)
downloadserenity-4ee5dfbe4b269157643d418de9eb97bf3ceaea3c.zip
LibWeb: Flesh out a chunk of the HTML spec's frame navigation algorithms
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/EventLoop')
-rw-r--r--Userland/Libraries/LibWeb/HTML/EventLoop/TaskQueue.cpp7
-rw-r--r--Userland/Libraries/LibWeb/HTML/EventLoop/TaskQueue.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/EventLoop/TaskQueue.cpp b/Userland/Libraries/LibWeb/HTML/EventLoop/TaskQueue.cpp
index 2fe4681d8c..1431b73952 100644
--- a/Userland/Libraries/LibWeb/HTML/EventLoop/TaskQueue.cpp
+++ b/Userland/Libraries/LibWeb/HTML/EventLoop/TaskQueue.cpp
@@ -40,4 +40,11 @@ bool TaskQueue::has_runnable_tasks() const
return false;
}
+void TaskQueue::remove_tasks_matching(Function<bool(HTML::Task const&)> filter)
+{
+ m_tasks.remove_all_matching([&](auto& task) {
+ return filter(*task);
+ });
+}
+
}
diff --git a/Userland/Libraries/LibWeb/HTML/EventLoop/TaskQueue.h b/Userland/Libraries/LibWeb/HTML/EventLoop/TaskQueue.h
index cfc2a15254..f3e31c4fac 100644
--- a/Userland/Libraries/LibWeb/HTML/EventLoop/TaskQueue.h
+++ b/Userland/Libraries/LibWeb/HTML/EventLoop/TaskQueue.h
@@ -31,6 +31,8 @@ public:
return m_tasks.take_first();
}
+ void remove_tasks_matching(Function<bool(HTML::Task const&)>);
+
private:
HTML::EventLoop& m_event_loop;