RESOLVED FIXED 108509
[Chromium] Select multi-word misspelling on context click
https://bugs.webkit.org/show_bug.cgi?id=108509
Summary [Chromium] Select multi-word misspelling on context click
Rouslan Solomakhin
Reported 2013-01-31 12:18:59 PST
Spell check should select multi-word misspellings on context click. To test manually, enable 'Ask Google for Suggestions' in Chrome, type 'It should be upper case.', and context-click on the word 'upper'. The test succeeds when 'upper case' was selected after context click.
Attachments
Patch (8.04 KB, patch)
2013-01-31 13:38 PST, Rouslan Solomakhin
no flags
Patch for landing (14.68 KB, patch)
2013-01-31 16:01 PST, Rouslan Solomakhin
no flags
Patch for landing (14.68 KB, patch)
2013-01-31 16:06 PST, Rouslan Solomakhin
no flags
Patch for landing (14.49 KB, patch)
2013-01-31 16:44 PST, Rouslan Solomakhin
no flags
Rouslan Solomakhin
Comment 1 2013-01-31 13:38:42 PST
Tony Chang
Comment 2 2013-01-31 15:10:02 PST
Comment on attachment 185850 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=185850&action=review As a follow up, it would be nice if we moved the spellchecking code into a helper function out of getCustomMenuFromDefaultItems() since that function is > 200 lines. > Source/WebKit/chromium/src/ContextMenuClientImpl.cpp:295 > + if (markerRange->startOffset() == selectionRange->startOffset() && markerRange->endOffset() == selectionRange->endOffset()) { Could you use WebCore::areRangesEqual() here instead of comparing start and end?
Rouslan Solomakhin
Comment 3 2013-01-31 16:01:36 PST
Created attachment 185884 [details] Patch for landing
WebKit Review Bot
Comment 4 2013-01-31 16:03:58 PST
Attachment 185884 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/editing/spelling/spelling-exactly-selected-multiple-words-expected.txt', u'LayoutTests/editing/spelling/spelling-exactly-selected-multiple-words.html', u'LayoutTests/editing/spelling/spelling-should-select-multiple-words-expected.txt', u'LayoutTests/editing/spelling/spelling-should-select-multiple-words.html', u'LayoutTests/platform/chromium/TestExpectations', u'Source/WebKit/chromium/ChangeLog', u'Source/WebKit/chromium/src/ContextMenuClientImpl.cpp', u'Tools/ChangeLog', u'Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.cpp']" exit_code: 1 Source/WebKit/chromium/src/ContextMenuClientImpl.cpp:150: Place brace on its own line for function definitions. [whitespace/braces] [4] Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.cpp:40: Place brace on its own line for function definitions. [whitespace/braces] [4] Total errors found: 2 in 9 files If any of these errors are false positives, please file a bug against check-webkit-style.
Rouslan Solomakhin
Comment 5 2013-01-31 16:04:48 PST
(In reply to comment #2) > (From update of attachment 185850 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=185850&action=review > > As a follow up, it would be nice if we moved the spellchecking code into a helper function out of getCustomMenuFromDefaultItems() since that function is > 200 lines. Moved the async part of the spellchecking code into "selectMisspellingAsync()", which is symmetric to the synchronous version "selectMisspelledWord()". Do we need more refactorings here? > > Source/WebKit/chromium/src/ContextMenuClientImpl.cpp:295 > > + if (markerRange->startOffset() == selectionRange->startOffset() && markerRange->endOffset() == selectionRange->endOffset()) { > > Could you use WebCore::areRangesEqual() here instead of comparing start and end? Done.
Rouslan Solomakhin
Comment 6 2013-01-31 16:06:04 PST
Created attachment 185887 [details] Patch for landing
Rouslan Solomakhin
Comment 7 2013-01-31 16:07:05 PST
Comment on attachment 185887 [details] Patch for landing Fixed style errors.
Tony Chang
Comment 8 2013-01-31 16:35:49 PST
Comment on attachment 185887 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=185887&action=review I had suggested moving in a follow up change because now the diff doesn't show your changes. Anyway, this is OK too. > Source/WebKit/chromium/src/ContextMenuClientImpl.cpp:149 > +// Helper function to get misspelling on which context menu is to be invoked > +// for asynchronous spellcheck. This function changes the selection only when > +// there were no selected characters. Remove this comment. > Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.cpp:120 > + if (word == WebString::fromUTF8("wellcome")) > + append(suggestions, WebString::fromUTF8("welcome")); Why do we copy and swap? Why can't we append to |suggestions| directly?
Rouslan Solomakhin
Comment 9 2013-01-31 16:44:35 PST
Created attachment 185896 [details] Patch for landing
Rouslan Solomakhin
Comment 10 2013-01-31 16:45:45 PST
(In reply to comment #8) > (From update of attachment 185887 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=185887&action=review > > I had suggested moving in a follow up change because now the diff doesn't show your changes. Anyway, this is OK too. Sorry about the confusion. > > Source/WebKit/chromium/src/ContextMenuClientImpl.cpp:149 > > +// Helper function to get misspelling on which context menu is to be invoked > > +// for asynchronous spellcheck. This function changes the selection only when > > +// there were no selected characters. > > Remove this comment. Removed. > > Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.cpp:120 > > + if (word == WebString::fromUTF8("wellcome")) > > + append(suggestions, WebString::fromUTF8("welcome")); > > Why do we copy and swap? Why can't we append to |suggestions| directly? WebVector has a constant size.
Rouslan Solomakhin
Comment 11 2013-01-31 16:53:15 PST
(In reply to comment #10) > WebVector has a constant size. ... and does not have built-in append(), add(), or push_back() methods.
Tony Chang
Comment 12 2013-01-31 17:01:36 PST
Comment on attachment 185896 [details] Patch for landing (In reply to comment #10) > (In reply to comment #8) > > > Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.cpp:120 > > > + if (word == WebString::fromUTF8("wellcome")) > > > + append(suggestions, WebString::fromUTF8("welcome")); > > > > Why do we copy and swap? Why can't we append to |suggestions| directly? > > WebVector has a constant size. I see. Makes sense.
WebKit Review Bot
Comment 13 2013-01-31 18:06:52 PST
Comment on attachment 185896 [details] Patch for landing Clearing flags on attachment: 185896 Committed r141519: <http://trac.webkit.org/changeset/141519>
WebKit Review Bot
Comment 14 2013-01-31 18:06:57 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.