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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 1976183002: Add TextTrack::isVisualKind helper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: One more Created 4 years, 7 months 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 | third_party/WebKit/Source/core/html/track/AutomaticTrackSelection.cpp » ('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) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 3252 matching lines...) Expand 10 before | Expand all | Expand 10 after
3263 3263
3264 WebLayer* HTMLMediaElement::platformLayer() const 3264 WebLayer* HTMLMediaElement::platformLayer() const
3265 { 3265 {
3266 return m_webLayer; 3266 return m_webLayer;
3267 } 3267 }
3268 3268
3269 bool HTMLMediaElement::hasClosedCaptions() const 3269 bool HTMLMediaElement::hasClosedCaptions() const
3270 { 3270 {
3271 if (m_textTracks) { 3271 if (m_textTracks) {
3272 for (unsigned i = 0; i < m_textTracks->length(); ++i) { 3272 for (unsigned i = 0; i < m_textTracks->length(); ++i) {
3273 TextTrack* track = m_textTracks->anonymousIndexedGetter(i); 3273 if (m_textTracks->anonymousIndexedGetter(i)->canBeRendered())
3274 if (track->getReadinessState() == TextTrack::FailedToLoad)
3275 continue;
3276
3277 if (track->kind() == TextTrack::captionsKeyword()
3278 || track->kind() == TextTrack::subtitlesKeyword())
3279 return true; 3274 return true;
3280 } 3275 }
3281 } 3276 }
3282 return false; 3277 return false;
3283 } 3278 }
3284 3279
3285 bool HTMLMediaElement::textTracksVisible() const 3280 bool HTMLMediaElement::textTracksVisible() const
3286 { 3281 {
3287 return m_textTracksVisible; 3282 return m_textTracksVisible;
3288 } 3283 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
3378 return; 3373 return;
3379 3374
3380 // Mark all tracks as not "configured" so that 3375 // Mark all tracks as not "configured" so that
3381 // honorUserPreferencesForAutomaticTextTrackSelection() will reconsider 3376 // honorUserPreferencesForAutomaticTextTrackSelection() will reconsider
3382 // which tracks to display in light of new user preferences (e.g. default 3377 // which tracks to display in light of new user preferences (e.g. default
3383 // tracks should not be displayed if the user has turned off captions and 3378 // tracks should not be displayed if the user has turned off captions and
3384 // non-default tracks should be displayed based on language preferences if 3379 // non-default tracks should be displayed based on language preferences if
3385 // the user has turned captions on). 3380 // the user has turned captions on).
3386 for (unsigned i = 0; i < m_textTracks->length(); ++i) { 3381 for (unsigned i = 0; i < m_textTracks->length(); ++i) {
3387 TextTrack* textTrack = m_textTracks->anonymousIndexedGetter(i); 3382 TextTrack* textTrack = m_textTracks->anonymousIndexedGetter(i);
3388 String kind = textTrack->kind(); 3383 if (textTrack->isVisualKind())
3389
3390 if (kind == TextTrack::subtitlesKeyword() || kind == TextTrack::captions Keyword())
3391 textTrack->setHasBeenConfigured(false); 3384 textTrack->setHasBeenConfigured(false);
3392 } 3385 }
3393 } 3386 }
3394 3387
3395 unsigned HTMLMediaElement::webkitAudioDecodedByteCount() const 3388 unsigned HTMLMediaElement::webkitAudioDecodedByteCount() const
3396 { 3389 {
3397 if (!webMediaPlayer()) 3390 if (!webMediaPlayer())
3398 return 0; 3391 return 0;
3399 return webMediaPlayer()->audioDecodedByteCount(); 3392 return webMediaPlayer()->audioDecodedByteCount();
3400 } 3393 }
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
3873 3866
3874 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst 3867 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst
3875 { 3868 {
3876 IntRect result; 3869 IntRect result;
3877 if (LayoutObject* object = m_element->layoutObject()) 3870 if (LayoutObject* object = m_element->layoutObject())
3878 result = object->absoluteBoundingBoxRect(); 3871 result = object->absoluteBoundingBoxRect();
3879 return result; 3872 return result;
3880 } 3873 }
3881 3874
3882 } // namespace blink 3875 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/track/AutomaticTrackSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698