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

Unified Diff: webkit/glue/context_menu_client_impl.cc

Issue 92047: Don't change selection if some texts were already selected.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/context_menu_client_impl.cc
===================================================================
--- webkit/glue/context_menu_client_impl.cc (revision 14268)
+++ webkit/glue/context_menu_client_impl.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -57,7 +57,8 @@
// Helper function to get misspelled word on which context menu
// is to be evolked. This function also sets the word on which context menu
-// has been evoked to be the selected word, as required.
+// has been evoked to be the selected word, as required. This function changes
+// the selection only when there were no selected characters.
std::wstring GetMisspelledWord(const WebCore::ContextMenu* default_menu,
WebCore::Frame* selected_frame) {
std::wstring misspelled_word_string;
@@ -67,10 +68,14 @@
webkit_glue::StringToStdWString(selected_frame->selectedText()),
false);
- // Don't provide suggestions for multiple words.
- if (!misspelled_word_string.empty() &&
- !IsASingleWord(misspelled_word_string))
- return L"";
+ // If some texts were already selected, we don't change the selection.
+ if (!misspelled_word_string.empty()) {
+ // Don't provide suggestions for multiple words.
+ if (!IsASingleWord(misspelled_word_string))
+ return L"";
+ else
+ return misspelled_word_string;
+ }
WebCore::HitTestResult hit_test_result = selected_frame->eventHandler()->
hitTestResultAtPoint(default_menu->hitTestResult().point(), true);
« 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