зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1407040 - Remove C++ usage of nsIDOMHTMLMediaElement; r=bz
MozReview-Commit-ID: 6MGS4UqKwrU --HG-- extra : rebase_source : 19fe880afb9a7a0a7ff2405c8144cdb96b9fd5aa
This commit is contained in:
Родитель
b8e88868d6
Коммит
4040ae7b11
|
@ -69,7 +69,7 @@ HTMLAudioElement::Audio(const GlobalObject& aGlobal,
|
|||
}
|
||||
|
||||
if (aSrc.WasPassed()) {
|
||||
aRv = audio->SetSrc(aSrc.Value());
|
||||
audio->SetSrc(aSrc.Value(), aRv);
|
||||
}
|
||||
|
||||
return audio.forget();
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
#include "AutoplayPolicy.h"
|
||||
#include "base/basictypes.h"
|
||||
#include "nsIDOMHTMLMediaElement.h"
|
||||
#include "TimeRanges.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
|
@ -974,8 +973,9 @@ private:
|
|||
SetSuspended(aSuspend);
|
||||
if (aSuspend == nsISuspendedTypes::SUSPENDED_PAUSE ||
|
||||
aSuspend == nsISuspendedTypes::SUSPENDED_PAUSE_DISPOSABLE) {
|
||||
nsresult rv = mOwner->Pause();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
IgnoredErrorResult rv;
|
||||
mOwner->Pause(rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1470,9 +1470,6 @@ private:
|
|||
bool mSrcIsUnsupportedTypeMedia;
|
||||
};
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(HTMLMediaElement, nsGenericHTMLElement)
|
||||
NS_IMPL_RELEASE_INHERITED(HTMLMediaElement, nsGenericHTMLElement)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLMediaElement)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLMediaElement, nsGenericHTMLElement)
|
||||
|
@ -1531,17 +1528,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLMediaElement, nsGenericHTMLE
|
|||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSetMediaKeysDOMPromise)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(HTMLMediaElement)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLMediaElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement)
|
||||
|
||||
// nsIDOMHTMLMediaElement
|
||||
NS_IMPL_URI_ATTR(HTMLMediaElement, Src, src)
|
||||
NS_IMPL_BOOL_ATTR(HTMLMediaElement, Controls, controls)
|
||||
NS_IMPL_BOOL_ATTR(HTMLMediaElement, Autoplay, autoplay)
|
||||
NS_IMPL_BOOL_ATTR(HTMLMediaElement, Loop, loop)
|
||||
NS_IMPL_BOOL_ATTR(HTMLMediaElement, DefaultMuted, muted)
|
||||
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLMediaElement, Preload, preload, nullptr)
|
||||
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(HTMLMediaElement, nsGenericHTMLElement)
|
||||
|
||||
void
|
||||
HTMLMediaElement::ContentRemoved(nsIDocument* aDocument,
|
||||
|
@ -1554,12 +1541,6 @@ HTMLMediaElement::ContentRemoved(nsIDocument* aDocument,
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
HTMLMediaElement::IsVideo()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
already_AddRefed<MediaSource>
|
||||
HTMLMediaElement::GetMozMediaSourceObject() const
|
||||
{
|
||||
|
@ -1573,7 +1554,7 @@ HTMLMediaElement::GetMozDebugReaderData(nsAString& aString)
|
|||
if (mDecoder && !mSrcStream) {
|
||||
nsAutoCString result;
|
||||
mDecoder->GetMozDebugReaderData(result);
|
||||
aString = NS_ConvertUTF8toUTF16(result);
|
||||
CopyUTF8toUTF16(result, aString);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1724,24 +1705,12 @@ HTMLMediaElement::Ended()
|
|||
(mSrcStream && !mSrcStream->Active());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::GetEnded(bool* aEnded)
|
||||
{
|
||||
*aEnded = Ended();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::GetCurrentSrc(nsAString & aCurrentSrc)
|
||||
void
|
||||
HTMLMediaElement::GetCurrentSrc(nsAString & aCurrentSrc)
|
||||
{
|
||||
nsAutoCString src;
|
||||
GetCurrentSpec(src);
|
||||
aCurrentSrc = NS_ConvertUTF8toUTF16(src);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::GetNetworkState(uint16_t* aNetworkState)
|
||||
{
|
||||
*aNetworkState = NetworkState();
|
||||
return NS_OK;
|
||||
CopyUTF8toUTF16(src, aCurrentSrc);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -1980,7 +1949,8 @@ static bool HasSourceChildren(nsIContent* aElement)
|
|||
return false;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::Load()
|
||||
void
|
||||
HTMLMediaElement::Load()
|
||||
{
|
||||
LOG(LogLevel::Debug,
|
||||
("%p Load() hasSrcAttrStream=%d hasSrcAttr=%d hasSourceChildren=%d "
|
||||
|
@ -1989,13 +1959,11 @@ NS_IMETHODIMP HTMLMediaElement::Load()
|
|||
HasSourceChildren(this), EventStateManager::IsHandlingUserInput()));
|
||||
|
||||
if (mIsRunningLoadMethod) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
mIsDoingExplicitLoad = true;
|
||||
DoLoad();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void HTMLMediaElement::DoLoad()
|
||||
|
@ -2027,7 +1995,7 @@ void HTMLMediaElement::DoLoad()
|
|||
SetPlayedOrSeeked(false);
|
||||
mIsRunningLoadMethod = true;
|
||||
AbortExistingLoads();
|
||||
SetPlaybackRate(mDefaultPlaybackRate);
|
||||
SetPlaybackRate(mDefaultPlaybackRate, IgnoreErrors());
|
||||
QueueSelectResourceTask();
|
||||
ResetState();
|
||||
mIsRunningLoadMethod = false;
|
||||
|
@ -2657,31 +2625,18 @@ nsresult HTMLMediaElement::LoadWithChannel(nsIChannel* aChannel,
|
|||
return rv;
|
||||
}
|
||||
|
||||
SetPlaybackRate(mDefaultPlaybackRate);
|
||||
SetPlaybackRate(mDefaultPlaybackRate, IgnoreErrors());
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("loadstart"));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::GetReadyState(uint16_t* aReadyState)
|
||||
{
|
||||
*aReadyState = ReadyState();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
HTMLMediaElement::Seeking() const
|
||||
{
|
||||
return mDecoder && mDecoder->IsSeeking();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::GetSeeking(bool* aSeeking)
|
||||
{
|
||||
*aSeeking = Seeking();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
double
|
||||
HTMLMediaElement::CurrentTime() const
|
||||
{
|
||||
|
@ -2699,12 +2654,6 @@ HTMLMediaElement::CurrentTime() const
|
|||
return mDefaultPlaybackStartPosition;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::GetCurrentTime(double* aCurrentTime)
|
||||
{
|
||||
*aCurrentTime = CurrentTime();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLMediaElement::FastSeek(double aTime, ErrorResult& aRv)
|
||||
{
|
||||
|
@ -2924,19 +2873,6 @@ HTMLMediaElement::Seek(double aTime,
|
|||
return promise.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::SetCurrentTime(double aCurrentTime)
|
||||
{
|
||||
// Detect for a NaN and invalid values.
|
||||
if (mozilla::IsNaN(aCurrentTime)) {
|
||||
LOG(LogLevel::Debug, ("%p SetCurrentTime(%f) failed: bad time", this, aCurrentTime));
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
ErrorResult rv;
|
||||
SetCurrentTime(aCurrentTime, rv);
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
double
|
||||
HTMLMediaElement::Duration() const
|
||||
{
|
||||
|
@ -2951,12 +2887,6 @@ HTMLMediaElement::Duration() const
|
|||
return std::numeric_limits<double>::quiet_NaN();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::GetDuration(double* aDuration)
|
||||
{
|
||||
*aDuration = Duration();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<TimeRanges>
|
||||
HTMLMediaElement::Seekable() const
|
||||
{
|
||||
|
@ -2966,20 +2896,6 @@ HTMLMediaElement::Seekable() const
|
|||
return ranges.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::GetSeekable(nsIDOMTimeRanges** aSeekable)
|
||||
{
|
||||
RefPtr<TimeRanges> ranges = Seekable();
|
||||
ranges.forget(aSeekable);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::GetPaused(bool* aPaused)
|
||||
{
|
||||
*aPaused = Paused();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<TimeRanges>
|
||||
HTMLMediaElement::Played()
|
||||
{
|
||||
|
@ -3008,13 +2924,6 @@ HTMLMediaElement::Played()
|
|||
return ranges.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::GetPlayed(nsIDOMTimeRanges** aPlayed)
|
||||
{
|
||||
RefPtr<TimeRanges> ranges = Played();
|
||||
ranges.forget(aPlayed);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLMediaElement::Pause(ErrorResult& aRv)
|
||||
{
|
||||
|
@ -3042,19 +2951,6 @@ HTMLMediaElement::Pause(ErrorResult& aRv)
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::Pause()
|
||||
{
|
||||
ErrorResult rv;
|
||||
Pause(rv);
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::GetVolume(double* aVolume)
|
||||
{
|
||||
*aVolume = Volume();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLMediaElement::SetVolume(double aVolume, ErrorResult& aRv)
|
||||
{
|
||||
|
@ -3074,13 +2970,6 @@ HTMLMediaElement::SetVolume(double aVolume, ErrorResult& aRv)
|
|||
DispatchAsyncEvent(NS_LITERAL_STRING("volumechange"));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::SetVolume(double aVolume)
|
||||
{
|
||||
ErrorResult rv;
|
||||
SetVolume(aVolume, rv);
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
void
|
||||
HTMLMediaElement::MozGetMetadata(JSContext* cx,
|
||||
JS::MutableHandle<JSObject*> aRetval,
|
||||
|
@ -3098,7 +2987,8 @@ HTMLMediaElement::MozGetMetadata(JSContext* cx,
|
|||
}
|
||||
if (mTags) {
|
||||
for (auto iter = mTags->ConstIter(); !iter.Done(); iter.Next()) {
|
||||
nsString wideValue = NS_ConvertUTF8toUTF16(iter.UserData());
|
||||
nsString wideValue;
|
||||
CopyUTF8toUTF16(iter.UserData(), wideValue);
|
||||
JS::Rooted<JSString*> string(cx,
|
||||
JS_NewUCStringCopyZ(cx, wideValue.Data()));
|
||||
if (!string || !JS_DefineProperty(cx, tags, iter.Key().Data(), string,
|
||||
|
@ -3113,27 +3003,8 @@ HTMLMediaElement::MozGetMetadata(JSContext* cx,
|
|||
aRetval.set(tags);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLMediaElement::MozGetMetadata(JSContext* cx, JS::MutableHandle<JS::Value> aValue)
|
||||
{
|
||||
ErrorResult rv;
|
||||
JS::Rooted<JSObject*> obj(cx);
|
||||
MozGetMetadata(cx, &obj, rv);
|
||||
if (!rv.Failed()) {
|
||||
MOZ_ASSERT(obj);
|
||||
aValue.setObject(*obj);
|
||||
}
|
||||
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::GetMuted(bool* aMuted)
|
||||
{
|
||||
*aMuted = Muted();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void HTMLMediaElement::SetMutedInternal(uint32_t aMuted)
|
||||
void
|
||||
HTMLMediaElement::SetMutedInternal(uint32_t aMuted)
|
||||
{
|
||||
uint32_t oldMuted = mMuted;
|
||||
mMuted = aMuted;
|
||||
|
@ -3145,7 +3016,8 @@ void HTMLMediaElement::SetMutedInternal(uint32_t aMuted)
|
|||
SetVolumeInternal();
|
||||
}
|
||||
|
||||
void HTMLMediaElement::SetVolumeInternal()
|
||||
void
|
||||
HTMLMediaElement::SetVolumeInternal()
|
||||
{
|
||||
float effectiveVolume = ComputedVolume();
|
||||
|
||||
|
@ -3161,10 +3033,11 @@ void HTMLMediaElement::SetVolumeInternal()
|
|||
AudioChannelService::AudibleChangedReasons::eVolumeChanged);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::SetMuted(bool aMuted)
|
||||
void
|
||||
HTMLMediaElement::SetMuted(bool aMuted)
|
||||
{
|
||||
if (aMuted == Muted()) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
if (aMuted) {
|
||||
|
@ -3174,7 +3047,6 @@ NS_IMETHODIMP HTMLMediaElement::SetMuted(bool aMuted)
|
|||
}
|
||||
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("volumechange"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
class HTMLMediaElement::StreamCaptureTrackSource :
|
||||
|
@ -3767,12 +3639,6 @@ HTMLMediaElement::MozCaptureStreamUntilEnded(ErrorResult& aRv)
|
|||
return stream.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::GetMozAudioCaptured(bool* aCaptured)
|
||||
{
|
||||
*aCaptured = MozAudioCaptured();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
class MediaElementSetForURI : public nsURIHashKey {
|
||||
public:
|
||||
explicit MediaElementSetForURI(const nsIURI* aKey) : nsURIHashKey(aKey) {}
|
||||
|
@ -3961,6 +3827,7 @@ HTMLMediaElement::HTMLMediaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNo
|
|||
mShutdownObserver(new ShutdownObserver),
|
||||
mSourcePointer(nullptr),
|
||||
mNetworkState(NETWORK_EMPTY),
|
||||
mReadyState(HAVE_NOTHING),
|
||||
mCurrentLoadID(0),
|
||||
mLoadWaitStatus(NOT_WAITING),
|
||||
mVolume(1.0),
|
||||
|
@ -4845,7 +4712,7 @@ HTMLMediaElement::GetCanPlay(const nsAString& aType,
|
|||
return status;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
HTMLMediaElement::CanPlayType(const nsAString& aType, nsAString& aResult)
|
||||
{
|
||||
DecoderDoctorDiagnostics diagnostics;
|
||||
|
@ -4870,8 +4737,6 @@ HTMLMediaElement::CanPlayType(const nsAString& aType, nsAString& aResult)
|
|||
LOG(LogLevel::Debug, ("%p CanPlayType(%s) = \"%s\"", this,
|
||||
NS_ConvertUTF16toUTF8(aType).get(),
|
||||
NS_ConvertUTF16toUTF8(aResult).get()));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -6760,13 +6625,6 @@ HTMLMediaElement::Buffered() const
|
|||
return ranges.forget();
|
||||
}
|
||||
|
||||
nsresult HTMLMediaElement::GetBuffered(nsIDOMTimeRanges** aBuffered)
|
||||
{
|
||||
RefPtr<TimeRanges> ranges = Buffered();
|
||||
ranges.forget(aBuffered);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void HTMLMediaElement::SetRequestHeaders(nsIHttpChannel* aChannel)
|
||||
{
|
||||
// Send Accept header for video and audio types only (Bug 489071)
|
||||
|
@ -6862,12 +6720,6 @@ HTMLMediaElement::MozFragmentEnd()
|
|||
return (mFragmentEnd < 0.0 || mFragmentEnd > duration) ? duration : mFragmentEnd;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::GetMozFragmentEnd(double* aTime)
|
||||
{
|
||||
*aTime = MozFragmentEnd();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static double ClampPlaybackRate(double aPlaybackRate)
|
||||
{
|
||||
MOZ_ASSERT(aPlaybackRate >= 0.0);
|
||||
|
@ -6884,12 +6736,6 @@ static double ClampPlaybackRate(double aPlaybackRate)
|
|||
return aPlaybackRate;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::GetDefaultPlaybackRate(double* aDefaultPlaybackRate)
|
||||
{
|
||||
*aDefaultPlaybackRate = DefaultPlaybackRate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLMediaElement::SetDefaultPlaybackRate(double aDefaultPlaybackRate, ErrorResult& aRv)
|
||||
{
|
||||
|
@ -6902,19 +6748,6 @@ HTMLMediaElement::SetDefaultPlaybackRate(double aDefaultPlaybackRate, ErrorResul
|
|||
DispatchAsyncEvent(NS_LITERAL_STRING("ratechange"));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::SetDefaultPlaybackRate(double aDefaultPlaybackRate)
|
||||
{
|
||||
ErrorResult rv;
|
||||
SetDefaultPlaybackRate(aDefaultPlaybackRate, rv);
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::GetPlaybackRate(double* aPlaybackRate)
|
||||
{
|
||||
*aPlaybackRate = PlaybackRate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLMediaElement::SetPlaybackRate(double aPlaybackRate, ErrorResult& aRv)
|
||||
{
|
||||
|
@ -6945,29 +6778,17 @@ HTMLMediaElement::SetPlaybackRate(double aPlaybackRate, ErrorResult& aRv)
|
|||
DispatchAsyncEvent(NS_LITERAL_STRING("ratechange"));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::SetPlaybackRate(double aPlaybackRate)
|
||||
{
|
||||
ErrorResult rv;
|
||||
SetPlaybackRate(aPlaybackRate, rv);
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::GetMozPreservesPitch(bool* aPreservesPitch)
|
||||
{
|
||||
*aPreservesPitch = MozPreservesPitch();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::SetMozPreservesPitch(bool aPreservesPitch)
|
||||
void
|
||||
HTMLMediaElement::SetMozPreservesPitch(bool aPreservesPitch)
|
||||
{
|
||||
mPreservesPitch = aPreservesPitch;
|
||||
if (mDecoder) {
|
||||
mDecoder->SetPreservesPitch(mPreservesPitch);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
ImageContainer* HTMLMediaElement::GetImageContainer()
|
||||
ImageContainer*
|
||||
HTMLMediaElement::GetImageContainer()
|
||||
{
|
||||
VideoFrameContainer* container = GetVideoFrameContainer();
|
||||
return container ? container->GetImageContainer() : nullptr;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#define mozilla_dom_HTMLMediaElement_h
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIDOMHTMLMediaElement.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "MediaEventSource.h"
|
||||
#include "SeekTarget.h"
|
||||
|
@ -101,7 +100,6 @@ enum class StreamCaptureBehavior : uint8_t
|
|||
};
|
||||
|
||||
class HTMLMediaElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLMediaElement,
|
||||
public MediaDecoderOwner,
|
||||
public PrincipalChangeObserver<DOMMediaStream>,
|
||||
public SupportsWeakPtr<HTMLMediaElement>,
|
||||
|
@ -137,9 +135,6 @@ public:
|
|||
*/
|
||||
nsresult LoadWithChannel(nsIChannel *aChannel, nsIStreamListener **aListener);
|
||||
|
||||
// nsIDOMHTMLMediaElement
|
||||
NS_DECL_NSIDOMHTMLMEDIAELEMENT
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLMediaElement,
|
||||
|
@ -445,12 +440,20 @@ public:
|
|||
|
||||
MediaError* GetError() const;
|
||||
|
||||
void SetSrc(const nsAString& aSrc, nsIPrincipal* aTriggeringPrincipal, ErrorResult& aRv)
|
||||
void GetSrc(nsAString& aSrc)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::src, aSrc, aTriggeringPrincipal, aRv);
|
||||
GetURIAttr(nsGkAtoms::src, nullptr, aSrc);
|
||||
}
|
||||
void SetSrc(const nsAString& aSrc, ErrorResult& aError)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::src, aSrc, aError);
|
||||
}
|
||||
void SetSrc(const nsAString& aSrc, nsIPrincipal* aTriggeringPrincipal, ErrorResult& aError)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::src, aSrc, aTriggeringPrincipal, aError);
|
||||
}
|
||||
|
||||
// XPCOM GetCurrentSrc() is OK
|
||||
void GetCurrentSrc(nsAString& aCurrentSrc);
|
||||
|
||||
void GetCrossOrigin(nsAString& aResult)
|
||||
{
|
||||
|
@ -478,7 +481,10 @@ public:
|
|||
// Notify agent when the MediaElement changes its audible state.
|
||||
void NotifyAudioPlaybackChanged(AudibleChangedReasons aReason);
|
||||
|
||||
// XPCOM GetPreload() is OK
|
||||
void GetPreload(nsAString& aValue)
|
||||
{
|
||||
GetEnumAttr(nsGkAtoms::preload, nullptr, aValue);
|
||||
}
|
||||
void SetPreload(const nsAString& aValue, ErrorResult& aRv)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::preload, aValue, aRv);
|
||||
|
@ -486,9 +492,9 @@ public:
|
|||
|
||||
already_AddRefed<TimeRanges> Buffered() const;
|
||||
|
||||
// XPCOM Load() is OK
|
||||
void Load();
|
||||
|
||||
// XPCOM CanPlayType() is OK
|
||||
void CanPlayType(const nsAString& aType, nsAString& aResult);
|
||||
|
||||
uint16_t ReadyState() const
|
||||
{
|
||||
|
@ -500,6 +506,10 @@ public:
|
|||
double CurrentTime() const;
|
||||
|
||||
void SetCurrentTime(double aCurrentTime, ErrorResult& aRv);
|
||||
void SetCurrentTime(double aCurrentTime)
|
||||
{
|
||||
SetCurrentTime(aCurrentTime, IgnoreErrors());
|
||||
}
|
||||
|
||||
void FastSeek(double aTime, ErrorResult& aRv);
|
||||
|
||||
|
@ -512,6 +522,11 @@ public:
|
|||
return mMediaInfo.HasAudio();
|
||||
}
|
||||
|
||||
virtual bool IsVideo() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HasVideo() const
|
||||
{
|
||||
return mMediaInfo.HasVideo();
|
||||
|
@ -570,6 +585,10 @@ public:
|
|||
already_AddRefed<Promise> Play(ErrorResult& aRv);
|
||||
|
||||
void Pause(ErrorResult& aRv);
|
||||
void Pause()
|
||||
{
|
||||
Pause(IgnoreErrors());
|
||||
}
|
||||
|
||||
bool Controls() const
|
||||
{
|
||||
|
@ -592,8 +611,7 @@ public:
|
|||
{
|
||||
return mMuted & MUTED_BY_CONTENT;
|
||||
}
|
||||
|
||||
// XPCOM SetMuted() is OK
|
||||
void SetMuted(bool aMuted);
|
||||
|
||||
bool DefaultMuted() const
|
||||
{
|
||||
|
@ -665,8 +683,7 @@ public:
|
|||
{
|
||||
return mPreservesPitch;
|
||||
}
|
||||
|
||||
// XPCOM MozPreservesPitch() is OK
|
||||
void SetMozPreservesPitch(bool aPreservesPitch);
|
||||
|
||||
MediaKeys* GetMediaKeys() const;
|
||||
|
||||
|
@ -760,6 +777,9 @@ public:
|
|||
// that will soon be gone.
|
||||
bool IsBeingDestroyed();
|
||||
|
||||
void OnVisibilityChange(Visibility aNewVisibility);
|
||||
|
||||
|
||||
// These are used for testing only
|
||||
float ComputedVolume() const;
|
||||
bool ComputedMuted() const;
|
||||
|
@ -1188,7 +1208,7 @@ protected:
|
|||
|
||||
/**
|
||||
* Resets the media element for an error condition as per aErrorCode.
|
||||
* aErrorCode must be one of nsIDOMHTMLMediaError codes.
|
||||
* aErrorCode must be one of WebIDL HTMLMediaElement error codes.
|
||||
*/
|
||||
void Error(uint16_t aErrorCode, const nsACString& aErrorDetails = nsCString());
|
||||
|
||||
|
@ -1229,9 +1249,7 @@ protected:
|
|||
// Return true if decoding should be paused
|
||||
virtual bool GetPaused() final override
|
||||
{
|
||||
bool isPaused = false;
|
||||
GetPaused(&isPaused);
|
||||
return isPaused;
|
||||
return Paused();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1439,7 +1457,7 @@ protected:
|
|||
// Media loading flags. See:
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/#video)
|
||||
nsMediaNetworkState mNetworkState;
|
||||
nsMediaReadyState mReadyState = HTMLMediaElementBinding::HAVE_NOTHING;
|
||||
nsMediaReadyState mReadyState;
|
||||
|
||||
enum LoadAlgorithmState {
|
||||
// No load algorithm instance is waiting for a source to be added to the
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMHTMLMediaElement.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsILoadGroup.h"
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
|
||||
using HTMLMediaElement::GetPaused;
|
||||
|
||||
NS_IMETHOD_(bool) IsVideo() override {
|
||||
virtual bool IsVideo() const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -115,8 +115,8 @@ VideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel,
|
|||
NOT_FROM_PARSER));
|
||||
if (!element)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
element->SetAutoplay(true);
|
||||
element->SetControls(true);
|
||||
element->SetAutoplay(true, IgnoreErrors());
|
||||
element->SetControls(true, IgnoreErrors());
|
||||
element->LoadWithChannel(aChannel, aListener);
|
||||
UpdateTitle(aChannel);
|
||||
|
||||
|
|
|
@ -809,7 +809,7 @@ nsVideoFrame::OnVisibilityChange(Visibility aNewVisibility,
|
|||
const Maybe<OnNonvisible>& aNonvisibleAction)
|
||||
{
|
||||
if (HasVideoElement()) {
|
||||
static_cast<HTMLMediaElement*>(mContent)->OnVisibilityChange(aNewVisibility);
|
||||
static_cast<HTMLMediaElement*>(GetContent())->OnVisibilityChange(aNewVisibility);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mPosterImage);
|
||||
|
@ -822,7 +822,7 @@ nsVideoFrame::OnVisibilityChange(Visibility aNewVisibility,
|
|||
}
|
||||
|
||||
bool nsVideoFrame::HasVideoElement() {
|
||||
return static_cast<HTMLMediaElement*>(mContent)->IsVideo();
|
||||
return static_cast<HTMLMediaElement*>(GetContent())->IsVideo();
|
||||
}
|
||||
|
||||
bool nsVideoFrame::HasVideoData()
|
||||
|
@ -837,5 +837,5 @@ bool nsVideoFrame::HasVideoData()
|
|||
|
||||
void nsVideoFrame::UpdateTextTrack()
|
||||
{
|
||||
static_cast<HTMLMediaElement*>(mContent)->NotifyCueDisplayStatesChanged();
|
||||
static_cast<HTMLMediaElement*>(GetContent())->NotifyCueDisplayStatesChanged();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче