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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 using namespace HTMLNames; | 46 using namespace HTMLNames; |
47 | 47 |
48 | 48 |
49 AccessibilityMediaControl::AccessibilityMediaControl(RenderObject* renderer) | 49 AccessibilityMediaControl::AccessibilityMediaControl(RenderObject* renderer) |
50 : AccessibilityRenderObject(renderer) | 50 : AccessibilityRenderObject(renderer) |
51 { | 51 { |
52 } | 52 } |
53 | 53 |
54 PassRefPtr<AccessibilityObject> AccessibilityMediaControl::create(RenderObject*
renderer) | 54 PassRefPtr<AccessibilityObject> AccessibilityMediaControl::create(RenderObject*
renderer) |
55 { | 55 { |
56 ASSERT(renderer->node() && renderer->node()->isMediaControlElement()); | 56 ASSERT(renderer->node()); |
57 | 57 |
58 Node* node = renderer->node(); | 58 switch (mediaControlElementType(renderer->node())) { |
59 MediaControlElementType controlType; | |
60 | |
61 if (node->hasTagName(inputTag)) | |
62 controlType = static_cast<MediaControlInputElement*>(node)->displayType(
); | |
63 else | |
64 controlType = static_cast<MediaControlElement*>(node)->displayType(); | |
65 | |
66 switch (controlType) { | |
67 case MediaSlider: | 59 case MediaSlider: |
68 return AccessibilityMediaTimeline::create(renderer); | 60 return AccessibilityMediaTimeline::create(renderer); |
69 | 61 |
70 case MediaCurrentTimeDisplay: | 62 case MediaCurrentTimeDisplay: |
71 case MediaTimeRemainingDisplay: | 63 case MediaTimeRemainingDisplay: |
72 return AccessibilityMediaTimeDisplay::create(renderer); | 64 return AccessibilityMediaTimeDisplay::create(renderer); |
73 | 65 |
74 case MediaControlsPanel: | 66 case MediaControlsPanel: |
75 return AccessibilityMediaControlsContainer::create(renderer); | 67 return AccessibilityMediaControlsContainer::create(renderer); |
76 | 68 |
77 default: | 69 default: |
78 return adoptRef(new AccessibilityMediaControl(renderer)); | 70 return adoptRef(new AccessibilityMediaControl(renderer)); |
79 } | 71 } |
80 } | 72 } |
81 | 73 |
82 MediaControlElementType AccessibilityMediaControl::controlType() const | 74 MediaControlElementType AccessibilityMediaControl::controlType() const |
83 { | 75 { |
84 if (!renderer() || !renderer()->node()) | 76 if (!renderer() || !renderer()->node()) |
85 return MediaTimelineContainer; // Timeline container is not accessible. | 77 return MediaTimelineContainer; // Timeline container is not accessible. |
86 | 78 |
87 Node* node = renderer()->node(); | 79 return mediaControlElementType(renderer()->node()); |
88 | |
89 if (node->hasTagName(inputTag)) | |
90 return static_cast<MediaControlInputElement*>(node)->displayType(); | |
91 | |
92 return static_cast<MediaControlElement*>(node)->displayType(); | |
93 } | 80 } |
94 | 81 |
95 String AccessibilityMediaControl::controlTypeName() const | 82 String AccessibilityMediaControl::controlTypeName() const |
96 { | 83 { |
97 DEFINE_STATIC_LOCAL(const String, mediaFullscreenButtonName, ("FullscreenBut
ton")); | 84 DEFINE_STATIC_LOCAL(const String, mediaFullscreenButtonName, ("FullscreenBut
ton")); |
98 DEFINE_STATIC_LOCAL(const String, mediaMuteButtonName, ("MuteButton")); | 85 DEFINE_STATIC_LOCAL(const String, mediaMuteButtonName, ("MuteButton")); |
99 DEFINE_STATIC_LOCAL(const String, mediaPlayButtonName, ("PlayButton")); | 86 DEFINE_STATIC_LOCAL(const String, mediaPlayButtonName, ("PlayButton")); |
100 DEFINE_STATIC_LOCAL(const String, mediaSeekBackButtonName, ("SeekBackButton"
)); | 87 DEFINE_STATIC_LOCAL(const String, mediaSeekBackButtonName, ("SeekBackButton"
)); |
101 DEFINE_STATIC_LOCAL(const String, mediaSeekForwardButtonName, ("SeekForwardB
utton")); | 88 DEFINE_STATIC_LOCAL(const String, mediaSeekForwardButtonName, ("SeekForwardB
utton")); |
102 DEFINE_STATIC_LOCAL(const String, mediaRewindButtonName, ("RewindButton")); | 89 DEFINE_STATIC_LOCAL(const String, mediaRewindButtonName, ("RewindButton")); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 { | 244 { |
258 } | 245 } |
259 | 246 |
260 PassRefPtr<AccessibilityObject> AccessibilityMediaTimeline::create(RenderObject*
renderer) | 247 PassRefPtr<AccessibilityObject> AccessibilityMediaTimeline::create(RenderObject*
renderer) |
261 { | 248 { |
262 return adoptRef(new AccessibilityMediaTimeline(renderer)); | 249 return adoptRef(new AccessibilityMediaTimeline(renderer)); |
263 } | 250 } |
264 | 251 |
265 String AccessibilityMediaTimeline::valueDescription() const | 252 String AccessibilityMediaTimeline::valueDescription() const |
266 { | 253 { |
267 ASSERT(m_renderer->node()->hasTagName(inputTag)); | 254 Node* node = m_renderer->node(); |
| 255 if (!node->hasTagName(inputTag)) |
| 256 return String(); |
268 | 257 |
269 float time = static_cast<HTMLInputElement*>(m_renderer->node())->value().toF
loat(); | 258 float time = static_cast<HTMLInputElement*>(node)->value().toFloat(); |
270 return localizedMediaTimeDescription(time); | 259 return localizedMediaTimeDescription(time); |
271 } | 260 } |
272 | 261 |
273 String AccessibilityMediaTimeline::helpText() const | 262 String AccessibilityMediaTimeline::helpText() const |
274 { | 263 { |
275 DEFINE_STATIC_LOCAL(const String, slider, ("Slider")); | 264 DEFINE_STATIC_LOCAL(const String, slider, ("Slider")); |
276 return localizedMediaControlElementHelpText(slider); | 265 return localizedMediaControlElementHelpText(slider); |
277 } | 266 } |
278 | 267 |
279 | 268 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 return String(); | 304 return String(); |
316 | 305 |
317 MediaControlTimeDisplayElement* element = static_cast<MediaControlTimeDispla
yElement*>(m_renderer->node()); | 306 MediaControlTimeDisplayElement* element = static_cast<MediaControlTimeDispla
yElement*>(m_renderer->node()); |
318 float time = element->currentValue(); | 307 float time = element->currentValue(); |
319 return localizedMediaTimeDescription(fabsf(time)); | 308 return localizedMediaTimeDescription(fabsf(time)); |
320 } | 309 } |
321 | 310 |
322 } // namespace WebCore | 311 } // namespace WebCore |
323 | 312 |
324 #endif // ENABLE(VIDEO) | 313 #endif // ENABLE(VIDEO) |
OLD | NEW |