Bug 1276830 - part1 : introduce LineAlignSetting. r=rillian,smaug
authorAlastor Wu <alwu@mozilla.com>
Mon, 06 Jun 2016 09:53:16 +0800
changeset 339579 0fbc23aff3623e45b3c72bb0acfc917493102632
parent 339578 f01ad499d0e090250dd354751d9ddd50f579345e
child 339580 03958a72e882feb4660900def152b60543ca2fe9
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian, smaug
bugs1276830
milestone49.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 1276830 - part1 : introduce LineAlignSetting. r=rillian,smaug MozReview-Commit-ID: 1nZhCpPpTEh
dom/media/TextTrackCue.cpp
dom/media/TextTrackCue.h
dom/webidl/VTTCue.webidl
--- a/dom/media/TextTrackCue.cpp
+++ b/dom/media/TextTrackCue.cpp
@@ -34,17 +34,17 @@ TextTrackCue::SetDefaultCueSettings()
 {
   mPosition = 50;
   mPositionAlign = PositionAlignSetting::Center;
   mSize = 100;
   mPauseOnExit = false;
   mSnapToLines = true;
   mLineIsAutoKeyword = true;
   mAlign = AlignSetting::Middle;
-  mLineAlign = AlignSetting::Start;
+  mLineAlign = LineAlignSetting::Start;
   mVertical = DirectionSetting::_empty;
   mActive = false;
 }
 
 TextTrackCue::TextTrackCue(nsPIDOMWindowInner* aOwnerWindow,
                            double aStartTime,
                            double aEndTime,
                            const nsAString& aText,
--- a/dom/media/TextTrackCue.h
+++ b/dom/media/TextTrackCue.h
@@ -167,29 +167,25 @@ public:
       return;
     }
     if (aLine.IsAutoKeyword() && !mLineIsAutoKeyword) {
       mLineIsAutoKeyword = true;
       mReset = true;
     }
   }
 
-  AlignSetting LineAlign() const
+  LineAlignSetting LineAlign() const
   {
     return mLineAlign;
   }
 
-  void SetLineAlign(AlignSetting& aLineAlign, ErrorResult& aRv)
+  void SetLineAlign(LineAlignSetting& aLineAlign, ErrorResult& aRv)
   {
-    if (mLineAlign == aLineAlign)
+    if (mLineAlign == aLineAlign) {
       return;
-
-    if (aLineAlign == AlignSetting::Left ||
-        aLineAlign == AlignSetting::Right) {
-      return aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
     }
 
     mReset = true;
     mLineAlign = aLineAlign;
   }
 
   int32_t Position() const
   {
@@ -359,17 +355,17 @@ private:
   int32_t mSize;
   bool mPauseOnExit;
   bool mSnapToLines;
   RefPtr<TextTrackRegion> mRegion;
   DirectionSetting mVertical;
   bool mLineIsAutoKeyword;
   long mLineLong;
   AlignSetting mAlign;
-  AlignSetting mLineAlign;
+  LineAlignSetting 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
   RefPtr<nsGenericHTMLElement> mDisplayState;
   // Tells whether or not we need to recompute mDisplayState. This is set
   // anytime a property that relates to the display of the TextTrackCue is
   // changed.
   bool mReset;
--- a/dom/webidl/VTTCue.webidl
+++ b/dom/webidl/VTTCue.webidl
@@ -4,16 +4,22 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  *
  * The origin of this IDL file is
  * http://dev.w3.org/html5/webvtt/#the-vttcue-interface
  */
 
 enum AutoKeyword { "auto" };
 
+enum LineAlignSetting {
+  "start",
+  "center",
+  "end"
+};
+
 enum PositionAlignSetting {
   "line-left",
   "center",
   "line-right",
   "auto"
 };
 
 enum AlignSetting {
@@ -34,17 +40,17 @@ enum DirectionSetting {
  Pref="media.webvtt.enabled"]
 interface VTTCue : TextTrackCue {
   [Pref="media.webvtt.regions.enabled"]
   attribute VTTRegion? region;
   attribute DirectionSetting vertical;
   attribute boolean snapToLines;
   attribute (long or AutoKeyword) line;
   [SetterThrows]
-  attribute AlignSetting lineAlign;
+  attribute LineAlignSetting lineAlign;
   [SetterThrows]
   attribute long position;
   [SetterThrows]
   attribute PositionAlignSetting positionAlign;
   [SetterThrows]
   attribute long size;
   attribute AlignSetting align;
   attribute DOMString text;