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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 void DateTimeFieldElement::initialize(const AtomicString& shadowPseudoId, const
String& axHelpText) | 138 void DateTimeFieldElement::initialize(const AtomicString& shadowPseudoId, const
String& axHelpText) |
139 { | 139 { |
140 setAttribute(aria_helpAttr, axHelpText); | 140 setAttribute(aria_helpAttr, axHelpText); |
141 setAttribute(aria_valueminAttr, String::number(minimum())); | 141 setAttribute(aria_valueminAttr, String::number(minimum())); |
142 setAttribute(aria_valuemaxAttr, String::number(maximum())); | 142 setAttribute(aria_valuemaxAttr, String::number(maximum())); |
143 setShadowPseudoId(shadowPseudoId); | 143 setShadowPseudoId(shadowPseudoId); |
144 appendChild(Text::create(document(), visibleValue())); | 144 appendChild(Text::create(document(), visibleValue())); |
145 } | 145 } |
146 | 146 |
| 147 bool DateTimeFieldElement::isDateTimeFieldElement() const |
| 148 { |
| 149 return true; |
| 150 } |
| 151 |
147 bool DateTimeFieldElement::isFocusable() const | 152 bool DateTimeFieldElement::isFocusable() const |
148 { | 153 { |
149 if (isReadOnly()) | 154 if (isReadOnly()) |
150 return false; | 155 return false; |
151 if (m_fieldOwner && m_fieldOwner->isFieldOwnerDisabledOrReadOnly()) | 156 if (m_fieldOwner && m_fieldOwner->isFieldOwnerDisabledOrReadOnly()) |
152 return false; | 157 return false; |
153 return HTMLElement::isFocusable(); | 158 return HTMLElement::isFocusable(); |
154 } | 159 } |
155 | 160 |
156 bool DateTimeFieldElement::isReadOnly() const | 161 bool DateTimeFieldElement::isReadOnly() const |
157 { | 162 { |
158 return fastHasAttribute(readonlyAttr); | 163 return fastHasAttribute(readonlyAttr); |
159 } | 164 } |
160 | 165 |
161 bool DateTimeFieldElement::isRTL() const | 166 bool DateTimeFieldElement::isRTL() const |
162 { | 167 { |
163 return renderer() && renderer()->style()->direction() == RTL; | 168 return renderer() && renderer()->style()->direction() == RTL; |
164 } | 169 } |
165 | 170 |
166 AtomicString DateTimeFieldElement::localeIdentifier() const | 171 AtomicString DateTimeFieldElement::localeIdentifier() const |
167 { | 172 { |
168 return m_fieldOwner ? m_fieldOwner->localeIdentifier() : nullAtom; | 173 return m_fieldOwner ? m_fieldOwner->localeIdentifier() : nullAtom; |
169 } | 174 } |
170 | 175 |
| 176 float DateTimeFieldElement::maximumWidth(const Font&) |
| 177 { |
| 178 const float paddingLeftAndRight = 2; // This should match to html.css. |
| 179 return paddingLeftAndRight; |
| 180 } |
| 181 |
171 void DateTimeFieldElement::setReadOnly() | 182 void DateTimeFieldElement::setReadOnly() |
172 { | 183 { |
173 // Set HTML attribute readonly to change apperance. | 184 // Set HTML attribute readonly to change apperance. |
174 setBooleanAttribute(readonlyAttr, true); | 185 setBooleanAttribute(readonlyAttr, true); |
175 setNeedsStyleRecalc(); | 186 setNeedsStyleRecalc(); |
176 } | 187 } |
177 | 188 |
178 bool DateTimeFieldElement::supportsFocus() const | 189 bool DateTimeFieldElement::supportsFocus() const |
179 { | 190 { |
180 return true; | 191 return true; |
(...skipping 12 matching lines...) Expand all Loading... |
193 setAttribute(aria_valuetextAttr, hasValue() ? newVisibleValue : AXDateTimeFi
eldEmptyValueText()); | 204 setAttribute(aria_valuetextAttr, hasValue() ? newVisibleValue : AXDateTimeFi
eldEmptyValueText()); |
194 setAttribute(aria_valuenowAttr, newVisibleValue); | 205 setAttribute(aria_valuenowAttr, newVisibleValue); |
195 | 206 |
196 if (eventBehavior == DispatchEvent && m_fieldOwner) | 207 if (eventBehavior == DispatchEvent && m_fieldOwner) |
197 m_fieldOwner->fieldValueChanged(); | 208 m_fieldOwner->fieldValueChanged(); |
198 } | 209 } |
199 | 210 |
200 } // namespace WebCore | 211 } // namespace WebCore |
201 | 212 |
202 #endif | 213 #endif |
OLD | NEW |