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

Unified Diff: content/browser/web_contents/web_drag_source_mac.mm

Issue 11666018: Don't put HTML onto the clipboard if there is file content data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nil check Created 8 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_drag_source_mac.mm
diff --git a/content/browser/web_contents/web_drag_source_mac.mm b/content/browser/web_contents/web_drag_source_mac.mm
index 2063b093599ecfdf719dc8b25583aba67d0dc94b..d0d8aa17c64f82cdc0eeab9641384d084c8490e5 100644
--- a/content/browser/web_contents/web_drag_source_mac.mm
+++ b/content/browser/web_contents/web_drag_source_mac.mm
@@ -343,11 +343,6 @@ void PromiseWriterHelper(const WebDropData& drop_data,
declareTypes:[NSArray arrayWithObject:ui::kChromeDragDummyPboardType]
owner:contentsView_];
- // HTML.
- if (!dropData_->html.string().empty())
- [pasteboard_ addTypes:[NSArray arrayWithObject:NSHTMLPboardType]
- owner:contentsView_];
-
// URL (and title).
if (dropData_->url.is_valid()) {
NSURL* url = [NSURL URLWithString:SysUTF8ToNSString(dropData_->url.spec())];
@@ -433,6 +428,20 @@ void PromiseWriterHelper(const WebDropData& drop_data,
}
}
+ // HTML.
+ bool hasHTMLData = !dropData_->html.string().empty();
+ // Mail.app and TextEdit accept drags that have both HTML and image flavors on
+ // them, but don't process them correctly <http://crbug.com/55879>. Therefore,
+ // omit the HTML flavor if there is an image flavor. (The only time that
+ // WebKit fills in the WebDropData::file_contents is with an image drop, but
+ // the MIME time is tested anyway for paranoia's sake.)
+ bool hasImageData = !dropData_->file_contents.empty() &&
+ fileUTI_ &&
+ UTTypeConformsTo(fileUTI_.get(), kUTTypeImage);
+ if (hasHTMLData && !hasImageData)
+ [pasteboard_ addTypes:[NSArray arrayWithObject:NSHTMLPboardType]
+ owner:contentsView_];
+
// Plain text.
if (!dropData_->text.string().empty())
[pasteboard_ addTypes:[NSArray arrayWithObject:NSStringPboardType]
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698