LibWeb: Add an empty DataTransferItemList IDL implementation

This commit is contained in:
Timothy Flynn 2024-08-15 12:20:22 -04:00 committed by Andreas Kling
parent 9e3c6921ab
commit dcb76572e4
Notes: github-actions[bot] 2024-08-19 11:31:01 +00:00
7 changed files with 79 additions and 0 deletions

View file

@ -75,6 +75,7 @@ DOMStringMap
DOMTokenList
DataTransfer
DataTransferItem
DataTransferItemList
DataView
Date
DisposableStack

View file

@ -276,6 +276,7 @@ set(SOURCES
HTML/CustomElements/CustomElementRegistry.cpp
HTML/DataTransfer.cpp
HTML/DataTransferItem.cpp
HTML/DataTransferItemList.cpp
HTML/Dates.cpp
HTML/DecodedImageData.cpp
HTML/DedicatedWorkerGlobalScope.cpp

View file

@ -354,6 +354,7 @@ class CloseWatcherManager;
class CustomElementDefinition;
class CustomElementRegistry;
class DataTransferItem;
class DataTransferItemList;
class DecodedImageData;
class DocumentState;
class DOMParser;

View file

@ -0,0 +1,34 @@
/*
* Copyright (c) 2024, Tim Flynn <trflynn89@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibJS/Runtime/Realm.h>
#include <LibWeb/Bindings/DataTransferItemListPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/DataTransferItemList.h>
namespace Web::HTML {
JS_DEFINE_ALLOCATOR(DataTransferItemList);
JS::NonnullGCPtr<DataTransferItemList> DataTransferItemList::construct_impl(JS::Realm& realm)
{
return realm.heap().allocate<DataTransferItemList>(realm, realm);
}
DataTransferItemList::DataTransferItemList(JS::Realm& realm)
: PlatformObject(realm)
{
}
DataTransferItemList::~DataTransferItemList() = default;
void DataTransferItemList::initialize(JS::Realm& realm)
{
Base::initialize(realm);
WEB_SET_PROTOTYPE_FOR_INTERFACE(DataTransferItemList);
}
}

View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2024, Tim Flynn <trflynn89@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibJS/Forward.h>
#include <LibWeb/Bindings/PlatformObject.h>
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitemlist-interface
class DataTransferItemList : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(DataTransferItemList, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(DataTransferItemList);
public:
static JS::NonnullGCPtr<DataTransferItemList> construct_impl(JS::Realm&);
virtual ~DataTransferItemList() override;
private:
DataTransferItemList(JS::Realm&);
virtual void initialize(JS::Realm&) override;
};
}

View file

@ -0,0 +1,12 @@
#import <HTML/DataTransferItem.idl>
// https://html.spec.whatwg.org/multipage/dnd.html#datatransferitemlist
[Exposed=Window]
interface DataTransferItemList {
[FIXME] readonly attribute unsigned long length;
[FIXME] getter DataTransferItem (unsigned long index);
[FIXME] DataTransferItem? add(DOMString data, DOMString type);
[FIXME] DataTransferItem? add(File data);
[FIXME] undefined remove(unsigned long index);
[FIXME] undefined clear();
};

View file

@ -103,6 +103,7 @@ libweb_js_bindings(HTML/CloseWatcher)
libweb_js_bindings(HTML/CustomElements/CustomElementRegistry)
libweb_js_bindings(HTML/DataTransfer)
libweb_js_bindings(HTML/DataTransferItem)
libweb_js_bindings(HTML/DataTransferItemList)
libweb_js_bindings(HTML/DedicatedWorkerGlobalScope GLOBAL)
libweb_js_bindings(HTML/DOMParser)
libweb_js_bindings(HTML/DOMStringList)