Chromium Code Reviews| 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..80aa3edb94ba45652df376922513454f3c92e000 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,19 @@ 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() && |
| + UTTypeConformsTo(fileUTI_.get(), kUTTypeImage); |
|
Nico
2012/12/26 21:52:55
fileUTI_ is only set if !mimeType.empty(). Since t
Avi (use Gerrit)
2012/12/26 22:22:10
True. Fixed. I don't want to trace through webkit
|
| + if (hasHTMLData && !hasImageData) |
| + [pasteboard_ addTypes:[NSArray arrayWithObject:NSHTMLPboardType] |
| + owner:contentsView_]; |
| + |
| // Plain text. |
| if (!dropData_->text.string().empty()) |
| [pasteboard_ addTypes:[NSArray arrayWithObject:NSStringPboardType] |