summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-23 18:14:06 +0000
committersidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-23 18:14:06 +0000
commit442a3a19447e3fb2409c96ae75184cecfd956638 (patch)
tree7d3323f0f214cf4bf394767d644cec679feb0779
parente549b2135f56657ef0a5509fb2a8374d8c57c482 (diff)
downloadchromium_src-442a3a19447e3fb2409c96ae75184cecfd956638.zip
chromium_src-442a3a19447e3fb2409c96ae75184cecfd956638.tar.gz
chromium_src-442a3a19447e3fb2409c96ae75184cecfd956638.tar.bz2
Don't change selection for right click on text area if some texts were already selected.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14332 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/glue/context_menu_client_impl.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/webkit/glue/context_menu_client_impl.cc b/webkit/glue/context_menu_client_impl.cc
index 65089c9..2947968 100644
--- a/webkit/glue/context_menu_client_impl.cc
+++ b/webkit/glue/context_menu_client_impl.cc
@@ -57,7 +57,8 @@ bool IsASingleWord(const std::wstring& text) {
// 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 @@ std::wstring GetMisspelledWord(const WebCore::ContextMenu* default_menu,
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);