AX: ARIA 1.1: aria-orientation now defaults to undefined, supported on more elements...
authorn_wang@apple.com <n_wang@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Oct 2015 21:46:08 +0000 (21:46 +0000)
committern_wang@apple.com <n_wang@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Oct 2015 21:46:08 +0000 (21:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132177

Reviewed by Chris Fleizach.

Source/WebCore:

Added role-specific defaults and changed general default to undefined.
Also added more elements to support aria-orientation on Mac.

Test: accessibility/mac/aria-orientation.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::orientation):
(WebCore::AccessibilityObject::isDescendantOfObject):
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::isColorWell):
(WebCore::AccessibilityObject::isSplitter):
(WebCore::AccessibilityObject::isToolbar):
(WebCore::AccessibilityObject::isChecked):
(WebCore::AccessibilityObject::isEnabled):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::orientation):
* accessibility/AccessibilityScrollView.cpp:
(WebCore::AccessibilityScrollView::scrollBar):
* accessibility/AccessibilityScrollbar.cpp:
(WebCore::AccessibilityScrollbar::orientation):
(WebCore::AccessibilityScrollbar::isEnabled):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):

LayoutTests:

* accessibility/mac/aria-orientation-expected.txt: Added.
* accessibility/mac/aria-orientation.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/accessibility/mac/aria-orientation-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/mac/aria-orientation.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/accessibility/AccessibilityScrollView.cpp
Source/WebCore/accessibility/AccessibilityScrollbar.cpp
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

index 766e3a4..9e65c53 100644 (file)
@@ -1,3 +1,13 @@
+2015-10-06  Nan Wang  <n_wang@apple.com>
+
+        AX: ARIA 1.1: aria-orientation now defaults to undefined, supported on more elements, and role-specific defaults are defined.
+        https://bugs.webkit.org/show_bug.cgi?id=132177
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/mac/aria-orientation-expected.txt: Added.
+        * accessibility/mac/aria-orientation.html: Added.
+
 2015-10-06  Simon Fraser  <simon.fraser@apple.com>
 
         Mark compositing/geometry/limit-layer-bounds-opacity-transition.html as failing
diff --git a/LayoutTests/accessibility/mac/aria-orientation-expected.txt b/LayoutTests/accessibility/mac/aria-orientation-expected.txt
new file mode 100644 (file)
index 0000000..3ea45cb
--- /dev/null
@@ -0,0 +1,33 @@
+Implicit defaults
+Option
+Menu item 1
+menubar
+item one
+tree item
+
+Authored orientation
+radio 1
+cell
+cell2
+X
+This test makes sure that aria-orientation works correctly and the implicit defaults are defined on different roles.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS slider.orientation is 'AXOrientation: AXHorizontalOrientation'
+PASS combobox.orientation is 'AXOrientation: AXVerticalOrientation'
+PASS listbox.orientation is 'AXOrientation: AXVerticalOrientation'
+PASS menu.orientation is 'AXOrientation: AXVerticalOrientation'
+PASS menubar.orientation is 'AXOrientation: AXHorizontalOrientation'
+PASS tablist.orientation is 'AXOrientation: AXHorizontalOrientation'
+PASS toolbar.orientation is 'AXOrientation: AXHorizontalOrientation'
+PASS tree.orientation is 'AXOrientation: AXVerticalOrientation'
+PASS radiogroup.orientation is 'AXOrientation: AXVerticalOrientation'
+PASS treegrid.orientation is 'AXOrientation: AXHorizontalOrientation'
+PASS slider2.orientation is 'AXOrientation: AXUnknownOrientation'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/mac/aria-orientation.html b/LayoutTests/accessibility/mac/aria-orientation.html
new file mode 100644 (file)
index 0000000..743b60b
--- /dev/null
@@ -0,0 +1,85 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<div>Implicit defaults</div>
+<input type="range" id="slider">
+<input id="combo" type="text" role="combobox" placeholder="Placeholder" value="text">
+<div id="listbox" role="listbox">
+    <div id="option1" role="option" aria-selected="true">Option</div>
+</div>
+<div id="menu" role="menu">
+    <div role="menuitem" id="item1" tabindex="0">Menu item 1</div>
+</div>
+<div id="menubar" role="menubar">menubar</div>
+<div role="tablist" id="tablist">
+<div role="toolbar" id="toolbar" aria-label="test toolbar"><li>item one</div>
+<ul id="tree" role="tree">
+    <li id="treeitem1" role="treeitem">tree item</li>
+</ul>
+
+<br>
+<div>Authored orientation</div>
+<div role="radiogroup" id="radiogroup" aria-orientation="vertical">
+    <div role="radio" aria-label="radio 1" aria-checked=false>radio 1</div>
+</div>
+<table id="treegrid" role="treegrid" aria-orientation="horizontal">
+<tbody>
+    <tr><td role="gridcell" colspan="3">cell</tr>
+    <tr><td role="gridcell" colspan="3">cell2</tr>
+</tbody>
+</table>
+<span role="slider" id="slider2" aria-orientation="undefined" aria-valuenow=5 aria-valuemin=0 aria-valuemax=10>X</span>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This test makes sure that aria-orientation works correctly and the implicit defaults are defined on different roles.");
+
+    if (window.accessibilityController) {
+          // Test implicit defaults on some roles.
+          var slider = accessibilityController.accessibleElementById("slider");
+          shouldBe("slider.orientation", "'AXOrientation: AXHorizontalOrientation'");
+          
+          var combobox = accessibilityController.accessibleElementById("combo");
+          shouldBe("combobox.orientation", "'AXOrientation: AXVerticalOrientation'");
+          
+          var listbox = accessibilityController.accessibleElementById("listbox");
+          shouldBe("listbox.orientation", "'AXOrientation: AXVerticalOrientation'");
+          
+          var menu = accessibilityController.accessibleElementById("menu");
+          shouldBe("menu.orientation", "'AXOrientation: AXVerticalOrientation'");
+          
+          var menubar = accessibilityController.accessibleElementById("menubar");
+          shouldBe("menubar.orientation", "'AXOrientation: AXHorizontalOrientation'");
+          
+          var tablist = accessibilityController.accessibleElementById("tablist");
+          shouldBe("tablist.orientation", "'AXOrientation: AXHorizontalOrientation'");
+          
+          var toolbar = accessibilityController.accessibleElementById("toolbar");
+          shouldBe("toolbar.orientation", "'AXOrientation: AXHorizontalOrientation'");
+          
+          var tree = accessibilityController.accessibleElementById("tree");
+          shouldBe("tree.orientation", "'AXOrientation: AXVerticalOrientation'");
+          
+          // Test authored aria-orientation are correct.
+          var radiogroup = accessibilityController.accessibleElementById("radiogroup");
+          shouldBe("radiogroup.orientation", "'AXOrientation: AXVerticalOrientation'");
+          
+          var treegrid = accessibilityController.accessibleElementById("treegrid");
+          shouldBe("treegrid.orientation", "'AXOrientation: AXHorizontalOrientation'");
+          
+          var slider2 = accessibilityController.accessibleElementById("slider2");
+          shouldBe("slider2.orientation", "'AXOrientation: AXUnknownOrientation'");
+    }
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
index 892656d..4549d13 100644 (file)
@@ -1,3 +1,35 @@
+2015-10-06  Nan Wang  <n_wang@apple.com>
+
+        AX: ARIA 1.1: aria-orientation now defaults to undefined, supported on more elements, and role-specific defaults are defined.
+        https://bugs.webkit.org/show_bug.cgi?id=132177
+
+        Reviewed by Chris Fleizach.
+
+        Added role-specific defaults and changed general default to undefined.
+        Also added more elements to support aria-orientation on Mac.
+
+        Test: accessibility/mac/aria-orientation.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::orientation):
+        (WebCore::AccessibilityObject::isDescendantOfObject):
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::isColorWell):
+        (WebCore::AccessibilityObject::isSplitter):
+        (WebCore::AccessibilityObject::isToolbar):
+        (WebCore::AccessibilityObject::isChecked):
+        (WebCore::AccessibilityObject::isEnabled):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::orientation):
+        * accessibility/AccessibilityScrollView.cpp:
+        (WebCore::AccessibilityScrollView::scrollBar):
+        * accessibility/AccessibilityScrollbar.cpp:
+        (WebCore::AccessibilityScrollbar::orientation):
+        (WebCore::AccessibilityScrollbar::isEnabled):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
+
 2015-10-06  Per Arne Vollan  <peavo@outlook.com>
 
         [WinCairo] GStreamer compile errors.
index 6a5c5d5..e1686f2 100644 (file)
@@ -1877,8 +1877,7 @@ AccessibilityOrientation AccessibilityObject::orientation() const
     if (bounds.size().height() > bounds.size().width())
         return AccessibilityOrientationVertical;
 
-    // A tie goes to horizontal.
-    return AccessibilityOrientationHorizontal;
+    return AccessibilityOrientationUndefined;
 }    
 
 bool AccessibilityObject::isDescendantOfObject(const AccessibilityObject* axObject) const
index b3f16f9..7aa31b0 100644 (file)
@@ -279,6 +279,7 @@ struct AccessibilityTextUnderElementMode {
 enum AccessibilityOrientation {
     AccessibilityOrientationVertical,
     AccessibilityOrientationHorizontal,
+    AccessibilityOrientationUndefined,
 };
     
 enum AccessibilityObjectInclusion {
@@ -536,6 +537,8 @@ public:
     bool isColorWell() const { return roleValue() == ColorWellRole; }
     bool isRangeControl() const;
     bool isMeter() const;
+    bool isSplitter() const { return roleValue() == SplitterRole; }
+    bool isToolbar() const { return roleValue() == ToolbarRole; }
 
     virtual bool isChecked() const { return false; }
     virtual bool isEnabled() const { return false; }
index bc55494..44445a3 100644 (file)
@@ -2717,10 +2717,17 @@ AccessibilityOrientation AccessibilityRenderObject::orientation() const
         return AccessibilityOrientationHorizontal;
     if (equalIgnoringCase(ariaOrientation, "vertical"))
         return AccessibilityOrientationVertical;
+    if (equalIgnoringCase(ariaOrientation, "undefined"))
+        return AccessibilityOrientationUndefined;
 
-    if (isScrollbar())
+    // ARIA 1.1 Implicit defaults are defined on some roles.
+    // http://www.w3.org/TR/wai-aria-1.1/#aria-orientation
+    if (isScrollbar() || isComboBox() || isListBox() || isMenu() || isTree())
         return AccessibilityOrientationVertical;
     
+    if (isMenuBar() || isSplitter() || isTabList() || isToolbar())
+        return AccessibilityOrientationHorizontal;
+    
     return AccessibilityObject::orientation();
 }
     
index 7e530b3..ed5aa58 100644 (file)
@@ -64,6 +64,8 @@ AccessibilityObject* AccessibilityScrollView::scrollBar(AccessibilityOrientation
     updateScrollbars();
     
     switch (orientation) {
+    // ARIA 1.1 Elements with the role scrollbar have an implicit aria-orientation value of vertical.
+    case AccessibilityOrientationUndefined:
     case AccessibilityOrientationVertical:
         return m_verticalScrollbar ? m_verticalScrollbar.get() : nullptr;
     case AccessibilityOrientationHorizontal:
index e24e635..a46d1b2 100644 (file)
@@ -65,15 +65,16 @@ Document* AccessibilityScrollbar::document() const
 
 AccessibilityOrientation AccessibilityScrollbar::orientation() const
 {
+    // ARIA 1.1 Elements with the role scrollbar have an implicit aria-orientation value of vertical.
     if (!m_scrollbar)
-        return AccessibilityOrientationHorizontal;
+        return AccessibilityOrientationVertical;
 
     if (m_scrollbar->orientation() == HorizontalScrollbar)
         return AccessibilityOrientationHorizontal;
     if (m_scrollbar->orientation() == VerticalScrollbar)
         return AccessibilityOrientationVertical;
 
-    return AccessibilityOrientationHorizontal;
+    return AccessibilityOrientationVertical;
 }
 
 bool AccessibilityScrollbar::isEnabled() const
index 620f455..bb8bed0 100644 (file)
@@ -1236,7 +1236,10 @@ static id textMarkerRangeFromVisiblePositions(AXObjectCache *cache, const Visibl
     if (m_object->supportsExpanded())
         [additional addObject:NSAccessibilityExpandedAttribute];
     
-    if (m_object->isScrollbar())
+    if (m_object->isScrollbar()
+        || m_object->isRadioGroup()
+        || m_object->isSplitter()
+        || m_object->isToolbar())
         [additional addObject:NSAccessibilityOrientationAttribute];
     
     if (m_object->supportsARIADragging())
@@ -1439,6 +1442,7 @@ static id textMarkerRangeFromVisiblePositions(AXObjectCache *cache, const Visibl
         [tempArray addObject:NSAccessibilityAccessKeyAttribute];
         [tempArray addObject:NSAccessibilityRequiredAttribute];
         [tempArray addObject:NSAccessibilityInvalidAttribute];
+        [tempArray addObject:NSAccessibilityOrientationAttribute];
         listBoxAttrs = [[NSArray alloc] initWithArray:tempArray];
         [tempArray release];
     }
@@ -1457,6 +1461,7 @@ static id textMarkerRangeFromVisiblePositions(AXObjectCache *cache, const Visibl
         [tempArray addObject:NSAccessibilitySelectedChildrenAttribute];
         [tempArray addObject:NSAccessibilityVisibleChildrenAttribute];
         [tempArray addObject:NSAccessibilityTitleUIElementAttribute];
+        [tempArray addObject:NSAccessibilityOrientationAttribute];
         menuBarAttrs = [[NSArray alloc] initWithArray:tempArray];
         [tempArray release];
     }
@@ -1465,6 +1470,7 @@ static id textMarkerRangeFromVisiblePositions(AXObjectCache *cache, const Visibl
         [tempArray addObject:NSAccessibilitySelectedChildrenAttribute];
         [tempArray addObject:NSAccessibilityVisibleChildrenAttribute];
         [tempArray addObject:NSAccessibilityTitleUIElementAttribute];
+        [tempArray addObject:NSAccessibilityOrientationAttribute];
         menuAttrs = [[NSArray alloc] initWithArray:tempArray];
         [tempArray release];
     }
@@ -1529,6 +1535,7 @@ static id textMarkerRangeFromVisiblePositions(AXObjectCache *cache, const Visibl
     if (comboBoxAttrs == nil) {
         tempArray = [[NSMutableArray alloc] initWithArray:controlAttrs];
         [tempArray addObject:NSAccessibilityExpandedAttribute];
+        [tempArray addObject:NSAccessibilityOrientationAttribute];
         comboBoxAttrs = [[NSArray alloc] initWithArray:tempArray];
         [tempArray release];
     }
@@ -1597,6 +1604,7 @@ static id textMarkerRangeFromVisiblePositions(AXObjectCache *cache, const Visibl
         tempArray = [[NSMutableArray alloc] initWithArray:attributes];
         [tempArray addObject:NSAccessibilityTabsAttribute];
         [tempArray addObject:NSAccessibilityContentsAttribute];
+        [tempArray addObject:NSAccessibilityOrientationAttribute];
         tabListAttrs = [[NSArray alloc] initWithArray:tempArray];
         [tempArray release];
     }
@@ -1605,6 +1613,7 @@ static id textMarkerRangeFromVisiblePositions(AXObjectCache *cache, const Visibl
         [tempArray addObject:NSAccessibilitySelectedRowsAttribute];
         [tempArray addObject:NSAccessibilityRowsAttribute];
         [tempArray addObject:NSAccessibilityColumnsAttribute];
+        [tempArray addObject:NSAccessibilityOrientationAttribute];
         outlineAttrs = [[NSArray alloc] initWithArray:tempArray];
         [tempArray release];
     }
@@ -2927,6 +2936,8 @@ static NSString* roleValueToNSString(AccessibilityRole value)
             return NSAccessibilityVerticalOrientationValue;
         if (elementOrientation == AccessibilityOrientationHorizontal)
             return NSAccessibilityHorizontalOrientationValue;
+        if (elementOrientation == AccessibilityOrientationUndefined)
+            return NSAccessibilityUnknownOrientationValue;
         return nil;
     }