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

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: addressed nits 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
« no previous file with comments | « Source/core/editing/Editor.cpp ('k') | Source/web/tests/WebViewTest.cpp » ('j') | 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 7dbf1ba9dadf60efe4f03278582e41497e11a5f7..64a2f995e79948058736a9deb19e126e51f23b7c 100644
--- a/Source/web/ContextMenuClientImpl.cpp
+++ b/Source/web/ContextMenuClientImpl.cpp
@@ -225,10 +225,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 be null for many reasons, like being blocked, no image
+ // data received from server yet.
+ data.hasImageContents = r.image() && !r.image()->isNull();
} else if (!r.absoluteMediaURL().isEmpty()) {
data.srcURL = r.absoluteMediaURL();
@@ -288,12 +293,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())
« no previous file with comments | « Source/core/editing/Editor.cpp ('k') | Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698