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

Unified Diff: third_party/WebKit/Source/web/ContextMenuClientImpl.cpp

Issue 2712603007: Select All present even all selectable text has been selected (Closed)
Patch Set: yosin's nits Created 3 years, 9 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
Index: third_party/WebKit/Source/web/ContextMenuClientImpl.cpp
diff --git a/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp b/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp
index 1cf04868b2b5756a8653bec5aa503f75b4575821..11c2a79b74f4b928aeb66c7ffa5a2dd46f8e9d31 100644
--- a/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp
+++ b/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp
@@ -166,21 +166,25 @@ bool ContextMenuClientImpl::showContextMenu(const ContextMenu* defaultMenu,
// Compute edit flags.
data.editFlags = WebContextMenuData::CanDoNone;
- if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canUndo())
- data.editFlags |= WebContextMenuData::CanUndo;
- if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canRedo())
- data.editFlags |= WebContextMenuData::CanRedo;
- if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canCut())
- data.editFlags |= WebContextMenuData::CanCut;
- if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canCopy())
- data.editFlags |= WebContextMenuData::CanCopy;
- if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canPaste())
- data.editFlags |= WebContextMenuData::CanPaste;
- if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canDelete())
- data.editFlags |= WebContextMenuData::CanDelete;
- // We can always select all...
- data.editFlags |= WebContextMenuData::CanSelectAll;
- data.editFlags |= WebContextMenuData::CanTranslate;
+ if (selectedFrame->document()->isHTMLDocument() ||
+ selectedFrame->document()->isXHTMLDocument()) {
+ if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canUndo())
+ data.editFlags |= WebContextMenuData::CanUndo;
+ if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canRedo())
+ data.editFlags |= WebContextMenuData::CanRedo;
+ if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canCut())
+ data.editFlags |= WebContextMenuData::CanCut;
+ if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canCopy())
+ data.editFlags |= WebContextMenuData::CanCopy;
+ if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canPaste())
+ data.editFlags |= WebContextMenuData::CanPaste;
+ if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canDelete())
+ data.editFlags |= WebContextMenuData::CanDelete;
+ if (selectedFrame->document()->queryCommandEnabled("selectAll",
+ ASSERT_NO_EXCEPTION))
+ data.editFlags |= WebContextMenuData::CanSelectAll;
+ data.editFlags |= WebContextMenuData::CanTranslate;
+ }
// Links, Images, Media tags, and Image/Media-Links take preference over
// all else.

Powered by Google App Engine
This is Rietveld 408576698