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 12 matching lines...) Expand all Loading... |
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 | 29 |
30 #include "config.h" | 30 #include "config.h" |
31 #include "modules/accessibility/AXMediaControls.h" | 31 #include "modules/accessibility/AXMediaControls.h" |
32 | 32 |
33 #include "core/html/HTMLMediaElement.h" | |
34 #include "platform/text/PlatformLocale.h" | 33 #include "platform/text/PlatformLocale.h" |
35 | 34 |
36 namespace blink { | 35 namespace blink { |
37 | 36 |
38 using blink::WebLocalizedString; | 37 using blink::WebLocalizedString; |
39 using namespace HTMLNames; | 38 using namespace HTMLNames; |
40 | 39 |
41 static inline String queryString(WebLocalizedString::Name name) | 40 static inline String queryString(WebLocalizedString::Name name) |
42 { | 41 { |
43 return Locale::defaultLocale().queryString(name); | 42 return Locale::defaultLocale().queryString(name); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 { | 197 { |
199 } | 198 } |
200 | 199 |
201 PassRefPtr<AXObject> AXMediaControlsContainer::create(RenderObject* renderer) | 200 PassRefPtr<AXObject> AXMediaControlsContainer::create(RenderObject* renderer) |
202 { | 201 { |
203 return adoptRef(new AXMediaControlsContainer(renderer)); | 202 return adoptRef(new AXMediaControlsContainer(renderer)); |
204 } | 203 } |
205 | 204 |
206 String AXMediaControlsContainer::accessibilityDescription() const | 205 String AXMediaControlsContainer::accessibilityDescription() const |
207 { | 206 { |
208 return queryString(controllingVideoElement() ? WebLocalizedString::AXMediaVi
deoElement : WebLocalizedString::AXMediaAudioElement); | 207 return queryString(isControllingVideoElement() ? WebLocalizedString::AXMedia
VideoElement : WebLocalizedString::AXMediaAudioElement); |
209 } | 208 } |
210 | 209 |
211 String AXMediaControlsContainer::helpText() const | 210 String AXMediaControlsContainer::helpText() const |
212 { | 211 { |
213 return queryString(controllingVideoElement() ? WebLocalizedString::AXMediaVi
deoElementHelp : WebLocalizedString::AXMediaAudioElementHelp); | 212 return queryString(isControllingVideoElement() ? WebLocalizedString::AXMedia
VideoElementHelp : WebLocalizedString::AXMediaAudioElementHelp); |
214 } | |
215 | |
216 bool AXMediaControlsContainer::controllingVideoElement() const | |
217 { | |
218 Node* node = m_renderer->node(); | |
219 if (!node) | |
220 return true; | |
221 | |
222 return isHTMLVideoElement(toParentMediaElement(node)); | |
223 } | 213 } |
224 | 214 |
225 bool AXMediaControlsContainer::computeAccessibilityIsIgnored() const | 215 bool AXMediaControlsContainer::computeAccessibilityIsIgnored() const |
226 { | 216 { |
227 return accessibilityIsIgnoredByDefault(); | 217 return accessibilityIsIgnoredByDefault(); |
228 } | 218 } |
229 | 219 |
230 // | 220 // |
231 // AccessibilityMediaTimeline | 221 // AccessibilityMediaTimeline |
232 | 222 |
(...skipping 18 matching lines...) Expand all Loading... |
251 { | 241 { |
252 Node* node = m_renderer->node(); | 242 Node* node = m_renderer->node(); |
253 if (!isHTMLInputElement(node)) | 243 if (!isHTMLInputElement(node)) |
254 return String(); | 244 return String(); |
255 | 245 |
256 return localizedMediaTimeDescription(toHTMLInputElement(node)->value().toFlo
at()); | 246 return localizedMediaTimeDescription(toHTMLInputElement(node)->value().toFlo
at()); |
257 } | 247 } |
258 | 248 |
259 String AccessibilityMediaTimeline::helpText() const | 249 String AccessibilityMediaTimeline::helpText() const |
260 { | 250 { |
261 return queryString(WebLocalizedString::AXMediaSliderHelp); | 251 return queryString(isControllingVideoElement() ? WebLocalizedString::AXMedia
VideoSliderHelp : WebLocalizedString::AXMediaAudioSliderHelp); |
262 } | 252 } |
263 | 253 |
264 | 254 |
265 // | 255 // |
266 // AccessibilityMediaTimeDisplay | 256 // AccessibilityMediaTimeDisplay |
267 | 257 |
268 AccessibilityMediaTimeDisplay::AccessibilityMediaTimeDisplay(RenderObject* rende
rer) | 258 AccessibilityMediaTimeDisplay::AccessibilityMediaTimeDisplay(RenderObject* rende
rer) |
269 : AccessibilityMediaControl(renderer) | 259 : AccessibilityMediaControl(renderer) |
270 { | 260 { |
271 } | 261 } |
(...skipping 25 matching lines...) Expand all Loading... |
297 { | 287 { |
298 if (!m_renderer || !m_renderer->node()) | 288 if (!m_renderer || !m_renderer->node()) |
299 return String(); | 289 return String(); |
300 | 290 |
301 MediaControlTimeDisplayElement* element = static_cast<MediaControlTimeDispla
yElement*>(m_renderer->node()); | 291 MediaControlTimeDisplayElement* element = static_cast<MediaControlTimeDispla
yElement*>(m_renderer->node()); |
302 float time = element->currentValue(); | 292 float time = element->currentValue(); |
303 return localizedMediaTimeDescription(fabsf(time)); | 293 return localizedMediaTimeDescription(fabsf(time)); |
304 } | 294 } |
305 | 295 |
306 } // namespace blink | 296 } // namespace blink |
OLD | NEW |