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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // Don't provide suggestions for multiple words. | 122 // Don't provide suggestions for multiple words. |
123 if (!isASingleWord(misspelledWord)) | 123 if (!isASingleWord(misspelledWord)) |
124 return String(); | 124 return String(); |
125 return misspelledWord; | 125 return misspelledWord; |
126 } | 126 } |
127 | 127 |
128 // Selection is empty, so change the selection to the word under the cursor. | 128 // Selection is empty, so change the selection to the word under the cursor. |
129 HitTestResult hitTestResult = selectedFrame->eventHandler(). | 129 HitTestResult hitTestResult = selectedFrame->eventHandler(). |
130 hitTestResultAtPoint(selectedFrame->page()->contextMenuController().hitT
estResult().pointInInnerNodeFrame()); | 130 hitTestResultAtPoint(selectedFrame->page()->contextMenuController().hitT
estResult().pointInInnerNodeFrame()); |
131 Node* innerNode = hitTestResult.innerNode(); | 131 Node* innerNode = hitTestResult.innerNode(); |
132 VisiblePosition pos(innerNode->layoutObject()->positionForPoint( | 132 VisiblePosition pos = visiblePositionOf(innerNode->layoutObject()->positionF
orPoint( |
133 hitTestResult.localPoint())); | 133 hitTestResult.localPoint())); |
134 | 134 |
135 if (pos.isNull()) | 135 if (pos.isNull()) |
136 return misspelledWord; // It is empty. | 136 return misspelledWord; // It is empty. |
137 | 137 |
138 WebLocalFrameImpl::selectWordAroundPosition(selectedFrame, pos); | 138 WebLocalFrameImpl::selectWordAroundPosition(selectedFrame, pos); |
139 misspelledWord = selectedFrame->selectedText().stripWhiteSpace(); | 139 misspelledWord = selectedFrame->selectedText().stripWhiteSpace(); |
140 | 140 |
141 #if OS(MACOSX) | 141 #if OS(MACOSX) |
142 // If misspelled word is still empty, then that portion should not be | 142 // If misspelled word is still empty, then that portion should not be |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 outputItems[i] = subItems[i]; | 466 outputItems[i] = subItems[i]; |
467 subMenuItems.swap(outputItems); | 467 subMenuItems.swap(outputItems); |
468 } | 468 } |
469 | 469 |
470 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe
nu, WebContextMenuData* data) | 470 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe
nu, WebContextMenuData* data) |
471 { | 471 { |
472 populateSubMenuItems(defaultMenu->items(), data->customItems); | 472 populateSubMenuItems(defaultMenu->items(), data->customItems); |
473 } | 473 } |
474 | 474 |
475 } // namespace blink | 475 } // namespace blink |
OLD | NEW |