HTMLVideoElement.h [plain text]
#pragma once
#if ENABLE(VIDEO)
#include "HTMLMediaElement.h"
#include <memory>
namespace WebCore {
class HTMLImageLoader;
class RenderVideo;
class HTMLVideoElement final : public HTMLMediaElement {
public:
WEBCORE_EXPORT static Ref<HTMLVideoElement> create(Document&);
static Ref<HTMLVideoElement> create(const QualifiedName&, Document&, bool createdByParser);
WEBCORE_EXPORT unsigned videoWidth() const;
WEBCORE_EXPORT unsigned videoHeight() const;
WEBCORE_EXPORT ExceptionOr<void> webkitEnterFullscreen();
WEBCORE_EXPORT void webkitExitFullscreen();
WEBCORE_EXPORT bool webkitSupportsFullscreen();
WEBCORE_EXPORT bool webkitDisplayingFullscreen();
void ancestorWillEnterFullscreen() final;
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
bool webkitWirelessVideoPlaybackDisabled() const;
void setWebkitWirelessVideoPlaybackDisabled(bool);
#endif
#if ENABLE(MEDIA_STATISTICS)
unsigned webkitDecodedFrameCount() const;
unsigned webkitDroppedFrameCount() const;
#endif
void paintCurrentFrameInContext(GraphicsContext&, const FloatRect&);
NativeImagePtr nativeImageForCurrentTime();
bool copyVideoTextureToPlatformTexture(GraphicsContext3D*, Platform3DObject texture, GC3Denum target, GC3Dint level, GC3Denum internalFormat, GC3Denum format, GC3Denum type, bool premultiplyAlpha, bool flipY);
bool shouldDisplayPosterImage() const { return displayMode() == Poster || displayMode() == PosterWaitingForVideo; }
URL posterImageURL() const;
RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
#if ENABLE(VIDEO_PRESENTATION_MODE)
enum class VideoPresentationMode { Fullscreen, PictureInPicture, Inline };
WEBCORE_EXPORT bool webkitSupportsPresentationMode(VideoPresentationMode) const;
void webkitSetPresentationMode(VideoPresentationMode);
VideoPresentationMode webkitPresentationMode() const;
void setFullscreenMode(VideoFullscreenMode);
void fullscreenModeChanged(VideoFullscreenMode) final;
#endif
#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
void exitToFullscreenModeWithoutAnimationIfPossible(HTMLMediaElementEnums::VideoFullscreenMode fromMode, HTMLMediaElementEnums::VideoFullscreenMode toMode);
#endif
RenderVideo* renderer() const;
private:
HTMLVideoElement(const QualifiedName&, Document&, bool createdByParser);
void scheduleResizeEvent() final;
void scheduleResizeEventIfSizeChanged() final;
bool rendererIsNeeded(const RenderStyle&) final;
void didAttachRenderers() final;
void parseAttribute(const QualifiedName&, const AtomicString&) final;
bool isPresentationAttribute(const QualifiedName&) const final;
void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) final;
bool isVideo() const final { return true; }
bool hasVideo() const final { return player() && player()->hasVideo(); }
bool supportsFullscreen(HTMLMediaElementEnums::VideoFullscreenMode) const final;
bool isURLAttribute(const Attribute&) const final;
const AtomicString& imageSourceURL() const final;
bool hasAvailableVideoFrame() const;
void updateDisplayState() final;
void didMoveToNewDocument(Document& oldDocument, Document& newDocument) final;
void setDisplayMode(DisplayMode) final;
PlatformMediaSession::MediaType presentationType() const final { return PlatformMediaSession::Video; }
std::unique_ptr<HTMLImageLoader> m_imageLoader;
AtomicString m_defaultPosterURL;
unsigned m_lastReportedVideoWidth { 0 };
unsigned m_lastReportedVideoHeight { 0 };
};
}
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::HTMLVideoElement)
static bool isType(const WebCore::HTMLMediaElement& element) { return element.hasTagName(WebCore::HTMLNames::videoTag); }
static bool isType(const WebCore::Element& element) { return is<WebCore::HTMLMediaElement>(element) && isType(downcast<WebCore::HTMLMediaElement>(element)); }
static bool isType(const WebCore::Node& node) { return is<WebCore::HTMLMediaElement>(node) && isType(downcast<WebCore::HTMLMediaElement>(node)); }
SPECIALIZE_TYPE_TRAITS_END()
#endif // ENABLE(VIDEO)