Commit 3a4f3617 authored by deejay's avatar deejay Committed by Commit Bot

Change default value of aria-level to 2

According from ARIA 1.1 [1],
default value of aria-level was changed to 2.

We will return 2 as default in aria-level
if not otherwise specified.

[1] https://www.w3.org/WAI/ARIA/wiki/ARIA_1.1_Changes

Bug=688581

Change-Id: Ib03c23f96b74814fe9f52f196c6e0e417059112f
Reviewed-on: https://chromium-review.googlesource.com/670539Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: default avatarAaron Leventhal <aleventhal@chromium.org>
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505425}
parent c52283dc
...@@ -6,4 +6,4 @@ android.webkit.WebView focusable focused scrollable ...@@ -6,4 +6,4 @@ android.webkit.WebView focusable focused scrollable
++android.view.View role_description='heading 5' heading name='ARIA Heading 5' ++android.view.View role_description='heading 5' heading name='ARIA Heading 5'
++android.view.View role_description='heading 6' heading name='ARIA Heading 6' ++android.view.View role_description='heading 6' heading name='ARIA Heading 6'
++android.view.View ++android.view.View
++++android.view.View role_description='heading' heading name='Heading' ++++android.view.View role_description='heading 2' heading name='Heading'
\ No newline at end of file \ No newline at end of file
...@@ -18,6 +18,6 @@ rootWebArea ...@@ -18,6 +18,6 @@ rootWebArea
++++staticText name='ARIA Heading 6' ++++staticText name='ARIA Heading 6'
++++++inlineTextBox name='ARIA Heading 6' ++++++inlineTextBox name='ARIA Heading 6'
++genericContainer ++genericContainer
++++heading name='Heading' ++++heading name='Heading' hierarchicalLevel=2
++++++staticText name='Heading' ++++++staticText name='Heading'
++++++++inlineTextBox name='Heading' ++++++++inlineTextBox name='Heading'
\ No newline at end of file
...@@ -12,5 +12,5 @@ AXWebArea ...@@ -12,5 +12,5 @@ AXWebArea
++AXHeading AXTitle='ARIA Heading 6' AXValue='6' ++AXHeading AXTitle='ARIA Heading 6' AXValue='6'
++++AXStaticText AXValue='ARIA Heading 6' ++++AXStaticText AXValue='ARIA Heading 6'
++AXGroup ++AXGroup
++++AXHeading AXTitle='Heading' ++++AXHeading AXTitle='Heading' AXValue='2'
++++++AXStaticText AXValue='Heading' ++++++AXStaticText AXValue='Heading'
\ No newline at end of file
...@@ -12,5 +12,5 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ...@@ -12,5 +12,5 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
++IA2_ROLE_HEADING name='ARIA Heading 6' xml-roles:heading level:6 ++IA2_ROLE_HEADING name='ARIA Heading 6' xml-roles:heading level:6
++++ROLE_SYSTEM_STATICTEXT name='ARIA Heading 6' ++++ROLE_SYSTEM_STATICTEXT name='ARIA Heading 6'
++IA2_ROLE_SECTION ++IA2_ROLE_SECTION
++++IA2_ROLE_HEADING name='Heading' xml-roles:heading ++++IA2_ROLE_HEADING name='Heading' xml-roles:heading level:2
++++++ROLE_SYSTEM_STATICTEXT name='Heading' ++++++ROLE_SYSTEM_STATICTEXT name='Heading'
...@@ -21,8 +21,8 @@ PASS: level is 3. ...@@ -21,8 +21,8 @@ PASS: level is 3.
PASS: level is 4. PASS: level is 4.
PASS: level is 5. PASS: level is 5.
PASS: level is 6. PASS: level is 6.
PASS: level is 1. PASS: level is 2.
PASS: level is 1. PASS: level is 2.
PASS successfullyParsed is true PASS successfullyParsed is true
TEST COMPLETE TEST COMPLETE
......
...@@ -39,8 +39,8 @@ ...@@ -39,8 +39,8 @@
<div class="ex" role="heading" data-expected="6" aria-level="6">X</div> <div class="ex" role="heading" data-expected="6" aria-level="6">X</div>
<!-- A level that is specified either as 0 or as a ntegative number,should be set to 1. --> <!-- A level that is specified either as 0 or as a ntegative number,should be set to 1. -->
<div class="ex" role="heading" data-expected="1" aria-level="0">X</div> <div class="ex" role="heading" data-expected="2" aria-level="0">X</div>
<div class="ex" role="heading" data-expected="1" aria-level="-1">X</div> <div class="ex" role="heading" data-expected="2" aria-level="-1">X</div>
<!-- todo: h1 elements nested in section elements should inherit nested level. --> <!-- todo: h1 elements nested in section elements should inherit nested level. -->
......
...@@ -75,6 +75,9 @@ namespace blink { ...@@ -75,6 +75,9 @@ namespace blink {
using namespace HTMLNames; using namespace HTMLNames;
// In ARIA 1.1, default value of aria-level was changed to 2.
const int kDefaultHeadingLevel = 2;
AXNodeObject::AXNodeObject(Node* node, AXObjectCacheImpl& ax_object_cache) AXNodeObject::AXNodeObject(Node* node, AXObjectCacheImpl& ax_object_cache)
: AXObject(ax_object_cache), : AXObject(ax_object_cache),
children_dirty_(false), children_dirty_(false),
...@@ -1073,7 +1076,6 @@ int AXNodeObject::HeadingLevel() const { ...@@ -1073,7 +1076,6 @@ int AXNodeObject::HeadingLevel() const {
if (HasAOMPropertyOrARIAAttribute(AOMUIntProperty::kLevel, level)) { if (HasAOMPropertyOrARIAAttribute(AOMUIntProperty::kLevel, level)) {
if (level >= 1 && level <= 9) if (level >= 1 && level <= 9)
return level; return level;
return 1;
} }
} }
...@@ -1099,6 +1101,9 @@ int AXNodeObject::HeadingLevel() const { ...@@ -1099,6 +1101,9 @@ int AXNodeObject::HeadingLevel() const {
if (element.HasTagName(h6Tag)) if (element.HasTagName(h6Tag))
return 6; return 6;
if (RoleValue() == kHeadingRole)
return kDefaultHeadingLevel;
return 0; return 0;
} }
...@@ -1111,7 +1116,6 @@ unsigned AXNodeObject::HierarchicalLevel() const { ...@@ -1111,7 +1116,6 @@ unsigned AXNodeObject::HierarchicalLevel() const {
if (HasAOMPropertyOrARIAAttribute(AOMUIntProperty::kLevel, level)) { if (HasAOMPropertyOrARIAAttribute(AOMUIntProperty::kLevel, level)) {
if (level >= 1 && level <= 9) if (level >= 1 && level <= 9)
return level; return level;
return 1;
} }
// Only tree item will calculate its level through the DOM currently. // Only tree item will calculate its level through the DOM currently.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment