Bug 978163 - Part 1: Remove VTTRegionList and VTTRegion TextTrack extensions. r=rillian, r=bz
authorRick Eyre <rick.eyre@hotmail.com>
Mon, 10 Mar 2014 11:33:06 -0400
changeset 190613 f0cd5b6b1ec2d5496f22ff93df63d3294dd84aca
parent 190612 16d6b2e332e09ebba1fa623e300b28ceddd9c858
child 190614 3f3712a1272945243febeca51d30605b1b9b6691
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 1: Remove VTTRegionList and VTTRegion TextTrack extensions. r=rillian, r=bz - These two parts of the spec were recently removed as they were seen as unecessary or bad design, in the case of the VTTRegion TextTrack extensions. See the spec bug at: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24380
content/media/TextTrack.cpp
content/media/TextTrack.h
content/media/TextTrackRegion.cpp
content/media/TextTrackRegion.h
content/media/TextTrackRegionList.cpp
content/media/TextTrackRegionList.h
content/media/WebVTTListener.cpp
content/media/moz.build
dom/bindings/Bindings.conf
dom/tests/mochitest/general/test_interfaces.html
dom/webidl/TextTrack.webidl
dom/webidl/VTTRegion.webidl
dom/webidl/VTTRegionList.webidl
dom/webidl/moz.build
--- a/content/media/TextTrack.cpp
+++ b/content/media/TextTrack.cpp
@@ -5,29 +5,27 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/TextTrack.h"
 #include "mozilla/dom/TextTrackBinding.h"
 #include "mozilla/dom/TextTrackList.h"
 #include "mozilla/dom/TextTrackCue.h"
 #include "mozilla/dom/TextTrackCueList.h"
 #include "mozilla/dom/TextTrackRegion.h"
-#include "mozilla/dom/TextTrackRegionList.h"
 #include "mozilla/dom/HTMLMediaElement.h"
 #include "mozilla/dom/HTMLTrackElement.h"
 
 namespace mozilla {
 namespace dom {
 
-NS_IMPL_CYCLE_COLLECTION_INHERITED_5(TextTrack,
+NS_IMPL_CYCLE_COLLECTION_INHERITED_4(TextTrack,
                                      nsDOMEventTargetHelper,
                                      mParent,
                                      mCueList,
                                      mActiveCueList,
-                                     mRegionList,
                                      mTextTrackList)
 
 NS_IMPL_ADDREF_INHERITED(TextTrack, nsDOMEventTargetHelper)
 NS_IMPL_RELEASE_INHERITED(TextTrack, nsDOMEventTargetHelper)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TextTrack)
 NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
 
 TextTrack::TextTrack(nsISupports* aParent)
@@ -67,17 +65,16 @@ TextTrack::TextTrack(nsISupports* aParen
 
 void
 TextTrack::SetDefaultSettings()
 {
   mKind = TextTrackKind::Subtitles;
   mMode = TextTrackMode::Hidden;
   mCueList = new TextTrackCueList(mParent);
   mActiveCueList = new TextTrackCueList(mParent);
-  mRegionList = new TextTrackRegionList(mParent);
   mCuePos = 0;
   mDirty = false;
   mReadyState = HTMLTrackElement::READY_STATE_NONE;
 }
 
 JSObject*
 TextTrack::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
 {
@@ -117,40 +114,16 @@ TextTrack::RemoveCue(TextTrackCue& aCue,
 
 void
 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
-TextTrack::RemoveRegion(const TextTrackRegion& aRegion, ErrorResult& aRv)
-{
-  if (!mRegionList->GetRegionById(aRegion.Id())) {
-    aRv.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
-    return;
-  }
-
-  mRegionList->RemoveTextTrackRegion(aRegion);
-}
-
-void
 TextTrack::UpdateActiveCueList()
 {
   if (!mTextTrackList) {
     return;
   }
 
   HTMLMediaElement* mediaElement = mTextTrackList->GetMediaElement();
   if (!mediaElement) {
--- a/content/media/TextTrack.h
+++ b/content/media/TextTrack.h
@@ -15,17 +15,16 @@
 
 namespace mozilla {
 namespace dom {
 
 class TextTrackList;
 class TextTrackCue;
 class TextTrackCueList;
 class TextTrackRegion;
-class TextTrackRegionList;
 
 class TextTrack MOZ_FINAL : public nsDOMEventTargetHelper
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TextTrack, nsDOMEventTargetHelper)
 
   TextTrack(nsISupports* aParent);
@@ -82,30 +81,19 @@ public:
       return nullptr;
     }
     return mCueList;
   }
 
   TextTrackCueList* GetActiveCues();
   void GetActiveCueArray(nsTArray<nsRefPtr<TextTrackCue> >& aCues);
 
-  TextTrackRegionList* GetRegions() const
-  {
-    if (mMode != TextTrackMode::Disabled) {
-      return mRegionList;
-    }
-    return nullptr;
-  }
-
   uint16_t ReadyState() const;
   void SetReadyState(uint16_t aState);
 
-  void AddRegion(TextTrackRegion& aRegion);
-  void RemoveRegion(const TextTrackRegion& aRegion, ErrorResult& aRv);
-
   void AddCue(TextTrackCue& aCue);
   void RemoveCue(TextTrackCue& aCue, ErrorResult& aRv);
   void CueChanged(TextTrackCue& aCue);
   void SetDirty() { mDirty = true; }
 
   TextTrackList* GetTextTrackList();
   void SetTextTrackList(TextTrackList* aTextTrackList);
 
@@ -121,17 +109,16 @@ private:
   nsString mLabel;
   nsString mLanguage;
   nsString mType;
   nsString mId;
   TextTrackMode mMode;
 
   nsRefPtr<TextTrackCueList> mCueList;
   nsRefPtr<TextTrackCueList> mActiveCueList;
-  nsRefPtr<TextTrackRegionList> mRegionList;
 
   uint32_t mCuePos;
   uint16_t mReadyState;
   bool mDirty;
 };
 
 } // namespace dom
 } // namespace mozilla
--- a/content/media/TextTrackRegion.cpp
+++ b/content/media/TextTrackRegion.cpp
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #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_COLLECTION_WRAPPERCACHE_1(TextTrackRegion, mParent)
 NS_IMPL_CYCLE_COLLECTING_ADDREF(TextTrackRegion)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(TextTrackRegion)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TextTrackRegion)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
 JSObject*
@@ -41,17 +41,16 @@ TextTrackRegion::TextTrackRegion(nsISupp
   : mParent(aGlobal)
   , mWidth(100)
   , mLines(3)
   , mRegionAnchorX(0)
   , mRegionAnchorY(100)
   , mViewportAnchorX(0)
   , mViewportAnchorY(100)
 {
-  mTrack = new TextTrack(aGlobal);
   SetIsDOMBinding();
 }
 
 void
 TextTrackRegion::CopyValues(TextTrackRegion& aRegion)
 {
   mWidth = aRegion.Width();
   mLines = aRegion.Lines();
--- a/content/media/TextTrackRegion.h
+++ b/content/media/TextTrackRegion.h
@@ -38,31 +38,16 @@ public:
 
   TextTrackRegion(nsISupports* aGlobal);
 
   /** WebIDL Methods. */
 
   static already_AddRefed<TextTrackRegion>
   Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
 
-  TextTrack* GetTrack() const
-  {
-    return mTrack;
-  }
-
-  void  GetId(nsAString& aId) const
-  {
-    aId = mId;
-  }
-
-  void SetId(const nsAString& aId)
-  {
-    mId = aId;
-  }
-
   double Lines() const
   {
     return mLines;
   }
 
   void SetLines(double aLines)
   {
     mLines = aLines;
@@ -140,41 +125,29 @@ 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;
   }
 
-  const nsAString& Id() const
-  {
-    return mId;
-  }
-
-
 private:
   nsCOMPtr<nsISupports> mParent;
-  nsRefPtr<TextTrack> mTrack;
-  nsString mId;
   double mWidth;
   long mLines;
   double mRegionAnchorX;
   double mRegionAnchorY;
   double mViewportAnchorX;
   double mViewportAnchorY;
   nsString mScroll;
 
deleted file mode 100644
--- a/content/media/TextTrackRegionList.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- 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/TextTrackRegion.h"
-#include "mozilla/dom/TextTrackRegionList.h"
-#include "mozilla/dom/VTTRegionListBinding.h"
-
-namespace mozilla {
-namespace dom {
-
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_2(TextTrackRegionList,
-                                        mParent,
-                                        mTextTrackRegions)
-NS_IMPL_CYCLE_COLLECTING_ADDREF(TextTrackRegionList)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(TextTrackRegionList)
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TextTrackRegionList)
-  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
-
-JSObject*
-TextTrackRegionList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
-{
-  return VTTRegionListBinding::Wrap(aCx, aScope, this);
-}
-
-TextTrackRegionList::TextTrackRegionList(nsISupports* aGlobal)
-  : mParent(aGlobal)
-{
-  SetIsDOMBinding();
-}
-
-TextTrackRegion*
-TextTrackRegionList::IndexedGetter(uint32_t aIndex, bool& aFound)
-{
-  aFound = aIndex < mTextTrackRegions.Length();
-  return aFound ? mTextTrackRegions[aIndex] : nullptr;
-}
-
-TextTrackRegion*
-TextTrackRegionList::GetRegionById(const nsAString& aId)
-{
-  if (aId.IsEmpty()) {
-    return nullptr;
-  }
-
-  for (uint32_t i = 0; i < Length(); ++i) {
-    if (aId.Equals(mTextTrackRegions[i]->Id())) {
-      return mTextTrackRegions[i];
-    }
-  }
-
-  return nullptr;
-}
-
-void
-TextTrackRegionList::AddTextTrackRegion(TextTrackRegion* aRegion)
-{
-  mTextTrackRegions.AppendElement(aRegion);
-}
-
-void
-TextTrackRegionList::RemoveTextTrackRegion(const TextTrackRegion& aRegion)
-{
-  mTextTrackRegions.RemoveElement(&aRegion);
-}
-
-} //namespace dom
-} //namespace mozilla
deleted file mode 100644
--- a/content/media/TextTrackRegionList.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- 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/. */
-
-#ifndef mozilla_dom_TextTrackRegionList_h
-#define mozilla_dom_TextTrackRegionList_h
-
-#include "nsAutoPtr.h"
-#include "nsCycleCollectionParticipant.h"
-#include "nsTArray.h"
-#include "nsWrapperCache.h"
-
-namespace mozilla {
-namespace dom {
-
-class TextTrackRegion;
-
-class TextTrackRegionList MOZ_FINAL : public nsISupports,
-                                      public nsWrapperCache
-{
-public:
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TextTrackRegionList)
-
-  virtual JSObject* WrapObject(JSContext* aCx,
-                               JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
-
-  TextTrackRegionList(nsISupports* aGlobal);
-
-  nsISupports* GetParentObject() const
-  {
-    return mParent;
-  }
-
-  /** WebIDL Methods. */
-  uint32_t Length() const
-  {
-    return mTextTrackRegions.Length();
-  }
-
-  TextTrackRegion* IndexedGetter(uint32_t aIndex, bool& aFound);
-
-  TextTrackRegion* GetRegionById(const nsAString& aId);
-
-  /** end WebIDL Methods. */
-
-  void AddTextTrackRegion(TextTrackRegion* aRegion);
-
-  void RemoveTextTrackRegion(const TextTrackRegion& aRegion);
-
-private:
-  nsCOMPtr<nsISupports> mParent;
-  nsTArray<nsRefPtr<TextTrackRegion> > mTextTrackRegions;
-};
-
-} //namespace dom
-} //namespace mozilla
-
-#endif //mozilla_dom_TextTrackRegionList_h
--- a/content/media/WebVTTListener.cpp
+++ b/content/media/WebVTTListener.cpp
@@ -170,23 +170,14 @@ WebVTTListener::OnCue(JS::Handle<JS::Val
 
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 WebVTTListener::OnRegion(JS::Handle<JS::Value> aRegion, JSContext* aCx)
 {
-  if (!aRegion.isObject()) {
-    return NS_ERROR_FAILURE;
-  }
-
-  TextTrackRegion* region;
-  nsresult rv = UNWRAP_OBJECT(VTTRegion, &aRegion.toObject(), region);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  mElement->mTrack->AddRegion(*region);
-
+  // Nothing for this callback to do.
   return NS_OK;
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/content/media/moz.build
+++ b/content/media/moz.build
@@ -101,17 +101,16 @@ EXPORTS += [
 EXPORTS.mozilla.dom += [
     'AudioStreamTrack.h',
     'MediaStreamTrack.h',
     'TextTrack.h',
     'TextTrackCue.h',
     'TextTrackCueList.h',
     'TextTrackList.h',
     'TextTrackRegion.h',
-    'TextTrackRegionList.h',
     'VideoPlaybackQuality.h',
     'VideoStreamTrack.h',
 ]
 
 UNIFIED_SOURCES += [
     'AudioAvailableEventManager.cpp',
     'AudioChannelFormat.cpp',
     'AudioCompactor.cpp',
@@ -140,17 +139,16 @@ UNIFIED_SOURCES += [
     'RtspMediaResource.cpp',
     'SharedThreadPool.cpp',
     'StreamBuffer.cpp',
     'TextTrack.cpp',
     'TextTrackCue.cpp',
     'TextTrackCueList.cpp',
     'TextTrackList.cpp',
     'TextTrackRegion.cpp',
-    'TextTrackRegionList.cpp',
     'VideoFrameContainer.cpp',
     'VideoPlaybackQuality.cpp',
     'VideoSegment.cpp',
     'VideoStreamTrack.cpp',
     'VideoUtils.cpp',
     'WebVTTListener.cpp',
 ]
 
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -1242,20 +1242,16 @@ DOMInterfaces = {
 'VTTCue': {
     'nativeType': 'mozilla::dom::TextTrackCue'
 },
 
 'VTTRegion': {
   'nativeType': 'mozilla::dom::TextTrackRegion',
 },
 
-'VTTRegionList': {
-  'nativeType': 'mozilla::dom::TextTrackRegionList',
-},
-
 'WebGLActiveInfo': {
     'nativeType': 'mozilla::WebGLActiveInfo',
     'headerFile': 'WebGLActiveInfo.h',
     'wrapperCache': False
 },
 
 'WebGLBuffer': {
     'nativeType': 'mozilla::WebGLBuffer',
--- a/dom/tests/mochitest/general/test_interfaces.html
+++ b/dom/tests/mochitest/general/test_interfaces.html
@@ -1115,18 +1115,16 @@ var interfaceNamesInGlobalScope =
     "ValidityState",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "VideoStreamTrack",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "VTTCue",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "VTTRegion",
 // IMPORTANT: Do not change this list without review from a DOM peer!
-    "VTTRegionList",
-// IMPORTANT: Do not change this list without review from a DOM peer!
     "WaveShaperNode",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "WebGLActiveInfo",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "WebGLBuffer",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "WebGLFramebuffer",
 // IMPORTANT: Do not change this list without review from a DOM peer!
--- a/dom/webidl/TextTrack.webidl
+++ b/dom/webidl/TextTrack.webidl
@@ -29,25 +29,21 @@ interface TextTrack : EventTarget {
 
   readonly attribute DOMString id;
   readonly attribute DOMString inBandMetadataTrackDispatchType;
 
            attribute TextTrackMode mode;
 
   readonly attribute TextTrackCueList? cues;
   readonly attribute TextTrackCueList? activeCues;
-  readonly attribute VTTRegionList? regions;
 
   void addCue(VTTCue cue);
   [Throws]
   void removeCue(VTTCue cue);
 
            attribute EventHandler oncuechange;
-  [Throws]
-  void removeRegion(VTTRegion region);
-  void addRegion(VTTRegion region);
 };
 
 // Mozilla Extensions
 partial interface TextTrack {
   [ChromeOnly]
   readonly attribute TextTrackList? textTrackList;
 };
--- a/dom/webidl/VTTRegion.webidl
+++ b/dom/webidl/VTTRegion.webidl
@@ -4,19 +4,16 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  *
  * The origin of this IDL file is
  *  http://dev.w3.org/html5/webvtt/#extension-of-the-texttrack-interface-for-region-support
  */
 
 [Constructor, Pref="media.webvtt.enabled"]
 interface VTTRegion {
-  readonly attribute TextTrack? track;
-           attribute DOMString id;
-
            [SetterThrows]
            attribute double width;
 
            attribute long lines;
 
            [SetterThrows]
            attribute double regionAnchorX;
            [SetterThrows]
deleted file mode 100644
--- a/dom/webidl/VTTRegionList.webidl
+++ /dev/null
@@ -1,15 +0,0 @@
-/* -*- Mode: IDL; 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/.
- *
- * The origin of this IDL file is
- *  http://dev.w3.org/html5/webvtt/#extension-of-the-texttrack-interface-for-region-support
- */
-
-[Pref="media.webvtt.enabled"]
-interface VTTRegionList {
-  readonly attribute unsigned long length;
-  getter VTTRegion (unsigned long index);
-  VTTRegion? getRegionById(DOMString id);
-};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -425,17 +425,16 @@ WEBIDL_FILES = [
     'URLSearchParams.webidl',
     'URLUtils.webidl',
     'URLUtilsReadOnly.webidl',
     'ValidityState.webidl',
     'VideoPlaybackQuality.webidl',
     'VideoStreamTrack.webidl',
     'VTTCue.webidl',
     'VTTRegion.webidl',
-    'VTTRegionList.webidl',
     'WaveShaperNode.webidl',
     'WebComponents.webidl',
     'WebSocket.webidl',
     'WheelEvent.webidl',
     'WifiOptions.webidl',
     'Worker.webidl',
     'WorkerGlobalScope.webidl',
     'WorkerLocation.webidl',