mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 23:30:20 +00:00
LibWeb: Make the drag data store reference counted
Ownership of the drag data store is a bit weird. In a normal drag-and- drop operation, the DragAndDropEventHandler owns the store. When events are fired for the operation, the DataTransfer object assigned to those events are "associated" with the store. We currently represent that with an Optional<DragDataStore&>. However, it's also possible to create DataTransfer objects from scripts. Those objects create their own drag data store. This puts DataTransfer in a weird situation where it may own a store or just reference one. Rather than coming up with something like Variant<DDS, DDS&> or using MaybeOwned<DDS> here, we can get by with just making the store reference counted.
This commit is contained in:
parent
1b70362954
commit
f7c4165dde
Notes:
github-actions[bot]
2024-08-22 12:23:00 +00:00
Author: https://github.com/trflynn89
Commit: f7c4165dde
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1158
Reviewed-by: https://github.com/shannonbooth
6 changed files with 24 additions and 15 deletions
|
@ -9,6 +9,11 @@
|
|||
|
||||
namespace Web::HTML {
|
||||
|
||||
NonnullRefPtr<DragDataStore> DragDataStore::create()
|
||||
{
|
||||
return adopt_ref(*new DragDataStore());
|
||||
}
|
||||
|
||||
DragDataStore::DragDataStore()
|
||||
: m_allowed_effects_state(DataTransferEffect::uninitialized)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue