SpellCheck::ReplaceMisspelledRange() should be robust |
||
Issue descriptionSpellCheck::ReplaceMisspelledRange() attempts to replaces selected text, text under caret or selected range. However, this function is used for action of replacing misspelled word selected in context menu. This can work most of case, but someone change selection for DOM tree during context menu execution, e.g. firing timer. One of the robust way to implement replacing misspelled word with suggestion is assigned unique id to misspelled word and pass it to context menu and context menu action passes back unique id to Blink. Using unique id requires lots of change in both Blink and Chrome sides. For short time solution, I propose: - Move SelectMisspellingAsync() to SpellChecker.cpp from ContextMenuClient.cpp - Make SelectMisspellingAsync() and ReplaceMisspelledRange() uses same algorithm to find misspelled word. At this time, SelectMisspellingAsync() picks up misspelled word at start of selection, thus we can simply ReplaceMisspelledRange() simpler to replace misspelled word only rather than selected range.
,
Jun 23 2017
My work to support SuggestionSpans in Chrome is going to require a similar replacement mechanism (each suggestion marker will get an ID, and the browser code will pass back an ID). I'm not sure how much work we can re-use though since there's probably a bunch of other browser-side spell check stuff we have to change.
,
Jul 20 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/37f9a3079589e85e24eaa5849235b7eedc9fd0ab commit 37f9a3079589e85e24eaa5849235b7eedc9fd0ab Author: rlanday <rlanday@chromium.org> Date: Thu Jul 20 23:17:15 2017 Change behavior of SpellChecker::GetSpellCheckMarkerTouchingSelection() When I added this method, I had added some extra logic for the case where we have a collapsed selection to make it find spell check markers the caret is touching an endpoint of. This was to support the spell check menu on Android, where tapping the endpoint of a word brings up the menu (on other platforms you need to right-click in the interior of the word for spell check options to appear in the context menu). Upon further reflection, we decided we should put this logic somewhere else. We're going to keep this method around though because we're going to make use of it in ContextMenuClient::SelectMisspellingAsync(). I'm renaming this method to GetSpellCheckMarkerUnderSelection() to try to make the name less misleading. BUG=736181 Review-Url: https://codereview.chromium.org/2954763002 Cr-Commit-Position: refs/heads/master@{#488476} [modify] https://crrev.com/37f9a3079589e85e24eaa5849235b7eedc9fd0ab/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp [modify] https://crrev.com/37f9a3079589e85e24eaa5849235b7eedc9fd0ab/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.h [modify] https://crrev.com/37f9a3079589e85e24eaa5849235b7eedc9fd0ab/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckerTest.cpp
,
Jul 21 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/eef04de483168c40a8eadfc840fc8ddf4432f55a commit eef04de483168c40a8eadfc840fc8ddf4432f55a Author: rlanday <rlanday@chromium.org> Date: Fri Jul 21 04:17:08 2017 Optimize SpellChecker::GetSpellCheckMarkerUnderSelection() Currently, this method does a linear scan over all spell check markers contained in the text node(s) containing the selection. This takes about 0.553 ms on the source for the "List of Australian treaties" Wikipedia page. This CL refactors this method to instead use the newly-added DocumentMarkerController::FirstMarkerIntersectingRange() method, which is more efficient as it uses binary search. With this change, we now spend about ~0.02 ms in this method doing the same test. BUG=736181 Review-Url: https://codereview.chromium.org/2947093003 Cr-Commit-Position: refs/heads/master@{#488577} [modify] https://crrev.com/eef04de483168c40a8eadfc840fc8ddf4432f55a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
,
Jul 25 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/76cf4f1fd0db79aeb3c6c08d92afcae00b0cd08e commit 76cf4f1fd0db79aeb3c6c08d92afcae00b0cd08e Author: rlanday <rlanday@chromium.org> Date: Tue Jul 25 20:41:37 2017 Refactor ContextMenuClient::SelectMisspellingAsync() Currently, ContextMenuClient::SelectMisspellingAsync() duplicates logic that we also implement in SpellChecker::GetSpellCheckMarkerUnderSelection(). This CL implements SelectMisspellingAsync() on top of GetSpellCheckMarkerUnderSelection() to reduce code duplication. BUG=736181 Review-Url: https://codereview.chromium.org/2959553002 Cr-Commit-Position: refs/heads/master@{#489417} [modify] https://crrev.com/76cf4f1fd0db79aeb3c6c08d92afcae00b0cd08e/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
,
Aug 17 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/34710333ad9383a45f2fcf93d15b45add857c4bf commit 34710333ad9383a45f2fcf93d15b45add857c4bf Author: Ryan Landay <rlanday@chromium.org> Date: Thu Aug 17 05:20:49 2017 Add DocumentMarkerController::MarkersIntersectingRange() Currently, the only way to find the full list of markers intersecting a range is to iterate through the nodes the range contains, and get the complete list of nodes for each range from DocumentMarkerController, and do a linear search through the list. This is inefficient if we have a text node with a lot of markers, since we could be doing a binary search instead of a linear scan. This CL introduces a DocumentMarkerController::MarkersIntersectingRange() method which allows us to perform this operation much more efficiently. Bug: 736181 Change-Id: Ib9c8036560a1ada642fc265a41e1bcadd5d5c949 Reviewed-on: https://chromium-review.googlesource.com/590948 Commit-Queue: Ryan Landay <rlanday@chromium.org> Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org> Cr-Commit-Position: refs/heads/master@{#495081} [modify] https://crrev.com/34710333ad9383a45f2fcf93d15b45add857c4bf/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp [modify] https://crrev.com/34710333ad9383a45f2fcf93d15b45add857c4bf/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h [modify] https://crrev.com/34710333ad9383a45f2fcf93d15b45add857c4bf/third_party/WebKit/Source/core/editing/markers/DocumentMarkerControllerTest.cpp
,
Feb 1 2018
|
||
►
Sign in to add a comment |
||
Comment 1 by rlanday@chromium.org
, Jun 23 2017Status: Assigned (was: Available)