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

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 code as suggested Created 6 years, 4 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 if (isHTMLTextFormControlElement(r.innerNonSharedNode())) {
223 data.editFlags |= WebContextMenuData::CanSelectAll; 223 if (!toHTMLTextFormControlElement(r.innerNonSharedNode())->value().isEmp ty())
224 data.editFlags |= WebContextMenuData::CanSelectAll;
225 }
224 data.editFlags |= WebContextMenuData::CanTranslate; 226 data.editFlags |= WebContextMenuData::CanTranslate;
225 227
226 // Links, Images, Media tags, and Image/Media-Links take preference over 228 // Links, Images, Media tags, and Image/Media-Links take preference over
227 // all else. 229 // all else.
228 data.linkURL = r.absoluteLinkURL(); 230 data.linkURL = r.absoluteLinkURL();
229 231
230 if (isHTMLCanvasElement(r.innerNonSharedNode())) { 232 if (isHTMLCanvasElement(r.innerNonSharedNode())) {
231 data.mediaType = WebContextMenuData::MediaTypeCanvas; 233 data.mediaType = WebContextMenuData::MediaTypeCanvas;
232 data.hasImageContents = true; 234 data.hasImageContents = true;
233 } else if (!r.absoluteImageURL().isEmpty()) { 235 } else if (!r.absoluteImageURL().isEmpty()) {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 outputItems[i] = subItems[i]; 439 outputItems[i] = subItems[i];
438 subMenuItems.swap(outputItems); 440 subMenuItems.swap(outputItems);
439 } 441 }
440 442
441 void ContextMenuClientImpl::populateCustomMenuItems(const blink::ContextMenu* de faultMenu, WebContextMenuData* data) 443 void ContextMenuClientImpl::populateCustomMenuItems(const blink::ContextMenu* de faultMenu, WebContextMenuData* data)
442 { 444 {
443 populateSubMenuItems(defaultMenu->items(), data->customItems); 445 populateSubMenuItems(defaultMenu->items(), data->customItems);
444 } 446 }
445 447
446 } // namespace blink 448 } // 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