Title: [285632] trunk/Source/WebCore
Revision
285632
Author
[email protected]
Date
2021-11-11 07:57:14 -0800 (Thu, 11 Nov 2021)

Log Message

AX: Implement AXCoreObject::value for AXIsolatedObject
https://bugs.webkit.org/show_bug.cgi?id=232983

Patch by Tyler Wilcock <[email protected]> on 2021-11-11
Reviewed by Chris Fleizach.

This patch implements AXCoreObject::value by moving the implementation
from AccessibilityObject into AXCoreObject (AccessibilityObjectInterface.h),
as the behavior should be the same for both types of objects. We can entirely
share the implementation because all the methods it calls are interface methods.

This patch also changes AXIsolatedObject::headingLevel() to use
`unsignedAttributeValue` rather than `intAttributeValue`, as the value
we are setting is an `unsigned`. Before this change, `headingLevel`
always returned zero because the property lookup never returned an
int.

Between these two changes, roughly 57 text-only failures are fixed compared to `main`
with run-webkit-tests --release --accessibility-isolated-tree accessibility/

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::value):
Move implementation to AXCoreObject (AccessibilityObjectInterface.h).

* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityObjectInterface.h:
(WebCore::AXCoreObject::value):
Added default implementation from AccessibilityObject.cpp.

* accessibility/isolatedtree/AXIsolatedObject.h:
Change `headingLevel` to use `unsignedAttributeValue` rather than
`intAttributeValue`.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (285631 => 285632)


--- trunk/Source/WebCore/ChangeLog	2021-11-11 15:55:11 UTC (rev 285631)
+++ trunk/Source/WebCore/ChangeLog	2021-11-11 15:57:14 UTC (rev 285632)
@@ -1,3 +1,37 @@
+2021-11-11  Tyler Wilcock  <[email protected]>
+
+        AX: Implement AXCoreObject::value for AXIsolatedObject
+        https://bugs.webkit.org/show_bug.cgi?id=232983
+
+        Reviewed by Chris Fleizach.
+
+        This patch implements AXCoreObject::value by moving the implementation
+        from AccessibilityObject into AXCoreObject (AccessibilityObjectInterface.h),
+        as the behavior should be the same for both types of objects. We can entirely
+        share the implementation because all the methods it calls are interface methods.
+
+        This patch also changes AXIsolatedObject::headingLevel() to use
+        `unsignedAttributeValue` rather than `intAttributeValue`, as the value
+        we are setting is an `unsigned`. Before this change, `headingLevel`
+        always returned zero because the property lookup never returned an
+        int.
+
+        Between these two changes, roughly 57 text-only failures are fixed compared to `main`
+        with run-webkit-tests --release --accessibility-isolated-tree accessibility/
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::value):
+        Move implementation to AXCoreObject (AccessibilityObjectInterface.h).
+
+        * accessibility/AccessibilityObject.h:
+        * accessibility/AccessibilityObjectInterface.h:
+        (WebCore::AXCoreObject::value):
+        Added default implementation from AccessibilityObject.cpp.
+
+        * accessibility/isolatedtree/AXIsolatedObject.h:
+        Change `headingLevel` to use `unsignedAttributeValue` rather than
+        `intAttributeValue`.
+
 2021-11-11  Antoine Quint  <[email protected]>
 
         Improve additivity support when animating the transform property

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (285631 => 285632)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2021-11-11 15:55:11 UTC (rev 285631)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2021-11-11 15:57:14 UTC (rev 285632)
@@ -290,38 +290,6 @@
     return true;
 }
 
-AXCoreObject::AXValue AccessibilityObject::value()
-{
-    if (supportsRangeValue())
-        return valueForRange();
-
-    if (roleValue() == AccessibilityRole::SliderThumb)
-        return parentObject()->valueForRange();
-
-    if (isHeading())
-        return headingLevel();
-
-    if (supportsCheckedState())
-        return checkboxOrRadioValue();
-
-    // Radio groups return the selected radio button as the AXValue.
-    if (isRadioGroup())
-        return selectedRadioButton();
-
-    if (isTabList())
-        return selectedTabItem();
-
-    if (isTabItem())
-        return isSelected();
-
-    if (isColorWell()) {
-        auto color = convertColor<SRGBA<float>>(colorValue());
-        return makeString("rgb ", String::numberToStringFixedPrecision(color.red, 6, KeepTrailingZeros), " ", String::numberToStringFixedPrecision(color.green, 6, KeepTrailingZeros), " ", String::numberToStringFixedPrecision(color.blue, 6, KeepTrailingZeros), " 1");
-    }
-
-    return stringValue();
-}
-
 String AccessibilityObject::computedLabel()
 {
     // This method is being called by WebKit inspector, which may happen at any time, so we need to update our backing store now.

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (285631 => 285632)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.h	2021-11-11 15:55:11 UTC (rev 285631)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h	2021-11-11 15:57:14 UTC (rev 285632)
@@ -391,8 +391,6 @@
     bool ariaRoleHasPresentationalChildren() const override { return false; }
     bool inheritsPresentationalRole() const override { return false; }
 
-    AXValue value() override;
-
     // Accessibility Text
     void accessibilityText(Vector<AccessibilityText>&) const override { };
     // A single method for getting a computed label for an AXObject. It condenses the nuances of accessibilityText. Used by Inspector.

Modified: trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h (285631 => 285632)


--- trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h	2021-11-11 15:55:11 UTC (rev 285631)
+++ trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h	2021-11-11 15:57:14 UTC (rev 285632)
@@ -1143,7 +1143,7 @@
     virtual bool inheritsPresentationalRole() const = 0;
 
     using AXValue = std::variant<bool, unsigned, float, String, AccessibilityButtonState, AXCoreObject*>;
-    virtual AXValue value() = 0;
+    AXValue value();
 
     // Accessibility Text
     virtual void accessibilityText(Vector<AccessibilityText>&) const = 0;
@@ -1546,6 +1546,38 @@
     virtual void detachPlatformWrapper(AccessibilityDetachmentType) = 0;
 };
 
+inline AXCoreObject::AXValue AXCoreObject::value()
+{
+    if (supportsRangeValue())
+        return valueForRange();
+
+    if (roleValue() == AccessibilityRole::SliderThumb)
+        return parentObject()->valueForRange();
+
+    if (isHeading())
+        return headingLevel();
+
+    if (supportsCheckedState())
+        return checkboxOrRadioValue();
+
+    // Radio groups return the selected radio button as the AXValue.
+    if (isRadioGroup())
+        return selectedRadioButton();
+
+    if (isTabList())
+        return selectedTabItem();
+
+    if (isTabItem())
+        return isSelected();
+
+    if (isColorWell()) {
+        auto color = convertColor<SRGBA<float>>(colorValue());
+        return makeString("rgb ", String::numberToStringFixedPrecision(color.red, 6, KeepTrailingZeros), " ", String::numberToStringFixedPrecision(color.green, 6, KeepTrailingZeros), " ", String::numberToStringFixedPrecision(color.blue, 6, KeepTrailingZeros), " 1");
+    }
+
+    return stringValue();
+}
+
 inline void AXCoreObject::detach(AccessibilityDetachmentType detachmentType)
 {
     detachWrapper(detachmentType);

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h (285631 => 285632)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2021-11-11 15:55:11 UTC (rev 285631)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2021-11-11 15:57:14 UTC (rev 285632)
@@ -212,7 +212,7 @@
     bool isShowingValidationMessage() const override { return boolAttributeValue(AXPropertyName::IsShowingValidationMessage); }
     String validationMessage() const override { return stringAttributeValue(AXPropertyName::ValidationMessage); }
     unsigned blockquoteLevel() const override { return unsignedAttributeValue(AXPropertyName::BlockquoteLevel); }
-    unsigned headingLevel() const override { return intAttributeValue(AXPropertyName::HeadingLevel); }
+    unsigned headingLevel() const override { return unsignedAttributeValue(AXPropertyName::HeadingLevel); }
     AccessibilityButtonState checkboxOrRadioValue() const override { return static_cast<AccessibilityButtonState>(intAttributeValue(AXPropertyName::AccessibilityButtonState)); }
     String valueDescription() const override { return stringAttributeValue(AXPropertyName::ValueDescription); }
     float valueForRange() const override { return floatAttributeValue(AXPropertyName::ValueForRange); }
@@ -275,7 +275,6 @@
     LayoutRect boundingBoxRect() const override { return rectAttributeValue<LayoutRect>(AXPropertyName::BoundingBoxRect); }
     LayoutRect elementRect() const override { return rectAttributeValue<LayoutRect>(AXPropertyName::ElementRect); }
     IntPoint clickPoint() override { return intPointAttributeValue(AXPropertyName::ClickPoint); }
-    AXValue value() override { return { }; }
     void accessibilityText(Vector<AccessibilityText>& texts) const override;
     String brailleLabel() const override { return stringAttributeValue(AXPropertyName::BrailleLabel); }
     String brailleRoleDescription() const override { return stringAttributeValue(AXPropertyName::BrailleRoleDescription); }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to