Bug 903425 - Update TextTrackCue::Vertical to be a DirectionSetting enum. r=rillian

Following up with the changes made in http://dev.w3.org/html5/webvtt/#dfn-dom-vttcue-vertical, this patch comes to create a new enum to validate and control the possible values for TextTrackCue::Vertical. Throwing behavior was removed for spec conformance.
This commit is contained in:
Marcus Saad 2013-09-12 11:07:14 -03:00
Родитель df8998c4db
Коммит 569b911fc5
3 изменённых файлов: 12 добавлений и 11 удалений

Просмотреть файл

@ -37,6 +37,7 @@ TextTrackCue::SetDefaultCueSettings()
mSnapToLines = true;
mLine = WEBVTT_AUTO;
mAlign = TextTrackCueAlign::Middle;
mVertical = DirectionSetting::_empty;
}
TextTrackCue::TextTrackCue(nsISupports* aGlobal,

Просмотреть файл

@ -120,21 +120,16 @@ public:
CueChanged();
}
void GetVertical(nsAString& aVertical)
DirectionSetting Vertical() const
{
aVertical = mVertical;
return mVertical;
}
void SetVertical(const nsAString& aVertical, ErrorResult& aRv)
void SetVertical(const DirectionSetting& aVertical)
{
if (mVertical == aVertical)
return;
if (!aVertical.EqualsLiteral("rl") && !aVertical.EqualsLiteral("lr") && !aVertical.IsEmpty()){
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
return;
}
mReset = true;
mVertical = aVertical;
CueChanged();
@ -344,7 +339,7 @@ private:
int32_t mSize;
bool mPauseOnExit;
bool mSnapToLines;
nsString mVertical;
DirectionSetting mVertical;
int mLine;
TextTrackCueAlign mAlign;

Просмотреть файл

@ -19,6 +19,12 @@ enum TextTrackCueAlign {
"right"
};
enum DirectionSetting {
"",
"rl",
"lr"
};
[Constructor(double startTime, double endTime, DOMString text),
Pref="media.webvtt.enabled"]
interface VTTCue : EventTarget {
@ -28,8 +34,7 @@ interface VTTCue : EventTarget {
attribute double startTime;
attribute double endTime;
attribute boolean pauseOnExit;
[SetterThrows]
attribute DOMString vertical;
attribute DirectionSetting vertical;
attribute boolean snapToLines;
// XXXhumph: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20651
// attribute (long or AutoKeyword) line;