Autocorrected text doesn't have a marker of type autocorrected
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Apr 2013 18:56:16 +0000 (18:56 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Apr 2013 18:56:16 +0000 (18:56 +0000)
commit6afd49343a1c2f779838a7dfd360a6526d647915
tree5d023c59d9d021679eb816abca09d0b798c307b1
parentf5fcbe6d35d3d5b27b0cd1e4be311cb46ca7fe65
Autocorrected text doesn't have a marker of type autocorrected
https://bugs.webkit.org/show_bug.cgi?id=114337

Reviewed by Darin Adler.

Source/WebCore:

The bug was caused by markAndReplaceFor's text replacement errornously assuming that there are
no other text checking result starting at the same offset. That resulted in us adjusting location
offsets of the subsequent results pointing at the replaced text, hit an assertion, and blow up.

Fixed the bug by skipping all remaining results for the replaced text since they're no longer
applicable.

Tests: Existing autocorection tests have been updated to assert new behavior.

* editing/Editor.cpp:
(WebCore::Editor::markAndReplaceFor):

LayoutTests:

Updated tests to assert the existence of "autocorrected" markers.

* platform/mac/editing/spelling/click-autocorrected-word-expected.png:
* platform/mac/editing/spelling/click-autocorrected-word-expected.txt:
* platform/mac/editing/spelling/click-autocorrected-word.html:
* platform/mac/editing/spelling/delete-into-autocorrected-word-expected.png:
* platform/mac/editing/spelling/delete-into-autocorrected-word-expected.txt:
* platform/mac/editing/spelling/delete-into-autocorrected-word.html:
* platform/mac/editing/spelling/forward-delete-into-autocorrected-word-expected.png:
* platform/mac/editing/spelling/forward-delete-into-autocorrected-word-expected.txt:
* platform/mac/editing/spelling/forward-delete-into-autocorrected-word.html:
* platform/mac/editing/spelling/move-cursor-to-autocorrected-word-expected.png:
* platform/mac/editing/spelling/move-cursor-to-autocorrected-word-expected.txt:
* platform/mac/editing/spelling/move-cursor-to-autocorrected-word.html:
* platform/mac/editing/spelling/move-cursor-to-beginning-of-autocorrected-word-expected.png:
* platform/mac/editing/spelling/move-cursor-to-beginning-of-autocorrected-word-expected.txt:
* platform/mac/editing/spelling/move-cursor-to-beginning-of-autocorrected-word.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@148221 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/editing/spelling/click-autocorrected-word-expected.png
LayoutTests/platform/mac/editing/spelling/click-autocorrected-word-expected.txt
LayoutTests/platform/mac/editing/spelling/click-autocorrected-word.html
LayoutTests/platform/mac/editing/spelling/delete-into-autocorrected-word-expected.png
LayoutTests/platform/mac/editing/spelling/delete-into-autocorrected-word-expected.txt
LayoutTests/platform/mac/editing/spelling/delete-into-autocorrected-word.html
LayoutTests/platform/mac/editing/spelling/forward-delete-into-autocorrected-word-expected.png
LayoutTests/platform/mac/editing/spelling/forward-delete-into-autocorrected-word-expected.txt
LayoutTests/platform/mac/editing/spelling/forward-delete-into-autocorrected-word.html
LayoutTests/platform/mac/editing/spelling/move-cursor-to-autocorrected-word-expected.png
LayoutTests/platform/mac/editing/spelling/move-cursor-to-autocorrected-word-expected.txt
LayoutTests/platform/mac/editing/spelling/move-cursor-to-autocorrected-word.html
LayoutTests/platform/mac/editing/spelling/move-cursor-to-beginning-of-autocorrected-word-expected.png
LayoutTests/platform/mac/editing/spelling/move-cursor-to-beginning-of-autocorrected-word-expected.txt
LayoutTests/platform/mac/editing/spelling/move-cursor-to-beginning-of-autocorrected-word.html
Source/WebCore/ChangeLog
Source/WebCore/editing/Editor.cpp