Skip to content

Commit

Permalink
Prevent showing suggestions when right-clicking a selection range.
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=94189

Reviewed by Hajime Morita.

To emulate Safari, my r120810 changes selection when right-clicking a misspelled
word. Unfortunately, this change somehow uses VisibleSelection::isCaretOrRange
and it changes the existing selection when right-clicking a selection which
includes a misspelled word. This change uses VisibleSelection::isCaret to
prevent showing suggestions when right-clicking a selection range. (Neither does
Safari show suggestions when there is a selection range.)

* src/ContextMenuClientImpl.cpp:
(WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125757 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
hbono committed Aug 16, 2012
1 parent 0b8e849 commit 371ca95
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
17 changes: 17 additions & 0 deletions Source/WebKit/chromium/ChangeLog
@@ -1,3 +1,20 @@
2012-08-16 Hironori Bono <hbono@chromium.org>

Prevent showing suggestions when right-clicking a selection range.
https://bugs.webkit.org/show_bug.cgi?id=94189

Reviewed by Hajime Morita.

To emulate Safari, my r120810 changes selection when right-clicking a misspelled
word. Unfortunately, this change somehow uses VisibleSelection::isCaretOrRange
and it changes the existing selection when right-clicking a selection which
includes a misspelled word. This change uses VisibleSelection::isCaret to
prevent showing suggestions when right-clicking a selection range. (Neither does
Safari show suggestions when there is a selection range.)

* src/ContextMenuClientImpl.cpp:
(WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems):

2012-08-15 Sheriff Bot <webkit.review.bot@gmail.com>

Unreviewed. Rolled DEPS.
Expand Down
5 changes: 2 additions & 3 deletions Source/WebKit/chromium/src/ContextMenuClientImpl.cpp
Expand Up @@ -279,9 +279,8 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems(
// a mouse on a word, Chrome just needs to find a spelling marker on the word instread of spellchecking it.
if (selectedFrame->settings() && selectedFrame->settings()->asynchronousSpellCheckingEnabled()) {
VisibleSelection selection = selectedFrame->selection()->selection();
if (selection.isCaretOrRange()) {
if (selection.isCaret())
selection.expandUsingGranularity(WordGranularity);
if (selection.isCaret()) {
selection.expandUsingGranularity(WordGranularity);
RefPtr<Range> range = selection.toNormalizedRange();
Vector<DocumentMarker*> markers = selectedFrame->document()->markers()->markersInRange(range.get(), DocumentMarker::Spelling | DocumentMarker::Grammar);
if (markers.size() == 1) {
Expand Down

0 comments on commit 371ca95

Please sign in to comment.