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

Unified 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: Updated tests Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index c6953735ad4189f84bf5c9f29b6a9472e32ad1d2..82117cbbab32ec38290af214e5250af6fdd946ab 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -1041,16 +1041,8 @@ void HTMLMediaElement::updateActiveTextTrackCues(double movieTime)
activeSetChanged = true;
}
- if (!activeSetChanged) {
- // Even though the active set has not changed, it is possible that the
- // the mode of a track has changed from 'hidden' to 'showing' and the
- // cues have not yet been rendered.
- // Note: don't call updateTextTrackDisplay() unless we have controls because it will
- // create them.
- if (hasMediaControls())
- updateTextTrackDisplay();
+ if (!activeSetChanged)
return;
- }
// 7 - If the time was reached through the usual monotonic increase of the
// current playback position during normal playback, and there are cues in
@@ -1251,8 +1243,7 @@ void HTMLMediaElement::textTrackModeChanged(TextTrack* track)
} else if (track->trackType() == TextTrack::AddTrack && track->mode() != TextTrack::disabledKeyword())
textTrackAddCues(track, track->cues());
- configureTextTrackDisplay();
- updateActiveTextTrackCues(currentTime());
+ configureTextTrackDisplay(AssumeVisibleChange);
}
void HTMLMediaElement::textTrackKindChanged(TextTrack* track)
@@ -3477,7 +3468,7 @@ void HTMLMediaElement::clearMediaPlayer(int flags)
m_loadState = WaitingForSource;
if (m_textTracks)
- configureTextTrackDisplay();
+ configureTextTrackDisplay(AssumeNoVisibleChange);
}
bool HTMLMediaElement::canSuspend() const
@@ -3738,7 +3729,7 @@ void HTMLMediaElement::configureMediaControls()
mediaControls()->show();
}
-void HTMLMediaElement::configureTextTrackDisplay()
+void HTMLMediaElement::configureTextTrackDisplay(VisibilityChangeAssumption assumption)
{
ASSERT(m_textTracks);
LOG(Media, "HTMLMediaElement::configureTextTrackDisplay");
@@ -3754,8 +3745,11 @@ void HTMLMediaElement::configureTextTrackDisplay()
}
}
- if (m_haveVisibleTextTrack == haveVisibleTextTrack)
+ if (assumption == AssumeNoVisibleChange
+ && m_haveVisibleTextTrack == haveVisibleTextTrack) {
+ updateActiveTextTrackCues(currentTime());
return;
+ }
m_haveVisibleTextTrack = haveVisibleTextTrack;
m_closedCaptionsVisible = m_haveVisibleTextTrack;
@@ -3766,8 +3760,10 @@ void HTMLMediaElement::configureTextTrackDisplay()
mediaControls()->changedClosedCaptionsVisibility();
- if (RuntimeEnabledFeatures::videoTrackEnabled())
+ if (RuntimeEnabledFeatures::videoTrackEnabled()) {
+ updateActiveTextTrackCues(currentTime());
updateTextTrackDisplay();
+ }
}
void HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured()
« 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