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