Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Unified Diff: third_party/WebKit/Source/core/clipboard/DataTransfer.cpp

Issue 2875013002: DataTransfer: Make |types| be a FrozenArray<DOMString>. (Closed)
Patch Set: Fix interactive_ui_tests Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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(

Powered by Google App Engine
This is Rietveld 408576698