haikuwebkit/LayoutTests/accessibility/set-selected-text-range-aft...

14 lines
403 B
Plaintext
Raw Permalink Normal View History

Inserting a newline in contenteditable causes two characters to be added instead of one https://bugs.webkit.org/show_bug.cgi?id=197894 <rdar://problem/49700998> Patch by Andres Gonzalez <andresg_22@apple.com> on 2019-05-30 Reviewed by Wenson Hsieh and Chris Fleizach. Source/WebCore: There were two issues with inserting a newline character at the end of a line that caused problems for accessibility: - the first '\n' inserted after text would result in two line breaks inserted instead of one. createFragmentFromText in markup.cpp was splitting the string "\n" into two empty strings and creating a <div> and a <br> respectively. Then the emission code would emit a '\n' for the empty div and another for the <br>. - the second problem is a consequence of <rdar://problem/5192593> and the workaround is the change in editing.cpp in the function visiblePositionForIndexUsingCharacterIterator, similar to what is done in VisibleUnits.cpp for nextBoundary. The rest of the changes in this patch are accessibility changes to execute the layout tests. Tests: accessibility/ios-simulator/set-selected-text-range-after-newline.html accessibility/set-selected-text-range-after-newline.html * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::setSelectedTextRange): * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper stringForRange:]): (-[WebAccessibilityObjectWrapper _accessibilitySelectedTextRange]): (-[WebAccessibilityObjectWrapper accessibilityReplaceRange:withText:]): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): * editing/Editing.cpp: (WebCore::visiblePositionForIndexUsingCharacterIterator): * editing/markup.cpp: (WebCore::createFragmentFromText): Tools: iOS implementation of several AccessibilityUIElement methods to execute LayoutTests. * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm: (WTR::AccessibilityUIElement::selectedTextRange): (WTR::AccessibilityUIElement::setSelectedTextRange): (WTR::AccessibilityUIElement::replaceTextInRange): LayoutTests: * accessibility/ios-simulator/set-selected-text-range-after-newline-expected.txt: Added. * accessibility/ios-simulator/set-selected-text-range-after-newline.html: Added. * accessibility/ios-simulator/text-marker-list-item-expected.txt: * accessibility/set-selected-text-range-after-newline-expected.txt: Added. * accessibility/set-selected-text-range-after-newline.html: Added. * platform/win/TestExpectations: Canonical link: https://commits.webkit.org/212417@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245912 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-31 00:02:59 +00:00
hello
Inserting a newline in contenteditable causes two characters to be added instead of one https://bugs.webkit.org/show_bug.cgi?id=197894 <rdar://problem/49700998> Patch by Andres Gonzalez <andresg_22@apple.com> on 2019-05-30 Reviewed by Wenson Hsieh and Chris Fleizach. Source/WebCore: There were two issues with inserting a newline character at the end of a line that caused problems for accessibility: - the first '\n' inserted after text would result in two line breaks inserted instead of one. createFragmentFromText in markup.cpp was splitting the string "\n" into two empty strings and creating a <div> and a <br> respectively. Then the emission code would emit a '\n' for the empty div and another for the <br>. - the second problem is a consequence of <rdar://problem/5192593> and the workaround is the change in editing.cpp in the function visiblePositionForIndexUsingCharacterIterator, similar to what is done in VisibleUnits.cpp for nextBoundary. The rest of the changes in this patch are accessibility changes to execute the layout tests. Tests: accessibility/ios-simulator/set-selected-text-range-after-newline.html accessibility/set-selected-text-range-after-newline.html * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::setSelectedTextRange): * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper stringForRange:]): (-[WebAccessibilityObjectWrapper _accessibilitySelectedTextRange]): (-[WebAccessibilityObjectWrapper accessibilityReplaceRange:withText:]): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): * editing/Editing.cpp: (WebCore::visiblePositionForIndexUsingCharacterIterator): * editing/markup.cpp: (WebCore::createFragmentFromText): Tools: iOS implementation of several AccessibilityUIElement methods to execute LayoutTests. * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm: (WTR::AccessibilityUIElement::selectedTextRange): (WTR::AccessibilityUIElement::setSelectedTextRange): (WTR::AccessibilityUIElement::replaceTextInRange): LayoutTests: * accessibility/ios-simulator/set-selected-text-range-after-newline-expected.txt: Added. * accessibility/ios-simulator/set-selected-text-range-after-newline.html: Added. * accessibility/ios-simulator/text-marker-list-item-expected.txt: * accessibility/set-selected-text-range-after-newline-expected.txt: Added. * accessibility/set-selected-text-range-after-newline.html: Added. * platform/win/TestExpectations: Canonical link: https://commits.webkit.org/212417@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245912 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-31 00:02:59 +00:00
world
PASS text.selectedTextRange became '{5, 0}'
There must be only one [newline] between hello and world: hello[newline]world
PASS text.selectedTextRange became '{6, 0}'
There must be two [newline] between hello and world: hello[newline][newline]world
PASS text.selectedTextRange became '{7, 0}'
Inserting a newline in contenteditable causes two characters to be added instead of one https://bugs.webkit.org/show_bug.cgi?id=197894 <rdar://problem/49700998> Patch by Andres Gonzalez <andresg_22@apple.com> on 2019-05-30 Reviewed by Wenson Hsieh and Chris Fleizach. Source/WebCore: There were two issues with inserting a newline character at the end of a line that caused problems for accessibility: - the first '\n' inserted after text would result in two line breaks inserted instead of one. createFragmentFromText in markup.cpp was splitting the string "\n" into two empty strings and creating a <div> and a <br> respectively. Then the emission code would emit a '\n' for the empty div and another for the <br>. - the second problem is a consequence of <rdar://problem/5192593> and the workaround is the change in editing.cpp in the function visiblePositionForIndexUsingCharacterIterator, similar to what is done in VisibleUnits.cpp for nextBoundary. The rest of the changes in this patch are accessibility changes to execute the layout tests. Tests: accessibility/ios-simulator/set-selected-text-range-after-newline.html accessibility/set-selected-text-range-after-newline.html * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::setSelectedTextRange): * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper stringForRange:]): (-[WebAccessibilityObjectWrapper _accessibilitySelectedTextRange]): (-[WebAccessibilityObjectWrapper accessibilityReplaceRange:withText:]): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): * editing/Editing.cpp: (WebCore::visiblePositionForIndexUsingCharacterIterator): * editing/markup.cpp: (WebCore::createFragmentFromText): Tools: iOS implementation of several AccessibilityUIElement methods to execute LayoutTests. * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm: (WTR::AccessibilityUIElement::selectedTextRange): (WTR::AccessibilityUIElement::setSelectedTextRange): (WTR::AccessibilityUIElement::replaceTextInRange): LayoutTests: * accessibility/ios-simulator/set-selected-text-range-after-newline-expected.txt: Added. * accessibility/ios-simulator/set-selected-text-range-after-newline.html: Added. * accessibility/ios-simulator/text-marker-list-item-expected.txt: * accessibility/set-selected-text-range-after-newline-expected.txt: Added. * accessibility/set-selected-text-range-after-newline.html: Added. * platform/win/TestExpectations: Canonical link: https://commits.webkit.org/212417@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245912 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-31 00:02:59 +00:00
The text after the newline should be world: world
PASS successfullyParsed is true
TEST COMPLETE