mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-03 13:02:09 +02:00
LibWeb/IDB: Implement IDBIndex::getAll
This commit is contained in:
committed by
Jelle Raaijmakers
parent
47450bc15c
commit
3fa1d1299c
Notes:
github-actions[bot]
2025-05-14 15:19:24 +00:00
Author: https://github.com/stelar7 Commit: https://github.com/LadybirdBrowser/ladybird/commit/3fa1d1299c7 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4727 Reviewed-by: https://github.com/gmta ✅ Reviewed-by: https://github.com/shannonbooth
@@ -83,4 +83,18 @@ Optional<IndexRecord&> Index::first_in_range(GC::Ref<IDBKeyRange> range)
|
||||
});
|
||||
}
|
||||
|
||||
GC::ConservativeVector<IndexRecord> Index::first_n_in_range(GC::Ref<IDBKeyRange> range, Optional<WebIDL::UnsignedLong> count)
|
||||
{
|
||||
GC::ConservativeVector<IndexRecord> records(range->heap());
|
||||
for (auto const& record : m_records) {
|
||||
if (range->is_in_range(record.key))
|
||||
records.append(record);
|
||||
|
||||
if (count.has_value() && records.size() >= *count)
|
||||
break;
|
||||
}
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user