Bug 978163 - Part 2: VTTCue should have Region property. r=rillian, r=bz
authorRick Eyre <rick.eyre@hotmail.com>
Tue, 11 Mar 2014 13:33:58 -0400
changeset 190614 3f3712a1272945243febeca51d30605b1b9b6691
parent 190613 f0cd5b6b1ec2d5496f22ff93df63d3294dd84aca
child 190615 a35718f7ef732b8cb5a2bb74a5a384f1b47c3d31
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian, bz
bugs978163, 24380
milestone30.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 978163 - Part 2: VTTCue should have Region property. r=rillian, r=bz See spec bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24380
content/media/TextTrackCue.cpp
content/media/TextTrackCue.h
dom/webidl/VTTCue.webidl
--- a/content/media/TextTrackCue.cpp
+++ b/content/media/TextTrackCue.cpp
@@ -1,27 +1,29 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/HTMLTrackElement.h"
 #include "mozilla/dom/TextTrackCue.h"
+#include "mozilla/dom/TextTrackRegion.h"
 #include "nsComponentManagerUtils.h"
 #include "mozilla/ClearOnShutdown.h"
 
 namespace mozilla {
 namespace dom {
 
-NS_IMPL_CYCLE_COLLECTION_INHERITED_4(TextTrackCue,
+NS_IMPL_CYCLE_COLLECTION_INHERITED_5(TextTrackCue,
                                      nsDOMEventTargetHelper,
                                      mDocument,
                                      mTrack,
                                      mTrackElement,
-                                     mDisplayState)
+                                     mDisplayState,
+                                     mRegion)
 
 NS_IMPL_ADDREF_INHERITED(TextTrackCue, nsDOMEventTargetHelper)
 NS_IMPL_RELEASE_INHERITED(TextTrackCue, nsDOMEventTargetHelper)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TextTrackCue)
 NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
 
 StaticRefPtr<nsIWebVTTParserWrapper> TextTrackCue::sParserWrapper;
 
@@ -141,16 +143,33 @@ TextTrackCue::SetTrackElement(HTMLTrackE
 }
 
 JSObject*
 TextTrackCue::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
 {
   return VTTCueBinding::Wrap(aCx, aScope, this);
 }
 
+TextTrackRegion*
+TextTrackCue::GetRegion()
+{
+  return mRegion;
+}
+
+void
+TextTrackCue::SetRegion(TextTrackRegion* aRegion)
+{
+  if (mRegion == aRegion) {
+    return;
+  }
+  mRegion = aRegion;
+  mReset = true;
+  CueChanged();
+}
+
 void
 TextTrackCue::CueChanged()
 {
   if (mTrack) {
     mTrack->CueChanged(*this);
   }
 }
 } // namespace dom
--- a/content/media/TextTrackCue.h
+++ b/content/media/TextTrackCue.h
@@ -17,16 +17,17 @@
 #include "mozilla/dom/HTMLDivElement.h"
 #include "mozilla/dom/UnionTypes.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLTrackElement;
 class TextTrack;
+class TextTrackRegion;
 
 class TextTrackCue MOZ_FINAL : public nsDOMEventTargetHelper
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TextTrackCue, nsDOMEventTargetHelper)
 
   // TextTrackCue WebIDL
@@ -119,30 +120,18 @@ public:
     if (mPauseOnExit == aPauseOnExit) {
       return;
     }
 
     mPauseOnExit = aPauseOnExit;
     CueChanged();
   }
 
-  void GetRegionId(nsAString& aRegionId) const
-  {
-    aRegionId = mRegionId;
-  }
-
-  void SetRegionId(const nsAString& aRegionId)
-  {
-    if (mRegionId == aRegionId) {
-      return;
-    }
-
-    mRegionId = aRegionId;
-    CueChanged();
-  }
+  TextTrackRegion* GetRegion();
+  void SetRegion(TextTrackRegion* aRegion);
 
   DirectionSetting Vertical() const
   {
     return mVertical;
   }
 
   void SetVertical(const DirectionSetting& aVertical)
   {
@@ -366,17 +355,17 @@ private:
   nsRefPtr<TextTrack> mTrack;
   nsRefPtr<HTMLTrackElement> mTrackElement;
   nsString mId;
   int32_t mPosition;
   AlignSetting mPositionAlign;
   int32_t mSize;
   bool mPauseOnExit;
   bool mSnapToLines;
-  nsString mRegionId;
+  nsRefPtr<TextTrackRegion> mRegion;
   DirectionSetting mVertical;
   bool mLineIsAutoKeyword;
   long mLineLong;
   AlignSetting mAlign;
   AlignSetting mLineAlign;
 
   // Holds the computed DOM elements that represent the parsed cue text.
   // http://www.whatwg.org/specs/web-apps/current-work/#text-track-cue-display-state
--- a/dom/webidl/VTTCue.webidl
+++ b/dom/webidl/VTTCue.webidl
@@ -27,17 +27,17 @@ enum DirectionSetting {
  Pref="media.webvtt.enabled"]
 interface VTTCue : EventTarget {
   readonly attribute TextTrack? track;
 
   attribute DOMString id;
   attribute double startTime;
   attribute double endTime;
   attribute boolean pauseOnExit;
-  attribute DOMString regionId;
+  attribute VTTRegion? region;
   attribute DirectionSetting vertical;
   attribute boolean snapToLines;
   attribute (long or AutoKeyword) line;
   [SetterThrows]
   attribute AlignSetting lineAlign;
   [SetterThrows]
   attribute long position;
   [SetterThrows]