INPUT_MULTIPLE_FIELDS_UI: Inconsistent value of aria-valuetext attribute
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2013 10:10:47 +0000 (10:10 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2013 10:10:47 +0000 (10:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=107897

Reviewed by Kentaro Hara.

Source/WebCore:

aria-valuetext and aria-valuenow attributes had inconsistent values in
a case of initial empty state and a case that a user clears a field.

- aria-valuetext attribute should have "blank" message in the initial
  empty state.
- aria-valuenow attribute should be removed in the cleared empty state.

Also, we have a bug that aira-valuenow had a symbolic value such as "AM"
"January". It should always have a numeric value according to the
specification.
http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuenow

No new tests. Updates fast/forms/*-multiple-fields/*-multiple-fields-ax-aria-attributes.html.

* html/shadow/DateTimeFieldElement.cpp:
(WebCore::DateTimeFieldElement::DateTimeFieldElement):
Set "blank" message to aria-valuetext attribute.
(WebCore::DateTimeFieldElement::updateVisibleValue):
aria-valuenow attribute should be a numeric value. Apply String::number
to the return value of valueForARIAValueNow.
Remove aria-valuenow attribute if nothing is selected.
(WebCore::DateTimeFieldElement::valueForARIAValueNow):
Added.
* html/shadow/DateTimeFieldElement.h:
(DateTimeFieldElement): Declare valueForARIAValueNow.

* html/shadow/DateTimeSymbolicFieldElement.cpp:
(WebCore::DateTimeSymbolicFieldElement::valueForARIAValueNow):
Added. Returns 1 + internal selection index.
For example, the function returns 1 for January.
* html/shadow/DateTimeSymbolicFieldElement.h:
(DateTimeSymbolicFieldElement): Declare valueForARIAValueNow.

LayoutTests:

Fix existing tests to show aria-valuenow attribute values.

* fast/forms/resources/multiple-fields-ax-aria-attributes.js: Added.
* fast/forms/date-multiple-fields/date-multiple-fields-ax-aria-attributes-expected.txt:
* fast/forms/date-multiple-fields/date-multiple-fields-ax-aria-attributes.html:
Use multiple-fields-ax-aria-attributes.js.
Add tests for initial empty-value state.
* fast/forms/month-multiple-fields/month-multiple-fields-ax-aria-attributes-expected.txt:
* fast/forms/month-multiple-fields/month-multiple-fields-ax-aria-attributes.html:
Use multiple-fields-ax-aria-attributes.js.
* fast/forms/time-multiple-fields/time-multiple-fields-ax-aria-attributes-expected.txt:
* fast/forms/time-multiple-fields/time-multiple-fields-ax-aria-attributes.html:
Use multiple-fields-ax-aria-attributes.js.

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

13 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-ax-aria-attributes-expected.txt
LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-ax-aria-attributes.html
LayoutTests/fast/forms/month-multiple-fields/month-multiple-fields-ax-aria-attributes-expected.txt
LayoutTests/fast/forms/month-multiple-fields/month-multiple-fields-ax-aria-attributes.html
LayoutTests/fast/forms/resources/multiple-fields-ax-aria-attributes.js [new file with mode: 0644]
LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-ax-aria-attributes-expected.txt
LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-ax-aria-attributes.html
Source/WebCore/ChangeLog
Source/WebCore/html/shadow/DateTimeFieldElement.cpp
Source/WebCore/html/shadow/DateTimeFieldElement.h
Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.cpp
Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.h

index 204723a..044c1a0 100644 (file)
@@ -1,3 +1,24 @@
+2013-01-25  Kent Tamura  <tkent@chromium.org>
+
+        INPUT_MULTIPLE_FIELDS_UI: Inconsistent value of aria-valuetext attribute
+        https://bugs.webkit.org/show_bug.cgi?id=107897
+
+        Reviewed by Kentaro Hara.
+
+        Fix existing tests to show aria-valuenow attribute values.
+
+        * fast/forms/resources/multiple-fields-ax-aria-attributes.js: Added.
+        * fast/forms/date-multiple-fields/date-multiple-fields-ax-aria-attributes-expected.txt:
+        * fast/forms/date-multiple-fields/date-multiple-fields-ax-aria-attributes.html:
+        Use multiple-fields-ax-aria-attributes.js.
+        Add tests for initial empty-value state.
+        * fast/forms/month-multiple-fields/month-multiple-fields-ax-aria-attributes-expected.txt:
+        * fast/forms/month-multiple-fields/month-multiple-fields-ax-aria-attributes.html:
+        Use multiple-fields-ax-aria-attributes.js.
+        * fast/forms/time-multiple-fields/time-multiple-fields-ax-aria-attributes-expected.txt:
+        * fast/forms/time-multiple-fields/time-multiple-fields-ax-aria-attributes.html:
+        Use multiple-fields-ax-aria-attributes.js.
+
 2013-01-25  Keishi Hattori  <keishi@webkit.org>
 
         [Chromium] Rebaseline for r140728.
index d59c0f3..e3e2de3 100644 (file)
@@ -3,14 +3,18 @@ This test checks aria-help attribute of fields in multiple fields date input UI.
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+Initial empty state
+PASS focusedElementDescription() is "AXHelp: Month, AXValueDescription: blank, intValue:0, range:1-12"
+PASS focusedElementDescription() is "AXHelp: Day, AXValueDescription: blank, intValue:0, range:1-31"
+PASS focusedElementDescription() is "AXHelp: Year, AXValueDescription: blank, intValue:0, range:1-275760"
 Non-empty value
-PASS focusedFieldValueDescription() is "AXHelp: Month, AXValueDescription: 10, 1, 12"
-PASS focusedFieldValueDescription() is "AXHelp: Day, AXValueDescription: 09, 1, 31"
-PASS focusedFieldValueDescription() is "AXHelp: Year, AXValueDescription: 2012, 1, 275760"
+PASS focusedElementDescription() is "AXHelp: Month, AXValueDescription: 10, intValue:10, range:1-12"
+PASS focusedElementDescription() is "AXHelp: Day, AXValueDescription: 09, intValue:9, range:1-31"
+PASS focusedElementDescription() is "AXHelp: Year, AXValueDescription: 2012, intValue:2012, range:1-275760"
 Empty value
-PASS focusedFieldValueDescription() is "AXHelp: Year, AXValueDescription: blank, 1, 275760"
-PASS focusedFieldValueDescription() is "AXHelp: Day, AXValueDescription: blank, 1, 31"
-PASS focusedFieldValueDescription() is "AXHelp: Month, AXValueDescription: blank, 1, 12"
+PASS focusedElementDescription() is "AXHelp: Year, AXValueDescription: blank, intValue:0, range:1-275760"
+PASS focusedElementDescription() is "AXHelp: Day, AXValueDescription: blank, intValue:0, range:1-31"
+PASS focusedElementDescription() is "AXHelp: Month, AXValueDescription: blank, intValue:0, range:1-12"
 
 PASS successfullyParsed is true
 
index c30243b..0d6770f 100644 (file)
@@ -2,40 +2,45 @@
 <html>
 <head>
 <script src="../../../fast/js/resources/js-test-pre.js"></script>
+<script src="../resources/multiple-fields-ax-aria-attributes.js"></script>
 </head>
 <body>
-<input id="test" type="date" value="2012-10-09">
+<input id="test" type="date">
 <script>
 description('This test checks aria-help attribute of fields in multiple fields date input UI.');
 
-function focusedFieldValueDescription()
-{
-    var element = accessibilityController.focusedElement;
-    return element.helpText + ', ' +  element.valueDescription + ', ' + element.minValue + ', ' + element.maxValue;
-}
-
 var testInput = document.getElementById('test');
 
 if (!window.accessibilityController || !window.eventSender)
     debug('Please run inside DRT or WTR.');
 else {
-    debug('Non-empty value');
     testInput.focus();
-    shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Month, AXValueDescription: 10, 1, 12');
+    debug('Initial empty state');
+    checkFocusedElementAXAttributes('AXHelp: Month, AXValueDescription: blank, intValue:0, range:1-12');
+    eventSender.keyDown('\t');
+    checkFocusedElementAXAttributes('AXHelp: Day, AXValueDescription: blank, intValue:0, range:1-31');
+    eventSender.keyDown('\t');
+    checkFocusedElementAXAttributes('AXHelp: Year, AXValueDescription: blank, intValue:0, range:1-275760');
+
+    eventSender.keyDown('\t', ['shiftKey']);
+    eventSender.keyDown('\t', ['shiftKey']);
+    debug('Non-empty value');
+    testInput.value = "2012-10-09";
+    checkFocusedElementAXAttributes('AXHelp: Month, AXValueDescription: 10, intValue:10, range:1-12');
     eventSender.keyDown('\t');
-    shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Day, AXValueDescription: 09, 1, 31');
+    checkFocusedElementAXAttributes('AXHelp: Day, AXValueDescription: 09, intValue:9, range:1-31');
     eventSender.keyDown('\t');
-    shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Year, AXValueDescription: 2012, 1, 275760');
+    checkFocusedElementAXAttributes('AXHelp: Year, AXValueDescription: 2012, intValue:2012, range:1-275760');
 
     debug('Empty value');
     eventSender.keyDown('\b');
-    shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Year, AXValueDescription: blank, 1, 275760');
+    checkFocusedElementAXAttributes('AXHelp: Year, AXValueDescription: blank, intValue:0, range:1-275760');
     eventSender.keyDown('\t', ['shiftKey']);
     eventSender.keyDown('\b');
-    shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Day, AXValueDescription: blank, 1, 31');
+    checkFocusedElementAXAttributes('AXHelp: Day, AXValueDescription: blank, intValue:0, range:1-31');
     eventSender.keyDown('\t', ['shiftKey']);
     eventSender.keyDown('\b');
-    shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Month, AXValueDescription: blank, 1, 12');
+    checkFocusedElementAXAttributes('AXHelp: Month, AXValueDescription: blank, intValue:0, range:1-12');
 
     debug('');
     testInput.parentNode.removeChild(testInput);
index 6cca67b..9e58939 100644 (file)
@@ -4,11 +4,11 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 Non-empty value
-PASS focusedFieldValueDescription() is "AXHelp: Month, AXValueDescription: October, 1, 12"
-PASS focusedFieldValueDescription() is "AXHelp: Year, AXValueDescription: 2012, 1, 275760"
+PASS focusedElementDescription() is "AXHelp: Month, AXValueDescription: October, intValue:10, range:1-12"
+PASS focusedElementDescription() is "AXHelp: Year, AXValueDescription: 2012, intValue:2012, range:1-275760"
 Empty value
-PASS focusedFieldValueDescription() is "AXHelp: Year, AXValueDescription: blank, 1, 275760"
-PASS focusedFieldValueDescription() is "AXHelp: Month, AXValueDescription: blank, 1, 12"
+PASS focusedElementDescription() is "AXHelp: Year, AXValueDescription: blank, intValue:0, range:1-275760"
+PASS focusedElementDescription() is "AXHelp: Month, AXValueDescription: blank, intValue:0, range:1-12"
 
 PASS successfullyParsed is true
 
index 4283801..330cf6b 100644 (file)
@@ -2,18 +2,13 @@
 <html>
 <head>
 <script src="../../../fast/js/resources/js-test-pre.js"></script>
+<script src="../resources/multiple-fields-ax-aria-attributes.js"></script>
 </head>
 <body>
 <input id="test" type="month" value="2012-10">
 <script>
 description('This test checks aria-help attribute of fields in multiple fields week input UI.');
 
-function focusedFieldValueDescription()
-{
-    var element = accessibilityController.focusedElement;
-    return element.helpText + ', ' +  element.valueDescription + ', ' + element.minValue + ', ' + element.maxValue;
-}
-
 var testInput = document.getElementById('test');
 
 if (!window.accessibilityController || !window.eventSender)
@@ -21,16 +16,16 @@ if (!window.accessibilityController || !window.eventSender)
 else {
     debug('Non-empty value');
     testInput.focus();
-    shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Month, AXValueDescription: October, 1, 12');
+    checkFocusedElementAXAttributes('AXHelp: Month, AXValueDescription: October, intValue:10, range:1-12');
     eventSender.keyDown('\t');
-    shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Year, AXValueDescription: 2012, 1, 275760');
+    checkFocusedElementAXAttributes('AXHelp: Year, AXValueDescription: 2012, intValue:2012, range:1-275760');
 
     debug('Empty value');
     eventSender.keyDown('\b');
-    shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Year, AXValueDescription: blank, 1, 275760');
+    checkFocusedElementAXAttributes('AXHelp: Year, AXValueDescription: blank, intValue:0, range:1-275760');
     eventSender.keyDown('\t', ['shiftKey']);
     eventSender.keyDown('\b');
-    shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Month, AXValueDescription: blank, 1, 12');
+    checkFocusedElementAXAttributes('AXHelp: Month, AXValueDescription: blank, intValue:0, range:1-12');
 
     debug('');
     testInput.remove();
diff --git a/LayoutTests/fast/forms/resources/multiple-fields-ax-aria-attributes.js b/LayoutTests/fast/forms/resources/multiple-fields-ax-aria-attributes.js
new file mode 100644 (file)
index 0000000..d4c083e
--- /dev/null
@@ -0,0 +1,9 @@
+function focusedElementDescription()
+{
+    var element = accessibilityController.focusedElement;
+    return element.helpText + ', ' +  element.valueDescription + ', intValue:' + element.intValue + ', range:'+ element.minValue + '-' + element.maxValue;
+}
+
+function checkFocusedElementAXAttributes(expected) {
+    shouldBeEqualToString('focusedElementDescription()', expected);
+}
index 957c0b5..b7b32a2 100644 (file)
@@ -4,17 +4,17 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 Non-empty value
-PASS focusedFieldValueDescription() is "AXHelp: Hours, AXValueDescription: 12, 1, 12"
-PASS focusedFieldValueDescription() is "AXHelp: Minutes, AXValueDescription: 34, 0, 59"
-PASS focusedFieldValueDescription() is "AXHelp: Seconds, AXValueDescription: 56, 0, 59"
-PASS focusedFieldValueDescription() is "AXHelp: Milliseconds, AXValueDescription: 789, 0, 999"
-PASS focusedFieldValueDescription() is "AXHelp: AM/PM, AXValueDescription: PM, 1, 2"
+PASS focusedElementDescription() is "AXHelp: Hours, AXValueDescription: 12, intValue:12, range:1-12"
+PASS focusedElementDescription() is "AXHelp: Minutes, AXValueDescription: 34, intValue:34, range:0-59"
+PASS focusedElementDescription() is "AXHelp: Seconds, AXValueDescription: 56, intValue:56, range:0-59"
+PASS focusedElementDescription() is "AXHelp: Milliseconds, AXValueDescription: 789, intValue:789, range:0-999"
+PASS focusedElementDescription() is "AXHelp: AM/PM, AXValueDescription: PM, intValue:2, range:1-2"
 Empty value
-PASS focusedFieldValueDescription() is "AXHelp: AM/PM, AXValueDescription: blank, 1, 2"
-PASS focusedFieldValueDescription() is "AXHelp: Milliseconds, AXValueDescription: blank, 0, 999"
-PASS focusedFieldValueDescription() is "AXHelp: Seconds, AXValueDescription: blank, 0, 59"
-PASS focusedFieldValueDescription() is "AXHelp: Minutes, AXValueDescription: blank, 0, 59"
-PASS focusedFieldValueDescription() is "AXHelp: Hours, AXValueDescription: blank, 1, 12"
+PASS focusedElementDescription() is "AXHelp: AM/PM, AXValueDescription: blank, intValue:0, range:1-2"
+PASS focusedElementDescription() is "AXHelp: Milliseconds, AXValueDescription: blank, intValue:0, range:0-999"
+PASS focusedElementDescription() is "AXHelp: Seconds, AXValueDescription: blank, intValue:0, range:0-59"
+PASS focusedElementDescription() is "AXHelp: Minutes, AXValueDescription: blank, intValue:0, range:0-59"
+PASS focusedElementDescription() is "AXHelp: Hours, AXValueDescription: blank, intValue:0, range:1-12"
 
 PASS successfullyParsed is true
 
index 2066689..eb0d45a 100644 (file)
@@ -2,6 +2,7 @@
 <html>
 <head>
 <script src="../../../fast/js/resources/js-test-pre.js"></script>
+<script src="../resources/multiple-fields-ax-aria-attributes.js"></script>
 </head>
 <body>
 <input id=test type="time" value="12:34:56.789">
@@ -16,14 +17,6 @@ function enableAccessibility()
     }
 }
 
-function focusedFieldValueDescription()
-{
-    if (!window.accessibilityController)
-        return;
-    var element = accessibilityController.focusedElement
-    return element.helpText + ", " +  element.valueDescription + ", " + element.minValue + ", " + element.maxValue;
-}
-
 function keyDown(key, modifiers)
 {
     if (!window.eventSender)
@@ -38,31 +31,31 @@ testInput.focus();
 
 debug('Non-empty value');
 testInput.focus();
-shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Hours, AXValueDescription: 12, 1, 12');
+checkFocusedElementAXAttributes('AXHelp: Hours, AXValueDescription: 12, intValue:12, range:1-12');
 keyDown('\t');
-shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Minutes, AXValueDescription: 34, 0, 59');
+checkFocusedElementAXAttributes('AXHelp: Minutes, AXValueDescription: 34, intValue:34, range:0-59');
 keyDown('\t');
-shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Seconds, AXValueDescription: 56, 0, 59');
+checkFocusedElementAXAttributes('AXHelp: Seconds, AXValueDescription: 56, intValue:56, range:0-59');
 keyDown('\t');
-shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Milliseconds, AXValueDescription: 789, 0, 999');
+checkFocusedElementAXAttributes('AXHelp: Milliseconds, AXValueDescription: 789, intValue:789, range:0-999');
 keyDown('\t');
-shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: AM/PM, AXValueDescription: PM, 1, 2');
+checkFocusedElementAXAttributes('AXHelp: AM/PM, AXValueDescription: PM, intValue:2, range:1-2');
 
 debug('Empty value');
 keyDown('\b');
-shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: AM/PM, AXValueDescription: blank, 1, 2');
+checkFocusedElementAXAttributes('AXHelp: AM/PM, AXValueDescription: blank, intValue:0, range:1-2');
 keyDown('\t', ['shiftKey']);
 keyDown('\b');
-shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Milliseconds, AXValueDescription: blank, 0, 999');
+checkFocusedElementAXAttributes('AXHelp: Milliseconds, AXValueDescription: blank, intValue:0, range:0-999');
 keyDown('\t', ['shiftKey']);
 keyDown('\b');
-shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Seconds, AXValueDescription: blank, 0, 59');
+checkFocusedElementAXAttributes('AXHelp: Seconds, AXValueDescription: blank, intValue:0, range:0-59');
 keyDown('\t', ['shiftKey']);
 keyDown('\b');
-shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Minutes, AXValueDescription: blank, 0, 59');
+checkFocusedElementAXAttributes('AXHelp: Minutes, AXValueDescription: blank, intValue:0, range:0-59');
 keyDown('\t', ['shiftKey']);
 keyDown('\b');
-shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Hours, AXValueDescription: blank, 1, 12');
+checkFocusedElementAXAttributes('AXHelp: Hours, AXValueDescription: blank, intValue:0, range:1-12');
 
 debug('');
 testInput.parentNode.removeChild(testInput);
index f3674bf..7635470 100644 (file)
@@ -1,3 +1,43 @@
+2013-01-25  Kent Tamura  <tkent@chromium.org>
+
+        INPUT_MULTIPLE_FIELDS_UI: Inconsistent value of aria-valuetext attribute
+        https://bugs.webkit.org/show_bug.cgi?id=107897
+
+        Reviewed by Kentaro Hara.
+
+        aria-valuetext and aria-valuenow attributes had inconsistent values in
+        a case of initial empty state and a case that a user clears a field.
+
+        - aria-valuetext attribute should have "blank" message in the initial
+          empty state.
+        - aria-valuenow attribute should be removed in the cleared empty state.
+
+        Also, we have a bug that aira-valuenow had a symbolic value such as "AM"
+        "January". It should always have a numeric value according to the
+        specification.
+        http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuenow
+
+        No new tests. Updates fast/forms/*-multiple-fields/*-multiple-fields-ax-aria-attributes.html.
+
+        * html/shadow/DateTimeFieldElement.cpp:
+        (WebCore::DateTimeFieldElement::DateTimeFieldElement):
+        Set "blank" message to aria-valuetext attribute.
+        (WebCore::DateTimeFieldElement::updateVisibleValue):
+        aria-valuenow attribute should be a numeric value. Apply String::number
+        to the return value of valueForARIAValueNow.
+        Remove aria-valuenow attribute if nothing is selected.
+        (WebCore::DateTimeFieldElement::valueForARIAValueNow):
+        Added.
+        * html/shadow/DateTimeFieldElement.h:
+        (DateTimeFieldElement): Declare valueForARIAValueNow.
+
+        * html/shadow/DateTimeSymbolicFieldElement.cpp:
+        (WebCore::DateTimeSymbolicFieldElement::valueForARIAValueNow):
+        Added. Returns 1 + internal selection index.
+        For example, the function returns 1 for January.
+        * html/shadow/DateTimeSymbolicFieldElement.h:
+        (DateTimeSymbolicFieldElement): Declare valueForARIAValueNow.
+
 2013-01-24  Hans Wennborg  <hans@chromium.org>
 
         Disable Clang's -Wreturn-type-c-linkage for Source/WebCore/bindings/v8/
index 0fbbddf..023b1b9 100644 (file)
@@ -50,6 +50,7 @@ DateTimeFieldElement::DateTimeFieldElement(Document* document, FieldOwner& field
 {
     // On accessibility, DateTimeFieldElement acts like spin button.
     setAttribute(roleAttr, "spinbutton");
+    setAttribute(aria_valuetextAttr, AXDateTimeFieldEmptyValueText());
 }
 
 void DateTimeFieldElement::defaultEventHandler(Event* event)
@@ -206,13 +207,23 @@ void DateTimeFieldElement::updateVisibleValue(EventBehavior eventBehavior)
         return;
 
     textNode->replaceWholeText(newVisibleValue, ASSERT_NO_EXCEPTION);
-    setAttribute(aria_valuetextAttr, hasValue() ? newVisibleValue : AXDateTimeFieldEmptyValueText());
-    setAttribute(aria_valuenowAttr, newVisibleValue);
+    if (hasValue()) {
+        setAttribute(aria_valuetextAttr, newVisibleValue);
+        setAttribute(aria_valuenowAttr, String::number(valueForARIAValueNow()));
+    } else {
+        setAttribute(aria_valuetextAttr, AXDateTimeFieldEmptyValueText());
+        removeAttribute(aria_valuenowAttr);
+    }
 
     if (eventBehavior == DispatchEvent && m_fieldOwner)
         m_fieldOwner->fieldValueChanged();
 }
 
+int DateTimeFieldElement::valueForARIAValueNow() const
+{
+    return valueAsInteger();
+}
+
 } // namespace WebCore
 
 #endif
index 5b141ae..eacc6e6 100644 (file)
@@ -87,6 +87,7 @@ protected:
     AtomicString localeIdentifier() const;
     void updateVisibleValue(EventBehavior);
     virtual int valueAsInteger() const = 0;
+    virtual int valueForARIAValueNow() const;
 
 private:
     void defaultKeyboardEventHandler(KeyboardEvent*);
index a7dc43b..6781acd 100644 (file)
@@ -144,6 +144,12 @@ int DateTimeSymbolicFieldElement::valueAsInteger() const
     return m_selectedIndex;
 }
 
+int DateTimeSymbolicFieldElement::valueForARIAValueNow() const
+{
+    // Synchronize with minimum/maximum adjustment in initialize().
+    return m_selectedIndex + 1;
+}
+
 String DateTimeSymbolicFieldElement::visibleEmptyValue() const
 {
     return m_visibleEmptyValue;
index fa88c28..77ca143 100644 (file)
@@ -58,6 +58,7 @@ private:
     virtual void stepDown() OVERRIDE FINAL;
     virtual void stepUp() OVERRIDE FINAL;
     virtual String value() const OVERRIDE FINAL;
+    virtual int valueForARIAValueNow() const OVERRIDE FINAL;
     virtual String visibleValue() const OVERRIDE FINAL;
 
     // TypeAheadDataSource functions.