DragDataStore.cpp 696 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 2024, Tim Flynn <trflynn89@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/HTML/DataTransfer.h>
  7. #include <LibWeb/HTML/DragDataStore.h>
  8. namespace Web::HTML {
  9. NonnullRefPtr<DragDataStore> DragDataStore::create()
  10. {
  11. return adopt_ref(*new DragDataStore());
  12. }
  13. DragDataStore::DragDataStore()
  14. : m_allowed_effects_state(DataTransferEffect::uninitialized)
  15. {
  16. }
  17. DragDataStore::~DragDataStore() = default;
  18. bool DragDataStore::has_text_item() const
  19. {
  20. for (auto const& item : m_item_list) {
  21. if (item.kind == DragDataStoreItem::Kind::Text && item.type_string == "text/plain"sv)
  22. return true;
  23. }
  24. return false;
  25. }
  26. }