Bug 1283417 - part1 : implement function to notify cue's display states changed. r=bechen
authorAlastor Wu <alwu@mozilla.com>
Tue, 09 Aug 2016 16:43:07 +0800
changeset 350047 00dfeaac18145c2f07a8760d20f2de0d16273e9e
parent 350046 f38875b13ca370bf23407270ddc9ad7fe21e16fa
child 350048 b47abe0917b074d95b7e240a8deda72bf4a71b84
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbechen
bugs1283417
milestone51.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 1283417 - part1 : implement function to notify cue's display states changed. r=bechen MozReview-Commit-ID: AF2S2UOLCt1
dom/html/HTMLMediaElement.cpp
dom/html/HTMLMediaElement.h
dom/media/TextTrackCue.cpp
dom/media/TextTrackCue.h
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -6202,10 +6202,21 @@ HTMLMediaElement::OnVisibilityChange(Vis
     }
     case Visibility::IN_DISPLAYPORT: {
       mDecoder->NotifyOwnerActivityChanged(true);
       break;
     }
   }
 
 }
+
+void
+HTMLMediaElement::NotifyCueDisplayStatesChanged()
+{
+  if (!mTextTrackManager) {
+    return;
+  }
+
+  mTextTrackManager->DispatchUpdateCueDisplay();
+}
+
 } // namespace dom
 } // namespace mozilla
--- a/dom/html/HTMLMediaElement.h
+++ b/dom/html/HTMLMediaElement.h
@@ -704,16 +704,18 @@ public:
     }
   }
   void NotifyCueUpdated(TextTrackCue *aCue) {
     if (mTextTrackManager) {
       mTextTrackManager->NotifyCueUpdated(aCue);
     }
   }
 
+  void NotifyCueDisplayStatesChanged();
+
   bool GetHasUserInteraction()
   {
     return mHasUserInteraction;
   }
 
   // A method to check whether we are currently playing.
   bool IsCurrentlyPlaying() const;
 
--- a/dom/media/TextTrackCue.cpp
+++ b/dom/media/TextTrackCue.cpp
@@ -227,10 +227,26 @@ TextTrackCue::ComputedPositionAlign()
   } else if (mAlign == AlignSetting::Left) {
     return PositionAlignSetting::Line_left;
   } else if (mAlign == AlignSetting::Right) {
     return PositionAlignSetting::Line_right;
   }
   return PositionAlignSetting::Center;
 }
 
+void
+TextTrackCue::NotifyDisplayStatesChanged()
+{
+  if (!mReset) {
+    return;
+  }
+
+  if (!mTrack ||
+      !mTrack->GetTextTrackList() ||
+      !mTrack->GetTextTrackList()->GetMediaElement()) {
+    return;
+  }
+
+  mTrack->GetTextTrackList()->GetMediaElement()->NotifyCueDisplayStatesChanged();
+}
+
 } // namespace dom
 } // namespace mozilla
--- a/dom/media/TextTrackCue.h
+++ b/dom/media/TextTrackCue.h
@@ -355,16 +355,19 @@ private:
   ~TextTrackCue();
 
   void NotifyCueUpdated(TextTrackCue* aCue)
   {
     if (mTrack) {
       mTrack->NotifyCueUpdated(aCue);
     }
   }
+
+  void NotifyDisplayStatesChanged();
+
   void SetDefaultCueSettings();
   nsresult StashDocument();
 
   RefPtr<nsIDocument> mDocument;
   nsString mText;
   double mStartTime;
   double mEndTime;