AX: Re-enable accessibility/set-selected-text-range-after-newline.html test.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Jul 2019 14:36:06 +0000 (14:36 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Jul 2019 14:36:06 +0000 (14:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=199431
<rdar://problem/52563340>

Patch by Andres Gonzalez <andresg_22@apple.com> on 2019-07-31
Reviewed by Chris Fleizach.

Source/WebCore:

- Re-enabled LayoutTests/accessibility/set-selected-text-range-after-newline.html.
- Put back workaround in visiblePositionForIndexUsingCharacterIterator
that is needed for several accessibility issues.
- This workaround was rolled back because it was thought the cause of:
https://bugs.webkit.org/show_bug.cgi?id=199434
It turned out that the actual cause of that hang was unrelated and was
fixed in:
https://bugs.webkit.org/show_bug.cgi?id=199845

* editing/Editing.cpp:
(WebCore::visiblePositionForIndexUsingCharacterIterator):

LayoutTests:

* TestExpectations:
* accessibility/ios-simulator/set-selected-text-range-after-newline.html: Removed because it was the same as the one in the parent accessibility directory, so enabling it for iOS in ios-wk2/TestExpectations.
* platform/ios-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248037 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/accessibility/ios-simulator/set-selected-text-range-after-newline.html [deleted file]
LayoutTests/platform/ios-wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/editing/Editing.cpp

index 0ac3a84..5647643 100644 (file)
@@ -1,3 +1,15 @@
+2019-07-31  Andres Gonzalez  <andresg_22@apple.com>
+
+        AX: Re-enable accessibility/set-selected-text-range-after-newline.html test.
+        https://bugs.webkit.org/show_bug.cgi?id=199431
+        <rdar://problem/52563340>
+
+        Reviewed by Chris Fleizach.
+
+        * TestExpectations:
+        * accessibility/ios-simulator/set-selected-text-range-after-newline.html: Removed because it was the same as the one in the parent accessibility directory, so enabling it for iOS in ios-wk2/TestExpectations.
+        * platform/ios-wk2/TestExpectations:
+
 2019-07-31  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Unreviewed GTK gardening. Update expectations after r248033.
index 9dc32ca..156ee5a 100644 (file)
@@ -2208,7 +2208,6 @@ webkit.org/b/170122 http/tests/preload/single_download_preload_headers_charset.p
 ########################################
 ### START OF -disabled tests
 
-webkit.org/b/199431 accessibility/set-selected-text-range-after-newline.html [ Skip ]
 webkit.org/b/20871 js/garbage-collect-after-string-appends.html [ Skip ]
 webkit.org/b/58323 compositing/objects/composited-object-alignment.html [ Skip ]
 webkit.org/b/48454 compositing/tiling/huge-layer-resize.html [ Skip ]
diff --git a/LayoutTests/accessibility/ios-simulator/set-selected-text-range-after-newline.html b/LayoutTests/accessibility/ios-simulator/set-selected-text-range-after-newline.html
deleted file mode 100644 (file)
index 8db656f..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<html>
-<head>
-<script src="../../resources/js-test-pre.js"></script>
-</head>
-<body>
-
-<div id="content" contenteditable tabindex="0">helloworld</div>
-
-<div id="console"></div>
-
-<script>
-    if (window.accessibilityController) {
-        window.jsTestIsAsync = true;
-
-        var content = document.getElementById("content");
-        content.focus();
-
-        var text = accessibilityController.focusedElement;
-        text.setSelectedTextRange(5, 0);
-        shouldBecomeEqual("text.selectedTextRange", "'{5, 0}'", function() {
-            text.replaceTextInRange("\n", 5, 0);
-
-            var t = text.stringForRange(0, 11);
-            t = t.replace(/(?:\r\n|\r|\n)/g, '[newline]');
-            debug("There must be only one [newline] between hello and world: " + t);
-
-            text.setSelectedTextRange(6, 0);
-            shouldBecomeEqual("text.selectedTextRange", "'{6, 0}'", function() {
-                var t = text.stringForRange(6, 5);
-                t = t.replace(/(?:\r\n|\r|\n)/g, '[newline]');
-                debug("The text after the newline should be world: " + t);
-
-                finishJSTest();
-            });
-        });
-    }
-</script>
-<script src="../../resources/js-test-post.js"></script>
-</body>
-</html>
index fa4edcc..047b2a5 100644 (file)
@@ -24,6 +24,7 @@ editing/input/ios [ Pass ]
 editing/pasteboard/ios [ Pass ]
 editing/undo-manager [ Pass ]
 
+accessibility/set-selected-text-range-after-newline.html [ Pass ]
 accessibility/smart-invert.html [ Pass ]
 accessibility/smart-invert-reference.html [ Pass ]
 fast/media/mq-inverted-colors-live-update.html [ Pass ]
@@ -996,7 +997,6 @@ fast/forms/indeterminate-progress-inline-height.html [ Failure ]
 fast/forms/input-appearance-spinbutton.html [ Failure ]
 fast/replaced/border-radius-clip.html [ Failure ]
 accessibility/ios-simulator/press-fires-touch-events.html [ Skip ]
-webkit.org/b/199431 accessibility/ios-simulator/set-selected-text-range-after-newline.html [ Skip ]
 
 fast/text/combining-character-sequence-vertical.html [ ImageOnlyFailure ]
 fast/text/vertical-quotation-marks.html [ ImageOnlyFailure ]
index a71e403..bd66213 100644 (file)
@@ -1,3 +1,23 @@
+2019-07-31  Andres Gonzalez  <andresg_22@apple.com>
+
+        AX: Re-enable accessibility/set-selected-text-range-after-newline.html test.
+        https://bugs.webkit.org/show_bug.cgi?id=199431
+        <rdar://problem/52563340>
+
+        Reviewed by Chris Fleizach.
+
+        - Re-enabled LayoutTests/accessibility/set-selected-text-range-after-newline.html.
+        - Put back workaround in visiblePositionForIndexUsingCharacterIterator
+        that is needed for several accessibility issues.
+        - This workaround was rolled back because it was thought the cause of:
+        https://bugs.webkit.org/show_bug.cgi?id=199434
+        It turned out that the actual cause of that hang was unrelated and was
+        fixed in:
+        https://bugs.webkit.org/show_bug.cgi?id=199845
+
+        * editing/Editing.cpp:
+        (WebCore::visiblePositionForIndexUsingCharacterIterator):
+
 2019-07-31  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: Second call to setAttributeNS creates non-prefixed attribute
index fbe5860..f0d82d5 100644 (file)
@@ -1122,6 +1122,16 @@ VisiblePosition visiblePositionForIndexUsingCharacterIterator(Node& node, int in
     CharacterIterator it(range.get());
     it.advance(index - 1);
 
+    if (!it.atEnd() && it.text()[0] == '\n') {
+        // FIXME: workaround for collapsed range (where only start position is correct) emitted for some emitted newlines.
+        auto iteratorRange = it.range();
+        if (iteratorRange->startPosition() == iteratorRange->endPosition()) {
+            it.advance(1);
+            if (!it.atEnd())
+                return VisiblePosition(it.range()->startPosition());
+        }
+    }
+
     return { it.atEnd() ? range->endPosition() : it.range()->endPosition(), UPSTREAM };
 }