Bug 920088 - TextTrackRegion's TextTrack should point at the correct TextTrack. r=rillian
authorRick Eyre <rick.eyre@hotmail.com>
Tue, 24 Sep 2013 11:59:17 -0400
changeset 149072 ca0f0d8b8cd6dec1c822b47052d62b0011dca40f
parent 149071 44558c02904e66370dc5a5e28d1b395751de3fa1
child 149073 51a41b1393057cf040ae035f3496261a9581e23e
push id25367
push userkwierso@gmail.com
push dateSat, 28 Sep 2013 02:36:01 +0000
treeherdermozilla-central@b3bb2171ff2b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian
bugs920088
milestone27.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 920088 - TextTrackRegion's TextTrack should point at the correct TextTrack. r=rillian
content/media/TextTrack.cpp
content/media/TextTrackRegion.cpp
content/media/TextTrackRegion.h
content/media/test/test_texttrackregion.html
--- a/content/media/TextTrack.cpp
+++ b/content/media/TextTrack.cpp
@@ -108,16 +108,17 @@ TextTrack::CueChanged(TextTrackCue& aCue
   //XXX: Implement Cue changed. Bug 867823.
 }
 
 void
 TextTrack::AddRegion(TextTrackRegion& aRegion)
 {
   TextTrackRegion* region = mRegionList->GetRegionById(aRegion.Id());
   if (!region) {
+    aRegion.SetTextTrack(this);
     mRegionList->AddTextTrackRegion(&aRegion);
     return;
   }
 
   region->CopyValues(aRegion);
 }
 
 void
--- a/content/media/TextTrackRegion.cpp
+++ b/content/media/TextTrackRegion.cpp
@@ -1,15 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 et tw=78: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "mozilla/dom/TextTrack.h"
 #include "mozilla/dom/TextTrackRegion.h"
 #include "mozilla/dom/VTTRegionBinding.h"
 
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_2(TextTrackRegion, mParent, mTrack)
 NS_IMPL_CYCLE_COLLECTING_ADDREF(TextTrackRegion)
--- a/content/media/TextTrackRegion.h
+++ b/content/media/TextTrackRegion.h
@@ -7,16 +7,17 @@
 #ifndef mozilla_dom_TextTrackRegion_h
 #define mozilla_dom_TextTrackRegion_h
 
 #include "nsAutoPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsString.h"
 #include "nsWrapperCache.h"
 #include "mozilla/ErrorResult.h"
+#include "mozilla/dom/TextTrack.h"
 
 namespace mozilla {
 namespace dom {
 
 class GlobalObject;
 class TextTrack;
 
 class TextTrackRegion MOZ_FINAL : public nsISupports,
@@ -139,16 +140,21 @@ public:
       return;
     }
 
     mScroll = aScroll;
   }
 
   /** end WebIDL Methods. */
 
+  void SetTextTrack(TextTrack* aTrack)
+  {
+    mTrack = aTrack;
+  }
+
   // Helper to aid copying of a given TextTrackRegion's width, lines,
   // anchor, viewport and scroll values.
   void CopyValues(TextTrackRegion& aRegion);
 
   // -----helpers-------
   const nsAString& Scroll() const
   {
     return mScroll;
--- a/content/media/test/test_texttrackregion.html
+++ b/content/media/test/test_texttrackregion.html
@@ -49,16 +49,17 @@ SpecialPowers.pushPrefEnv({"set": [["med
       is(region.id, "fred", "Region ID should be 'fred'.");
       is(region.width, 62, "Region width should be 50.");
       is(region.lines, 5, "Region lines should be 5.");
       is(region.regionAnchorX, 4, "Region regionAnchorX should be 4.");
       is(region.regionAnchorY, 78, "Region regionAnchorY should be 78.");
       is(region.viewportAnchorX, 10, "Region viewportAnchorX should be 10.");
       is(region.viewportAnchorY, 90, "Region viewportAnchorY should be 90.");
       is(region.scroll, "up", "Region scroll should be 'up'");
+      is(region.track, trackElement.track, "Tracks should be equal.");
 
       SimpleTest.finish();
     });
   }
 );
 
 </script>
 </pre>