diff options
Diffstat (limited to 'Source/WebCore/html/HTMLVideoElement.h')
-rw-r--r-- | Source/WebCore/html/HTMLVideoElement.h | 121 |
1 files changed, 72 insertions, 49 deletions
diff --git a/Source/WebCore/html/HTMLVideoElement.h b/Source/WebCore/html/HTMLVideoElement.h index 536c32262..c12b5a5a0 100644 --- a/Source/WebCore/html/HTMLVideoElement.h +++ b/Source/WebCore/html/HTMLVideoElement.h @@ -10,10 +10,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -23,86 +23,109 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef HTMLVideoElement_h -#define HTMLVideoElement_h +#pragma once #if ENABLE(VIDEO) + #include "HTMLMediaElement.h" +#include <memory> namespace WebCore { class HTMLImageLoader; +class RenderVideo; class HTMLVideoElement final : public HTMLMediaElement { public: - static PassRefPtr<HTMLVideoElement> create(const QualifiedName&, Document&, bool); - - unsigned videoWidth() const; - unsigned videoHeight() const; - - // Fullscreen - void webkitEnterFullscreen(ExceptionCode&); - void webkitExitFullscreen(); - bool webkitSupportsFullscreen(); - bool webkitDisplayingFullscreen(); - - // FIXME: Maintain "FullScreen" capitalization scheme for backwards compatibility. - // https://bugs.webkit.org/show_bug.cgi?id=36081 - void webkitEnterFullScreen(ExceptionCode& ec) { webkitEnterFullscreen(ec); } - void webkitExitFullScreen() { webkitExitFullscreen(); } - -#if ENABLE(IOS_AIRPLAY) + 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) - // Statistics unsigned webkitDecodedFrameCount() const; unsigned webkitDroppedFrameCount() const; #endif // Used by canvas to gain raw pixel access - void paintCurrentFrameInContext(GraphicsContext*, const IntRect&); + void paintCurrentFrameInContext(GraphicsContext&, const FloatRect&); - PassNativeImagePtr nativeImageForCurrentTime(); + NativeImagePtr nativeImageForCurrentTime(); // Used by WebGL to do GPU-GPU textures copy if possible. // See more details at MediaPlayer::copyVideoTextureToPlatformTexture() defined in Source/WebCore/platform/graphics/MediaPlayer.h. - bool copyVideoTextureToPlatformTexture(GraphicsContext3D*, Platform3DObject texture, GC3Dint level, GC3Denum type, GC3Denum internalFormat, bool premultiplyAlpha, bool flipY); + 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; - virtual RenderPtr<RenderElement> createElementRenderer(PassRef<RenderStyle>) override; + RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; + +#if ENABLE(VIDEO_PRESENTATION_MODE) + enum class VideoPresentationMode { Fullscreen, PictureInPicture, Inline }; + 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); - - virtual bool rendererIsNeeded(const RenderStyle&) override; - virtual void didAttachRenderers() override; - virtual void parseAttribute(const QualifiedName&, const AtomicString&) override; - virtual bool isPresentationAttribute(const QualifiedName&) const override; - virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) override; - virtual bool isVideo() const override { return true; } - virtual bool hasVideo() const override { return player() && player()->hasVideo(); } - virtual bool supportsFullscreen() const override; - virtual bool isURLAttribute(const Attribute&) const override; - virtual const AtomicString& imageSourceURL() const override; - - virtual bool hasAvailableVideoFrame() const; - virtual void updateDisplayState() override; - virtual void didMoveToNewDocument(Document* oldDocument) override; - virtual void setDisplayMode(DisplayMode) override; - - OwnPtr<HTMLImageLoader> m_imageLoader; + 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) 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 }; }; -NODE_TYPE_CASTS(HTMLVideoElement) +} // namespace WebCore -} //namespace +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 -#endif +#endif // ENABLE(VIDEO) |