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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 { | 145 { |
146 if (!m_fieldOwner) | 146 if (!m_fieldOwner) |
147 return; | 147 return; |
148 m_fieldOwner->focusOnNextField(*this); | 148 m_fieldOwner->focusOnNextField(*this); |
149 } | 149 } |
150 | 150 |
151 void DateTimeFieldElement::initialize(const AtomicString& pseudo, const String&
axHelpText, int axMinimum, int axMaximum) | 151 void DateTimeFieldElement::initialize(const AtomicString& pseudo, const String&
axHelpText, int axMinimum, int axMaximum) |
152 { | 152 { |
153 // On accessibility, DateTimeFieldElement acts like spin button. | 153 // On accessibility, DateTimeFieldElement acts like spin button. |
154 setAttribute(roleAttr, AtomicString("spinbutton", AtomicString::ConstructFro
mLiteral)); | 154 setAttribute(roleAttr, AtomicString("spinbutton", AtomicString::ConstructFro
mLiteral)); |
155 setAttribute(aria_valuetextAttr, emptyValueAXText()); | 155 setAttribute(aria_valuetextAttr, AtomicString(emptyValueAXText())); |
156 setAttribute(aria_valueminAttr, String::number(axMinimum)); | 156 setAttribute(aria_valueminAttr, AtomicString::number(axMinimum)); |
157 setAttribute(aria_valuemaxAttr, String::number(axMaximum)); | 157 setAttribute(aria_valuemaxAttr, AtomicString::number(axMaximum)); |
158 | 158 |
159 setAttribute(aria_helpAttr, axHelpText); | 159 setAttribute(aria_helpAttr, AtomicString(axHelpText)); |
160 setShadowPseudoId(pseudo); | 160 setShadowPseudoId(pseudo); |
161 appendChild(Text::create(document(), visibleValue())); | 161 appendChild(Text::create(document(), visibleValue())); |
162 } | 162 } |
163 | 163 |
164 bool DateTimeFieldElement::isDateTimeFieldElement() const | 164 bool DateTimeFieldElement::isDateTimeFieldElement() const |
165 { | 165 { |
166 return true; | 166 return true; |
167 } | 167 } |
168 | 168 |
169 bool DateTimeFieldElement::isFieldOwnerDisabled() const | 169 bool DateTimeFieldElement::isFieldOwnerDisabled() const |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 { | 213 { |
214 Text* const textNode = toText(firstChild()); | 214 Text* const textNode = toText(firstChild()); |
215 const String newVisibleValue = visibleValue(); | 215 const String newVisibleValue = visibleValue(); |
216 ASSERT(newVisibleValue.length() > 0); | 216 ASSERT(newVisibleValue.length() > 0); |
217 | 217 |
218 if (textNode->wholeText() == newVisibleValue) | 218 if (textNode->wholeText() == newVisibleValue) |
219 return; | 219 return; |
220 | 220 |
221 textNode->replaceWholeText(newVisibleValue); | 221 textNode->replaceWholeText(newVisibleValue); |
222 if (hasValue()) { | 222 if (hasValue()) { |
223 setAttribute(aria_valuetextAttr, newVisibleValue); | 223 setAttribute(aria_valuetextAttr, AtomicString(newVisibleValue)); |
224 setAttribute(aria_valuenowAttr, String::number(valueForARIAValueNow())); | 224 setAttribute(aria_valuenowAttr, AtomicString::number(valueForARIAValueNo
w())); |
225 } else { | 225 } else { |
226 setAttribute(aria_valuetextAttr, emptyValueAXText()); | 226 setAttribute(aria_valuetextAttr, AtomicString(emptyValueAXText())); |
227 removeAttribute(aria_valuenowAttr); | 227 removeAttribute(aria_valuenowAttr); |
228 } | 228 } |
229 | 229 |
230 if (eventBehavior == DispatchEvent && m_fieldOwner) | 230 if (eventBehavior == DispatchEvent && m_fieldOwner) |
231 m_fieldOwner->fieldValueChanged(); | 231 m_fieldOwner->fieldValueChanged(); |
232 } | 232 } |
233 | 233 |
234 int DateTimeFieldElement::valueForARIAValueNow() const | 234 int DateTimeFieldElement::valueForARIAValueNow() const |
235 { | 235 { |
236 return valueAsInteger(); | 236 return valueAsInteger(); |
237 } | 237 } |
238 | 238 |
239 } // namespace WebCore | 239 } // namespace WebCore |
240 | 240 |
241 #endif | 241 #endif |
OLD | NEW |