Bug 842782 - p2: introduce attributes for orientation lock to video element. r=jwwang,smaug

MozReview-Commit-ID: odq1y9qH1
This commit is contained in:
John Lin 2017-08-25 14:23:03 +08:00
Родитель d40baf7687
Коммит bad6535260
3 изменённых файлов: 28 добавлений и 0 удалений

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

@ -47,6 +47,7 @@ NS_IMPL_ELEMENT_CLONE(HTMLVideoElement)
HTMLVideoElement::HTMLVideoElement(already_AddRefed<NodeInfo>& aNodeInfo) HTMLVideoElement::HTMLVideoElement(already_AddRefed<NodeInfo>& aNodeInfo)
: HTMLMediaElement(aNodeInfo) : HTMLMediaElement(aNodeInfo)
, mUseScreenWakeLock(true) , mUseScreenWakeLock(true)
, mIsOrientationLocked(false)
{ {
} }

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

@ -9,6 +9,7 @@
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/dom/HTMLMediaElement.h" #include "mozilla/dom/HTMLMediaElement.h"
#include "MediaPrefs.h"
namespace mozilla { namespace mozilla {
@ -139,6 +140,22 @@ public:
already_AddRefed<VideoPlaybackQuality> GetVideoPlaybackQuality(); already_AddRefed<VideoPlaybackQuality> GetVideoPlaybackQuality();
bool MozOrientationLockEnabled() const
{
return MediaPrefs::VideoOrientationLockEnabled();
}
bool MozIsOrientationLocked() const
{
return mIsOrientationLocked;
}
void SetMozIsOrientationLocked(bool aLock)
{
mIsOrientationLocked = aLock;
}
protected: protected:
virtual ~HTMLVideoElement(); virtual ~HTMLVideoElement();
@ -151,6 +168,8 @@ protected:
bool mUseScreenWakeLock; bool mUseScreenWakeLock;
RefPtr<WakeLock> mScreenWakeLock; RefPtr<WakeLock> mScreenWakeLock;
bool mIsOrientationLocked;
private: private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aGenericData); GenericSpecifiedValues* aGenericData);

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

@ -49,6 +49,14 @@ partial interface HTMLVideoElement {
// True if the video should use a screen wake lock. // True if the video should use a screen wake lock.
[Pref="dom.wakelock.enabled", Func="Navigator::HasWakeLockSupport"] [Pref="dom.wakelock.enabled", Func="Navigator::HasWakeLockSupport"]
attribute boolean mozUseScreenWakeLock; attribute boolean mozUseScreenWakeLock;
// Attributes for builtin video controls to lock screen orientation.
// True if video controls should lock orientation when fullscreen.
[Pref="media.videocontrols.lock-video-orientation", Func="IsChromeOrXBL"]
readonly attribute boolean mozOrientationLockEnabled;
// True if screen orientation is locked by video controls.
[Pref="media.videocontrols.lock-video-orientation", Func="IsChromeOrXBL"]
attribute boolean mozIsOrientationLocked;
}; };
// https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#idl-def-HTMLVideoElement // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#idl-def-HTMLVideoElement