Changeset 148221 in webkit
- Timestamp:
- Apr 11, 2013, 11:56:16 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r148220 r148221 1 2013-04-11 Ryosuke Niwa <rniwa@webkit.org> 2 3 Autocorrected text doesn't have a marker of type autocorrected 4 https://bugs.webkit.org/show_bug.cgi?id=114337 5 6 Reviewed by Darin Adler. 7 8 Updated tests to assert the existence of "autocorrected" markers. 9 10 * platform/mac/editing/spelling/click-autocorrected-word-expected.png: 11 * platform/mac/editing/spelling/click-autocorrected-word-expected.txt: 12 * platform/mac/editing/spelling/click-autocorrected-word.html: 13 * platform/mac/editing/spelling/delete-into-autocorrected-word-expected.png: 14 * platform/mac/editing/spelling/delete-into-autocorrected-word-expected.txt: 15 * platform/mac/editing/spelling/delete-into-autocorrected-word.html: 16 * platform/mac/editing/spelling/forward-delete-into-autocorrected-word-expected.png: 17 * platform/mac/editing/spelling/forward-delete-into-autocorrected-word-expected.txt: 18 * platform/mac/editing/spelling/forward-delete-into-autocorrected-word.html: 19 * platform/mac/editing/spelling/move-cursor-to-autocorrected-word-expected.png: 20 * platform/mac/editing/spelling/move-cursor-to-autocorrected-word-expected.txt: 21 * platform/mac/editing/spelling/move-cursor-to-autocorrected-word.html: 22 * platform/mac/editing/spelling/move-cursor-to-beginning-of-autocorrected-word-expected.png: 23 * platform/mac/editing/spelling/move-cursor-to-beginning-of-autocorrected-word-expected.txt: 24 * platform/mac/editing/spelling/move-cursor-to-beginning-of-autocorrected-word.html: 25 1 26 2013-04-11 Michelangelo De Simone <michelangelo@webkit.org> 2 27 -
trunk/LayoutTests/platform/mac/editing/spelling/click-autocorrected-word-expected.txt
r147994 r148221 65 65 PASS internals.markerRangeForNode(textNode, 'replacement', 1) is null 66 66 PASS internals.markerRangeForNode(textNode, 'spelling', 0) is null 67 PASS internals.markerRangeForNode(textNode, 'autocorrected', 0) is null 67 PASS markerRange = internals.markerRangeForNode(textNode, 'autocorrected', 0); markerRange.startContainer is textNode 68 PASS markerRange.toString() is 'message' 69 PASS markerRange.endContainer is textNode 70 PASS markerRange.startOffset is textNode.textContent.indexOf(markerRange.toString()) 71 PASS markerRange.endOffset is markerRange.startOffset + markerRange.toString().length 72 PASS internals.markerRangeForNode(textNode, 'autocorrected', 1) is null 68 73 PASS successfullyParsed is true 69 74 -
trunk/LayoutTests/platform/mac/editing/spelling/click-autocorrected-word.html
r147994 r148221 35 35 shouldBeNull("internals.markerRangeForNode(textNode, 'replacement', 1)"); 36 36 shouldBeNull("internals.markerRangeForNode(textNode, 'spelling', 0)"); 37 shouldBeNull("internals.markerRangeForNode(textNode, 'autocorrected', 0)"); 37 38 shouldBe("markerRange = internals.markerRangeForNode(textNode, 'autocorrected', 0); markerRange.startContainer", "textNode"); 39 shouldBe("markerRange.toString()", "'message'"); 40 shouldBe("markerRange.endContainer", "textNode"); 41 shouldBe("markerRange.startOffset", "textNode.textContent.indexOf(markerRange.toString())"); 42 shouldBe("markerRange.endOffset", "markerRange.startOffset + markerRange.toString().length"); 43 shouldBeNull("internals.markerRangeForNode(textNode, 'autocorrected', 1)"); 38 44 } 39 45 } -
trunk/LayoutTests/platform/mac/editing/spelling/delete-into-autocorrected-word-expected.txt
r147994 r148221 68 68 PASS internals.markerRangeForNode(textNode, 'replacement', 1) is null 69 69 PASS internals.markerRangeForNode(textNode, 'spelling', 0) is null 70 PASS internals.markerRangeForNode(textNode, 'autocorrected', 0) is null 70 PASS markerRange = internals.markerRangeForNode(textNode, 'autocorrected', 0); markerRange.startContainer is textNode 71 PASS markerRange.toString() is 'message' 72 PASS markerRange.endContainer is textNode 73 PASS markerRange.startOffset is textNode.textContent.indexOf(markerRange.toString()) 74 PASS markerRange.endOffset is markerRange.startOffset + markerRange.toString().length 75 PASS internals.markerRangeForNode(textNode, 'autocorrected', 1) is null 71 76 PASS successfullyParsed is true 72 77 -
trunk/LayoutTests/platform/mac/editing/spelling/delete-into-autocorrected-word.html
r147994 r148221 34 34 shouldBeNull("internals.markerRangeForNode(textNode, 'replacement', 1)"); 35 35 shouldBeNull("internals.markerRangeForNode(textNode, 'spelling', 0)"); 36 shouldBeNull("internals.markerRangeForNode(textNode, 'autocorrected', 0)"); 36 37 shouldBe("markerRange = internals.markerRangeForNode(textNode, 'autocorrected', 0); markerRange.startContainer", "textNode"); 38 shouldBe("markerRange.toString()", "'message'"); 39 shouldBe("markerRange.endContainer", "textNode"); 40 shouldBe("markerRange.startOffset", "textNode.textContent.indexOf(markerRange.toString())"); 41 shouldBe("markerRange.endOffset", "markerRange.startOffset + markerRange.toString().length"); 42 shouldBeNull("internals.markerRangeForNode(textNode, 'autocorrected', 1)"); 37 43 } 38 44 } -
trunk/LayoutTests/platform/mac/editing/spelling/forward-delete-into-autocorrected-word-expected.txt
r147994 r148221 73 73 PASS markerRange.endOffset is markerRange.startOffset + markerRange.toString().length 74 74 PASS internals.markerRangeForNode(textNode, 'spelling', 1) is null 75 PASS internals.markerRangeForNode(textNode, 'autocorrected', 0) is null 75 PASS markerRange = internals.markerRangeForNode(textNode, 'autocorrected', 0); markerRange.startContainer is textNode 76 PASS markerRange.toString() is 'message' 77 PASS markerRange.endContainer is textNode 78 PASS markerRange.startOffset is textNode.textContent.indexOf(markerRange.toString()) 79 PASS markerRange.endOffset is markerRange.startOffset + markerRange.toString().length 80 PASS internals.markerRangeForNode(textNode, 'autocorrected', 1) is null 76 81 PASS successfullyParsed is true 77 82 -
trunk/LayoutTests/platform/mac/editing/spelling/forward-delete-into-autocorrected-word.html
r147994 r148221 43 43 shouldBeNull("internals.markerRangeForNode(textNode, 'spelling', 1)"); 44 44 45 shouldBeNull("internals.markerRangeForNode(textNode, 'autocorrected', 0)"); 45 shouldBe("markerRange = internals.markerRangeForNode(textNode, 'autocorrected', 0); markerRange.startContainer", "textNode"); 46 shouldBe("markerRange.toString()", "'message'"); 47 shouldBe("markerRange.endContainer", "textNode"); 48 shouldBe("markerRange.startOffset", "textNode.textContent.indexOf(markerRange.toString())"); 49 shouldBe("markerRange.endOffset", "markerRange.startOffset + markerRange.toString().length"); 50 shouldBeNull("internals.markerRangeForNode(textNode, 'autocorrected', 1)"); 46 51 } 47 52 } -
trunk/LayoutTests/platform/mac/editing/spelling/move-cursor-to-autocorrected-word-expected.txt
r147994 r148221 65 65 PASS internals.markerRangeForNode(textNode, 'replacement', 1) is null 66 66 PASS internals.markerRangeForNode(textNode, 'spelling', 0) is null 67 PASS internals.markerRangeForNode(textNode, 'autocorrected', 0) is null 67 PASS markerRange = internals.markerRangeForNode(textNode, 'autocorrected', 0); markerRange.startContainer is textNode 68 PASS markerRange.toString() is 'message' 69 PASS markerRange.endContainer is textNode 70 PASS markerRange.startOffset is textNode.textContent.indexOf(markerRange.toString()) 71 PASS markerRange.endOffset is markerRange.startOffset + markerRange.toString().length 72 PASS internals.markerRangeForNode(textNode, 'autocorrected', 1) is null 68 73 PASS successfullyParsed is true 69 74 -
trunk/LayoutTests/platform/mac/editing/spelling/move-cursor-to-autocorrected-word.html
r147994 r148221 34 34 shouldBeNull("internals.markerRangeForNode(textNode, 'replacement', 1)"); 35 35 shouldBeNull("internals.markerRangeForNode(textNode, 'spelling', 0)"); 36 shouldBeNull("internals.markerRangeForNode(textNode, 'autocorrected', 0)"); 36 37 shouldBe("markerRange = internals.markerRangeForNode(textNode, 'autocorrected', 0); markerRange.startContainer", "textNode"); 38 shouldBe("markerRange.toString()", "'message'"); 39 shouldBe("markerRange.endContainer", "textNode"); 40 shouldBe("markerRange.startOffset", "textNode.textContent.indexOf(markerRange.toString())"); 41 shouldBe("markerRange.endOffset", "markerRange.startOffset + markerRange.toString().length"); 42 shouldBeNull("internals.markerRangeForNode(textNode, 'autocorrected', 1)"); 37 43 } 38 44 } -
trunk/LayoutTests/platform/mac/editing/spelling/move-cursor-to-beginning-of-autocorrected-word-expected.txt
r147994 r148221 66 66 PASS internals.markerRangeForNode(textNode, 'replacement', 1) is null 67 67 PASS internals.markerRangeForNode(textNode, 'spelling', 0) is null 68 PASS internals.markerRangeForNode(textNode, 'autocorrected', 0) is null 68 PASS markerRange = internals.markerRangeForNode(textNode, 'autocorrected', 0); markerRange.startContainer is textNode 69 PASS markerRange.toString() is 'message' 70 PASS markerRange.endContainer is textNode 71 PASS markerRange.startOffset is textNode.textContent.indexOf(markerRange.toString()) 72 PASS markerRange.endOffset is markerRange.startOffset + markerRange.toString().length 73 PASS internals.markerRangeForNode(textNode, 'autocorrected', 1) is null 69 74 PASS successfullyParsed is true 70 75 -
trunk/LayoutTests/platform/mac/editing/spelling/move-cursor-to-beginning-of-autocorrected-word.html
r147994 r148221 38 38 shouldBeNull("internals.markerRangeForNode(textNode, 'replacement', 1)"); 39 39 shouldBeNull("internals.markerRangeForNode(textNode, 'spelling', 0)"); 40 shouldBeNull("internals.markerRangeForNode(textNode, 'autocorrected', 0)"); 40 41 shouldBe("markerRange = internals.markerRangeForNode(textNode, 'autocorrected', 0); markerRange.startContainer", "textNode"); 42 shouldBe("markerRange.toString()", "'message'"); 43 shouldBe("markerRange.endContainer", "textNode"); 44 shouldBe("markerRange.startOffset", "textNode.textContent.indexOf(markerRange.toString())"); 45 shouldBe("markerRange.endOffset", "markerRange.startOffset + markerRange.toString().length"); 46 shouldBeNull("internals.markerRangeForNode(textNode, 'autocorrected', 1)"); 41 47 } 42 48 } -
trunk/Source/WebCore/ChangeLog
r148220 r148221 1 2013-04-11 Ryosuke Niwa <rniwa@webkit.org> 2 3 Autocorrected text doesn't have a marker of type autocorrected 4 https://bugs.webkit.org/show_bug.cgi?id=114337 5 6 Reviewed by Darin Adler. 7 8 The bug was caused by markAndReplaceFor's text replacement errornously assuming that there are 9 no other text checking result starting at the same offset. That resulted in us adjusting location 10 offsets of the subsequent results pointing at the replaced text, hit an assertion, and blow up. 11 12 Fixed the bug by skipping all remaining results for the replaced text since they're no longer 13 applicable. 14 15 Tests: Existing autocorection tests have been updated to assert new behavior. 16 17 * editing/Editor.cpp: 18 (WebCore::Editor::markAndReplaceFor): 19 1 20 2013-04-11 Michelangelo De Simone <michelangelo@webkit.org> 2 21 -
trunk/Source/WebCore/editing/Editor.cpp
r148163 r148221 2299 2299 } 2300 2300 2301 // Skip all other results for the replaced text. 2302 while (i + 1 < results.size() && results[i + 1].location + offsetDueToReplacement <= resultLocation) 2303 i++; 2304 2301 2305 selectionChanged = true; 2302 2306 offsetDueToReplacement += replacement.length() - resultLength;
Note:
See TracChangeset
for help on using the changeset viewer.