Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: Source/modules/accessibility/AXMediaControls.cpp

Issue 729343003: Handle AX help-Text for media time slider. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/modules/accessibility/AXNodeObject.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
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
OLDNEW
« no previous file with comments | « no previous file | Source/modules/accessibility/AXNodeObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698