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

Unified Diff: Source/web/ContextMenuClientImpl.cpp

Issue 402403003: Added code to fix visibility of select all option in context menu. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Modified based on review comments Created 6 years, 5 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 | « no previous file | 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 517305b7570e797255ab3ac8d6ee9ef5271aafa6..69bcc52ba957271fc25a05ab1957153542ec38af 100644
--- a/Source/web/ContextMenuClientImpl.cpp
+++ b/Source/web/ContextMenuClientImpl.cpp
@@ -219,8 +219,14 @@ void ContextMenuClientImpl::showContextMenu(const blink::ContextMenu* defaultMen
data.editFlags |= WebContextMenuData::CanPaste;
if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canDelete())
data.editFlags |= WebContextMenuData::CanDelete;
- // We can always select all...
- data.editFlags |= WebContextMenuData::CanSelectAll;
+ Node* node = r.innerNonSharedNode();
+ if (node->isElementNode() && (static_cast<Element*>(node))->isFormControlElement()) {
darin (slow to review) 2014/07/25 16:43:36 why do you bother calling isFormControlElement? wh
ankit 2014/07/28 04:08:06 Acknowledged. I have made changes as suggested and
+ Element* element = toHTMLFormControlElement(node);
+ if (element->isTextFormControl()) {
+ if (!(static_cast<HTMLTextFormControlElement*>(element))->value().isEmpty())
+ data.editFlags |= WebContextMenuData::CanSelectAll;
+ }
+ }
data.editFlags |= WebContextMenuData::CanTranslate;
// Links, Images, Media tags, and Image/Media-Links take preference over
« 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