AX: WebKit is incorrectly mapping the <meter> element to progressbar
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Feb 2019 16:11:41 +0000 (16:11 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Feb 2019 16:11:41 +0000 (16:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=164051
<rdar://problem/29055615>

Reviewed by Joanmarie Diggs.

Source/WebCore:

Add a specific role for meter and map that to the appropriate mac role.

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::canHaveChildren const):
(WebCore::AccessibilityNodeObject::isProgressIndicator const):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::accessibleNameDerivesFromContent const):
(WebCore::AccessibilityObject::isRangeControl const):
(WebCore::AccessibilityObject::computedRoleString const):
* accessibility/AccessibilityObjectInterface.h:
* accessibility/AccessibilityProgressIndicator.cpp:
(WebCore::AccessibilityProgressIndicator::roleValue const):
* accessibility/AccessibilityProgressIndicator.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::shouldFocusActiveDescendant const):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(createAccessibilityRoleMap):

LayoutTests:

* platform/mac-wk2/accessibility/roles-exposed-expected.txt:
* platform/mac/accessibility/meter-element-expected.txt:
* platform/mac/accessibility/roles-exposed-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241989 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-wk2/accessibility/roles-exposed-expected.txt
LayoutTests/platform/mac/accessibility/meter-element-expected.txt
LayoutTests/platform/mac/accessibility/roles-exposed-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityNodeObject.cpp
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/accessibility/AccessibilityObjectInterface.h
Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp
Source/WebCore/accessibility/AccessibilityProgressIndicator.h
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

index ee1bf1c..4625fae 100644 (file)
@@ -1,3 +1,15 @@
+2019-02-23  chris fleizach  <cfleizach@apple.com>
+
+        AX: WebKit is incorrectly mapping the <meter> element to progressbar
+        https://bugs.webkit.org/show_bug.cgi?id=164051
+        <rdar://problem/29055615>
+
+        Reviewed by Joanmarie Diggs.
+
+        * platform/mac-wk2/accessibility/roles-exposed-expected.txt:
+        * platform/mac/accessibility/meter-element-expected.txt:
+        * platform/mac/accessibility/roles-exposed-expected.txt:
+
 2019-02-22  Simon Fraser  <simon.fraser@apple.com>
 
         Fix a legacy animation test. The <!-- webkit-test-runner --> was inside the <style>.
index d2c6855..72837c3 100644 (file)
@@ -530,9 +530,9 @@ mtd
       AXRoleDescription: group
       
 meter
-      AXRole: AXProgressIndicator
+      AXRole: AXLevelIndicator
       AXSubrole: AXMeter
-      AXRoleDescription: progress indicator
+      AXRoleDescription: level indicator
       
 nav
       AXRole: AXGroup
index c98166e..5a611d4 100644 (file)
@@ -4,7 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 Meter1
-AXRole: AXProgressIndicator
+AXRole: AXLevelIndicator
 AXTitle: 
 AXDescription: 
 AXValueDescription: 6 blocks used (out of 8 total)
@@ -12,7 +12,7 @@ AXValueSettable: false
 
 
 Meter2
-AXRole: AXProgressIndicator
+AXRole: AXLevelIndicator
 AXTitle: 
 AXDescription: 
 AXValueDescription: 75%
@@ -20,7 +20,7 @@ AXValueSettable: false
 
 
 Meter3
-AXRole: AXProgressIndicator
+AXRole: AXLevelIndicator
 AXTitle: 
 AXDescription: 
 AXValueDescription: 
@@ -28,7 +28,7 @@ AXValueSettable: false
 
 
 Meter4
-AXRole: AXProgressIndicator
+AXRole: AXLevelIndicator
 AXTitle: 
 AXDescription: 
 AXValueDescription: 12cm
@@ -36,7 +36,7 @@ AXValueSettable: false
 
 
 Meter5
-AXRole: AXProgressIndicator
+AXRole: AXLevelIndicator
 AXTitle: 
 AXDescription: 
 AXValueDescription: 2cm
@@ -44,7 +44,7 @@ AXValueSettable: false
 
 
 Meter6
-AXRole: AXProgressIndicator
+AXRole: AXLevelIndicator
 AXTitle: 
 AXDescription: 
 AXValueDescription: 12cm
@@ -52,7 +52,7 @@ AXValueSettable: false
 
 
 Meter7
-AXRole: AXProgressIndicator
+AXRole: AXLevelIndicator
 AXTitle: 
 AXDescription: 
 AXValueDescription: 2cm
@@ -60,7 +60,7 @@ AXValueSettable: false
 
 
 Meter8
-AXRole: AXProgressIndicator
+AXRole: AXLevelIndicator
 AXTitle: 
 AXDescription: 
 AXValueDescription: 75 out of 100
@@ -68,7 +68,7 @@ AXValueSettable: false
 
 
 Meter9
-AXRole: AXProgressIndicator
+AXRole: AXLevelIndicator
 AXTitle: 
 AXDescription: 
 AXValueDescription: 75 percent
@@ -76,7 +76,7 @@ AXValueSettable: false
 
 
 Meter10
-AXRole: AXProgressIndicator
+AXRole: AXLevelIndicator
 AXTitle: 
 AXDescription: 
 AXValueDescription: 75 percent
@@ -84,7 +84,7 @@ AXValueSettable: false
 
 
 Meter11
-AXRole: AXProgressIndicator
+AXRole: AXLevelIndicator
 AXTitle: 
 AXDescription: 
 AXValueDescription: 75 (100 total)
@@ -92,7 +92,7 @@ AXValueSettable: false
 
 
 Meter12
-AXRole: AXProgressIndicator
+AXRole: AXLevelIndicator
 AXTitle: 
 AXDescription: 
 AXValueDescription: 75 (out of 100 total)
@@ -100,7 +100,7 @@ AXValueSettable: false
 
 
 Meter13
-AXRole: AXProgressIndicator
+AXRole: AXLevelIndicator
 AXTitle: 
 AXDescription: 
 AXValueDescription: 75 (out of 100 total)
@@ -108,7 +108,7 @@ AXValueSettable: false
 
 
 Meter14
-AXRole: AXProgressIndicator
+AXRole: AXLevelIndicator
 AXTitle: 
 AXDescription: 
 AXValueDescription: 7 of 10
index 8fa0107..16a2869 100644 (file)
@@ -530,9 +530,9 @@ mtd
       AXRoleDescription: group
       
 meter
-      AXRole: AXProgressIndicator
+      AXRole: AXLevelIndicator
       AXSubrole: AXMeter
-      AXRoleDescription: progress indicator
+      AXRoleDescription: level indicator
       
 nav
       AXRole: AXGroup
index d86be8d..0a507df 100644 (file)
@@ -1,3 +1,31 @@
+2019-02-23  chris fleizach  <cfleizach@apple.com>
+
+        AX: WebKit is incorrectly mapping the <meter> element to progressbar
+        https://bugs.webkit.org/show_bug.cgi?id=164051
+        <rdar://problem/29055615>
+
+        Reviewed by Joanmarie Diggs.
+
+        Add a specific role for meter and map that to the appropriate mac role. 
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::canHaveChildren const):
+        (WebCore::AccessibilityNodeObject::isProgressIndicator const):
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::accessibleNameDerivesFromContent const):
+        (WebCore::AccessibilityObject::isRangeControl const):
+        (WebCore::AccessibilityObject::computedRoleString const):
+        * accessibility/AccessibilityObjectInterface.h:
+        * accessibility/AccessibilityProgressIndicator.cpp:
+        (WebCore::AccessibilityProgressIndicator::roleValue const):
+        * accessibility/AccessibilityProgressIndicator.h:
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::shouldFocusActiveDescendant const):
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (createAccessibilityRoleMap):
+
 2019-02-22  Ryosuke Niwa  <rniwa@webkit.org>
 
         Crash in SWServerJobQueue::runNextJobSynchronously
index 666c3e8..d6ff0a5 100644 (file)
@@ -380,6 +380,7 @@ bool AccessibilityNodeObject::canHaveChildren() const
     case AccessibilityRole::MenuItemCheckbox:
     case AccessibilityRole::MenuItemRadio:
     case AccessibilityRole::Splitter:
+    case AccessibilityRole::Meter:
         return false;
     case AccessibilityRole::DocumentMath:
 #if ENABLE(MATHML)
@@ -560,7 +561,7 @@ bool AccessibilityNodeObject::isInputImage() const
 
 bool AccessibilityNodeObject::isProgressIndicator() const
 {
-    return roleValue() == AccessibilityRole::ProgressIndicator;
+    return roleValue() == AccessibilityRole::ProgressIndicator || roleValue() == AccessibilityRole::Meter;
 }
 
 bool AccessibilityNodeObject::isSlider() const
index 5867a1a..4f5d381 100644 (file)
@@ -334,6 +334,7 @@ bool AccessibilityObject::accessibleNameDerivesFromContent() const
     case AccessibilityRole::Menu:
     case AccessibilityRole::MenuBar:
     case AccessibilityRole::ProgressIndicator:
+    case AccessibilityRole::Meter:
     case AccessibilityRole::RadioGroup:
     case AccessibilityRole::ScrollBar:
     case AccessibilityRole::Slider:
@@ -947,6 +948,7 @@ bool AccessibilityObject::isARIAControl(AccessibilityRole ariaRole)
 bool AccessibilityObject::isRangeControl() const
 {
     switch (roleValue()) {
+    case AccessibilityRole::Meter:
     case AccessibilityRole::ProgressIndicator:
     case AccessibilityRole::Slider:
     case AccessibilityRole::ScrollBar:
@@ -2505,6 +2507,9 @@ String AccessibilityObject::computedRoleString() const
     if (role == AccessibilityRole::HorizontalRule)
         return reverseAriaRoleMap().get(static_cast<int>(AccessibilityRole::Splitter));
 
+    if (role == AccessibilityRole::Meter)
+        return reverseAriaRoleMap().get(static_cast<int>(AccessibilityRole::ProgressIndicator));
+
     if (role == AccessibilityRole::PopUpButton || role == AccessibilityRole::ToggleButton)
         return reverseAriaRoleMap().get(static_cast<int>(AccessibilityRole::Button));
 
index 27c3321..35bf520 100644 (file)
@@ -138,6 +138,7 @@ enum class AccessibilityRole {
     MenuItemRadio,
     MenuListPopup,
     MenuListOption,
+    Meter,
     Outline,
     Paragraph,
     PopUpButton,
index c14177c..5e530bc 100644 (file)
@@ -151,6 +151,13 @@ float AccessibilityProgressIndicator::minValueForRange() const
     
     return 0.0;
 }
+    
+AccessibilityRole AccessibilityProgressIndicator::roleValue() const
+{
+    if (meterElement())
+        return AccessibilityRole::Meter;
+    return AccessibilityRole::ProgressIndicator;
+}
 
 HTMLProgressElement* AccessibilityProgressIndicator::progressElement() const
 {
index 7c5438a..7bb0360 100644 (file)
@@ -42,7 +42,7 @@ public:
     Element* element() const override;
 
 private:
-    AccessibilityRole roleValue() const override { return AccessibilityRole::ProgressIndicator; }
+    AccessibilityRole roleValue() const override;
 
     bool isProgressIndicator() const override { return true; }
 
index fd27463..a36d10f 100644 (file)
@@ -2432,6 +2432,7 @@ bool AccessibilityRenderObject::shouldFocusActiveDescendant() const
     case AccessibilityRole::RadioGroup:
     case AccessibilityRole::Row:
     case AccessibilityRole::PopUpButton:
+    case AccessibilityRole::Meter:
     case AccessibilityRole::ProgressIndicator:
     case AccessibilityRole::Toolbar:
     case AccessibilityRole::Outline:
index 1487ddc..997ae26 100644 (file)
@@ -865,6 +865,7 @@ static AccessibilityObjectWrapper* AccessibilityUnignoredAncestor(AccessibilityO
     case AccessibilityRole::Image:
     case AccessibilityRole::ImageMapLink:
     case AccessibilityRole::ProgressIndicator:
+    case AccessibilityRole::Meter:
     case AccessibilityRole::MenuItem:
     case AccessibilityRole::MenuItemCheckbox:
     case AccessibilityRole::MenuItemRadio:
index 446d358..42873c2 100644 (file)
@@ -1891,6 +1891,7 @@ static AccessibilityRoleMap createAccessibilityRoleMap()
         { AccessibilityRole::Toolbar, NSAccessibilityToolbarRole },
         { AccessibilityRole::BusyIndicator, NSAccessibilityBusyIndicatorRole },
         { AccessibilityRole::ProgressIndicator, NSAccessibilityProgressIndicatorRole },
+        { AccessibilityRole::Meter, NSAccessibilityLevelIndicatorRole },
         { AccessibilityRole::Window, NSAccessibilityWindowRole },
         { AccessibilityRole::Drawer, NSAccessibilityDrawerRole },
         { AccessibilityRole::SystemWide, NSAccessibilitySystemWideRole },