Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: Source/web/ContextMenuClientImpl.cpp

Issue 1326563002: Introduce visiblePositionOf() with PositionWithAffinity as replacement of VisiblePosition constructo (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-09-01T10:55:04 Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/testing/Internals.cpp ('k') | Source/web/WebSurroundingText.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/core/testing/Internals.cpp ('k') | Source/web/WebSurroundingText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698