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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canRedo()) 212 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canRedo())
213 data.editFlags |= WebContextMenuData::CanRedo; 213 data.editFlags |= WebContextMenuData::CanRedo;
214 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canCut()) 214 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canCut())
215 data.editFlags |= WebContextMenuData::CanCut; 215 data.editFlags |= WebContextMenuData::CanCut;
216 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canCopy()) 216 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canCopy())
217 data.editFlags |= WebContextMenuData::CanCopy; 217 data.editFlags |= WebContextMenuData::CanCopy;
218 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canPaste()) 218 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canPaste())
219 data.editFlags |= WebContextMenuData::CanPaste; 219 data.editFlags |= WebContextMenuData::CanPaste;
220 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canDelete()) 220 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canDelete())
221 data.editFlags |= WebContextMenuData::CanDelete; 221 data.editFlags |= WebContextMenuData::CanDelete;
222 // We can always select all... 222 Node* node = r.innerNonSharedNode();
223 data.editFlags |= WebContextMenuData::CanSelectAll; 223 if (node->isElementNode() && (static_cast<Element*>(node))->isFormControlEle ment()) {
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
224 Element* element = toHTMLFormControlElement(node);
225 if (element->isTextFormControl()) {
226 if (!(static_cast<HTMLTextFormControlElement*>(element))->value().is Empty())
227 data.editFlags |= WebContextMenuData::CanSelectAll;
228 }
229 }
224 data.editFlags |= WebContextMenuData::CanTranslate; 230 data.editFlags |= WebContextMenuData::CanTranslate;
225 231
226 // Links, Images, Media tags, and Image/Media-Links take preference over 232 // Links, Images, Media tags, and Image/Media-Links take preference over
227 // all else. 233 // all else.
228 data.linkURL = r.absoluteLinkURL(); 234 data.linkURL = r.absoluteLinkURL();
229 235
230 if (isHTMLCanvasElement(r.innerNonSharedNode())) { 236 if (isHTMLCanvasElement(r.innerNonSharedNode())) {
231 data.mediaType = WebContextMenuData::MediaTypeCanvas; 237 data.mediaType = WebContextMenuData::MediaTypeCanvas;
232 data.hasImageContents = true; 238 data.hasImageContents = true;
233 } else if (!r.absoluteImageURL().isEmpty()) { 239 } else if (!r.absoluteImageURL().isEmpty()) {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 outputItems[i] = subItems[i]; 443 outputItems[i] = subItems[i];
438 subMenuItems.swap(outputItems); 444 subMenuItems.swap(outputItems);
439 } 445 }
440 446
441 void ContextMenuClientImpl::populateCustomMenuItems(const blink::ContextMenu* de faultMenu, WebContextMenuData* data) 447 void ContextMenuClientImpl::populateCustomMenuItems(const blink::ContextMenu* de faultMenu, WebContextMenuData* data)
442 { 448 {
443 populateSubMenuItems(defaultMenu->items(), data->customItems); 449 populateSubMenuItems(defaultMenu->items(), data->customItems);
444 } 450 }
445 451
446 } // namespace blink 452 } // namespace blink
OLDNEW
« 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