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

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

Issue 22645014: Merge WebKit r153448 (Optimizes the number of updateTextTrackDisplay calls) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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
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 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 if (!currentCues.contains(previousCues[i]) && previousCues[i].data()->is Active()) 1024 if (!currentCues.contains(previousCues[i]) && previousCues[i].data()->is Active())
1025 activeSetChanged = true; 1025 activeSetChanged = true;
1026 1026
1027 for (size_t i = 0; i < currentCuesSize; ++i) { 1027 for (size_t i = 0; i < currentCuesSize; ++i) {
1028 currentCues[i].data()->updateDisplayTree(movieTime); 1028 currentCues[i].data()->updateDisplayTree(movieTime);
1029 1029
1030 if (!currentCues[i].data()->isActive()) 1030 if (!currentCues[i].data()->isActive())
1031 activeSetChanged = true; 1031 activeSetChanged = true;
1032 } 1032 }
1033 1033
1034 if (!activeSetChanged) { 1034 if (!activeSetChanged)
1035 // Even though the active set has not changed, it is possible that the
1036 // the mode of a track has changed from 'hidden' to 'showing' and the
1037 // cues have not yet been rendered.
1038 // Note: don't call updateTextTrackDisplay() unless we have controls bec ause it will
1039 // create them.
1040 if (hasMediaControls())
acolwell GONE FROM CHROMIUM 2013/08/12 20:19:02 Why is this code dropped? Doesn't this result in a
vcarbune.chromium 2013/08/19 22:20:12 No, configureTextTrackDisplay now calls this if As
1041 updateTextTrackDisplay();
1042 return; 1035 return;
1043 }
1044 1036
1045 // 7 - If the time was reached through the usual monotonic increase of the 1037 // 7 - If the time was reached through the usual monotonic increase of the
1046 // current playback position during normal playback, and there are cues in 1038 // current playback position during normal playback, and there are cues in
1047 // other cues that have their text track cue pause-on-exi flag set and that 1039 // other cues that have their text track cue pause-on-exi flag set and that
1048 // either have their text track cue active flag set or are also in missed 1040 // either have their text track cue active flag set or are also in missed
1049 // cues, then immediately pause the media element. 1041 // cues, then immediately pause the media element.
1050 for (size_t i = 0; !m_paused && i < previousCuesSize; ++i) { 1042 for (size_t i = 0; !m_paused && i < previousCuesSize; ++i) {
1051 if (previousCues[i].data()->pauseOnExit() 1043 if (previousCues[i].data()->pauseOnExit()
1052 && previousCues[i].data()->isActive() 1044 && previousCues[i].data()->isActive()
1053 && !currentCues.contains(previousCues[i])) 1045 && !currentCues.contains(previousCues[i]))
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 1226
1235 // If this is the first added track, create the list of text tra cks. 1227 // If this is the first added track, create the list of text tra cks.
1236 if (!m_textTracks) 1228 if (!m_textTracks)
1237 m_textTracks = TextTrackList::create(this, ActiveDOMObject::sc riptExecutionContext()); 1229 m_textTracks = TextTrackList::create(this, ActiveDOMObject::sc riptExecutionContext());
1238 } 1230 }
1239 break; 1231 break;
1240 } 1232 }
1241 } else if (track->trackType() == TextTrack::AddTrack && track->mode() != Tex tTrack::disabledKeyword()) 1233 } else if (track->trackType() == TextTrack::AddTrack && track->mode() != Tex tTrack::disabledKeyword())
1242 textTrackAddCues(track, track->cues()); 1234 textTrackAddCues(track, track->cues());
1243 1235
1244 configureTextTrackDisplay(); 1236 configureTextTrackDisplay(AssumeVisibleTextTracksChanged);
1245 updateActiveTextTrackCues(currentTime());
1246 } 1237 }
1247 1238
1248 void HTMLMediaElement::textTrackKindChanged(TextTrack* track) 1239 void HTMLMediaElement::textTrackKindChanged(TextTrack* track)
1249 { 1240 {
1250 if (track->kind() != TextTrack::captionsKeyword() && track->kind() != TextTr ack::subtitlesKeyword() && track->mode() == TextTrack::showingKeyword()) 1241 if (track->kind() != TextTrack::captionsKeyword() && track->kind() != TextTr ack::subtitlesKeyword() && track->mode() == TextTrack::showingKeyword())
1251 track->setMode(TextTrack::hiddenKeyword()); 1242 track->setMode(TextTrack::hiddenKeyword());
1252 } 1243 }
1253 1244
1254 void HTMLMediaElement::beginIgnoringTrackDisplayUpdateRequests() 1245 void HTMLMediaElement::beginIgnoringTrackDisplayUpdateRequests()
1255 { 1246 {
(...skipping 2447 matching lines...) Expand 10 before | Expand all | Expand 10 after
3703 mediaControls()->hide(); 3694 mediaControls()->hide();
3704 return; 3695 return;
3705 } 3696 }
3706 3697
3707 if (!hasMediaControls() && !createMediaControls()) 3698 if (!hasMediaControls() && !createMediaControls())
3708 return; 3699 return;
3709 3700
3710 mediaControls()->show(); 3701 mediaControls()->show();
3711 } 3702 }
3712 3703
3713 void HTMLMediaElement::configureTextTrackDisplay() 3704 void HTMLMediaElement::configureTextTrackDisplay(ConfigureTextTrackDisplayFlags flags)
3714 { 3705 {
3715 ASSERT(m_textTracks); 3706 ASSERT(m_textTracks);
3716 LOG(Media, "HTMLMediaElement::configureTextTrackDisplay"); 3707 LOG(Media, "HTMLMediaElement::configureTextTrackDisplay");
3717 3708
3718 if (m_processingPreferenceChange) 3709 if (m_processingPreferenceChange)
3719 return; 3710 return;
3720 3711
3721 bool haveVisibleTextTrack = false; 3712 bool haveVisibleTextTrack = false;
3722 for (unsigned i = 0; i < m_textTracks->length(); ++i) { 3713 for (unsigned i = 0; i < m_textTracks->length(); ++i) {
3723 if (m_textTracks->item(i)->mode() == TextTrack::showingKeyword()) { 3714 if (m_textTracks->item(i)->mode() == TextTrack::showingKeyword()) {
3724 haveVisibleTextTrack = true; 3715 haveVisibleTextTrack = true;
3725 break; 3716 break;
3726 } 3717 }
3727 } 3718 }
3728 3719
3729 if (m_haveVisibleTextTrack == haveVisibleTextTrack) 3720 if (flags == DoNotAssumeVisibleTextTracksChanged
3721 && m_haveVisibleTextTrack == haveVisibleTextTrack) {
3722 updateActiveTextTrackCues(currentTime());
3730 return; 3723 return;
3724 }
3731 m_haveVisibleTextTrack = haveVisibleTextTrack; 3725 m_haveVisibleTextTrack = haveVisibleTextTrack;
3732 m_closedCaptionsVisible = m_haveVisibleTextTrack; 3726 m_closedCaptionsVisible = m_haveVisibleTextTrack;
3733 3727
3734 if (!m_haveVisibleTextTrack && !hasMediaControls()) 3728 if (!m_haveVisibleTextTrack && !hasMediaControls())
3735 return; 3729 return;
3736 if (!hasMediaControls() && !createMediaControls()) 3730 if (!hasMediaControls() && !createMediaControls())
3737 return; 3731 return;
3738 3732
3739 mediaControls()->changedClosedCaptionsVisibility(); 3733 mediaControls()->changedClosedCaptionsVisibility();
3740 3734
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
3973 { 3967 {
3974 m_restrictions = NoRestrictions; 3968 m_restrictions = NoRestrictions;
3975 } 3969 }
3976 3970
3977 void HTMLMediaElement::mediaPlayerScheduleLayerUpdate() 3971 void HTMLMediaElement::mediaPlayerScheduleLayerUpdate()
3978 { 3972 {
3979 scheduleLayerUpdate(); 3973 scheduleLayerUpdate();
3980 } 3974 }
3981 3975
3982 } 3976 }
OLDNEW
« Source/core/html/HTMLMediaElement.h ('K') | « Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698