mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibWeb: Avoid Vector filtering when performing find in page queries
This commit is contained in:
committed by
Tim Ledbetter
parent
26f32b11f9
commit
c322603c42
@@ -513,7 +513,7 @@ void EventLoop::perform_a_microtask_checkpoint()
|
|||||||
// FIXME: 8. Record timing info for microtask checkpoint.
|
// FIXME: 8. Record timing info for microtask checkpoint.
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<GC::Root<DOM::Document>> EventLoop::documents_in_this_event_loop_matching(auto callback) const
|
Vector<GC::Root<DOM::Document>> EventLoop::documents_in_this_event_loop_matching(Function<bool(DOM::Document&)> callback) const
|
||||||
{
|
{
|
||||||
Vector<GC::Root<DOM::Document>> documents;
|
Vector<GC::Root<DOM::Document>> documents;
|
||||||
for (auto& document : m_documents) {
|
for (auto& document : m_documents) {
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ public:
|
|||||||
void unregister_document(Badge<DOM::Document>, DOM::Document&);
|
void unregister_document(Badge<DOM::Document>, DOM::Document&);
|
||||||
|
|
||||||
Vector<GC::Root<DOM::Document>> documents_in_this_event_loop() const;
|
Vector<GC::Root<DOM::Document>> documents_in_this_event_loop() const;
|
||||||
|
[[nodiscard]] Vector<GC::Root<DOM::Document>> documents_in_this_event_loop_matching(Function<bool(DOM::Document&)> callback) const;
|
||||||
|
|
||||||
Vector<GC::Root<HTML::Window>> same_loop_windows() const;
|
Vector<GC::Root<HTML::Window>> same_loop_windows() const;
|
||||||
|
|
||||||
@@ -95,8 +96,6 @@ private:
|
|||||||
|
|
||||||
virtual void visit_edges(Visitor&) override;
|
virtual void visit_edges(Visitor&) override;
|
||||||
|
|
||||||
[[nodiscard]] Vector<GC::Root<DOM::Document>> documents_in_this_event_loop_matching(auto callback) const;
|
|
||||||
|
|
||||||
void update_the_rendering();
|
void update_the_rendering();
|
||||||
|
|
||||||
Type m_type { Type::Window };
|
Type m_type { Type::Window };
|
||||||
|
|||||||
@@ -569,11 +569,9 @@ Vector<GC::Root<DOM::Document>> Page::documents_in_active_window() const
|
|||||||
if (!top_level_traversable_is_initialized())
|
if (!top_level_traversable_is_initialized())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
auto documents = HTML::main_thread_event_loop().documents_in_this_event_loop();
|
auto documents = HTML::main_thread_event_loop().documents_in_this_event_loop_matching([&](auto& document) {
|
||||||
for (ssize_t i = documents.size() - 1; i >= 0; --i) {
|
return document.window() == top_level_traversable()->active_window();
|
||||||
if (documents[i]->window() != top_level_traversable()->active_window())
|
});
|
||||||
documents.remove(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
return documents;
|
return documents;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user