| 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);
|
|
|