Bug 1275808 - Move the UpdateCueDisplay() into TimeMarchesOn() as step 18. r=rillian
authorbechen <bechen@mozilla.com>
Wed, 01 Jun 2016 17:37:26 +0800
changeset 300521 e059a7af074ee37744724e0cac913640b73c1999
parent 300520 318fae85147f4e44e4202b996b6a828308238a1b
child 300522 0fdbb035fd12cf781af6a49f2aa1ac0475ab8306
push id78000
push usercbook@mozilla.com
push dateMon, 06 Jun 2016 09:18:37 +0000
treeherdermozilla-inbound@e059a7af074e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian
bugs1275808
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1275808 - Move the UpdateCueDisplay() into TimeMarchesOn() as step 18. r=rillian MozReview-Commit-ID: GrcZCjstBy9
dom/html/HTMLMediaElement.cpp
dom/html/TextTrackManager.cpp
dom/html/TextTrackManager.h
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -4821,17 +4821,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.