Diff
Modified: trunk/LayoutTests/ChangeLog (288057 => 288058)
--- trunk/LayoutTests/ChangeLog 2022-01-15 17:21:40 UTC (rev 288057)
+++ trunk/LayoutTests/ChangeLog 2022-01-15 17:23:26 UTC (rev 288058)
@@ -1,3 +1,18 @@
+2022-01-15 Tyler Wilcock <[email protected]>
+
+ AX: Fix disabled-controls-not-focusable.html in isolated tree mode by updating AXPropertyName::CanSetFocusAttribute when the disabled attribute changes
+ https://bugs.webkit.org/show_bug.cgi?id=235246
+
+ Reviewed by Chris Fleizach.
+
+ * accessibility/disabled-controls-not-focusable-expected.txt:
+ * accessibility/disabled-controls-not-focusable.html:
+ Make this test async so that it can pass in isolated tree mode. This
+ test must be async because it dynamically changes the disabled
+ attribute via JS.
+ * platform/win/accessibility/disabled-controls-not-focusable-expected.txt:
+ Update Windows-specific expectation to match test changes.
+
2022-01-15 Rob Buis <[email protected]>
[css-contain] Fix contain-size-replaced-002.html
Modified: trunk/LayoutTests/accessibility/disabled-controls-not-focusable-expected.txt (288057 => 288058)
--- trunk/LayoutTests/accessibility/disabled-controls-not-focusable-expected.txt 2022-01-15 17:21:40 UTC (rev 288057)
+++ trunk/LayoutTests/accessibility/disabled-controls-not-focusable-expected.txt 2022-01-15 17:23:26 UTC (rev 288058)
@@ -1,36 +1,53 @@
-
This test makes sure that disabled form controls are not exposed as focusable.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-button
+Testing #button
PASS axElement.isFocusable is true
-PASS axElement.isFocusable is false
-text
+Setting the disabled attribute of element #button
+PASS axElement.isFocusable === false
+
+Testing #text
PASS axElement.isFocusable is true
-PASS axElement.isFocusable is false
-checkbox
+Setting the disabled attribute of element #text
+PASS axElement.isFocusable === false
+
+Testing #checkbox
PASS axElement.isFocusable is true
-PASS axElement.isFocusable is false
-radio
+Setting the disabled attribute of element #checkbox
+PASS axElement.isFocusable === false
+
+Testing #radio
PASS axElement.isFocusable is true
-PASS axElement.isFocusable is false
-submit
+Setting the disabled attribute of element #radio
+PASS axElement.isFocusable === false
+
+Testing #submit
PASS axElement.isFocusable is true
-PASS axElement.isFocusable is false
-slider
+Setting the disabled attribute of element #submit
+PASS axElement.isFocusable === false
+
+Testing #slider
PASS axElement.isFocusable is true
-PASS axElement.isFocusable is false
-combobox
+Setting the disabled attribute of element #slider
+PASS axElement.isFocusable === false
+
+Testing #combobox
PASS axElement.isFocusable is true
-PASS axElement.isFocusable is false
-listbox
+Setting the disabled attribute of element #combobox
+PASS axElement.isFocusable === false
+
+Testing #listbox
PASS axElement.isFocusable is true
-PASS axElement.isFocusable is false
-textarea
+Setting the disabled attribute of element #listbox
+PASS axElement.isFocusable === false
+
+Testing #textarea
PASS axElement.isFocusable is true
-PASS axElement.isFocusable is false
+Setting the disabled attribute of element #textarea
+PASS axElement.isFocusable === false
+
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/accessibility/disabled-controls-not-focusable.html (288057 => 288058)
--- trunk/LayoutTests/accessibility/disabled-controls-not-focusable.html 2022-01-15 17:21:40 UTC (rev 288057)
+++ trunk/LayoutTests/accessibility/disabled-controls-not-focusable.html 2022-01-15 17:23:26 UTC (rev 288058)
@@ -1,7 +1,10 @@
-<!DOCTYPE HTML>
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
+<head>
+<script src=""
+<script src=""
+</head>
<body>
-<script src=""
<div>
<button id="button"></button>
@@ -15,36 +18,37 @@
<textarea id="textarea"></textarea>
</div>
-<div id="console"></div>
<script>
-description("This test makes sure that disabled form controls are not exposed as focusable.");
+ description("This test makes sure that disabled form controls are not exposed as focusable.");
-if (window.testRunner && window.accessibilityController) {
- window.testRunner.dumpAsText();
+ if (window.accessibilityController) {
+ window.jsTestIsAsync = true;
- function checkControl(id) {
- window.element = document.getElementById(id);
- debug(element.id);
- element.focus();
- window.axElement = accessibilityController.focusedElement;
- shouldBeTrue("axElement.isFocusable");
- element.disabled = true;
- shouldBeFalse("axElement.isFocusable");
- }
+ var axElement;
+ async function checkControl(id) {
+ debug(`Testing #${id}`);
+ axElement = accessibilityController.accessibleElementById(id);
+ shouldBeTrue("axElement.isFocusable");
+ debug(`Setting the disabled attribute of element #${id}`);
+ document.getElementById(id).disabled = true;
+ await expectAsyncExpression("axElement.isFocusable", "false");
+ debug("");
+ }
- checkControl("button");
- checkControl("text");
- checkControl("checkbox");
- checkControl("radio");
- checkControl("submit");
- checkControl("slider");
- checkControl("combobox");
- checkControl("listbox");
- checkControl("textarea");
-}
+ setTimeout(async function() {
+ await checkControl("button");
+ await checkControl("text");
+ await checkControl("checkbox");
+ await checkControl("radio");
+ await checkControl("submit");
+ await checkControl("slider");
+ await checkControl("combobox");
+ await checkControl("listbox");
+ await checkControl("textarea");
+ finishJSTest();
+ }, 0);
+ }
</script>
-
-<script src=""
</body>
</html>
Modified: trunk/LayoutTests/platform/win/accessibility/disabled-controls-not-focusable-expected.txt (288057 => 288058)
--- trunk/LayoutTests/platform/win/accessibility/disabled-controls-not-focusable-expected.txt 2022-01-15 17:21:40 UTC (rev 288057)
+++ trunk/LayoutTests/platform/win/accessibility/disabled-controls-not-focusable-expected.txt 2022-01-15 17:23:26 UTC (rev 288058)
@@ -1,37 +1,55 @@
-
This test makes sure that disabled form controls are not exposed as focusable.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-button
+Testing #button
FAIL axElement.isFocusable should be true. Was false.
-PASS axElement.isFocusable is false
-text
+Setting the disabled attribute of element #button
+PASS axElement.isFocusable === false
+
+Testing #text
FAIL axElement.isFocusable should be true. Was false.
-PASS axElement.isFocusable is false
-checkbox
+Setting the disabled attribute of element #text
+PASS axElement.isFocusable === false
+
+Testing #checkbox
FAIL axElement.isFocusable should be true. Was false.
-PASS axElement.isFocusable is false
-radio
+Setting the disabled attribute of element #checkbox
+PASS axElement.isFocusable === false
+
+Testing #radio
FAIL axElement.isFocusable should be true. Was false.
-PASS axElement.isFocusable is false
-submit
+Setting the disabled attribute of element #radio
+PASS axElement.isFocusable === false
+
+Testing #submit
FAIL axElement.isFocusable should be true. Was false.
-PASS axElement.isFocusable is false
-slider
+Setting the disabled attribute of element #submit
+PASS axElement.isFocusable === false
+
+Testing #slider
FAIL axElement.isFocusable should be true. Was false.
-PASS axElement.isFocusable is false
-combobox
+Setting the disabled attribute of element #slider
+PASS axElement.isFocusable === false
+
+Testing #combobox
FAIL axElement.isFocusable should be true. Was false.
-PASS axElement.isFocusable is false
-listbox
+Setting the disabled attribute of element #combobox
+PASS axElement.isFocusable === false
+
+Testing #listbox
FAIL axElement.isFocusable should be true. Was false.
-PASS axElement.isFocusable is false
-textarea
+Setting the disabled attribute of element #listbox
+PASS axElement.isFocusable === false
+
+Testing #textarea
FAIL axElement.isFocusable should be true. Was false.
-PASS axElement.isFocusable is false
+Setting the disabled attribute of element #textarea
+PASS axElement.isFocusable === false
+
PASS successfullyParsed is true
+Some tests failed.
TEST COMPLETE
Modified: trunk/Source/WebCore/ChangeLog (288057 => 288058)
--- trunk/Source/WebCore/ChangeLog 2022-01-15 17:21:40 UTC (rev 288057)
+++ trunk/Source/WebCore/ChangeLog 2022-01-15 17:23:26 UTC (rev 288058)
@@ -1,3 +1,21 @@
+2022-01-15 Tyler Wilcock <[email protected]>
+
+ AX: Fix disabled-controls-not-focusable.html in isolated tree mode by updating AXPropertyName::CanSetFocusAttribute when the disabled attribute changes
+ https://bugs.webkit.org/show_bug.cgi?id=235246
+
+ Reviewed by Chris Fleizach.
+
+ Fixes disabled-controls-not-focusable.html in isolated tree mode.
+
+ * accessibility/AXObjectCache.cpp:
+ (WebCore::AXObjectCache::handleAttributeChange):
+ Post a AXDisabledStateChanged notification when the disabled attribute changes.
+ (WebCore::AXObjectCache::updateIsolatedTree):
+ Handle the AXDisabledStateChanged notification to update AXPropertyName::CanSetFocusAttribute.
+ * accessibility/isolatedtree/AXIsolatedTree.cpp:
+ (WebCore::AXIsolatedTree::updateNodeProperty):
+ Re-compute AXPropertyName::CanSetFocusAttribute when asked to do so.
+
2022-01-15 Rob Buis <[email protected]>
[css-contain] Fix contain-size-replaced-002.html
Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (288057 => 288058)
--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2022-01-15 17:21:40 UTC (rev 288057)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2022-01-15 17:23:26 UTC (rev 288058)
@@ -1791,6 +1791,8 @@
handleAriaRoleChanged(element);
else if (attrName == altAttr || attrName == titleAttr)
textChanged(element);
+ else if (attrName == disabledAttr)
+ postNotification(element, AXObjectCache::AXDisabledStateChanged);
else if (attrName == forAttr && is<HTMLLabelElement>(*element))
labelChanged(element);
else if (attrName == tabindexAttr)
@@ -3302,6 +3304,9 @@
case AXCheckedStateChanged:
tree->updateNodeProperty(object, AXPropertyName::IsChecked);
break;
+ case AXDisabledStateChanged:
+ tree->updateNodeProperty(object, AXPropertyName::CanSetFocusAttribute);
+ break;
case AXSortDirectionChanged:
tree->updateNodeProperty(object, AXPropertyName::SortDirection);
break;
@@ -3374,6 +3379,9 @@
case AXCheckedStateChanged:
tree->updateNodeProperty(*notification.first, AXPropertyName::IsChecked);
break;
+ case AXDisabledStateChanged:
+ tree->updateNodeProperty(*notification.first, AXPropertyName::CanSetFocusAttribute);
+ break;
case AXSortDirectionChanged:
tree->updateNodeProperty(*notification.first, AXPropertyName::SortDirection);
break;
Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp (288057 => 288058)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp 2022-01-15 17:21:40 UTC (rev 288057)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp 2022-01-15 17:23:26 UTC (rev 288058)
@@ -271,6 +271,9 @@
AXPropertyMap propertyMap;
switch (property) {
+ case AXPropertyName::CanSetFocusAttribute:
+ propertyMap.set(AXPropertyName::CanSetFocusAttribute, axObject.canSetFocusAttribute());
+ break;
case AXPropertyName::IsChecked:
propertyMap.set(AXPropertyName::IsChecked, axObject.isChecked());
break;
Modified: trunk/Tools/ChangeLog (288057 => 288058)
--- trunk/Tools/ChangeLog 2022-01-15 17:21:40 UTC (rev 288057)
+++ trunk/Tools/ChangeLog 2022-01-15 17:23:26 UTC (rev 288058)
@@ -1,3 +1,21 @@
+2022-01-15 Tyler Wilcock <[email protected]>
+
+ AX: Fix disabled-controls-not-focusable.html in isolated tree mode by updating AXPropertyName::CanSetFocusAttribute when the disabled attribute changes
+ https://bugs.webkit.org/show_bug.cgi?id=235246
+
+ Reviewed by Chris Fleizach.
+
+ * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+ * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+ (WTR::AccessibilityUIElement::isAttributeSettable):
+ Use new isAttributeSettable(NSString *attribute) helper function.
+ (WTR::AccessibilityUIElement::isAttributeSettable const):
+ Added. Dispatches call to accessibilityIsAttributeSettable on the AX thread.
+
+ (WTR::AccessibilityUIElement::isFocusable const):
+ (WTR::AccessibilityUIElement::isSelectable const):
+ Use new isAttributeSettable to reduce repetition.
+
2022-01-14 Jonathan Bedard <[email protected]>
[EWS] Only trigger builds for open and synchronize events
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h (288057 => 288058)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h 2022-01-15 17:21:40 UTC (rev 288057)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h 2022-01-15 17:23:26 UTC (rev 288058)
@@ -135,9 +135,6 @@
RefPtr<AccessibilityUIElement> uiElementAttributeValue(JSStringRef attribute) const;
bool boolAttributeValue(JSStringRef attribute);
#if PLATFORM(MAC)
- bool boolAttributeValue(NSString *attribute) const;
- JSRetainPtr<JSStringRef> stringAttributeValue(NSString *attribute) const;
- double numberAttributeValue(NSString *attribute) const;
RetainPtr<id> attributeValue(NSString *) const;
void attributeValueAsync(JSStringRef attribute, JSValueRef callback);
#else
@@ -409,6 +406,10 @@
#if PLATFORM(MAC)
RetainPtr<id> attributeValueForParameter(NSString *, id) const;
RetainPtr<NSString> descriptionOfValue(id valueObject) const;
+ bool boolAttributeValue(NSString *attribute) const;
+ JSRetainPtr<JSStringRef> stringAttributeValue(NSString *attribute) const;
+ double numberAttributeValue(NSString *attribute) const;
+ bool isAttributeSettable(NSString *) const;
#endif
#if !PLATFORM(COCOA) && !USE(ATSPI)
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (288057 => 288058)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm 2022-01-15 17:21:40 UTC (rev 288057)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm 2022-01-15 17:23:26 UTC (rev 288058)
@@ -699,11 +699,20 @@
bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute)
{
+ return isAttributeSettable([NSString stringWithJSStringRef:attribute]);
+}
+
+bool AccessibilityUIElement::isAttributeSettable(NSString *attribute) const
+{
+ bool value = false;
+
BEGIN_AX_OBJC_EXCEPTIONS
- return [m_element accessibilityIsAttributeSettable:[NSString stringWithJSStringRef:attribute]];
+ s_controller->executeOnAXThreadAndWait([this, &attribute, &value] {
+ value = [m_element accessibilityIsAttributeSettable:attribute];
+ });
END_AX_OBJC_EXCEPTIONS
-
- return false;
+
+ return value;
}
bool AccessibilityUIElement::isAttributeSupported(JSStringRef attribute)
@@ -1636,20 +1645,12 @@
bool AccessibilityUIElement::isFocusable() const
{
- bool result = false;
- BEGIN_AX_OBJC_EXCEPTIONS
- result = [m_element accessibilityIsAttributeSettable:NSAccessibilityFocusedAttribute];
- END_AX_OBJC_EXCEPTIONS
- return result;
+ return isAttributeSettable(NSAccessibilityFocusedAttribute);
}
bool AccessibilityUIElement::isSelectable() const
{
- bool result = false;
- BEGIN_AX_OBJC_EXCEPTIONS
- result = [m_element accessibilityIsAttributeSettable:NSAccessibilitySelectedAttribute];
- END_AX_OBJC_EXCEPTIONS
- return result;
+ return isAttributeSettable(NSAccessibilitySelectedAttribute);
}
bool AccessibilityUIElement::isMultiSelectable() const