Add SpellChecker::GetSpellCheckMarkerTouchingSelection()
This CL makes some changes to SpellChecker that I need to implement the Android spellcheck menu in Chrome. On most platforms, users can apply spellcheck suggestions by right-clicking in the interior of a misspelled word (nothing happens if you right-click at an endpoint) and selecting a replacement. On Android, the spellcheck menu is triggered by tapping on a word (either in the interior or at an endpoint). This means we need to do two things (both done in this CL): - Expose a way for a caller to determine if the selection (which may be an empty caret) is currently touching a spellcheck marker. If some text is actually selected, we can just see if any spellcheck markers on the text nodes making up the selected text intersect the selection. If we just have a caret selection, we need to create a range containing one character on either side and do the same operation. This method is being added as SpellChecker::GetSpellCheckMarkerTouchingSelection(). (Note: this will eventually be useful for suggestion markers as well once those are added, so we might want to consider putting this method somewhere else). - Make SpellChecker::ReplaceMisspelledRange() (which looks for a spellcheck marker intersecting the selection) work in the case where we have a caret selection touching the spellcheck marker. This is done by using the new GetSpellCheckMarkerTouchingSelection() method to find the marker. BUG=715365 Review-Url: https://codereview.chromium.org/2925363002 Cr-Commit-Position: refs/heads/master@{#478380}
Showing
Please register or sign in to comment