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

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

Issue 882993002: Implement automatic text track selection for 'metadata' tracks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Test touch-up. Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | no next file » | 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 2903 matching lines...) Expand 10 before | Expand all | Expand 10 after
2914 RefPtrWillBeRawPtr<TextTrack> textTrack = currentlyEnabledTracks[i]; 2914 RefPtrWillBeRawPtr<TextTrack> textTrack = currentlyEnabledTracks[i];
2915 if (textTrack != trackToEnable) 2915 if (textTrack != trackToEnable)
2916 textTrack->setMode(TextTrack::disabledKeyword()); 2916 textTrack->setMode(TextTrack::disabledKeyword());
2917 } 2917 }
2918 } 2918 }
2919 2919
2920 if (trackToEnable) 2920 if (trackToEnable)
2921 trackToEnable->setMode(TextTrack::showingKeyword()); 2921 trackToEnable->setMode(TextTrack::showingKeyword());
2922 } 2922 }
2923 2923
2924 void HTMLMediaElement::configureMetadataTextTrackGroup(const TrackGroup& group)
2925 {
2926 ASSERT(group.tracks.size());
2927
2928 // https://html.spec.whatwg.org/multipage/embedded-content.html#honor-user-p references-for-automatic-text-track-selection
2929
2930 // 4. If there are any text tracks in the media element's list of text
2931 // tracks whose text track kind is metadata that correspond to track
2932 // elements with a default attribute set whose text track mode is set to
2933 // disabled, then set the text track mode of all such tracks to hidden
2934 for (auto& textTrack : group.tracks) {
2935 if (textTrack->mode() != TextTrack::disabledKeyword())
2936 continue;
2937 if (!textTrack->isDefault())
2938 continue;
2939 textTrack->setMode(TextTrack::hiddenKeyword());
2940 }
2941 }
2942
2924 void HTMLMediaElement::configureTextTracks() 2943 void HTMLMediaElement::configureTextTracks()
2925 { 2944 {
2926 TrackGroup captionAndSubtitleTracks(TrackGroup::CaptionsAndSubtitles); 2945 TrackGroup captionAndSubtitleTracks(TrackGroup::CaptionsAndSubtitles);
2927 TrackGroup descriptionTracks(TrackGroup::Description); 2946 TrackGroup descriptionTracks(TrackGroup::Description);
2928 TrackGroup chapterTracks(TrackGroup::Chapter); 2947 TrackGroup chapterTracks(TrackGroup::Chapter);
2929 TrackGroup metadataTracks(TrackGroup::Metadata); 2948 TrackGroup metadataTracks(TrackGroup::Metadata);
2930 TrackGroup otherTracks(TrackGroup::Other); 2949 TrackGroup otherTracks(TrackGroup::Other);
2931 2950
2932 if (!m_textTracks) 2951 if (!m_textTracks)
2933 return; 2952 return;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2969 currentGroup->tracks.append(textTrack); 2988 currentGroup->tracks.append(textTrack);
2970 } 2989 }
2971 2990
2972 if (captionAndSubtitleTracks.tracks.size()) 2991 if (captionAndSubtitleTracks.tracks.size())
2973 configureTextTrackGroup(captionAndSubtitleTracks); 2992 configureTextTrackGroup(captionAndSubtitleTracks);
2974 if (descriptionTracks.tracks.size()) 2993 if (descriptionTracks.tracks.size())
2975 configureTextTrackGroup(descriptionTracks); 2994 configureTextTrackGroup(descriptionTracks);
2976 if (chapterTracks.tracks.size()) 2995 if (chapterTracks.tracks.size())
2977 configureTextTrackGroup(chapterTracks); 2996 configureTextTrackGroup(chapterTracks);
2978 if (metadataTracks.tracks.size()) 2997 if (metadataTracks.tracks.size())
2979 configureTextTrackGroup(metadataTracks); 2998 configureMetadataTextTrackGroup(metadataTracks);
2980 if (otherTracks.tracks.size()) 2999 if (otherTracks.tracks.size())
2981 configureTextTrackGroup(otherTracks); 3000 configureTextTrackGroup(otherTracks);
2982 3001
2983 textTracksChanged(); 3002 textTracksChanged();
2984 } 3003 }
2985 3004
2986 bool HTMLMediaElement::havePotentialSourceChild() 3005 bool HTMLMediaElement::havePotentialSourceChild()
2987 { 3006 {
2988 // Stash the current <source> node and next nodes so we can restore them aft er checking 3007 // Stash the current <source> node and next nodes so we can restore them aft er checking
2989 // to see there is another potential. 3008 // to see there is another potential.
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
4094 4113
4095 #if ENABLE(WEB_AUDIO) 4114 #if ENABLE(WEB_AUDIO)
4096 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 4115 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
4097 { 4116 {
4098 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) 4117 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider())
4099 audioSourceProvider()->setClient(nullptr); 4118 audioSourceProvider()->setClient(nullptr);
4100 } 4119 }
4101 #endif 4120 #endif
4102 4121
4103 } 4122 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698