mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Return the same DataTransfer.types() array if unmodified
This commit is contained in:
parent
3fc7613bf1
commit
3099459504
Notes:
github-actions[bot]
2025-09-12 10:31:31 +00:00
Author: https://github.com/tcl3
Commit: 3099459504
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6088
Reviewed-by: https://github.com/gmta
3 changed files with 6 additions and 1 deletions
|
|
@ -74,6 +74,8 @@ void DataTransfer::visit_edges(JS::Cell::Visitor& visitor)
|
|||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_items);
|
||||
visitor.visit(m_item_list);
|
||||
|
||||
VISIT_CACHED_ATTRIBUTE(types);
|
||||
}
|
||||
|
||||
void DataTransfer::set_drop_effect(String const& drop_effect)
|
||||
|
|
@ -374,6 +376,7 @@ void DataTransfer::update_data_transfer_types_list()
|
|||
}
|
||||
|
||||
// 3. Set the DataTransfer object's types array to the result of creating a frozen array from L.
|
||||
set_cached_types(nullptr);
|
||||
m_types = move(types);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <LibJS/Forward.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/HTML/DragDataStore.h>
|
||||
#include <LibWeb/WebIDL/CachedAttribute.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
|
@ -53,6 +54,7 @@ public:
|
|||
GC::Ref<DataTransferItemList> items();
|
||||
|
||||
ReadonlySpan<String> types() const;
|
||||
DEFINE_CACHED_ATTRIBUTE(types);
|
||||
String get_data(String const& format) const;
|
||||
void clear_data(Optional<String> maybe_format = {});
|
||||
GC::Ref<FileAPI::FileList> files() const;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ interface DataTransfer {
|
|||
[FIXME] undefined setDragImage(Element image, long x, long y);
|
||||
|
||||
// old interface
|
||||
readonly attribute FrozenArray<DOMString> types;
|
||||
[CachedAttribute] readonly attribute FrozenArray<DOMString> types;
|
||||
DOMString getData(DOMString format);
|
||||
[FIXME] undefined setData(DOMString format, DOMString data);
|
||||
undefined clearData(optional DOMString format);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue