mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-20 15:09:42 +00:00
LibWeb: Implement DataTransferItemList.remove()
This commit is contained in:
parent
8ab3549585
commit
d9341adb1e
Notes:
github-actions[bot]
2025-09-12 10:31:50 +00:00
Author: https://github.com/tcl3
Commit: d9341adb1e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6088
Reviewed-by: https://github.com/gmta
9 changed files with 84 additions and 1 deletions
|
@ -248,6 +248,22 @@ GC::Ref<DataTransferItem> DataTransfer::add_item(DragDataStoreItem item)
|
|||
return data_transfer_item;
|
||||
}
|
||||
|
||||
void DataTransfer::remove_item(size_t index)
|
||||
{
|
||||
VERIFY(m_associated_drag_data_store);
|
||||
VERIFY(index < m_item_list.size());
|
||||
|
||||
m_associated_drag_data_store->remove_item_at(index);
|
||||
auto& item = m_item_list.at(index);
|
||||
item->set_item_index({}, OptionalNone {});
|
||||
m_item_list.remove(index);
|
||||
for (size_t i = index; i < m_item_list.size(); ++i) {
|
||||
m_item_list.at(i)->set_item_index({}, i);
|
||||
}
|
||||
|
||||
update_data_transfer_types_list();
|
||||
}
|
||||
|
||||
bool DataTransfer::contains_item_with_type(DragDataStoreItem::Kind kind, String const& type) const
|
||||
{
|
||||
VERIFY(m_associated_drag_data_store);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue