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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 if (!renderer() || !renderer()->node()) | 68 if (!renderer() || !renderer()->node()) |
69 return MediaTimelineContainer; // Timeline container is not accessible. | 69 return MediaTimelineContainer; // Timeline container is not accessible. |
70 | 70 |
71 return mediaControlElementType(renderer()->node()); | 71 return mediaControlElementType(renderer()->node()); |
72 } | 72 } |
73 | 73 |
74 String AccessibilityMediaControl::controlTypeName() const | 74 String AccessibilityMediaControl::controlTypeName() const |
75 { | 75 { |
76 switch (controlType()) { | 76 switch (controlType()) { |
77 case MediaEnterFullscreenButton: | 77 case MediaEnterFullscreenButton: |
78 return ASCIILiteral("EnterFullscreenButton"); | 78 return "EnterFullscreenButton"; |
79 case MediaExitFullscreenButton: | 79 case MediaExitFullscreenButton: |
80 return ASCIILiteral("ExitFullscreenButton"); | 80 return "ExitFullscreenButton"; |
81 case MediaMuteButton: | 81 case MediaMuteButton: |
82 return ASCIILiteral("MuteButton"); | 82 return "MuteButton"; |
83 case MediaPlayButton: | 83 case MediaPlayButton: |
84 return ASCIILiteral("PlayButton"); | 84 return "PlayButton"; |
85 case MediaSeekBackButton: | 85 case MediaSeekBackButton: |
86 return ASCIILiteral("SeekBackButton"); | 86 return "SeekBackButton"; |
87 case MediaSeekForwardButton: | 87 case MediaSeekForwardButton: |
88 return ASCIILiteral("SeekForwardButton"); | 88 return "SeekForwardButton"; |
89 case MediaRewindButton: | 89 case MediaRewindButton: |
90 return ASCIILiteral("RewindButton"); | 90 return "RewindButton"; |
91 case MediaReturnToRealtimeButton: | 91 case MediaReturnToRealtimeButton: |
92 return ASCIILiteral("ReturnToRealtimeButton"); | 92 return "ReturnToRealtimeButton"; |
93 case MediaUnMuteButton: | 93 case MediaUnMuteButton: |
94 return ASCIILiteral("UnMuteButton"); | 94 return "UnMuteButton"; |
95 case MediaPauseButton: | 95 case MediaPauseButton: |
96 return ASCIILiteral("PauseButton"); | 96 return "PauseButton"; |
97 case MediaStatusDisplay: | 97 case MediaStatusDisplay: |
98 return ASCIILiteral("StatusDisplay"); | 98 return "StatusDisplay"; |
99 case MediaCurrentTimeDisplay: | 99 case MediaCurrentTimeDisplay: |
100 return ASCIILiteral("CurrentTimeDisplay"); | 100 return "CurrentTimeDisplay"; |
101 case MediaTimeRemainingDisplay: | 101 case MediaTimeRemainingDisplay: |
102 return ASCIILiteral("TimeRemainingDisplay"); | 102 return "TimeRemainingDisplay"; |
103 case MediaShowClosedCaptionsButton: | 103 case MediaShowClosedCaptionsButton: |
104 return ASCIILiteral("ShowClosedCaptionsButton"); | 104 return "ShowClosedCaptionsButton"; |
105 case MediaHideClosedCaptionsButton: | 105 case MediaHideClosedCaptionsButton: |
106 return ASCIILiteral("HideClosedCaptionsButton"); | 106 return "HideClosedCaptionsButton"; |
107 | 107 |
108 default: | 108 default: |
109 break; | 109 break; |
110 } | 110 } |
111 | 111 |
112 return String(); | 112 return String(); |
113 } | 113 } |
114 | 114 |
115 void AccessibilityMediaControl::accessibilityText(Vector<AccessibilityText>& tex
tOrder) | 115 void AccessibilityMediaControl::accessibilityText(Vector<AccessibilityText>& tex
tOrder) |
116 { | 116 { |
117 String description = accessibilityDescription(); | 117 String description = accessibilityDescription(); |
118 if (!description.isEmpty()) | 118 if (!description.isEmpty()) |
119 textOrder.append(AccessibilityText(description, AlternativeText)); | 119 textOrder.append(AccessibilityText(description, AlternativeText)); |
120 | 120 |
121 String title = this->title(); | 121 String title = this->title(); |
122 if (!title.isEmpty()) | 122 if (!title.isEmpty()) |
123 textOrder.append(AccessibilityText(title, AlternativeText)); | 123 textOrder.append(AccessibilityText(title, AlternativeText)); |
124 | 124 |
125 String helptext = helpText(); | 125 String helptext = helpText(); |
126 if (!helptext.isEmpty()) | 126 if (!helptext.isEmpty()) |
127 textOrder.append(AccessibilityText(helptext, HelpText)); | 127 textOrder.append(AccessibilityText(helptext, HelpText)); |
128 } | 128 } |
129 | 129 |
130 | 130 |
131 String AccessibilityMediaControl::title() const | 131 String AccessibilityMediaControl::title() const |
132 { | 132 { |
133 if (controlType() == MediaControlsPanel) | 133 if (controlType() == MediaControlsPanel) |
134 return localizedMediaControlElementString(ASCIILiteral("ControlsPanel"))
; | 134 return localizedMediaControlElementString("ControlsPanel"); |
135 | 135 |
136 return AccessibilityRenderObject::title(); | 136 return AccessibilityRenderObject::title(); |
137 } | 137 } |
138 | 138 |
139 String AccessibilityMediaControl::accessibilityDescription() const | 139 String AccessibilityMediaControl::accessibilityDescription() const |
140 { | 140 { |
141 return localizedMediaControlElementString(controlTypeName()); | 141 return localizedMediaControlElementString(controlTypeName()); |
142 } | 142 } |
143 | 143 |
144 String AccessibilityMediaControl::helpText() const | 144 String AccessibilityMediaControl::helpText() const |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 return true; | 215 return true; |
216 | 216 |
217 MediaControlTimeDisplayElement* element = static_cast<MediaControlTimeDispla
yElement*>(m_renderer->node()); | 217 MediaControlTimeDisplayElement* element = static_cast<MediaControlTimeDispla
yElement*>(m_renderer->node()); |
218 | 218 |
219 return toParentMediaElement(element)->isVideo(); | 219 return toParentMediaElement(element)->isVideo(); |
220 } | 220 } |
221 | 221 |
222 const String AccessibilityMediaControlsContainer::elementTypeName() const | 222 const String AccessibilityMediaControlsContainer::elementTypeName() const |
223 { | 223 { |
224 if (controllingVideoElement()) | 224 if (controllingVideoElement()) |
225 return ASCIILiteral("VideoElement"); | 225 return "VideoElement"; |
226 return ASCIILiteral("AudioElement"); | 226 return "AudioElement"; |
227 } | 227 } |
228 | 228 |
229 bool AccessibilityMediaControlsContainer::computeAccessibilityIsIgnored() const | 229 bool AccessibilityMediaControlsContainer::computeAccessibilityIsIgnored() const |
230 { | 230 { |
231 return accessibilityIsIgnoredByDefault(); | 231 return accessibilityIsIgnoredByDefault(); |
232 } | 232 } |
233 | 233 |
234 // | 234 // |
235 // AccessibilityMediaTimeline | 235 // AccessibilityMediaTimeline |
236 | 236 |
(...skipping 11 matching lines...) Expand all Loading... |
248 { | 248 { |
249 Node* node = m_renderer->node(); | 249 Node* node = m_renderer->node(); |
250 if (!node->hasTagName(inputTag)) | 250 if (!node->hasTagName(inputTag)) |
251 return String(); | 251 return String(); |
252 | 252 |
253 return localizedMediaTimeDescription(toHTMLInputElement(node)->value().toFlo
at()); | 253 return localizedMediaTimeDescription(toHTMLInputElement(node)->value().toFlo
at()); |
254 } | 254 } |
255 | 255 |
256 String AccessibilityMediaTimeline::helpText() const | 256 String AccessibilityMediaTimeline::helpText() const |
257 { | 257 { |
258 return localizedMediaControlElementHelpText(ASCIILiteral("Slider")); | 258 return localizedMediaControlElementHelpText("Slider"); |
259 } | 259 } |
260 | 260 |
261 | 261 |
262 // | 262 // |
263 // AccessibilityMediaTimeDisplay | 263 // AccessibilityMediaTimeDisplay |
264 | 264 |
265 AccessibilityMediaTimeDisplay::AccessibilityMediaTimeDisplay(RenderObject* rende
rer) | 265 AccessibilityMediaTimeDisplay::AccessibilityMediaTimeDisplay(RenderObject* rende
rer) |
266 : AccessibilityMediaControl(renderer) | 266 : AccessibilityMediaControl(renderer) |
267 { | 267 { |
268 } | 268 } |
(...skipping 10 matching lines...) Expand all Loading... |
279 | 279 |
280 if (!m_renderer->style()->width().value()) | 280 if (!m_renderer->style()->width().value()) |
281 return true; | 281 return true; |
282 | 282 |
283 return accessibilityIsIgnoredByDefault(); | 283 return accessibilityIsIgnoredByDefault(); |
284 } | 284 } |
285 | 285 |
286 String AccessibilityMediaTimeDisplay::accessibilityDescription() const | 286 String AccessibilityMediaTimeDisplay::accessibilityDescription() const |
287 { | 287 { |
288 if (controlType() == MediaCurrentTimeDisplay) | 288 if (controlType() == MediaCurrentTimeDisplay) |
289 return localizedMediaControlElementString(ASCIILiteral("CurrentTimeDispl
ay")); | 289 return localizedMediaControlElementString("CurrentTimeDisplay"); |
290 | 290 |
291 return localizedMediaControlElementString(ASCIILiteral("TimeRemainingDisplay
")); | 291 return localizedMediaControlElementString("TimeRemainingDisplay"); |
292 } | 292 } |
293 | 293 |
294 String AccessibilityMediaTimeDisplay::stringValue() const | 294 String AccessibilityMediaTimeDisplay::stringValue() const |
295 { | 295 { |
296 if (!m_renderer || !m_renderer->node()) | 296 if (!m_renderer || !m_renderer->node()) |
297 return String(); | 297 return String(); |
298 | 298 |
299 MediaControlTimeDisplayElement* element = static_cast<MediaControlTimeDispla
yElement*>(m_renderer->node()); | 299 MediaControlTimeDisplayElement* element = static_cast<MediaControlTimeDispla
yElement*>(m_renderer->node()); |
300 float time = element->currentValue(); | 300 float time = element->currentValue(); |
301 return localizedMediaTimeDescription(fabsf(time)); | 301 return localizedMediaTimeDescription(fabsf(time)); |
302 } | 302 } |
303 | 303 |
304 } // namespace WebCore | 304 } // namespace WebCore |
OLD | NEW |