LibWeb: Begin implementing the drag data store

(cherry picked from commit 9e98e63559ebaaf50e7260c62ea750869bb3613d)
This commit is contained in:
Timothy Flynn
2024-08-16 13:31:42 -04:00
committed by Nico Weber
parent 80c1ab0de1
commit cfd1c66552
4 changed files with 108 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
/*
* Copyright (c) 2024, Tim Flynn <trflynn89@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/HTML/DataTransfer.h>
#include <LibWeb/HTML/DragDataStore.h>
namespace Web::HTML {
DragDataStore::DragDataStore()
: m_allowed_effects_state(DataTransferEffect::uninitialized)
{
}
DragDataStore::~DragDataStore() = default;
bool DragDataStore::has_text_item() const
{
for (auto const& item : m_item_list) {
if (item.kind == DragDataStoreItem::Kind::Text && item.type_string == "text/plain"sv)
return true;
}
return false;
}
}