forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Spellchecker] Handles nested editables correctly in cold mode checker
When the currently focused editable element is nested in an uneditable element (see the new layout test in this CL as an example), cold mode spellchecker may create invalid checking ranges: - the range starts at the end position of the last sentence - the range ends at the last position in the focused editable element - when the editable element is nested in uneditable element, a reversed range is created This patch fixes the issue by using the highest root editable as the element to check, so that all sentences are within the element. To ensure that uneditable nodes in the highest root are not marked, this patch also modifies SpellChecker::IsSpellCheckingEnabledAt() to return false on uneditable nodes. Bug: 848026 Change-Id: I26d9852ffc66aad150cf3856fd402fc31e3ad3a0 Reviewed-on: https://chromium-review.googlesource.com/1080215 Reviewed-by: Yoshifumi Inoue <yosin@chromium.org> Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org> Cr-Commit-Position: refs/heads/master@{#563159}
- Loading branch information
1 parent
e88aa42
commit 11d5f36
Showing
3 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
third_party/WebKit/LayoutTests/editing/spelling/cold_mode_nested_editables.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!doctype html> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
<script src="../assert_selection.js"></script> | ||
<script src="spellcheck_test.js"></script> | ||
<script> | ||
const longCorrectText = ' word '.repeat(20); | ||
|
||
// crbug.com/848026 | ||
spellcheck_test( | ||
[ | ||
`<div contenteditable>${longCorrectText}`, | ||
'<span contenteditable="false">zz ', | ||
'<span contenteditable id="target">zz</span>', | ||
' zz</span>', | ||
`${longCorrectText}</div>` | ||
].join(''), | ||
document => document.getElementById('target').focus(), | ||
[ | ||
`<div contenteditable>${longCorrectText}`, | ||
'<span contenteditable="false">zz ', | ||
'<span contenteditable id="target">#zz#</span>', | ||
' zz</span>', | ||
`${longCorrectText}</div>` | ||
].join(''), | ||
{ | ||
title: 'Cold mode checks text in nested editables correctly without crashing', | ||
needsFullCheck: true | ||
} | ||
); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters