OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple 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 25 matching lines...) Expand all Loading... |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 using blink::WebLocalizedString; | 38 using blink::WebLocalizedString; |
39 using namespace HTMLNames; | 39 using namespace HTMLNames; |
40 | 40 |
41 static inline String queryString(WebLocalizedString::Name name) | 41 static inline String queryString(WebLocalizedString::Name name) |
42 { | 42 { |
43 return Locale::defaultLocale().queryString(name); | 43 return Locale::defaultLocale().queryString(name); |
44 } | 44 } |
45 | 45 |
46 AccessibilityMediaControl::AccessibilityMediaControl(RenderObject* renderer, AXO
bjectCacheImpl* axObjectCache) | 46 AccessibilityMediaControl::AccessibilityMediaControl(LayoutObject* renderer, AXO
bjectCacheImpl* axObjectCache) |
47 : AXRenderObject(renderer, axObjectCache) | 47 : AXRenderObject(renderer, axObjectCache) |
48 { | 48 { |
49 } | 49 } |
50 | 50 |
51 PassRefPtr<AXObject> AccessibilityMediaControl::create(RenderObject* renderer, A
XObjectCacheImpl* axObjectCache) | 51 PassRefPtr<AXObject> AccessibilityMediaControl::create(LayoutObject* renderer, A
XObjectCacheImpl* axObjectCache) |
52 { | 52 { |
53 ASSERT(renderer->node()); | 53 ASSERT(renderer->node()); |
54 | 54 |
55 switch (mediaControlElementType(renderer->node())) { | 55 switch (mediaControlElementType(renderer->node())) { |
56 case MediaSlider: | 56 case MediaSlider: |
57 return AccessibilityMediaTimeline::create(renderer, axObjectCache); | 57 return AccessibilityMediaTimeline::create(renderer, axObjectCache); |
58 | 58 |
59 case MediaCurrentTimeDisplay: | 59 case MediaCurrentTimeDisplay: |
60 case MediaTimeRemainingDisplay: | 60 case MediaTimeRemainingDisplay: |
61 return AccessibilityMediaTimeDisplay::create(renderer, axObjectCache); | 61 return AccessibilityMediaTimeDisplay::create(renderer, axObjectCache); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 } | 186 } |
187 | 187 |
188 return UnknownRole; | 188 return UnknownRole; |
189 } | 189 } |
190 | 190 |
191 | 191 |
192 | 192 |
193 // | 193 // |
194 // AXMediaControlsContainer | 194 // AXMediaControlsContainer |
195 | 195 |
196 AXMediaControlsContainer::AXMediaControlsContainer(RenderObject* renderer, AXObj
ectCacheImpl* axObjectCache) | 196 AXMediaControlsContainer::AXMediaControlsContainer(LayoutObject* renderer, AXObj
ectCacheImpl* axObjectCache) |
197 : AccessibilityMediaControl(renderer, axObjectCache) | 197 : AccessibilityMediaControl(renderer, axObjectCache) |
198 { | 198 { |
199 } | 199 } |
200 | 200 |
201 PassRefPtr<AXObject> AXMediaControlsContainer::create(RenderObject* renderer, AX
ObjectCacheImpl* axObjectCache) | 201 PassRefPtr<AXObject> AXMediaControlsContainer::create(LayoutObject* renderer, AX
ObjectCacheImpl* axObjectCache) |
202 { | 202 { |
203 return adoptRef(new AXMediaControlsContainer(renderer, axObjectCache)); | 203 return adoptRef(new AXMediaControlsContainer(renderer, axObjectCache)); |
204 } | 204 } |
205 | 205 |
206 String AXMediaControlsContainer::accessibilityDescription() const | 206 String AXMediaControlsContainer::accessibilityDescription() const |
207 { | 207 { |
208 return queryString(isControllingVideoElement() ? WebLocalizedString::AXMedia
VideoElement : WebLocalizedString::AXMediaAudioElement); | 208 return queryString(isControllingVideoElement() ? WebLocalizedString::AXMedia
VideoElement : WebLocalizedString::AXMediaAudioElement); |
209 } | 209 } |
210 | 210 |
211 String AXMediaControlsContainer::helpText() const | 211 String AXMediaControlsContainer::helpText() const |
212 { | 212 { |
213 return queryString(isControllingVideoElement() ? WebLocalizedString::AXMedia
VideoElementHelp : WebLocalizedString::AXMediaAudioElementHelp); | 213 return queryString(isControllingVideoElement() ? WebLocalizedString::AXMedia
VideoElementHelp : WebLocalizedString::AXMediaAudioElementHelp); |
214 } | 214 } |
215 | 215 |
216 bool AXMediaControlsContainer::computeAccessibilityIsIgnored() const | 216 bool AXMediaControlsContainer::computeAccessibilityIsIgnored() const |
217 { | 217 { |
218 return accessibilityIsIgnoredByDefault(); | 218 return accessibilityIsIgnoredByDefault(); |
219 } | 219 } |
220 | 220 |
221 // | 221 // |
222 // AccessibilityMediaTimeline | 222 // AccessibilityMediaTimeline |
223 | 223 |
224 static String localizedMediaTimeDescription(float /*time*/) | 224 static String localizedMediaTimeDescription(float /*time*/) |
225 { | 225 { |
226 // FIXME: To be fixed. See | 226 // FIXME: To be fixed. See |
227 // http://trac.webkit.org/browser/trunk/Source/WebCore/platform/LocalizedStr
ings.cpp#L928 | 227 // http://trac.webkit.org/browser/trunk/Source/WebCore/platform/LocalizedStr
ings.cpp#L928 |
228 return String(); | 228 return String(); |
229 } | 229 } |
230 | 230 |
231 AccessibilityMediaTimeline::AccessibilityMediaTimeline(RenderObject* renderer, A
XObjectCacheImpl* axObjectCache) | 231 AccessibilityMediaTimeline::AccessibilityMediaTimeline(LayoutObject* renderer, A
XObjectCacheImpl* axObjectCache) |
232 : AXSlider(renderer, axObjectCache) | 232 : AXSlider(renderer, axObjectCache) |
233 { | 233 { |
234 } | 234 } |
235 | 235 |
236 PassRefPtr<AXObject> AccessibilityMediaTimeline::create(RenderObject* renderer,
AXObjectCacheImpl* axObjectCache) | 236 PassRefPtr<AXObject> AccessibilityMediaTimeline::create(LayoutObject* renderer,
AXObjectCacheImpl* axObjectCache) |
237 { | 237 { |
238 return adoptRef(new AccessibilityMediaTimeline(renderer, axObjectCache)); | 238 return adoptRef(new AccessibilityMediaTimeline(renderer, axObjectCache)); |
239 } | 239 } |
240 | 240 |
241 String AccessibilityMediaTimeline::valueDescription() const | 241 String AccessibilityMediaTimeline::valueDescription() const |
242 { | 242 { |
243 Node* node = m_renderer->node(); | 243 Node* node = m_renderer->node(); |
244 if (!isHTMLInputElement(node)) | 244 if (!isHTMLInputElement(node)) |
245 return String(); | 245 return String(); |
246 | 246 |
247 return localizedMediaTimeDescription(toHTMLInputElement(node)->value().toFlo
at()); | 247 return localizedMediaTimeDescription(toHTMLInputElement(node)->value().toFlo
at()); |
248 } | 248 } |
249 | 249 |
250 String AccessibilityMediaTimeline::helpText() const | 250 String AccessibilityMediaTimeline::helpText() const |
251 { | 251 { |
252 return queryString(isControllingVideoElement() ? WebLocalizedString::AXMedia
VideoSliderHelp : WebLocalizedString::AXMediaAudioSliderHelp); | 252 return queryString(isControllingVideoElement() ? WebLocalizedString::AXMedia
VideoSliderHelp : WebLocalizedString::AXMediaAudioSliderHelp); |
253 } | 253 } |
254 | 254 |
255 | 255 |
256 // | 256 // |
257 // AccessibilityMediaTimeDisplay | 257 // AccessibilityMediaTimeDisplay |
258 | 258 |
259 AccessibilityMediaTimeDisplay::AccessibilityMediaTimeDisplay(RenderObject* rende
rer, AXObjectCacheImpl* axObjectCache) | 259 AccessibilityMediaTimeDisplay::AccessibilityMediaTimeDisplay(LayoutObject* rende
rer, AXObjectCacheImpl* axObjectCache) |
260 : AccessibilityMediaControl(renderer, axObjectCache) | 260 : AccessibilityMediaControl(renderer, axObjectCache) |
261 { | 261 { |
262 } | 262 } |
263 | 263 |
264 PassRefPtr<AXObject> AccessibilityMediaTimeDisplay::create(RenderObject* rendere
r, AXObjectCacheImpl* axObjectCache) | 264 PassRefPtr<AXObject> AccessibilityMediaTimeDisplay::create(LayoutObject* rendere
r, AXObjectCacheImpl* axObjectCache) |
265 { | 265 { |
266 return adoptRef(new AccessibilityMediaTimeDisplay(renderer, axObjectCache)); | 266 return adoptRef(new AccessibilityMediaTimeDisplay(renderer, axObjectCache)); |
267 } | 267 } |
268 | 268 |
269 bool AccessibilityMediaTimeDisplay::computeAccessibilityIsIgnored() const | 269 bool AccessibilityMediaTimeDisplay::computeAccessibilityIsIgnored() const |
270 { | 270 { |
271 if (!m_renderer || !m_renderer->style() || m_renderer->style()->visibility()
!= VISIBLE) | 271 if (!m_renderer || !m_renderer->style() || m_renderer->style()->visibility()
!= VISIBLE) |
272 return true; | 272 return true; |
273 | 273 |
274 if (!m_renderer->style()->width().value()) | 274 if (!m_renderer->style()->width().value()) |
(...skipping 13 matching lines...) Expand all Loading... |
288 { | 288 { |
289 if (!m_renderer || !m_renderer->node()) | 289 if (!m_renderer || !m_renderer->node()) |
290 return String(); | 290 return String(); |
291 | 291 |
292 MediaControlTimeDisplayElement* element = static_cast<MediaControlTimeDispla
yElement*>(m_renderer->node()); | 292 MediaControlTimeDisplayElement* element = static_cast<MediaControlTimeDispla
yElement*>(m_renderer->node()); |
293 float time = element->currentValue(); | 293 float time = element->currentValue(); |
294 return localizedMediaTimeDescription(fabsf(time)); | 294 return localizedMediaTimeDescription(fabsf(time)); |
295 } | 295 } |
296 | 296 |
297 } // namespace blink | 297 } // namespace blink |
OLD | NEW |