Bug 1280373 - Fix the label and language attribute in TextTrack object. r=rillian draft
authorbechen <bechen@mozilla.com>
Thu, 30 Jun 2016 13:36:31 +0800
changeset 383092 7394c1cbb3af1e95fe562cceb94e92785076fa1d
parent 382654 85e55328a3a990b805a95df6b0f2836801a3ffba
child 383100 397a8d9999167660ca59277dedfa8beabff25bfb
push id21927
push userbechen@mozilla.com
push dateFri, 01 Jul 2016 06:37:20 +0000
reviewersrillian
bugs1280373
milestone50.0a1
Bug 1280373 - Fix the label and language attribute in TextTrack object. r=rillian MozReview-Commit-ID: 2NFJ5fCCkDy
dom/html/HTMLTrackElement.h
dom/media/TextTrack.cpp
dom/media/TextTrack.h
testing/web-platform/meta/html/semantics/embedded-content/media-elements/interfaces/TextTrack/label.html.ini
testing/web-platform/meta/html/semantics/embedded-content/media-elements/interfaces/TextTrack/language.html.ini
--- a/dom/html/HTMLTrackElement.h
+++ b/dom/html/HTMLTrackElement.h
@@ -50,30 +50,30 @@ public:
   {
     SetHTMLAttr(nsGkAtoms::src, aSrc, aError);
   }
 
   void GetSrclang(DOMString& aSrclang) const
   {
     GetHTMLAttr(nsGkAtoms::srclang, aSrclang);
   }
-  void GetSrclang(nsString& aSrclang) const
+  void GetSrclang(nsAString& aSrclang) const
   {
     GetHTMLAttr(nsGkAtoms::srclang, aSrclang);
   }
   void SetSrclang(const nsAString& aSrclang, ErrorResult& aError)
   {
     SetHTMLAttr(nsGkAtoms::srclang, aSrclang, aError);
   }
 
   void GetLabel(DOMString& aLabel) const
   {
     GetHTMLAttr(nsGkAtoms::label, aLabel);
   }
-  void GetLabel(nsString& aLabel) const
+  void GetLabel(nsAString& aLabel) const
   {
     GetHTMLAttr(nsGkAtoms::label, aLabel);
   }
   void SetLabel(const nsAString& aLabel, ErrorResult& aError)
   {
     SetHTMLAttr(nsGkAtoms::label, aLabel, aError);
   }
 
--- a/dom/media/TextTrack.cpp
+++ b/dom/media/TextTrack.cpp
@@ -294,10 +294,29 @@ TextTrack::NotifyCueUpdated(TextTrackCue
     HTMLMediaElement* mediaElement = mTextTrackList->GetMediaElement();
     if (mediaElement) {
       mediaElement->NotifyCueUpdated(aCue);
     }
   }
   SetDirty();
 }
 
+void
+TextTrack::GetLabel(nsAString& aLabel) const
+{
+  if (mTrackElement) {
+    mTrackElement->GetLabel(aLabel);
+  } else {
+    aLabel = mLabel;
+  }
+}
+void
+TextTrack::GetLanguage(nsAString& aLanguage) const
+{
+  if (mTrackElement) {
+    mTrackElement->GetSrclang(aLanguage);
+  } else {
+    aLanguage = mLanguage;
+  }
+}
+
 } // namespace dom
 } // namespace mozilla
--- a/dom/media/TextTrack.h
+++ b/dom/media/TextTrack.h
@@ -60,24 +60,18 @@ public:
   void SetDefaultSettings();
 
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   TextTrackKind Kind() const
   {
     return mKind;
   }
-  void GetLabel(nsAString& aLabel) const
-  {
-    aLabel = mLabel;
-  }
-  void GetLanguage(nsAString& aLanguage) const
-  {
-    aLanguage = mLanguage;
-  }
+  void GetLabel(nsAString& aLabel) const;
+  void GetLanguage(nsAString& aLanguage) const;
   void GetInBandMetadataTrackDispatchType(nsAString& aType) const
   {
     aType = mType;
   }
   void GetId(nsAString& aId) const;
 
   TextTrackMode Mode() const
   {
deleted file mode 100644
--- a/testing/web-platform/meta/html/semantics/embedded-content/media-elements/interfaces/TextTrack/label.html.ini
+++ /dev/null
@@ -1,8 +0,0 @@
-[label.html]
-  type: testharness
-  [TextTrack.label]
-    expected: FAIL
-
-  [TextTrack.label, \\u0000]
-    expected: FAIL
-
deleted file mode 100644
--- a/testing/web-platform/meta/html/semantics/embedded-content/media-elements/interfaces/TextTrack/language.html.ini
+++ /dev/null
@@ -1,8 +0,0 @@
-[language.html]
-  type: testharness
-  [TextTrack.language]
-    expected: FAIL
-
-  [TextTrack.language, \\u0000]
-    expected: FAIL
-