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

Side by Side Diff: webkit/glue/context_menu_client_impl.cc

Issue 20280: [chromium-reviews] Fix bug where right click in a text area selects empty space. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 8
9 MSVC_PUSH_WARNING_LEVEL(0); 9 MSVC_PUSH_WARNING_LEVEL(0);
10 #include "ContextMenu.h" 10 #include "ContextMenu.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if (selection.isRange()) { 85 if (selection.isRange()) {
86 selected_frame->setSelectionGranularity(WebCore::WordGranularity); 86 selected_frame->setSelectionGranularity(WebCore::WordGranularity);
87 } 87 }
88 88
89 if (selected_frame->shouldChangeSelection(selection)) 89 if (selected_frame->shouldChangeSelection(selection))
90 selected_frame->selection()->setSelection(selection); 90 selected_frame->selection()->setSelection(selection);
91 91
92 misspelled_word_string = CollapseWhitespace( 92 misspelled_word_string = CollapseWhitespace(
93 webkit_glue::StringToStdWString(selected_frame->selectedText()), 93 webkit_glue::StringToStdWString(selected_frame->selectedText()),
94 false); 94 false);
95 95
96 // If misspelled word is empty, then that portion should not be selected.
97 // Set the selection to that position only, and do not expand.
98 if (misspelled_word_string.empty()) {
99 selection = WebCore::Selection(pos);
100 selected_frame->selection()->setSelection(selection);
101 }
102
96 return misspelled_word_string; 103 return misspelled_word_string;
97 } 104 }
98 105
99 } // namespace 106 } // namespace
100 107
101 ContextMenuClientImpl::~ContextMenuClientImpl() { 108 ContextMenuClientImpl::~ContextMenuClientImpl() {
102 } 109 }
103 110
104 void ContextMenuClientImpl::contextMenuDestroyed() { 111 void ContextMenuClientImpl::contextMenuDestroyed() {
105 delete this; 112 delete this;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 279
273 bool ContextMenuClientImpl::shouldIncludeInspectElementItem() { 280 bool ContextMenuClientImpl::shouldIncludeInspectElementItem() {
274 return false; // TODO(jackson): Eventually include the inspector context me nu item 281 return false; // TODO(jackson): Eventually include the inspector context me nu item
275 } 282 }
276 283
277 #if defined(OS_MACOSX) 284 #if defined(OS_MACOSX)
278 void ContextMenuClientImpl::searchWithSpotlight() { 285 void ContextMenuClientImpl::searchWithSpotlight() {
279 // TODO(pinkerton): write this 286 // TODO(pinkerton): write this
280 } 287 }
281 #endif 288 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698