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

Unified Diff: Source/web/ContextMenuClientImpl.cpp

Issue 270613004: Implement "Copy image" for canvas (blink side). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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
« Source/core/editing/Editor.cpp ('K') | « Source/core/editing/Editor.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/ContextMenuClientImpl.cpp
diff --git a/Source/web/ContextMenuClientImpl.cpp b/Source/web/ContextMenuClientImpl.cpp
index 8d61b79c6601697230ff3900a89c436deaa764ea..7c261ea98b2d1c99e1043afe89eab767bb953189 100644
--- a/Source/web/ContextMenuClientImpl.cpp
+++ b/Source/web/ContextMenuClientImpl.cpp
@@ -224,10 +224,15 @@ void ContextMenuClientImpl::showContextMenu(const WebCore::ContextMenu* defaultM
if (isHTMLCanvasElement(r.innerNonSharedNode())) {
data.mediaType = WebContextMenuData::MediaTypeCanvas;
+ data.hasImageContents = true;
} else if (!r.absoluteImageURL().isEmpty()) {
data.srcURL = r.absoluteImageURL();
data.mediaType = WebContextMenuData::MediaTypeImage;
data.mediaFlags |= WebContextMenuData::MediaCanPrint;
+
+ // An image can to be null for many reasons, like being blocked, no image
+ // data received from server yet.
+ data.hasImageContents = r.image() && !(r.image()->isNull());
yosin_UTC9 2014/06/20 04:24:10 nit: We don't need to have parenthesis, |!r.image
} else if (!r.absoluteMediaURL().isEmpty()) {
data.srcURL = r.absoluteMediaURL();
@@ -287,12 +292,6 @@ void ContextMenuClientImpl::showContextMenu(const WebCore::ContextMenu* defaultM
}
}
- // An image can to be null for many reasons, like being blocked, no image
- // data received from server yet.
- data.hasImageContents =
- (data.mediaType == WebContextMenuData::MediaTypeImage)
- && r.image() && !(r.image()->isNull());
-
// If it's not a link, an image, a media element, or an image/media link,
// show a selection menu or a more generic page menu.
if (selectedFrame->document()->loader())
« Source/core/editing/Editor.cpp ('K') | « Source/core/editing/Editor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698