Bug 1275808 - Move the UpdateCueDisplay() into TimeMarchesOn() as step 18. r=rillian
MozReview-Commit-ID: GrcZCjstBy9
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -4824,17 +4824,17 @@ void HTMLMediaElement::FireTimeUpdate(bo
mDecoder->SetFragmentEndTime(mFragmentEnd);
}
// Update the cues displaying on the video.
// Here mTextTrackManager can be null if the cycle collector has unlinked
// us before our parent. In that case UnbindFromTree will call us
// when our parent is unlinked.
if (mTextTrackManager) {
- mTextTrackManager->UpdateCueDisplay();
+ mTextTrackManager->TimeMarchesOn();
}
}
void HTMLMediaElement::GetCurrentSpec(nsCString& aString)
{
if (mLoadingSrc) {
mLoadingSrc->GetSpec(aString);
} else {
--- a/dom/html/TextTrackManager.cpp
+++ b/dom/html/TextTrackManager.cpp
@@ -247,20 +247,16 @@ TextTrackManager::UpdateCueDisplay()
nsPIDOMWindowInner* window = mMediaElement->OwnerDoc()->GetInnerWindow();
if (window) {
sParserWrapper->ProcessCues(window, jsCues, overlay);
}
} else if (overlay->Length() > 0) {
nsContentUtils::SetNodeTextContent(overlay, EmptyString(), true);
}
- // Call TimeMarchesOn() directly instead DispatchTimeMarchesOn()
- // because we had render the new cue, so we must run
- // TimeMarchesOn immediately.
- TimeMarchesOn();
}
void
TextTrackManager::AddCue(TextTrackCue& aCue)
{
if (mNewCues) {
mNewCues->AddCue(aCue);
}
@@ -534,17 +530,17 @@ TextTrackManager::TimeMarchesOn()
nsISupports* parentObject =
mMediaElement->OwnerDoc()->GetParentObject();
if (NS_WARN_IF(!parentObject)) {
return;
}
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(parentObject);
if (mMediaElement &&
- (!(mMediaElement->GetPlayedOrSeeked())|| mMediaElement->Seeking())) {
+ (!(mMediaElement->GetPlayedOrSeeked()) || mMediaElement->Seeking())) {
return;
}
// Step 3.
double currentPlaybackTime = mMediaElement->CurrentTime();
bool hasNormalPlayback = !mHasSeeked;
mHasSeeked = false;
@@ -706,12 +702,15 @@ TextTrackManager::TimeMarchesOn()
if (trackElement) {
trackElement->DispatchTrackRunnable(NS_LITERAL_STRING("cuechange"));
}
}
}
mLastTimeMarchesOnCalled = currentPlaybackTime;
mLastActiveCues = currentCues;
+
+ // Step 18.
+ UpdateCueDisplay();
}
} // namespace dom
} // namespace mozilla
--- a/dom/html/TextTrackManager.h
+++ b/dom/html/TextTrackManager.h
@@ -78,38 +78,38 @@ public:
* This takes the form of <foo.class.subclass>. These classes are then parsed
* and set as the anonymous content's class attribute.
*
* Rules on constructing DOM objects from WebVTT nodes can be found here
* http://dev.w3.org/html5/webvtt/#webvtt-cue-text-dom-construction-rules.
* Current rules are taken from revision on April 15, 2013.
*/
- /**
- * Converts the TextTrackCue's cuetext into a tree of DOM objects and attaches
- * it to a div on it's owning TrackElement's MediaElement's caption overlay.
- */
- void UpdateCueDisplay();
-
void PopulatePendingList();
void AddListeners();
// The HTMLMediaElement that this TextTrackManager manages the TextTracks of.
RefPtr<HTMLMediaElement> mMediaElement;
void DispatchTimeMarchesOn();
+ void TimeMarchesOn();
void NotifyShutdown()
{
mShutdown = true;
}
private:
- void TimeMarchesOn();
+ /**
+ * Converts the TextTrackCue's cuetext into a tree of DOM objects
+ * and attaches it to a div on its owning TrackElement's
+ * MediaElement's caption overlay.
+ */
+ void UpdateCueDisplay();
// List of the TextTrackManager's owning HTMLMediaElement's TextTracks.
RefPtr<TextTrackList> mTextTracks;
// List of text track objects awaiting loading.
RefPtr<TextTrackList> mPendingTextTracks;
// List of newly introduced Text Track cues.
// Contain all cues for a MediaElement.