OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "core/InputTypeNames.h" | 32 #include "core/InputTypeNames.h" |
33 #include "core/dom/NodeTraversal.h" | 33 #include "core/dom/NodeTraversal.h" |
34 #include "core/dom/Text.h" | 34 #include "core/dom/Text.h" |
35 #include "core/html/HTMLDListElement.h" | 35 #include "core/html/HTMLDListElement.h" |
36 #include "core/html/HTMLFieldSetElement.h" | 36 #include "core/html/HTMLFieldSetElement.h" |
37 #include "core/html/HTMLFrameElementBase.h" | 37 #include "core/html/HTMLFrameElementBase.h" |
38 #include "core/html/HTMLInputElement.h" | 38 #include "core/html/HTMLInputElement.h" |
39 #include "core/html/HTMLLabelElement.h" | 39 #include "core/html/HTMLLabelElement.h" |
40 #include "core/html/HTMLLegendElement.h" | 40 #include "core/html/HTMLLegendElement.h" |
41 #include "core/html/HTMLMediaElement.h" | 41 #include "core/html/HTMLMediaElement.h" |
| 42 #include "core/html/HTMLMeterElement.h" |
42 #include "core/html/HTMLPlugInElement.h" | 43 #include "core/html/HTMLPlugInElement.h" |
43 #include "core/html/HTMLSelectElement.h" | 44 #include "core/html/HTMLSelectElement.h" |
44 #include "core/html/HTMLTextAreaElement.h" | 45 #include "core/html/HTMLTextAreaElement.h" |
45 #include "core/html/shadow/MediaControlElements.h" | 46 #include "core/html/shadow/MediaControlElements.h" |
46 #include "core/rendering/RenderObject.h" | 47 #include "core/rendering/RenderObject.h" |
47 #include "modules/accessibility/AXObjectCacheImpl.h" | 48 #include "modules/accessibility/AXObjectCacheImpl.h" |
48 #include "platform/UserGestureIndicator.h" | 49 #include "platform/UserGestureIndicator.h" |
49 #include "wtf/text/StringBuilder.h" | 50 #include "wtf/text/StringBuilder.h" |
50 | 51 |
51 | 52 |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 bool AXNodeObject::isMenu() const | 590 bool AXNodeObject::isMenu() const |
590 { | 591 { |
591 return roleValue() == MenuRole; | 592 return roleValue() == MenuRole; |
592 } | 593 } |
593 | 594 |
594 bool AXNodeObject::isMenuButton() const | 595 bool AXNodeObject::isMenuButton() const |
595 { | 596 { |
596 return roleValue() == MenuButtonRole; | 597 return roleValue() == MenuButtonRole; |
597 } | 598 } |
598 | 599 |
| 600 bool AXNodeObject::isMeter() const |
| 601 { |
| 602 return roleValue() == MeterRole; |
| 603 } |
| 604 |
599 bool AXNodeObject::isMultiSelectable() const | 605 bool AXNodeObject::isMultiSelectable() const |
600 { | 606 { |
601 const AtomicString& ariaMultiSelectable = getAttribute(aria_multiselectableA
ttr); | 607 const AtomicString& ariaMultiSelectable = getAttribute(aria_multiselectableA
ttr); |
602 if (equalIgnoringCase(ariaMultiSelectable, "true")) | 608 if (equalIgnoringCase(ariaMultiSelectable, "true")) |
603 return true; | 609 return true; |
604 if (equalIgnoringCase(ariaMultiSelectable, "false")) | 610 if (equalIgnoringCase(ariaMultiSelectable, "false")) |
605 return false; | 611 return false; |
606 | 612 |
607 return isHTMLSelectElement(node()) && toHTMLSelectElement(*node()).multiple(
); | 613 return isHTMLSelectElement(node()) && toHTMLSelectElement(*node()).multiple(
); |
608 } | 614 } |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 { | 1109 { |
1104 if (hasAttribute(aria_valuenowAttr)) | 1110 if (hasAttribute(aria_valuenowAttr)) |
1105 return getAttribute(aria_valuenowAttr).toFloat(); | 1111 return getAttribute(aria_valuenowAttr).toFloat(); |
1106 | 1112 |
1107 if (isHTMLInputElement(node())) { | 1113 if (isHTMLInputElement(node())) { |
1108 HTMLInputElement& input = toHTMLInputElement(*node()); | 1114 HTMLInputElement& input = toHTMLInputElement(*node()); |
1109 if (input.type() == InputTypeNames::range) | 1115 if (input.type() == InputTypeNames::range) |
1110 return input.valueAsNumber(); | 1116 return input.valueAsNumber(); |
1111 } | 1117 } |
1112 | 1118 |
| 1119 if (isHTMLMeterElement(node())) |
| 1120 return toHTMLMeterElement(*node()).value(); |
| 1121 |
1113 return 0.0; | 1122 return 0.0; |
1114 } | 1123 } |
1115 | 1124 |
1116 float AXNodeObject::maxValueForRange() const | 1125 float AXNodeObject::maxValueForRange() const |
1117 { | 1126 { |
1118 if (hasAttribute(aria_valuemaxAttr)) | 1127 if (hasAttribute(aria_valuemaxAttr)) |
1119 return getAttribute(aria_valuemaxAttr).toFloat(); | 1128 return getAttribute(aria_valuemaxAttr).toFloat(); |
1120 | 1129 |
1121 if (isHTMLInputElement(node())) { | 1130 if (isHTMLInputElement(node())) { |
1122 HTMLInputElement& input = toHTMLInputElement(*node()); | 1131 HTMLInputElement& input = toHTMLInputElement(*node()); |
1123 if (input.type() == InputTypeNames::range) | 1132 if (input.type() == InputTypeNames::range) |
1124 return input.maximum(); | 1133 return input.maximum(); |
1125 } | 1134 } |
1126 | 1135 |
| 1136 if (isHTMLMeterElement(node())) |
| 1137 return toHTMLMeterElement(*node()).max(); |
| 1138 |
1127 return 0.0; | 1139 return 0.0; |
1128 } | 1140 } |
1129 | 1141 |
1130 float AXNodeObject::minValueForRange() const | 1142 float AXNodeObject::minValueForRange() const |
1131 { | 1143 { |
1132 if (hasAttribute(aria_valueminAttr)) | 1144 if (hasAttribute(aria_valueminAttr)) |
1133 return getAttribute(aria_valueminAttr).toFloat(); | 1145 return getAttribute(aria_valueminAttr).toFloat(); |
1134 | 1146 |
1135 if (isHTMLInputElement(node())) { | 1147 if (isHTMLInputElement(node())) { |
1136 HTMLInputElement& input = toHTMLInputElement(*node()); | 1148 HTMLInputElement& input = toHTMLInputElement(*node()); |
1137 if (input.type() == InputTypeNames::range) | 1149 if (input.type() == InputTypeNames::range) |
1138 return input.minimum(); | 1150 return input.minimum(); |
1139 } | 1151 } |
1140 | 1152 |
| 1153 if (isHTMLMeterElement(node())) |
| 1154 return toHTMLMeterElement(*node()).min(); |
| 1155 |
1141 return 0.0; | 1156 return 0.0; |
1142 } | 1157 } |
1143 | 1158 |
1144 float AXNodeObject::stepValueForRange() const | 1159 float AXNodeObject::stepValueForRange() const |
1145 { | 1160 { |
1146 return getAttribute(stepAttr).toFloat(); | 1161 return getAttribute(stepAttr).toFloat(); |
1147 } | 1162 } |
1148 | 1163 |
1149 String AXNodeObject::stringValue() const | 1164 String AXNodeObject::stringValue() const |
1150 { | 1165 { |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1944 float range = maxValueForRange() - minValueForRange(); | 1959 float range = maxValueForRange() - minValueForRange(); |
1945 float value = valueForRange(); | 1960 float value = valueForRange(); |
1946 | 1961 |
1947 value += range * (percentChange / 100); | 1962 value += range * (percentChange / 100); |
1948 setValue(String::number(value)); | 1963 setValue(String::number(value)); |
1949 | 1964 |
1950 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged,
true); | 1965 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged,
true); |
1951 } | 1966 } |
1952 | 1967 |
1953 } // namespace blink | 1968 } // namespace blink |
OLD | NEW |