Index: third_party/WebKit/Source/core/clipboard/DataTransfer.cpp |
diff --git a/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp b/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp |
index 2738516710bd335ed2df5c41eca8df85e30a864e..9cc4aa0ac28ce428c279e9d37aa87925b772ada2 100644 |
--- a/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp |
+++ b/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp |
@@ -168,10 +168,15 @@ void DataTransfer::clearData(const String& type) { |
if (!CanWriteData()) |
return; |
+ const size_t old_length = data_object_->length(); |
+ |
if (type.IsNull()) |
data_object_->ClearAll(); |
else |
data_object_->ClearData(NormalizeType(type)); |
+ |
+ if (old_length != data_object_->length()) |
+ data_store_item_list_changed_ = true; |
} |
String DataTransfer::getData(const String& type) const { |
@@ -190,14 +195,19 @@ void DataTransfer::setData(const String& type, const String& data) { |
return; |
data_object_->SetData(NormalizeType(type), data); |
+ data_store_item_list_changed_ = true; |
+} |
+ |
+bool DataTransfer::hasDataStoreItemListChanged() const { |
+ return data_store_item_list_changed_ || !CanReadTypes(); |
foolip
2017/05/15 15:11:02
Is there a test that would fail if the CanReadType
Raphael Kubo da Costa (rakuco)
2017/05/15 15:17:59
Yes; the previous iterations of this CL didn't hav
|
} |
-// extensions beyond IE's API |
-Vector<String> DataTransfer::types() const { |
+Vector<String> DataTransfer::types() { |
Vector<String> types; |
if (!CanReadTypes()) |
return types; |
+ data_store_item_list_changed_ = false; |
return data_object_->Types(); |
} |
@@ -429,7 +439,8 @@ DataTransfer::DataTransfer(DataTransferType type, |
drop_effect_("uninitialized"), |
effect_allowed_("uninitialized"), |
transfer_type_(type), |
- data_object_(data_object) {} |
+ data_object_(data_object), |
+ data_store_item_list_changed_(true) {} |
void DataTransfer::setDragImage(ImageResourceContent* image, |
Node* node, |
@@ -461,7 +472,7 @@ bool DataTransfer::HasStringOfType(const String& type) const { |
if (!CanReadTypes()) |
return false; |
- return types().Contains(type); |
+ return data_object_->Types().Contains(type); |
} |
DragOperation ConvertDropZoneOperationToDragOperation( |