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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canDelete()) | 214 if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canDelete()) |
215 data.editFlags |= WebContextMenuData::CanDelete; | 215 data.editFlags |= WebContextMenuData::CanDelete; |
216 // We can always select all... | 216 // We can always select all... |
217 data.editFlags |= WebContextMenuData::CanSelectAll; | 217 data.editFlags |= WebContextMenuData::CanSelectAll; |
218 data.editFlags |= WebContextMenuData::CanTranslate; | 218 data.editFlags |= WebContextMenuData::CanTranslate; |
219 | 219 |
220 // Links, Images, Media tags, and Image/Media-Links take preference over | 220 // Links, Images, Media tags, and Image/Media-Links take preference over |
221 // all else. | 221 // all else. |
222 data.linkURL = r.absoluteLinkURL(); | 222 data.linkURL = r.absoluteLinkURL(); |
223 | 223 |
| 224 if (r.innerNode()->isHTMLElement()) { |
| 225 HTMLElement* htmlElement = toHTMLElement(r.innerNode()); |
| 226 if (!htmlElement->title().isEmpty()) { |
| 227 data.titleText = htmlElement->title(); |
| 228 } else { |
| 229 data.titleText = htmlElement->altText(); |
| 230 } |
| 231 } |
| 232 |
224 if (isHTMLCanvasElement(r.innerNode())) { | 233 if (isHTMLCanvasElement(r.innerNode())) { |
225 data.mediaType = WebContextMenuData::MediaTypeCanvas; | 234 data.mediaType = WebContextMenuData::MediaTypeCanvas; |
226 data.hasImageContents = true; | 235 data.hasImageContents = true; |
227 } else if (!r.absoluteImageURL().isEmpty()) { | 236 } else if (!r.absoluteImageURL().isEmpty()) { |
228 data.srcURL = r.absoluteImageURL(); | 237 data.srcURL = r.absoluteImageURL(); |
229 data.mediaType = WebContextMenuData::MediaTypeImage; | 238 data.mediaType = WebContextMenuData::MediaTypeImage; |
230 data.mediaFlags |= WebContextMenuData::MediaCanPrint; | 239 data.mediaFlags |= WebContextMenuData::MediaCanPrint; |
231 | 240 |
232 // An image can be null for many reasons, like being blocked, no image | 241 // An image can be null for many reasons, like being blocked, no image |
233 // data received from server yet. | 242 // data received from server yet. |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 outputItems[i] = subItems[i]; | 451 outputItems[i] = subItems[i]; |
443 subMenuItems.swap(outputItems); | 452 subMenuItems.swap(outputItems); |
444 } | 453 } |
445 | 454 |
446 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe
nu, WebContextMenuData* data) | 455 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe
nu, WebContextMenuData* data) |
447 { | 456 { |
448 populateSubMenuItems(defaultMenu->items(), data->customItems); | 457 populateSubMenuItems(defaultMenu->items(), data->customItems); |
449 } | 458 } |
450 | 459 |
451 } // namespace blink | 460 } // namespace blink |
OLD | NEW |