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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 Node* innerNode = hitTestResult.innerNode(); | 126 Node* innerNode = hitTestResult.innerNode(); |
127 VisiblePosition pos(innerNode->renderer()->positionForPoint( | 127 VisiblePosition pos(innerNode->renderer()->positionForPoint( |
128 hitTestResult.localPoint())); | 128 hitTestResult.localPoint())); |
129 | 129 |
130 if (pos.isNull()) | 130 if (pos.isNull()) |
131 return misspelledWord; // It is empty. | 131 return misspelledWord; // It is empty. |
132 | 132 |
133 WebFrameImpl::selectWordAroundPosition(selectedFrame, pos); | 133 WebFrameImpl::selectWordAroundPosition(selectedFrame, pos); |
134 misspelledWord = selectedFrame->selectedText().stripWhiteSpace(); | 134 misspelledWord = selectedFrame->selectedText().stripWhiteSpace(); |
135 | 135 |
136 #if OS(DARWIN) | 136 #if OS(MACOSX) |
137 // If misspelled word is still empty, then that portion should not be | 137 // If misspelled word is still empty, then that portion should not be |
138 // selected. Set the selection to that position only, and do not expand. | 138 // selected. Set the selection to that position only, and do not expand. |
139 if (misspelledWord.isEmpty()) | 139 if (misspelledWord.isEmpty()) |
140 selectedFrame->selection().setSelection(VisibleSelection(pos)); | 140 selectedFrame->selection().setSelection(VisibleSelection(pos)); |
141 #else | 141 #else |
142 // On non-Mac, right-click should not make a range selection in any case. | 142 // On non-Mac, right-click should not make a range selection in any case. |
143 selectedFrame->selection().setSelection(VisibleSelection(pos)); | 143 selectedFrame->selection().setSelection(VisibleSelection(pos)); |
144 #endif | 144 #endif |
145 return misspelledWord; | 145 return misspelledWord; |
146 } | 146 } |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 if (form && r.innerNonSharedNode()->hasTagName(HTMLNames::inputTag)) { | 338 if (form && r.innerNonSharedNode()->hasTagName(HTMLNames::inputTag)) { |
339 HTMLInputElement* selectedElement = toHTMLInputElement(r.innerNonSha
redNode()); | 339 HTMLInputElement* selectedElement = toHTMLInputElement(r.innerNonSha
redNode()); |
340 if (selectedElement) { | 340 if (selectedElement) { |
341 WebSearchableFormData ws = WebSearchableFormData(WebFormElement(
form), WebInputElement(selectedElement)); | 341 WebSearchableFormData ws = WebSearchableFormData(WebFormElement(
form), WebInputElement(selectedElement)); |
342 if (ws.url().isValid()) | 342 if (ws.url().isValid()) |
343 data.keywordURL = ws.url(); | 343 data.keywordURL = ws.url(); |
344 } | 344 } |
345 } | 345 } |
346 } | 346 } |
347 | 347 |
348 #if OS(DARWIN) | 348 #if OS(MACOSX) |
349 if (selectedFrame->editor().selectionHasStyle(CSSPropertyDirection, "ltr") !
= FalseTriState) | 349 if (selectedFrame->editor().selectionHasStyle(CSSPropertyDirection, "ltr") !
= FalseTriState) |
350 data.writingDirectionLeftToRight |= WebContextMenuData::CheckableMenuIte
mChecked; | 350 data.writingDirectionLeftToRight |= WebContextMenuData::CheckableMenuIte
mChecked; |
351 if (selectedFrame->editor().selectionHasStyle(CSSPropertyDirection, "rtl") !
= FalseTriState) | 351 if (selectedFrame->editor().selectionHasStyle(CSSPropertyDirection, "rtl") !
= FalseTriState) |
352 data.writingDirectionRightToLeft |= WebContextMenuData::CheckableMenuIte
mChecked; | 352 data.writingDirectionRightToLeft |= WebContextMenuData::CheckableMenuIte
mChecked; |
353 #endif // OS(DARWIN) | 353 #endif // OS(MACOSX) |
354 | 354 |
355 // Now retrieve the security info. | 355 // Now retrieve the security info. |
356 DocumentLoader* dl = selectedFrame->loader()->documentLoader(); | 356 DocumentLoader* dl = selectedFrame->loader()->documentLoader(); |
357 WebDataSource* ds = WebDataSourceImpl::fromDocumentLoader(dl); | 357 WebDataSource* ds = WebDataSourceImpl::fromDocumentLoader(dl); |
358 if (ds) | 358 if (ds) |
359 data.securityInfo = ds->response().securityInfo(); | 359 data.securityInfo = ds->response().securityInfo(); |
360 | 360 |
361 data.referrerPolicy = static_cast<WebReferrerPolicy>(selectedFrame->document
()->referrerPolicy()); | 361 data.referrerPolicy = static_cast<WebReferrerPolicy>(selectedFrame->document
()->referrerPolicy()); |
362 | 362 |
363 // Filter out custom menu elements and add them into the data. | 363 // Filter out custom menu elements and add them into the data. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 outputItems[i] = subItems[i]; | 412 outputItems[i] = subItems[i]; |
413 subMenuItems.swap(outputItems); | 413 subMenuItems.swap(outputItems); |
414 } | 414 } |
415 | 415 |
416 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu*
defaultMenu, WebContextMenuData* data) | 416 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu*
defaultMenu, WebContextMenuData* data) |
417 { | 417 { |
418 populateSubMenuItems(defaultMenu->items(), data->customItems); | 418 populateSubMenuItems(defaultMenu->items(), data->customItems); |
419 } | 419 } |
420 | 420 |
421 } // namespace WebKit | 421 } // namespace WebKit |
OLD | NEW |