Changeset 249695 in webkit
- Timestamp:
- Sep 9, 2019, 8:19:48 PM (7 years ago)
- Location:
- branches/safari-608-branch
- Files:
-
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/accessibility/set-selected-text-range-after-newline-expected.txt (modified) (1 diff)
-
LayoutTests/accessibility/set-selected-text-range-after-newline.html (modified) (2 diffs)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/editing/Editing.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-608-branch/LayoutTests/ChangeLog
r249694 r249695 1 2019-09-09 Kocsen Chung <kocsen_chung@apple.com> 2 3 Cherry-pick r249565. rdar://problem/55113261 4 5 AccessibilityRenderObject::setSelectedTextRange fails to set the selection passed an empty line. 6 https://bugs.webkit.org/show_bug.cgi?id=201518 7 <rdar://problem/54835122> 8 9 Patch by Andres Gonzalez <andresg_22@apple.com> on 2019-09-06 10 Reviewed by Ryosuke Niwa. 11 12 Source/WebCore: 13 14 Test: accessibility/set-selected-text-range-after-newline.html 15 16 In the case of an empty line, the CharacterIterator range start and end 17 were not equal, thus we were not advancing the iterator and returning 18 the iterator range end, which is not correct. With this change we are 19 always advancing the iterator if its text is just '\n'. This covers all 20 the cases we fixed before plus empty lines. 21 22 * editing/Editing.cpp: 23 (WebCore::visiblePositionForIndexUsingCharacterIterator): 24 25 LayoutTests: 26 27 Extended this test to set the selection range passed an empty line. 28 * accessibility/set-selected-text-range-after-newline-expected.txt: 29 * accessibility/set-selected-text-range-after-newline.html: 30 31 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249565 268f45cc-cd09-0410-ab3c-d52691b4dbfc 32 33 2019-09-06 Andres Gonzalez <andresg_22@apple.com> 34 35 AccessibilityRenderObject::setSelectedTextRange fails to set the selection passed an empty line. 36 https://bugs.webkit.org/show_bug.cgi?id=201518 37 <rdar://problem/54835122> 38 39 Reviewed by Ryosuke Niwa. 40 41 Extended this test to set the selection range passed an empty line. 42 * accessibility/set-selected-text-range-after-newline-expected.txt: 43 * accessibility/set-selected-text-range-after-newline.html: 44 1 45 2019-09-09 Kocsen Chung <kocsen_chung@apple.com> 2 46 -
branches/safari-608-branch/LayoutTests/accessibility/set-selected-text-range-after-newline-expected.txt
r245912 r249695 1 1 hello 2 2 3 world 3 4 PASS text.selectedTextRange became '{5, 0}' 4 5 There must be only one [newline] between hello and world: hello[newline]world 5 6 PASS text.selectedTextRange became '{6, 0}' 7 There must be two [newline] between hello and world: hello[newline][newline]world 8 PASS text.selectedTextRange became '{7, 0}' 6 9 The text after the newline should be world: world 7 10 PASS successfullyParsed is true -
branches/safari-608-branch/LayoutTests/accessibility/set-selected-text-range-after-newline.html
r245912 r249695 19 19 text.setSelectedTextRange(5, 0); 20 20 shouldBecomeEqual("text.selectedTextRange", "'{5, 0}'", function() { 21 // Insert a linebreak between "hello" and "world". 21 22 text.replaceTextInRange("\n", 5, 0); 22 23 … … 27 28 text.setSelectedTextRange(6, 0); 28 29 shouldBecomeEqual("text.selectedTextRange", "'{6, 0}'", function() { 29 var t = text.stringForRange(6, 5); 30 // Insert another linebreak before "world". 31 text.replaceTextInRange("\n", 6, 0); 32 33 var t = text.stringForRange(0, 12); 30 34 t = t.replace(/(?:\r\n|\r|\n)/g, '[newline]'); 31 debug("The text after the newline should beworld: " + t);35 debug("There must be two [newline] between hello and world: " + t); 32 36 33 finishJSTest(); 37 text.setSelectedTextRange(7, 0); 38 shouldBecomeEqual("text.selectedTextRange", "'{7, 0}'", function() { 39 var t = text.stringForRange(7, 5); 40 t = t.replace(/(?:\r\n|\r|\n)/g, '[newline]'); 41 debug("The text after the newline should be world: " + t); 42 43 finishJSTest(); 44 }); 34 45 }); 35 46 }); -
branches/safari-608-branch/Source/WebCore/ChangeLog
r249694 r249695 1 2019-09-09 Kocsen Chung <kocsen_chung@apple.com> 2 3 Cherry-pick r249565. rdar://problem/55113261 4 5 AccessibilityRenderObject::setSelectedTextRange fails to set the selection passed an empty line. 6 https://bugs.webkit.org/show_bug.cgi?id=201518 7 <rdar://problem/54835122> 8 9 Patch by Andres Gonzalez <andresg_22@apple.com> on 2019-09-06 10 Reviewed by Ryosuke Niwa. 11 12 Source/WebCore: 13 14 Test: accessibility/set-selected-text-range-after-newline.html 15 16 In the case of an empty line, the CharacterIterator range start and end 17 were not equal, thus we were not advancing the iterator and returning 18 the iterator range end, which is not correct. With this change we are 19 always advancing the iterator if its text is just '\n'. This covers all 20 the cases we fixed before plus empty lines. 21 22 * editing/Editing.cpp: 23 (WebCore::visiblePositionForIndexUsingCharacterIterator): 24 25 LayoutTests: 26 27 Extended this test to set the selection range passed an empty line. 28 * accessibility/set-selected-text-range-after-newline-expected.txt: 29 * accessibility/set-selected-text-range-after-newline.html: 30 31 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249565 268f45cc-cd09-0410-ab3c-d52691b4dbfc 32 33 2019-09-06 Andres Gonzalez <andresg_22@apple.com> 34 35 AccessibilityRenderObject::setSelectedTextRange fails to set the selection passed an empty line. 36 https://bugs.webkit.org/show_bug.cgi?id=201518 37 <rdar://problem/54835122> 38 39 Reviewed by Ryosuke Niwa. 40 41 Test: accessibility/set-selected-text-range-after-newline.html 42 43 In the case of an empty line, the CharacterIterator range start and end 44 were not equal, thus we were not advancing the iterator and returning 45 the iterator range end, which is not correct. With this change we are 46 always advancing the iterator if its text is just '\n'. This covers all 47 the cases we fixed before plus empty lines. 48 49 * editing/Editing.cpp: 50 (WebCore::visiblePositionForIndexUsingCharacterIterator): 51 1 52 2019-09-09 Kocsen Chung <kocsen_chung@apple.com> 2 53 -
branches/safari-608-branch/Source/WebCore/editing/Editing.cpp
r248069 r249695 1123 1123 it.advance(index - 1); 1124 1124 1125 if (!it.atEnd() && it.text() [0] == '\n') {1125 if (!it.atEnd() && it.text().length() == 1 && it.text()[0] == '\n') { 1126 1126 // FIXME: workaround for collapsed range (where only start position is correct) emitted for some emitted newlines. 1127 auto iteratorRange = it.range(); 1128 if (iteratorRange->startPosition() == iteratorRange->endPosition()) { 1129 it.advance(1); 1130 if (!it.atEnd()) 1131 return VisiblePosition(it.range()->startPosition()); 1132 } 1127 it.advance(1); 1128 if (!it.atEnd()) 1129 return VisiblePosition(it.range()->startPosition()); 1133 1130 } 1134 1131
Note:
See TracChangeset
for help on using the changeset viewer.