| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canDelete()) | 208 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canDelete()) |
| 209 data.editFlags |= WebContextMenuData::CanDelete; | 209 data.editFlags |= WebContextMenuData::CanDelete; |
| 210 // We can always select all... | 210 // We can always select all... |
| 211 data.editFlags |= WebContextMenuData::CanSelectAll; | 211 data.editFlags |= WebContextMenuData::CanSelectAll; |
| 212 data.editFlags |= WebContextMenuData::CanTranslate; | 212 data.editFlags |= WebContextMenuData::CanTranslate; |
| 213 | 213 |
| 214 // Links, Images, Media tags, and Image/Media-Links take preference over | 214 // Links, Images, Media tags, and Image/Media-Links take preference over |
| 215 // all else. | 215 // all else. |
| 216 data.linkURL = r.absoluteLinkURL(); | 216 data.linkURL = r.absoluteLinkURL(); |
| 217 | 217 |
| 218 if (!r.absoluteImageURL().isEmpty()) { | 218 if (isHTMLCanvasElement(r.innerNonSharedNode())) { |
| 219 data.mediaType = WebContextMenuData::MediaTypeCanvas; |
| 220 } else if (!r.absoluteImageURL().isEmpty()) { |
| 219 data.srcURL = r.absoluteImageURL(); | 221 data.srcURL = r.absoluteImageURL(); |
| 220 data.mediaType = WebContextMenuData::MediaTypeImage; | 222 data.mediaType = WebContextMenuData::MediaTypeImage; |
| 221 data.mediaFlags |= WebContextMenuData::MediaCanPrint; | 223 data.mediaFlags |= WebContextMenuData::MediaCanPrint; |
| 222 } else if (!r.absoluteMediaURL().isEmpty()) { | 224 } else if (!r.absoluteMediaURL().isEmpty()) { |
| 223 data.srcURL = r.absoluteMediaURL(); | 225 data.srcURL = r.absoluteMediaURL(); |
| 224 | 226 |
| 225 // We know that if absoluteMediaURL() is not empty, then this | 227 // We know that if absoluteMediaURL() is not empty, then this |
| 226 // is a media element. | 228 // is a media element. |
| 227 HTMLMediaElement* mediaElement = toHTMLMediaElement(r.innerNonSharedNode
()); | 229 HTMLMediaElement* mediaElement = toHTMLMediaElement(r.innerNonSharedNode
()); |
| 228 if (isHTMLVideoElement(*mediaElement)) | 230 if (isHTMLVideoElement(*mediaElement)) |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 outputItems[i] = subItems[i]; | 419 outputItems[i] = subItems[i]; |
| 418 subMenuItems.swap(outputItems); | 420 subMenuItems.swap(outputItems); |
| 419 } | 421 } |
| 420 | 422 |
| 421 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu*
defaultMenu, WebContextMenuData* data) | 423 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu*
defaultMenu, WebContextMenuData* data) |
| 422 { | 424 { |
| 423 populateSubMenuItems(defaultMenu->items(), data->customItems); | 425 populateSubMenuItems(defaultMenu->items(), data->customItems); |
| 424 } | 426 } |
| 425 | 427 |
| 426 } // namespace blink | 428 } // namespace blink |
| OLD | NEW |