18e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
2692e5dbf12901edacf14812a6fae25462920af42Steve Block * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
3692e5dbf12901edacf14812a6fae25462920af42Steve Block *
48e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Redistribution and use in source and binary forms, with or without
58e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * modification, are permitted provided that the following conditions
68e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * are met:
78e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 1. Redistributions of source code must retain the above copyright
88e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *    notice, this list of conditions and the following disclaimer.
98e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 2. Redistributions in binary form must reproduce the above copyright
108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *    notice, this list of conditions and the following disclaimer in the
118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *    documentation and/or other materials provided with the distribution.
128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24692e5dbf12901edacf14812a6fae25462920af42Steve Block */
258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#ifndef HTMLVideoElement_h
278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define HTMLVideoElement_h
288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#if ENABLE(VIDEO)
308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "HTMLMediaElement.h"
328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectnamespace WebCore {
348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass HTMLImageLoader;
36cad810f21b803229eb11403f9209855525a25d57Steve Block
37cad810f21b803229eb11403f9209855525a25d57Steve Blockclass HTMLVideoElement : public HTMLMediaElement {
380bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochpublic:
398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    static PassRefPtr<HTMLVideoElement> create(const QualifiedName&, Document*);
405af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke
41692e5dbf12901edacf14812a6fae25462920af42Steve Block    unsigned width() const;
425af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke    unsigned height() const;
43692e5dbf12901edacf14812a6fae25462920af42Steve Block
445af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke    unsigned videoWidth() const;
455af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke    unsigned videoHeight() const;
46692e5dbf12901edacf14812a6fae25462920af42Steve Block
478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // Fullscreen
488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void webkitEnterFullscreen(bool isUserGesture, ExceptionCode&);
498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void webkitExitFullscreen();
508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    bool webkitSupportsFullscreen();
518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    bool webkitDisplayingFullscreen();
528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
53    // FIXME: Maintain "FullScreen" capitalization scheme for backwards compatibility.
54    // https://bugs.webkit.org/show_bug.cgi?id=36081
55    void webkitEnterFullScreen(bool isUserGesture, ExceptionCode& ec) { webkitEnterFullscreen(isUserGesture, ec); }
56    void webkitExitFullScreen() { webkitExitFullscreen(); }
57
58#if ENABLE(MEDIA_STATISTICS)
59    // Statistics
60    unsigned webkitDecodedFrameCount() const;
61    unsigned webkitDroppedFrameCount() const;
62#endif
63
64    // Used by canvas to gain raw pixel access
65    void paintCurrentFrameInContext(GraphicsContext*, const IntRect&);
66
67    bool shouldDisplayPosterImage() const { return displayMode() == Poster || displayMode() == PosterWaitingForVideo; }
68
69private:
70    HTMLVideoElement(const QualifiedName&, Document*);
71
72    virtual bool rendererIsNeeded(RenderStyle*);
73#if !ENABLE(PLUGIN_PROXY_FOR_VIDEO)
74    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
75#endif
76    virtual void attach();
77    virtual void detach();
78    virtual void parseMappedAttribute(Attribute*);
79    virtual bool isVideo() const { return true; }
80    virtual bool hasVideo() const { return player() && player()->hasVideo(); }
81    virtual bool supportsFullscreen() const;
82    virtual bool isURLAttribute(Attribute*) const;
83    virtual const QualifiedName& imageSourceAttributeName() const;
84
85    virtual bool hasAvailableVideoFrame() const;
86    virtual void updateDisplayState();
87
88    virtual void willMoveToNewOwnerDocument();
89
90    virtual void setDisplayMode(DisplayMode);
91
92    OwnPtr<HTMLImageLoader> m_imageLoader;
93
94};
95
96} //namespace
97
98#endif
99#endif
100