Title: [284972] trunk
Revision
284972
Author
carlo...@webkit.org
Date
2021-10-28 01:36:34 -0700 (Thu, 28 Oct 2021)

Log Message

AX: AXValueChanged is only sent for range elements when value is changed with the keyboard
https://bugs.webkit.org/show_bug.cgi?id=232298
<rdar://problem/84653767>

Reviewed by Andres Gonzalez.

Source/WebCore:

It should always be sent.

Test: accessibility/gtk/html-slider-indicator.html

* html/InputType.cpp:
(WebCore::InputType::setValue): Send AXValueChanged for range elements.
* html/RangeInputType.cpp:
(WebCore::RangeInputType::handleKeydownEvent): Remove the AXValueChanged notification from here.

LayoutTests:

Update the mac test for slider indicator and add a new one for gtk port.

* accessibility/gtk/html-slider-indicator-expected.txt: Added.
* accessibility/gtk/html-slider-indicator.html: Added.
* accessibility/mac/html-slider-indicator-expected.txt:
* accessibility/mac/html-slider-indicator.html:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (284971 => 284972)


--- trunk/LayoutTests/ChangeLog	2021-10-28 07:32:31 UTC (rev 284971)
+++ trunk/LayoutTests/ChangeLog	2021-10-28 08:36:34 UTC (rev 284972)
@@ -1,3 +1,18 @@
+2021-10-28  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        AX: AXValueChanged is only sent for range elements when value is changed with the keyboard
+        https://bugs.webkit.org/show_bug.cgi?id=232298
+        <rdar://problem/84653767>
+
+        Reviewed by Andres Gonzalez.
+
+        Update the mac test for slider indicator and add a new one for gtk port.
+
+        * accessibility/gtk/html-slider-indicator-expected.txt: Added.
+        * accessibility/gtk/html-slider-indicator.html: Added.
+        * accessibility/mac/html-slider-indicator-expected.txt:
+        * accessibility/mac/html-slider-indicator.html:
+
 2021-10-28  Youenn Fablet  <you...@apple.com>
 
         Fetch API: Network process leaks when blobs are unused

Copied: trunk/LayoutTests/accessibility/gtk/html-slider-indicator-expected.txt (from rev 284971, trunk/LayoutTests/accessibility/mac/html-slider-indicator-expected.txt) (0 => 284972)


--- trunk/LayoutTests/accessibility/gtk/html-slider-indicator-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/gtk/html-slider-indicator-expected.txt	2021-10-28 08:36:34 UTC (rev 284972)
@@ -0,0 +1,22 @@
+
+This tests that a basic range returns all the correct information for the gtk platform.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS range.minValue is 0
+PASS range.maxValue is 100
+PASS range.intValue is 50
+PASS range.intValue is 49
+PASS range.intValue is 50
+PASS range.intValue is 55
+PASS range.intValue is 50
+PASS range.isEqual(hitTestRange) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Successfully received AXValueChanged
+Successfully received AXValueChanged
+Successfully received AXValueChanged
+Successfully received AXValueChanged
+

Copied: trunk/LayoutTests/accessibility/gtk/html-slider-indicator.html (from rev 284971, trunk/LayoutTests/accessibility/mac/html-slider-indicator.html) (0 => 284972)


--- trunk/LayoutTests/accessibility/gtk/html-slider-indicator.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/gtk/html-slider-indicator.html	2021-10-28 08:36:34 UTC (rev 284972)
@@ -0,0 +1,64 @@
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<input id="range1" type="range">
+
+<p id="description"></p>
+<div id="console"></div>
+<div id="notifications"></div>
+
+<script>
+
+    description("This tests that a basic range returns all the correct information for the gtk platform.");
+
+    var range = 0;
+    var valueChangeCount = 0;
+    function notificationCallback(notification) {
+        if (notification == "AXValueChanged") {
+           document.getElementById("notifications").innerHTML += "Successfully received " + notification + "<br>";
+           valueChangeCount++;
+        }
+
+        if (valueChangeCount == 4) {
+           range.removeNotificationListener();
+           finishJSTest();
+        }
+    }
+
+    if (window.accessibilityController) {
+        jsTestIsAsync = true;
+
+        document.getElementById("range1").focus();
+        range = accessibilityController.focusedElement;
+        range.addNotificationListener(notificationCallback);
+
+        // Check that min/max/value return correct default values.
+        shouldBe("range.minValue", "0");
+        shouldBe("range.maxValue", "100");
+        shouldBe("range.intValue", "50");
+
+        // Check that incrementing/decrementing with the keyboard sends AXValueChange.
+        eventSender.keyDown("leftArrow");
+        shouldBe("range.intValue", "49");
+
+        eventSender.keyDown("rightArrow");
+        shouldBe("range.intValue", "50");
+
+        // Check that incrementing/decrementing with accessibility API sends AXValueChange.
+        range.increment();
+        shouldBe("range.intValue", "55");
+
+        range.decrement();
+        shouldBe("range.intValue", "50");
+
+        // Check that outside the indicator returns the slider.
+        var hitTestRange = accessibilityController.elementAtPoint(range.x + 1, range.y + range.height/2);
+        shouldBeTrue("range.isEqual(hitTestRange)");
+    }
+
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/accessibility/mac/html-slider-indicator-expected.txt (284971 => 284972)


--- trunk/LayoutTests/accessibility/mac/html-slider-indicator-expected.txt	2021-10-28 07:32:31 UTC (rev 284971)
+++ trunk/LayoutTests/accessibility/mac/html-slider-indicator-expected.txt	2021-10-28 08:36:34 UTC (rev 284972)
@@ -12,6 +12,10 @@
 PASS valueIndicator.intValue is 49
 PASS range.intValue is 50
 PASS valueIndicator.intValue is 50
+PASS range.intValue is 55
+PASS valueIndicator.intValue is 55
+PASS range.intValue is 50
+PASS valueIndicator.intValue is 50
 PASS valueIndicator.isEqual(hitTestIndicator) is true
 PASS range.isEqual(hitTestRange) is true
 PASS successfullyParsed is true
@@ -19,4 +23,6 @@
 TEST COMPLETE
 Successfully received AXValueChanged
 Successfully received AXValueChanged
+Successfully received AXValueChanged
+Successfully received AXValueChanged
 

Modified: trunk/LayoutTests/accessibility/mac/html-slider-indicator.html (284971 => 284972)


--- trunk/LayoutTests/accessibility/mac/html-slider-indicator.html	2021-10-28 07:32:31 UTC (rev 284971)
+++ trunk/LayoutTests/accessibility/mac/html-slider-indicator.html	2021-10-28 08:36:34 UTC (rev 284972)
@@ -22,7 +22,7 @@
            valueChangeCount++;
         }
 
-        if (valueChangeCount == 2) {
+        if (valueChangeCount == 4) {
            range.removeNotificationListener();
            finishJSTest();
         }
@@ -44,7 +44,7 @@
         var valueIndicator = range.childAtIndex(0);
         shouldBe("valueIndicator.intValue", "50");
         
-        // Check that incrementing/decrementing sends AXValueChange.
+        // Check that incrementing/decrementing with keyboard sends AXValueChange.
         eventSender.keyDown("leftArrow");
         shouldBe("range.intValue", "49");
         shouldBe("valueIndicator.intValue", "49");
@@ -53,6 +53,15 @@
         shouldBe("range.intValue", "50");
         shouldBe("valueIndicator.intValue", "50");
 
+        // Check that incrementing/decrementing with accessibility API sends AXValueChange.
+        range.increment();
+        shouldBe("range.intValue", "55");
+        shouldBe("valueIndicator.intValue", "55");
+
+        range.decrement();
+        shouldBe("range.intValue", "50");
+        shouldBe("valueIndicator.intValue", "50");
+
         // Check that a hit test on the value indicator succeeds.
         var hitTestIndicator = accessibilityController.elementAtPoint(range.x + range.width/2, range.y + range.height/2);
         shouldBeTrue("valueIndicator.isEqual(hitTestIndicator)");

Modified: trunk/Source/WebCore/ChangeLog (284971 => 284972)


--- trunk/Source/WebCore/ChangeLog	2021-10-28 07:32:31 UTC (rev 284971)
+++ trunk/Source/WebCore/ChangeLog	2021-10-28 08:36:34 UTC (rev 284972)
@@ -1,3 +1,20 @@
+2021-10-28  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        AX: AXValueChanged is only sent for range elements when value is changed with the keyboard
+        https://bugs.webkit.org/show_bug.cgi?id=232298
+        <rdar://problem/84653767>
+
+        Reviewed by Andres Gonzalez.
+
+        It should always be sent.
+
+        Test: accessibility/gtk/html-slider-indicator.html
+
+        * html/InputType.cpp:
+        (WebCore::InputType::setValue): Send AXValueChanged for range elements.
+        * html/RangeInputType.cpp:
+        (WebCore::RangeInputType::handleKeydownEvent): Remove the AXValueChanged notification from here.
+
 2021-10-28  Youenn Fablet  <you...@apple.com>
 
         Fetch API: Network process leaks when blobs are unused

Modified: trunk/Source/WebCore/html/InputType.cpp (284971 => 284972)


--- trunk/Source/WebCore/html/InputType.cpp	2021-10-28 07:32:31 UTC (rev 284971)
+++ trunk/Source/WebCore/html/InputType.cpp	2021-10-28 08:36:34 UTC (rev 284972)
@@ -731,6 +731,11 @@
     case DispatchNoEvent:
         break;
     }
+
+    if (isRangeControl()) {
+        if (auto* cache = element()->document().existingAXObjectCache())
+            cache->postNotification(element(), AXObjectCache::AXValueChanged);
+    }
 }
 
 bool InputType::canSetValue(const String&)

Modified: trunk/Source/WebCore/html/RangeInputType.cpp (284971 => 284972)


--- trunk/Source/WebCore/html/RangeInputType.cpp	2021-10-28 07:32:31 UTC (rev 284971)
+++ trunk/Source/WebCore/html/RangeInputType.cpp	2021-10-28 08:36:34 UTC (rev 284972)
@@ -32,7 +32,6 @@
 #include "config.h"
 #include "RangeInputType.h"
 
-#include "AXObjectCache.h"
 #include "Decimal.h"
 #include "DocumentInlines.h"
 #include "ElementChildIterator.h"
@@ -236,9 +235,6 @@
     if (newValue != current) {
         EventQueueScope scope;
         setValueAsDecimal(newValue, DispatchInputAndChangeEvent);
-
-        if (AXObjectCache* cache = element()->document().existingAXObjectCache())
-            cache->postNotification(element(), AXObjectCache::AXValueChanged);
     }
 
     event.setDefaultHandled();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to