Title: [290762] trunk/Source/WebCore
Revision
290762
Author
[email protected]
Date
2022-03-02 17:03:52 -0800 (Wed, 02 Mar 2022)

Log Message

ITM: Checkbox state change is not updated in isolated tree
https://bugs.webkit.org/show_bug.cgi?id=237381
rdar://89529486

Reviewed by Chris Fleizach.

Fixes the following test in isolated tree mode:
accessibility/mac/checked-status-tree-items.html
accessibility/aria-switch-checked.html

* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::initializeAttributeData):
Properly initializes the properties SupportsCheckedState, IsChecked and
ButtonState.
(WebCore::AXIsolatedObject::getOrRetrievePropertyValue):
Uses the new template method propertyValue(PropertyName).
* accessibility/isolatedtree/AXIsolatedObject.h:
(WebCore::AXIsolatedObject::propertyValue const):
* accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::updateNodeProperty):
Updates both IsChecked and ButtonState.
* accessibility/isolatedtree/AXIsolatedTree.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (290761 => 290762)


--- trunk/Source/WebCore/ChangeLog	2022-03-03 00:29:04 UTC (rev 290761)
+++ trunk/Source/WebCore/ChangeLog	2022-03-03 01:03:52 UTC (rev 290762)
@@ -1,3 +1,28 @@
+2022-03-02  Andres Gonzalez  <[email protected]>
+
+        ITM: Checkbox state change is not updated in isolated tree
+        https://bugs.webkit.org/show_bug.cgi?id=237381
+        rdar://89529486
+
+        Reviewed by Chris Fleizach.
+
+        Fixes the following test in isolated tree mode:
+        accessibility/mac/checked-status-tree-items.html
+        accessibility/aria-switch-checked.html
+
+        * accessibility/isolatedtree/AXIsolatedObject.cpp:
+        (WebCore::AXIsolatedObject::initializeAttributeData):
+        Properly initializes the properties SupportsCheckedState, IsChecked and
+        ButtonState.
+        (WebCore::AXIsolatedObject::getOrRetrievePropertyValue):
+        Uses the new template method propertyValue(PropertyName).
+        * accessibility/isolatedtree/AXIsolatedObject.h:
+        (WebCore::AXIsolatedObject::propertyValue const):
+        * accessibility/isolatedtree/AXIsolatedTree.cpp:
+        (WebCore::AXIsolatedTree::updateNodeProperty):
+        Updates both IsChecked and ButtonState.
+        * accessibility/isolatedtree/AXIsolatedTree.h:
+
 2022-03-02  Dan Glastonbury  <[email protected]>
 
         [WebGPU] Implement GPUDeviceDescriptor.requiredLimits

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (290761 => 290762)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2022-03-03 00:29:04 UTC (rev 290761)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2022-03-03 01:03:52 UTC (rev 290762)
@@ -86,7 +86,6 @@
     setProperty(AXPropertyName::IsAttachment, object.isAttachment());
     setProperty(AXPropertyName::IsBusy, object.isBusy());
     setProperty(AXPropertyName::IsButton, object.isButton());
-    setProperty(AXPropertyName::IsChecked, object.isChecked());
     setProperty(AXPropertyName::IsCollapsed, object.isCollapsed());
     setProperty(AXPropertyName::IsControl, object.isControl());
     setProperty(AXPropertyName::IsDescriptionList, object.isDescriptionList());
@@ -157,7 +156,6 @@
     setProperty(AXPropertyName::ValidationMessage, object.validationMessage().isolatedCopy());
     setProperty(AXPropertyName::BlockquoteLevel, object.blockquoteLevel());
     setProperty(AXPropertyName::HeadingLevel, object.headingLevel());
-    setProperty(AXPropertyName::AccessibilityButtonState, static_cast<int>(object.checkboxOrRadioValue()));
     setProperty(AXPropertyName::ValueDescription, object.valueDescription().isolatedCopy());
     setProperty(AXPropertyName::ValueForRange, object.valueForRange());
     setProperty(AXPropertyName::MaxValueForRange, object.maxValueForRange());
@@ -231,10 +229,15 @@
     setProperty(AXPropertyName::IsKeyboardFocusable, object.isKeyboardFocusable());
     setObjectProperty(AXPropertyName::NextSibling, object.nextSibling());
     setObjectProperty(AXPropertyName::PreviousSibling, object.previousSibling());
-    setProperty(AXPropertyName::SupportsCheckedState, object.supportsCheckedState());
     setProperty(AXPropertyName::BrailleRoleDescription, object.brailleRoleDescription().isolatedCopy());
     setProperty(AXPropertyName::BrailleLabel, object.brailleLabel().isolatedCopy());
 
+    if (object.supportsCheckedState()) {
+        setProperty(AXPropertyName::SupportsCheckedState, true);
+        setProperty(AXPropertyName::IsChecked, object.isChecked());
+        setProperty(AXPropertyName::ButtonState, object.checkboxOrRadioValue());
+    }
+
     if (object.isTable()) {
         setProperty(AXPropertyName::IsTable, true);
         setProperty(AXPropertyName::IsExposable, object.isExposable());
@@ -966,16 +969,8 @@
 template<typename T>
 T AXIsolatedObject::getOrRetrievePropertyValue(AXPropertyName propertyName)
 {
-    auto typedValue = [&propertyName, this] () {
-        auto value = m_propertyMap.get(propertyName);
-        return WTF::switchOn(value,
-            [] (T& typedValue) -> T { return typedValue; },
-            [] (auto&) { return T(); }
-        );
-    };
-
     if (m_propertyMap.contains(propertyName))
-        return typedValue();
+        return propertyValue<T>(propertyName);
 
     Accessibility::performFunctionOnMainThread([&propertyName, this] () {
         auto* axObject = associatedAXObject();
@@ -1014,7 +1009,7 @@
         setProperty(propertyName, WTFMove(value));
     });
 
-    return typedValue();
+    return propertyValue<T>(propertyName);
 }
 
 void AXIsolatedObject::fillChildrenVectorForProperty(AXPropertyName propertyName, AccessibilityChildrenVector& children) const

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h (290761 => 290762)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2022-03-03 00:29:04 UTC (rev 290761)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2022-03-03 01:03:52 UTC (rev 290762)
@@ -218,7 +218,7 @@
     String validationMessage() const override { return stringAttributeValue(AXPropertyName::ValidationMessage); }
     unsigned blockquoteLevel() const override { return unsignedAttributeValue(AXPropertyName::BlockquoteLevel); }
     unsigned headingLevel() const override { return unsignedAttributeValue(AXPropertyName::HeadingLevel); }
-    AccessibilityButtonState checkboxOrRadioValue() const override { return static_cast<AccessibilityButtonState>(intAttributeValue(AXPropertyName::AccessibilityButtonState)); }
+    AccessibilityButtonState checkboxOrRadioValue() const override { return propertyValue<AccessibilityButtonState>(AXPropertyName::ButtonState); }
     String valueDescription() const override { return stringAttributeValue(AXPropertyName::ValueDescription); }
     float valueForRange() const override { return floatAttributeValue(AXPropertyName::ValueForRange); }
     float maxValueForRange() const override { return floatAttributeValue(AXPropertyName::MaxValueForRange); }
@@ -693,6 +693,16 @@
 #endif
 };
 
+template<typename T>
+inline T AXIsolatedObject::propertyValue(AXPropertyName propertyName) const
+{
+    auto value = m_propertyMap.get(propertyName);
+    return WTF::switchOn(value,
+        [] (T& typedValue) -> T { return typedValue; },
+        [] (auto&) { return T(); }
+    );
+}
+
 } // namespace WebCore
 
 SPECIALIZE_TYPE_TRAITS_ACCESSIBILITY(AXIsolatedObject, isAXIsolatedObjectInstance())

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp (290761 => 290762)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp	2022-03-03 00:29:04 UTC (rev 290761)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp	2022-03-03 01:03:52 UTC (rev 290762)
@@ -325,7 +325,9 @@
         propertyMap.set(AXPropertyName::CurrentValue, axObject.currentValue().isolatedCopy());
         break;
     case AXPropertyName::IsChecked:
+        ASSERT(axObject.supportsCheckedState());
         propertyMap.set(AXPropertyName::IsChecked, axObject.isChecked());
+        propertyMap.set(AXPropertyName::ButtonState, axObject.checkboxOrRadioValue());
         break;
     case AXPropertyName::IsEnabled:
         propertyMap.set(AXPropertyName::IsEnabled, axObject.isEnabled());

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h (290761 => 290762)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h	2022-03-03 00:29:04 UTC (rev 290761)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h	2022-03-03 01:03:52 UTC (rev 290762)
@@ -64,7 +64,6 @@
     AXRowCount,
     AXRowIndex,
     AccessKey,
-    AccessibilityButtonState,
     AccessibilityDescription,
     AccessibilityText,
     ActionVerb,
@@ -73,6 +72,7 @@
     BlockquoteLevel,
     BrailleLabel,
     BrailleRoleDescription,
+    ButtonState,
     CanHaveSelectedChildren,
     CanSetExpandedAttribute,
     CanSetFocusAttribute,
@@ -315,7 +315,7 @@
     WebArea,
 };
 
-using AXPropertyValueVariant = std::variant<std::nullptr_t, AXID, String, bool, int, unsigned, double, float, uint64_t, Color, URL, LayoutRect, FloatRect, PAL::SessionID, IntPoint, OptionSet<SpeakAs>, std::pair<unsigned, unsigned>, Vector<AccessibilityText>, Vector<AXID>, Vector<std::pair<AXID, AXID>>, Vector<String>, Path, OptionSet<AXAncestorFlag>>;
+using AXPropertyValueVariant = std::variant<std::nullptr_t, AXID, String, bool, int, unsigned, double, float, uint64_t, AccessibilityButtonState, Color, URL, LayoutRect, FloatRect, PAL::SessionID, IntPoint, OptionSet<SpeakAs>, std::pair<unsigned, unsigned>, Vector<AccessibilityText>, Vector<AXID>, Vector<std::pair<AXID, AXID>>, Vector<String>, Path, OptionSet<AXAncestorFlag>>;
 using AXPropertyMap = HashMap<AXPropertyName, AXPropertyValueVariant, IntHash<AXPropertyName>, WTF::StrongEnumHashTraits<AXPropertyName>>;
 
 struct AXPropertyChange {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to