summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/clipboard
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/clipboard')
-rw-r--r--chromium/third_party/blink/renderer/core/clipboard/data_object.cc8
-rw-r--r--chromium/third_party/blink/renderer/core/clipboard/data_object.h2
-rw-r--r--chromium/third_party/blink/renderer/core/clipboard/data_object_item.cc4
-rw-r--r--chromium/third_party/blink/renderer/core/clipboard/data_transfer.cc9
-rw-r--r--chromium/third_party/blink/renderer/core/clipboard/data_transfer.h4
-rw-r--r--chromium/third_party/blink/renderer/core/clipboard/system_clipboard.cc33
-rw-r--r--chromium/third_party/blink/renderer/core/clipboard/system_clipboard.h4
7 files changed, 30 insertions, 34 deletions
diff --git a/chromium/third_party/blink/renderer/core/clipboard/data_object.cc b/chromium/third_party/blink/renderer/core/clipboard/data_object.cc
index 63be43d777d..ecdb6e3c740 100644
--- a/chromium/third_party/blink/renderer/core/clipboard/data_object.cc
+++ b/chromium/third_party/blink/renderer/core/clipboard/data_object.cc
@@ -305,8 +305,8 @@ DataObject* DataObject::Create(WebDragData data) {
// This should never happen when dragging in.
break;
case WebDragData::Item::kStorageTypeFileSystemFile: {
- // FIXME: The file system URL may refer a user visible file, see
- // http://crbug.com/429077
+ // TODO(http://crbug.com/429077): The file system URL may refer a user
+ // visible file.
has_file_system = true;
FileMetadata file_metadata;
file_metadata.length = item.file_system_file_size;
@@ -363,8 +363,8 @@ WebDragData DataObject::ToWebDragData() {
item.file_system_file_size = file->size();
item.file_system_id = original_item->FileSystemId();
} else {
- // FIXME: support dragging constructed Files across renderers, see
- // http://crbug.com/394955
+ // TODO(http://crbug.com/394955): support dragging constructed Files
+ // across renderers.
item.storage_type = WebDragData::Item::kStorageTypeString;
item.string_type = "text/plain";
item.string_data = file->name();
diff --git a/chromium/third_party/blink/renderer/core/clipboard/data_object.h b/chromium/third_party/blink/renderer/core/clipboard/data_object.h
index bcef9644ca4..326391dfa38 100644
--- a/chromium/third_party/blink/renderer/core/clipboard/data_object.h
+++ b/chromium/third_party/blink/renderer/core/clipboard/data_object.h
@@ -74,7 +74,7 @@ class CORE_EXPORT DataObject : public GarbageCollectedFinalized<DataObject>,
// DataTransferItemList support.
uint32_t length() const;
DataObjectItem* Item(uint32_t index);
- // FIXME: Implement V8DataTransferItemList::indexedPropertyDeleter to get this
+ // TODO: Implement V8DataTransferItemList::indexedPropertyDeleter to get this
// called.
void DeleteItem(uint32_t index);
void ClearAll();
diff --git a/chromium/third_party/blink/renderer/core/clipboard/data_object_item.cc b/chromium/third_party/blink/renderer/core/clipboard/data_object_item.cc
index 8bc02b9aaba..ff792028520 100644
--- a/chromium/third_party/blink/renderer/core/clipboard/data_object_item.cc
+++ b/chromium/third_party/blink/renderer/core/clipboard/data_object_item.cc
@@ -127,7 +127,7 @@ File* DataObjectItem::GetAsFile() const {
if (file_)
return file_.Get();
DCHECK(shared_buffer_);
- // FIXME: This code is currently impossible--we never populate
+ // TODO: This code is currently impossible--we never populate
// |shared_buffer_| when dragging in. At some point though, we may need to
// support correctly converting a shared buffer into a file.
return nullptr;
@@ -180,7 +180,7 @@ String DataObjectItem::GetAsString() const {
}
bool DataObjectItem::IsFilename() const {
- // FIXME: https://bugs.webkit.org/show_bug.cgi?id=81261: When we properly
+ // TODO(https://bugs.webkit.org/show_bug.cgi?id=81261): When we properly
// support File dragout, we'll need to make sure this works as expected for
// DragDataChromium.
return kind_ == kFileKind && file_;
diff --git a/chromium/third_party/blink/renderer/core/clipboard/data_transfer.cc b/chromium/third_party/blink/renderer/core/clipboard/data_transfer.cc
index 4e7038d3fcf..0769fa7377d 100644
--- a/chromium/third_party/blink/renderer/core/clipboard/data_transfer.cc
+++ b/chromium/third_party/blink/renderer/core/clipboard/data_transfer.cc
@@ -119,12 +119,11 @@ class DraggedNodeImageBuilder {
FloatRect bounding_box =
layer->GetLayoutObject()
- .AbsoluteToLocalQuad(FloatQuad(absolute_bounding_box),
- kUseTransforms)
+ .AbsoluteToLocalQuad(FloatQuad(absolute_bounding_box))
.BoundingBox();
PaintLayerPaintingInfo painting_info(
layer, CullRect(EnclosingIntRect(bounding_box)),
- kGlobalPaintFlattenCompositingLayers, LayoutSize());
+ kGlobalPaintFlattenCompositingLayers, PhysicalOffset());
PaintLayerFlags flags = kPaintLayerHaveTransparency |
kPaintLayerUncachedClipRects;
PaintRecordBuilder builder;
@@ -159,7 +158,7 @@ class DraggedNodeImageBuilder {
} // namespace
static DragOperation ConvertEffectAllowedToDragOperation(const String& op) {
// Values specified in
- // http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dom-datatransfer-effectallowed
+ // https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-effectallowed
if (op == "uninitialized")
return kDragOperationEvery;
if (op == "none")
@@ -597,7 +596,7 @@ bool DataTransfer::HasDropZoneType(const String& keyword) {
}
DataTransferItemList* DataTransfer::items() {
- // FIXME: According to the spec, we are supposed to return the same collection
+ // TODO: According to the spec, we are supposed to return the same collection
// of items each time. We now return a wrapper that always wraps the *same*
// set of items, so JS shouldn't be able to tell, but we probably still want
// to fix this.
diff --git a/chromium/third_party/blink/renderer/core/clipboard/data_transfer.h b/chromium/third_party/blink/renderer/core/clipboard/data_transfer.h
index f1e4461bee6..08ef14c9612 100644
--- a/chromium/third_party/blink/renderer/core/clipboard/data_transfer.h
+++ b/chromium/third_party/blink/renderer/core/clipboard/data_transfer.h
@@ -50,9 +50,9 @@ enum class DataTransferAccessPolicy;
// Used for drag and drop and copy/paste.
// Drag and Drop:
-// http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html
+// https://html.spec.whatwg.org/multipage/dnd.html
// Clipboard API (copy/paste):
-// http://dev.w3.org/2006/webapi/clipops/clipops.html
+// https://w3c.github.io/clipboard-apis/
class CORE_EXPORT DataTransfer final : public ScriptWrappable,
public DataObject::Observer {
USING_GARBAGE_COLLECTED_MIXIN(DataTransfer);
diff --git a/chromium/third_party/blink/renderer/core/clipboard/system_clipboard.cc b/chromium/third_party/blink/renderer/core/clipboard/system_clipboard.cc
index 97272f4549f..c8f57fa6e07 100644
--- a/chromium/third_party/blink/renderer/core/clipboard/system_clipboard.cc
+++ b/chromium/third_party/blink/renderer/core/clipboard/system_clipboard.cc
@@ -107,7 +107,7 @@ void SystemClipboard::WritePlainText(const String& plain_text,
#if defined(OS_WIN)
ReplaceNewlinesWithWindowsStyleNewlines(text);
#endif
- clipboard_->WriteText(mojom::ClipboardBuffer::kStandard, NonNullString(text));
+ clipboard_->WriteText(NonNullString(text));
}
String SystemClipboard::ReadHTML(KURL& url,
@@ -137,11 +137,10 @@ void SystemClipboard::WriteHTML(const String& markup,
#endif
ReplaceNBSPWithSpace(text);
- clipboard_->WriteHtml(mojom::ClipboardBuffer::kStandard,
- NonNullString(markup), document_url);
- clipboard_->WriteText(mojom::ClipboardBuffer::kStandard, NonNullString(text));
+ clipboard_->WriteHtml(NonNullString(markup), document_url);
+ clipboard_->WriteText(NonNullString(text));
if (smart_replace_option == kCanSmartReplace)
- clipboard_->WriteSmartPasteMarker(mojom::ClipboardBuffer::kStandard);
+ clipboard_->WriteSmartPasteMarker();
}
String SystemClipboard::ReadRTF() {
@@ -168,7 +167,7 @@ void SystemClipboard::WriteImageWithTag(Image* image,
SkBitmap bitmap;
if (sk_sp<SkImage> sk_image = paint_image.GetSkImage())
sk_image->asLegacyBitmap(&bitmap);
- clipboard_->WriteImage(mojom::ClipboardBuffer::kStandard, bitmap);
+ clipboard_->WriteImage(bitmap);
if (url.IsValid() && !url.IsEmpty()) {
#if !defined(OS_MACOSX)
@@ -176,21 +175,19 @@ void SystemClipboard::WriteImageWithTag(Image* image,
// consistency between platforms, and to help fix errors in applications
// which prefer text/plain content over image content for compatibility with
// Microsoft Word.
- clipboard_->WriteBookmark(mojom::ClipboardBuffer::kStandard,
- url.GetString(), NonNullString(title));
+ clipboard_->WriteBookmark(url.GetString(), NonNullString(title));
#endif
// When writing the image, we also write the image markup so that pasting
// into rich text editors, such as Gmail, reveals the image. We also don't
// want to call writeText(), since some applications (WordPad) don't pick
// the image if there is also a text format on the clipboard.
- clipboard_->WriteHtml(mojom::ClipboardBuffer::kStandard,
- URLToImageMarkup(url, title), KURL());
+ clipboard_->WriteHtml(URLToImageMarkup(url, title), KURL());
}
}
void SystemClipboard::WriteImage(const SkBitmap& bitmap) {
- clipboard_->WriteImage(mojom::ClipboardBuffer::kStandard, bitmap);
+ clipboard_->WriteImage(bitmap);
}
String SystemClipboard::ReadCustomData(const String& type) {
@@ -202,6 +199,7 @@ String SystemClipboard::ReadCustomData(const String& type) {
}
void SystemClipboard::WriteDataObject(DataObject* data_object) {
+ DCHECK(data_object);
// This plagiarizes the logic in DropDataBuilder::Build, but only extracts the
// data needed for the implementation of WriteDataObject.
//
@@ -218,24 +216,21 @@ void SystemClipboard::WriteDataObject(DataObject* data_object) {
for (const WebDragData::Item& item : data.Items()) {
if (item.storage_type == WebDragData::Item::kStorageTypeString) {
if (item.string_type == blink::kMimeTypeTextPlain) {
- clipboard_->WriteText(mojom::ClipboardBuffer::kStandard,
- NonNullString(item.string_data));
+ clipboard_->WriteText(NonNullString(item.string_data));
} else if (item.string_type == blink::kMimeTypeTextHTML) {
- clipboard_->WriteHtml(mojom::ClipboardBuffer::kStandard,
- NonNullString(item.string_data), KURL());
+ clipboard_->WriteHtml(NonNullString(item.string_data), KURL());
} else if (item.string_type != blink::kMimeTypeDownloadURL) {
custom_data.insert(item.string_type, NonNullString(item.string_data));
}
}
}
if (!custom_data.IsEmpty()) {
- clipboard_->WriteCustomData(mojom::ClipboardBuffer::kStandard,
- std::move(custom_data));
+ clipboard_->WriteCustomData(std::move(custom_data));
}
}
void SystemClipboard::CommitWrite() {
- clipboard_->CommitWrite(mojom::ClipboardBuffer::kStandard);
+ clipboard_->CommitWrite();
}
bool SystemClipboard::IsValidBufferType(mojom::ClipboardBuffer buffer) {
@@ -248,7 +243,7 @@ bool SystemClipboard::IsValidBufferType(mojom::ClipboardBuffer buffer) {
#else
// Chrome OS and non-X11 unix builds do not support
// the X selection clipboard.
- // TODO: remove the need for this case, see http://crbug.com/361753
+ // TODO(http://crbug.com/361753): remove the need for this case.
return false;
#endif
}
diff --git a/chromium/third_party/blink/renderer/core/clipboard/system_clipboard.h b/chromium/third_party/blink/renderer/core/clipboard/system_clipboard.h
index bb48891f5aa..038ec507dc8 100644
--- a/chromium/third_party/blink/renderer/core/clipboard/system_clipboard.h
+++ b/chromium/third_party/blink/renderer/core/clipboard/system_clipboard.h
@@ -63,7 +63,7 @@ class CORE_EXPORT SystemClipboard {
String ReadCustomData(const String& type);
void WriteDataObject(DataObject*);
- // Clipboard write functions that must use CommitWrite for changes to reach
+ // Clipboard write functions must use CommitWrite for changes to reach
// the OS clipboard.
void CommitWrite();
@@ -72,6 +72,8 @@ class CORE_EXPORT SystemClipboard {
bool IsValidBufferType(mojom::ClipboardBuffer);
mojom::blink::ClipboardHostPtr clipboard_;
+ // In X11, |buffer_| may equal ClipboardBuffer::kStandard or kSelection.
+ // Outside X11, |buffer_| always equals ClipboardBuffer::kStandard.
mojom::ClipboardBuffer buffer_ = mojom::ClipboardBuffer::kStandard;
DISALLOW_COPY_AND_ASSIGN(SystemClipboard);