Changeset 249565 in webkit
- Timestamp:
- Sep 6, 2019 12:06:09 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r249563 r249565 1 2019-09-06 Andres Gonzalez <andresg_22@apple.com> 2 3 AccessibilityRenderObject::setSelectedTextRange fails to set the selection passed an empty line. 4 https://bugs.webkit.org/show_bug.cgi?id=201518 5 <rdar://problem/54835122> 6 7 Reviewed by Ryosuke Niwa. 8 9 Extended this test to set the selection range passed an empty line. 10 * accessibility/set-selected-text-range-after-newline-expected.txt: 11 * accessibility/set-selected-text-range-after-newline.html: 12 1 13 2019-09-05 Chris Dumez <cdumez@apple.com> 2 14 -
trunk/LayoutTests/accessibility/set-selected-text-range-after-newline-expected.txt
r245912 r249565 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 -
trunk/LayoutTests/accessibility/set-selected-text-range-after-newline.html
r245912 r249565 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 }); -
trunk/Source/WebCore/ChangeLog
r249560 r249565 1 2019-09-06 Andres Gonzalez <andresg_22@apple.com> 2 3 AccessibilityRenderObject::setSelectedTextRange fails to set the selection passed an empty line. 4 https://bugs.webkit.org/show_bug.cgi?id=201518 5 <rdar://problem/54835122> 6 7 Reviewed by Ryosuke Niwa. 8 9 Test: accessibility/set-selected-text-range-after-newline.html 10 11 In the case of an empty line, the CharacterIterator range start and end 12 were not equal, thus we were not advancing the iterator and returning 13 the iterator range end, which is not correct. With this change we are 14 always advancing the iterator if its text is just '\n'. This covers all 15 the cases we fixed before plus empty lines. 16 17 * editing/Editing.cpp: 18 (WebCore::visiblePositionForIndexUsingCharacterIterator): 19 1 20 2019-09-05 Fujii Hironori <Hironori.Fujii@sony.com> 2 21 -
trunk/Source/WebCore/editing/Editing.cpp
r248552 r249565 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.