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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 Range* markerRange = selectionRange->cloneRange(); | 124 Range* markerRange = selectionRange->cloneRange(); |
125 markerRange->setStart(markerRange->startContainer(), markers[0]->startOffset
()); | 125 markerRange->setStart(markerRange->startContainer(), markers[0]->startOffset
()); |
126 markerRange->setEnd(markerRange->endContainer(), markers[0]->endOffset()); | 126 markerRange->setEnd(markerRange->endContainer(), markers[0]->endOffset()); |
127 | 127 |
128 if (markerRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation) != selec
tionRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation)) | 128 if (markerRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation) != selec
tionRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation)) |
129 return String(); | 129 return String(); |
130 | 130 |
131 return markerRange->text(); | 131 return markerRange->text(); |
132 } | 132 } |
133 | 133 |
134 static bool shouldShowContextMenuFromTouch(const WebContextMenuData& data) | 134 bool ContextMenuClientImpl::shouldShowContextMenuFromTouch(const WebContextMenuD
ata& data) |
135 { | 135 { |
136 return !data.linkURL.isEmpty() | 136 return m_webView->page()->settings().alwaysShowContextMenuOnTouch() |
| 137 || !data.linkURL.isEmpty() |
137 || data.mediaType == WebContextMenuData::MediaTypeImage | 138 || data.mediaType == WebContextMenuData::MediaTypeImage |
138 || data.mediaType == WebContextMenuData::MediaTypeVideo | 139 || data.mediaType == WebContextMenuData::MediaTypeVideo |
139 || data.isEditable; | 140 || data.isEditable; |
140 } | 141 } |
141 | 142 |
142 bool ContextMenuClientImpl::showContextMenu(const ContextMenu* defaultMenu, bool
fromTouch) | 143 bool ContextMenuClientImpl::showContextMenu(const ContextMenu* defaultMenu, bool
fromTouch) |
143 { | 144 { |
144 // Displaying the context menu in this function is a big hack as we don't | 145 // Displaying the context menu in this function is a big hack as we don't |
145 // have context, i.e. whether this is being invoked via a script or in | 146 // have context, i.e. whether this is being invoked via a script or in |
146 // response to user input (Mouse event WM_RBUTTONDOWN, | 147 // response to user input (Mouse event WM_RBUTTONDOWN, |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 outputItems[i] = subItems[i]; | 427 outputItems[i] = subItems[i]; |
427 subMenuItems.swap(outputItems); | 428 subMenuItems.swap(outputItems); |
428 } | 429 } |
429 | 430 |
430 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe
nu, WebContextMenuData* data) | 431 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe
nu, WebContextMenuData* data) |
431 { | 432 { |
432 populateSubMenuItems(defaultMenu->items(), data->customItems); | 433 populateSubMenuItems(defaultMenu->items(), data->customItems); |
433 } | 434 } |
434 | 435 |
435 } // namespace blink | 436 } // namespace blink |
OLD | NEW |