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

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: 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // We can always select all...
223 data.editFlags |= WebContextMenuData::CanSelectAll; 223 Node* node = r.innerNonSharedNode();
224 int len = 0;
225 if (node->isElementNode() && (static_cast<Element *>(node))->isFormControlEl ement()) {
darin (slow to review) 2014/07/25 05:11:56 nit: no " " before "*"
226 Element* element = toHTMLFormControlElement(node);
227 if (element->isTextFormControl())
228 len = (static_cast<HTMLTextFormControlElement *>(element))->value(). length();
darin (slow to review) 2014/07/25 05:11:56 I would probably skip the "len" local variable and
229 }
230 if (len > 0)
231 data.editFlags |= WebContextMenuData::CanSelectAll;
224 data.editFlags |= WebContextMenuData::CanTranslate; 232 data.editFlags |= WebContextMenuData::CanTranslate;
225 233
226 // Links, Images, Media tags, and Image/Media-Links take preference over 234 // Links, Images, Media tags, and Image/Media-Links take preference over
227 // all else. 235 // all else.
228 data.linkURL = r.absoluteLinkURL(); 236 data.linkURL = r.absoluteLinkURL();
229 237
230 if (isHTMLCanvasElement(r.innerNonSharedNode())) { 238 if (isHTMLCanvasElement(r.innerNonSharedNode())) {
231 data.mediaType = WebContextMenuData::MediaTypeCanvas; 239 data.mediaType = WebContextMenuData::MediaTypeCanvas;
232 data.hasImageContents = true; 240 data.hasImageContents = true;
233 } else if (!r.absoluteImageURL().isEmpty()) { 241 } else if (!r.absoluteImageURL().isEmpty()) {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 outputItems[i] = subItems[i]; 445 outputItems[i] = subItems[i];
438 subMenuItems.swap(outputItems); 446 subMenuItems.swap(outputItems);
439 } 447 }
440 448
441 void ContextMenuClientImpl::populateCustomMenuItems(const blink::ContextMenu* de faultMenu, WebContextMenuData* data) 449 void ContextMenuClientImpl::populateCustomMenuItems(const blink::ContextMenu* de faultMenu, WebContextMenuData* data)
442 { 450 {
443 populateSubMenuItems(defaultMenu->items(), data->customItems); 451 populateSubMenuItems(defaultMenu->items(), data->customItems);
444 } 452 }
445 453
446 } // namespace blink 454 } // 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