Bug 983293 - Part 2: Move the READY_STATE enum to Track instead of HTMLTrackElement. r=cpearce

This makes more sense as the READY_STATE values in the spec are always
referred to be 'text track readiness states' not HTMLTrackElement
readiness states.
This commit is contained in:
Rick Eyre 2014-03-13 13:48:09 -04:00
parent 5a88f34b43
commit 560441d9f1
6 changed files with 16 additions and 16 deletions

View File

@ -317,7 +317,7 @@ uint16_t
HTMLTrackElement::ReadyState() const HTMLTrackElement::ReadyState() const
{ {
if (!mTrack) { if (!mTrack) {
return READY_STATE_NONE; return TextTrack::READY_STATE_NONE;
} }
return mTrack->ReadyState(); return mTrack->ReadyState();

View File

@ -85,13 +85,6 @@ public:
SetHTMLBoolAttr(nsGkAtoms::_default, aDefault, aError); SetHTMLBoolAttr(nsGkAtoms::_default, aDefault, aError);
} }
// Constants for numeric readyState property values.
enum {
READY_STATE_NONE = 0U,
READY_STATE_LOADING = 1U,
READY_STATE_LOADED = 2U,
READY_STATE_ERROR = 3U
};
uint16_t ReadyState() const; uint16_t ReadyState() const;
TextTrack* Track(); TextTrack* Track();

View File

@ -121,7 +121,7 @@ TextTrackManager::AddTextTrack(TextTrackKind aKind, const nsAString& aLabel,
nsRefPtr<TextTrack> ttrack = nsRefPtr<TextTrack> ttrack =
mTextTracks->AddTextTrack(aKind, aLabel, aLanguage, aMode, aTextTrackSource, mTextTracks->AddTextTrack(aKind, aLabel, aLanguage, aMode, aTextTrackSource,
CompareTextTracks(mMediaElement)); CompareTextTracks(mMediaElement));
ttrack->SetReadyState(HTMLTrackElement::READY_STATE_LOADED); ttrack->SetReadyState(TextTrack::READY_STATE_LOADED);
AddCues(ttrack); AddCues(ttrack);
return ttrack.forget(); return ttrack.forget();
} }
@ -218,7 +218,7 @@ TextTrackManager::PopulatePendingList()
for (uint32_t index = 0; index < len; ++index) { for (uint32_t index = 0; index < len; ++index) {
TextTrack* ttrack = mTextTracks->IndexedGetter(index, dummy); TextTrack* ttrack = mTextTracks->IndexedGetter(index, dummy);
if (ttrack && ttrack->Mode() != TextTrackMode::Disabled && if (ttrack && ttrack->Mode() != TextTrackMode::Disabled &&
ttrack->ReadyState() == HTMLTrackElement::READY_STATE_LOADING) { ttrack->ReadyState() == TextTrack::READY_STATE_LOADING) {
mPendingTextTracks->AddTextTrack(ttrack, mPendingTextTracks->AddTextTrack(ttrack,
CompareTextTracks(mMediaElement)); CompareTextTracks(mMediaElement));
} }

View File

@ -74,7 +74,7 @@ TextTrack::SetDefaultSettings()
mActiveCueList = new TextTrackCueList(mParent); mActiveCueList = new TextTrackCueList(mParent);
mCuePos = 0; mCuePos = 0;
mDirty = false; mDirty = false;
mReadyState = HTMLTrackElement::READY_STATE_NONE; mReadyState = TextTrack::READY_STATE_NONE;
} }
JSObject* JSObject*
@ -195,8 +195,8 @@ TextTrack::SetReadyState(uint16_t aState)
} }
HTMLMediaElement* mediaElement = mTextTrackList->GetMediaElement(); HTMLMediaElement* mediaElement = mTextTrackList->GetMediaElement();
if (mediaElement && (mReadyState == HTMLTrackElement::READY_STATE_LOADED || if (mediaElement && (mReadyState == TextTrack::READY_STATE_LOADED ||
mReadyState == HTMLTrackElement::READY_STATE_ERROR)) { mReadyState == TextTrack::READY_STATE_ERROR)) {
mediaElement->RemoveTextTrack(this, true); mediaElement->RemoveTextTrack(this, true);
} }
} }

View File

@ -96,6 +96,13 @@ public:
TextTrackCueList* GetActiveCues(); TextTrackCueList* GetActiveCues();
void GetActiveCueArray(nsTArray<nsRefPtr<TextTrackCue> >& aCues); void GetActiveCueArray(nsTArray<nsRefPtr<TextTrackCue> >& aCues);
// Constants for numeric readyState property values.
enum {
READY_STATE_NONE = 0U,
READY_STATE_LOADING = 1U,
READY_STATE_LOADED = 2U,
READY_STATE_ERROR = 3U
};
uint16_t ReadyState() const; uint16_t ReadyState() const;
void SetReadyState(uint16_t aState); void SetReadyState(uint16_t aState);

View File

@ -78,7 +78,7 @@ WebVTTListener::LoadResource()
rv = mParserWrapper->Watch(this); rv = mParserWrapper->Watch(this);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
mElement->mTrack->SetReadyState(HTMLTrackElement::READY_STATE_LOADING); mElement->mTrack->SetReadyState(TextTrack::READY_STATE_LOADING);
return NS_OK; return NS_OK;
} }
@ -106,9 +106,9 @@ WebVTTListener::OnStopRequest(nsIRequest* aRequest,
nsISupports* aContext, nsISupports* aContext,
nsresult aStatus) nsresult aStatus)
{ {
if (mElement->ReadyState() != HTMLTrackElement::READY_STATE_ERROR) { if (mElement->ReadyState() != TextTrack::READY_STATE_ERROR) {
TextTrack* track = mElement->Track(); TextTrack* track = mElement->Track();
track->SetReadyState(HTMLTrackElement::READY_STATE_LOADED); track->SetReadyState(TextTrack::READY_STATE_LOADED);
} }
// Attempt to parse any final data the parser might still have. // Attempt to parse any final data the parser might still have.
mParserWrapper->Flush(); mParserWrapper->Flush();