Title: [255839] trunk
Revision
255839
Author
[email protected]
Date
2020-02-05 11:48:25 -0800 (Wed, 05 Feb 2020)

Log Message

AX: replaceTextInRange should handle when called on the WebArea element
https://bugs.webkit.org/show_bug.cgi?id=207242
<rdar://problem/59173196>

Reviewed by Zalan Bujtas.

Source/WebCore:

Test: accessibility/mac/replace-text-with-range-on-webarea-element.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::replaceTextInRange):

LayoutTests:

* accessibility/mac/replace-text-with-range-on-webarea-element-expected.txt: Added.
* accessibility/mac/replace-text-with-range-on-webarea-element.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (255838 => 255839)


--- trunk/LayoutTests/ChangeLog	2020-02-05 19:48:12 UTC (rev 255838)
+++ trunk/LayoutTests/ChangeLog	2020-02-05 19:48:25 UTC (rev 255839)
@@ -1,3 +1,14 @@
+2020-02-05  Chris Fleizach  <[email protected]>
+
+        AX: replaceTextInRange should handle when called on the WebArea element
+        https://bugs.webkit.org/show_bug.cgi?id=207242
+        <rdar://problem/59173196>
+
+        Reviewed by Zalan Bujtas.
+
+        * accessibility/mac/replace-text-with-range-on-webarea-element-expected.txt: Added.
+        * accessibility/mac/replace-text-with-range-on-webarea-element.html: Added.
+
 2020-02-05  youenn fablet  <[email protected]>
 
         Improve stability of webrtc/video-autoplay.html by splitting tests in multiple files

Added: trunk/LayoutTests/accessibility/mac/replace-text-with-range-on-webarea-element-expected.txt (0 => 255839)


--- trunk/LayoutTests/accessibility/mac/replace-text-with-range-on-webarea-element-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/replace-text-with-range-on-webarea-element-expected.txt	2020-02-05 19:48:25 UTC (rev 255839)
@@ -0,0 +1,12 @@
+world
+This tests that the replace with range API functions as expected when called on the web area element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS webArea.replaceTextInRange("world", 0, 5) is true
+PASS webArea.childAtIndex(0).stringValue.substring(9, 14) is 'world'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/mac/replace-text-with-range-on-webarea-element.html (0 => 255839)


--- trunk/LayoutTests/accessibility/mac/replace-text-with-range-on-webarea-element.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/replace-text-with-range-on-webarea-element.html	2020-02-05 19:48:25 UTC (rev 255839)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body id="body" contenteditable="true" role="textbox">
+hello
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests that the replace with range API functions as expected when called on the web area element.");
+
+    if (window.accessibilityController) {
+        var webArea = accessibilityController.accessibleElementById("body").parentElement();
+        shouldBeTrue('webArea.replaceTextInRange("world", 0, 5)');
+        shouldBe("webArea.childAtIndex(0).stringValue.substring(9, 14)", "'world'");
+    }
+
+</script>
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (255838 => 255839)


--- trunk/Source/WebCore/ChangeLog	2020-02-05 19:48:12 UTC (rev 255838)
+++ trunk/Source/WebCore/ChangeLog	2020-02-05 19:48:25 UTC (rev 255839)
@@ -1,3 +1,16 @@
+2020-02-05  Chris Fleizach  <[email protected]>
+
+        AX: replaceTextInRange should handle when called on the WebArea element
+        https://bugs.webkit.org/show_bug.cgi?id=207242
+        <rdar://problem/59173196>
+
+        Reviewed by Zalan Bujtas.
+
+        Test: accessibility/mac/replace-text-with-range-on-webarea-element.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::replaceTextInRange):
+
 2020-02-05  Michael Catanzaro  <[email protected]>
 
         [GTK] Cannot perform most local loads with sandbox enabled

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (255838 => 255839)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2020-02-05 19:48:12 UTC (rev 255838)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2020-02-05 19:48:25 UTC (rev 255839)
@@ -48,6 +48,7 @@
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "FrameSelection.h"
+#include "HTMLBodyElement.h"
 #include "HTMLDataListElement.h"
 #include "HTMLDetailsElement.h"
 #include "HTMLFormControlElement.h"
@@ -2053,6 +2054,13 @@
 
 bool AccessibilityObject::replaceTextInRange(const String& replacementString, const PlainTextRange& range)
 {
+    // If this is being called on the web area, redirect it to be on the body, which will have a renderer associated with it.
+    if (is<Document>(node())) {
+        if (auto bodyObject = axObjectCache()->getOrCreate(downcast<Document>(node())->body()))
+            return bodyObject->replaceTextInRange(replacementString, range);
+        return false;
+    }
+    
     if (!renderer() || !is<Element>(node()))
         return false;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to