mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb/IDB: Implement IDBIndex::getAll
This commit is contained in:
parent
47450bc15c
commit
3fa1d1299c
Notes:
github-actions[bot]
2025-05-14 15:19:24 +00:00
Author: https://github.com/stelar7
Commit: 3fa1d1299c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4727
Reviewed-by: https://github.com/gmta ✅
Reviewed-by: https://github.com/shannonbooth
7 changed files with 80 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue