2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2013-03-19 16:27:35 +04:00
|
|
|
|
|
|
|
#ifndef mozilla_dom_HTMLVideoElement_h
|
|
|
|
#define mozilla_dom_HTMLVideoElement_h
|
2010-04-02 07:03:07 +04:00
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-03-19 16:23:54 +04:00
|
|
|
#include "mozilla/dom/HTMLMediaElement.h"
|
2008-07-09 12:22:20 +04:00
|
|
|
|
2013-03-19 16:27:35 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2014-01-07 16:16:07 +04:00
|
|
|
class WakeLock;
|
2013-10-22 01:23:33 +04:00
|
|
|
class VideoPlaybackQuality;
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class HTMLVideoElement final : public HTMLMediaElement
|
2008-07-09 12:22:20 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-07-13 06:20:42 +04:00
|
|
|
typedef mozilla::dom::NodeInfo NodeInfo;
|
2008-07-09 12:22:20 +04:00
|
|
|
|
2014-09-02 04:49:25 +04:00
|
|
|
explicit HTMLVideoElement(already_AddRefed<NodeInfo>& aNodeInfo);
|
2011-12-04 01:50:16 +04:00
|
|
|
|
2014-07-13 06:20:42 +04:00
|
|
|
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLVideoElement, video)
|
2008-07-09 12:22:20 +04:00
|
|
|
|
2013-03-19 16:27:35 +04:00
|
|
|
using HTMLMediaElement::GetPaused;
|
2008-07-09 12:22:20 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD_(bool) IsVideo() override {
|
2014-07-13 06:20:42 +04:00
|
|
|
return true;
|
|
|
|
}
|
2008-07-09 12:22:20 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual bool ParseAttribute(int32_t aNamespaceID,
|
2014-07-13 06:20:42 +04:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsAttrValue& aResult) override;
|
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
|
2013-06-11 19:23:13 +04:00
|
|
|
|
|
|
|
static void Init();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
|
2009-02-26 10:04:42 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult Clone(NodeInfo *aNodeInfo, nsINode **aResult) const override;
|
2008-07-09 12:22:20 +04:00
|
|
|
|
2012-05-11 12:32:15 +04:00
|
|
|
// Set size with the current video frame's height and width.
|
|
|
|
// If there is no video frame, returns NS_ERROR_FAILURE.
|
|
|
|
nsresult GetVideoSize(nsIntSize* size);
|
2010-07-23 13:49:57 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult SetAcceptHeader(nsIHttpChannel* aChannel) override;
|
2010-07-29 08:58:07 +04:00
|
|
|
|
2015-01-20 23:39:28 +03:00
|
|
|
// Element
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const override;
|
2015-01-20 23:39:28 +03:00
|
|
|
|
2013-03-19 16:28:34 +04:00
|
|
|
// WebIDL
|
|
|
|
|
|
|
|
uint32_t Width() const
|
|
|
|
{
|
|
|
|
return GetIntAttr(nsGkAtoms::width, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetWidth(uint32_t aValue, ErrorResult& aRv)
|
|
|
|
{
|
|
|
|
SetHTMLIntAttr(nsGkAtoms::width, aValue, aRv);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t Height() const
|
|
|
|
{
|
|
|
|
return GetIntAttr(nsGkAtoms::height, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetHeight(uint32_t aValue, ErrorResult& aRv)
|
|
|
|
{
|
|
|
|
SetHTMLIntAttr(nsGkAtoms::height, aValue, aRv);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t VideoWidth() const
|
|
|
|
{
|
2015-04-14 08:17:55 +03:00
|
|
|
return mMediaInfo.HasVideo() ? mMediaInfo.mVideo.mDisplay.width : 0;
|
2013-03-19 16:28:34 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t VideoHeight() const
|
|
|
|
{
|
2015-04-14 08:17:55 +03:00
|
|
|
return mMediaInfo.HasVideo() ? mMediaInfo.mVideo.mDisplay.height : 0;
|
2013-03-19 16:28:34 +04:00
|
|
|
}
|
|
|
|
|
2014-07-13 06:20:42 +04:00
|
|
|
void GetPoster(nsAString& aValue)
|
|
|
|
{
|
|
|
|
GetURIAttr(nsGkAtoms::poster, nullptr, aValue);
|
|
|
|
}
|
2013-03-19 16:28:34 +04:00
|
|
|
void SetPoster(const nsAString& aValue, ErrorResult& aRv)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::poster, aValue, aRv);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t MozParsedFrames() const;
|
|
|
|
|
|
|
|
uint32_t MozDecodedFrames() const;
|
|
|
|
|
|
|
|
uint32_t MozPresentedFrames() const;
|
|
|
|
|
|
|
|
uint32_t MozPaintedFrames();
|
|
|
|
|
|
|
|
double MozFrameDelay();
|
|
|
|
|
|
|
|
bool MozHasAudio() const;
|
|
|
|
|
2015-09-02 16:18:16 +03:00
|
|
|
bool MozUseScreenWakeLock() const;
|
|
|
|
|
|
|
|
void SetMozUseScreenWakeLock(bool aValue);
|
|
|
|
|
2015-07-06 01:36:49 +03:00
|
|
|
bool NotifyOwnerDocumentActivityChangedInternal() override;
|
2013-05-10 16:42:39 +04:00
|
|
|
|
2013-07-05 04:24:35 +04:00
|
|
|
already_AddRefed<VideoPlaybackQuality> GetVideoPlaybackQuality();
|
2013-06-21 07:14:18 +04:00
|
|
|
|
2013-03-19 16:28:34 +04:00
|
|
|
protected:
|
2014-07-09 01:23:16 +04:00
|
|
|
virtual ~HTMLVideoElement();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-05-10 16:42:39 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void WakeLockCreate() override;
|
|
|
|
virtual void WakeLockRelease() override;
|
2014-03-18 12:44:41 +04:00
|
|
|
void UpdateScreenWakeLock();
|
2013-05-10 16:42:39 +04:00
|
|
|
|
2015-09-02 16:18:16 +03:00
|
|
|
bool mUseScreenWakeLock;
|
2014-01-07 16:16:07 +04:00
|
|
|
nsRefPtr<WakeLock> mScreenWakeLock;
|
2013-11-19 23:21:29 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aData);
|
2008-07-09 12:22:20 +04:00
|
|
|
};
|
2010-04-02 07:03:07 +04:00
|
|
|
|
2013-03-19 16:27:35 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_HTMLVideoElement_h
|