2010-02-01 Eric Carlson <eric.carlson@apple.com>

        Reviewed by Adele Peterson.

        Fullscreen API should be on HTMLVideoElement
        https://bugs.webkit.org/show_bug.cgi?id=34438
        
        Move fullscreen DOM APIs from HTMLMediaElement to HTMLVideoElement.

        * html/HTMLMediaElement.cpp:
        * html/HTMLMediaElement.h:
        * html/HTMLMediaElement.idl:
        * html/HTMLVideoElement.cpp:
        (WebCore::HTMLVideoElement::paint): Removed outdated FIXME.
        (WebCore::HTMLVideoElement::paintCurrentFrameInContext): Ditto.
        (WebCore::HTMLVideoElement::webkitEnterFullScreen): Moved from HTMLMediaElement.
        (WebCore::HTMLVideoElement::webkitExitFullScreen): Ditto.
        (WebCore::HTMLVideoElement::webkitSupportsFullscreen): Ditto.
        (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): Ditto.
        * html/HTMLVideoElement.h:
        * html/HTMLVideoElement.idl:

2010-02-01  Eric Carlson  <eric.carlson@apple.com>

        Reviewed by Adele Peterson.

        Fullscreen API should be on HTMLVideoElement
        https://bugs.webkit.org/show_bug.cgi?id=34438

        Update fullscreen tests now that <audio> doesn't have fullscreen API.

        * fast/dom/Window/window-properties-expected.txt:
        * media/media-fullscreen-inline-expected.txt:
        * media/media-fullscreen-not-in-document-expected.txt:
        * media/media-fullscreen.js:
        (buttonClickHandler):
        (canplaythrough):



git-svn-id: svn://svn.chromium.org/blink/trunk@54143 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 8c399da7
2010-02-01 Eric Carlson <eric.carlson@apple.com>
Reviewed by Adele Peterson.
Fullscreen API should be on HTMLVideoElement
https://bugs.webkit.org/show_bug.cgi?id=34438
Update fullscreen tests now that <audio> doesn't have fullscreen API.
* fast/dom/Window/window-properties-expected.txt:
* media/media-fullscreen-inline-expected.txt:
* media/media-fullscreen-not-in-document-expected.txt:
* media/media-fullscreen.js:
(buttonClickHandler):
(canplaythrough):
2010-02-01 Ben Murdoch <benm@google.com>
Reviewed by Darin Adler.
......
......@@ -121,8 +121,6 @@ window.Audio.prototype.setAttribute [function]
window.Audio.prototype.setAttributeNS [function]
window.Audio.prototype.setAttributeNode [function]
window.Audio.prototype.setAttributeNodeNS [function]
window.Audio.prototype.webkitEnterFullScreen [function]
window.Audio.prototype.webkitExitFullScreen [function]
window.Audio.prototype.webkitMatchesSelector [function]
window.BeforeLoadEvent [object BeforeLoadEventConstructor]
window.BeforeLoadEvent.prototype [object BeforeLoadEventPrototype]
......
......@@ -8,13 +8,11 @@ EVENT(loadstart)
EVENT(durationchange)
EVENT(canplaythrough)
* event handler NOT triggered by a user gesture
EXPECTED (mediaElement.webkitSupportsFullscreen == 'false') OK
EXPECTED (mediaElement.webkitDisplayingFullscreen == 'false') OK
TEST(mediaElement.webkitEnterFullScreen()) THROWS(DOMException.INVALID_STATE_ERR) OK
EXPECTED (mediaElement.webkitSupportsFullscreen == 'undefined') OK
EXPECTED (mediaElement.webkitDisplayingFullscreen == 'undefined') OK
* clicking on button
EVENT(mouseup)
* event handler triggered by user gesture
TEST(mediaElement.webkitEnterFullScreen()) THROWS(DOMException.INVALID_STATE_ERR) OK
*** Creating <video> element with "content/silence.mpg" in the document, should NOT support fullscreen because it is an audio-only <video> element
EVENT(loadstart)
......
......@@ -25,13 +25,11 @@ EVENT(loadstart)
EVENT(durationchange)
EVENT(canplaythrough)
* event handler NOT triggered by a user gesture
EXPECTED (mediaElement.webkitSupportsFullscreen == 'false') OK
EXPECTED (mediaElement.webkitDisplayingFullscreen == 'false') OK
TEST(mediaElement.webkitEnterFullScreen()) THROWS(DOMException.INVALID_STATE_ERR) OK
EXPECTED (mediaElement.webkitSupportsFullscreen == 'undefined') OK
EXPECTED (mediaElement.webkitDisplayingFullscreen == 'undefined') OK
* clicking on button
EVENT(mouseup)
* event handler triggered by user gesture
TEST(mediaElement.webkitEnterFullScreen()) THROWS(DOMException.INVALID_STATE_ERR) OK
END OF TEST
function buttonClickHandler()
{
var movie = movieInfo.movies[movieInfo.current];
consoleWrite("EVENT(mouseup)");
consoleWrite("* event handler triggered by user gesture");
// Try to enter fullscreen in response to a mouse click
if (movieInfo.movies[movieInfo.current].supportsFS)
if (movie.supportsFS)
run("mediaElement.webkitEnterFullScreen()");
else {
testException("mediaElement.webkitEnterFullScreen()", "DOMException.INVALID_STATE_ERR");
if (movie.type == 'video')
testException("mediaElement.webkitEnterFullScreen()", "DOMException.INVALID_STATE_ERR");
openNextMovie();
}
}
......@@ -41,12 +44,18 @@ function canplaythrough()
consoleWrite("* event handler NOT triggered by a user gesture");
testExpected("mediaElement.webkitSupportsFullscreen", movie.supportsFS);
testExpected("mediaElement.webkitDisplayingFullscreen", false);
if (movie.type == 'video') {
testExpected("mediaElement.webkitSupportsFullscreen", movie.supportsFS);
testExpected("mediaElement.webkitDisplayingFullscreen", false);
} else {
testExpected("mediaElement.webkitSupportsFullscreen", undefined);
testExpected("mediaElement.webkitDisplayingFullscreen", undefined);
}
// Verify that we get an exception when trying to enter fullscreen since this isn't
// called in response to a user gesture.
testException("mediaElement.webkitEnterFullScreen()", "DOMException.INVALID_STATE_ERR");
if (movie.type == 'video')
testException("mediaElement.webkitEnterFullScreen()", "DOMException.INVALID_STATE_ERR");
// Click on the button
if (window.layoutTestController)
......
2010-02-01 Eric Carlson <eric.carlson@apple.com>
Reviewed by Adele Peterson.
Fullscreen API should be on HTMLVideoElement
https://bugs.webkit.org/show_bug.cgi?id=34438
Move fullscreen DOM APIs from HTMLMediaElement to HTMLVideoElement.
* html/HTMLMediaElement.cpp:
* html/HTMLMediaElement.h:
* html/HTMLMediaElement.idl:
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::paint): Removed outdated FIXME.
(WebCore::HTMLVideoElement::paintCurrentFrameInContext): Ditto.
(WebCore::HTMLVideoElement::webkitEnterFullScreen): Moved from HTMLMediaElement.
(WebCore::HTMLVideoElement::webkitExitFullScreen): Ditto.
(WebCore::HTMLVideoElement::webkitSupportsFullscreen): Ditto.
(WebCore::HTMLVideoElement::webkitDisplayingFullscreen): Ditto.
* html/HTMLVideoElement.h:
* html/HTMLVideoElement.idl:
2010-02-01 Pavel Feldman <pfeldman@chromium.org>
Reviewed by Timothy Hatcher.
......
......@@ -1878,37 +1878,6 @@ PlatformMedia HTMLMediaElement::platformMedia() const
return m_player ? m_player->platformMedia() : NoPlatformMedia;
}
void HTMLMediaElement::webkitEnterFullScreen(ExceptionCode& ec)
{
if (m_isFullscreen)
return;
// Generate an exception if this isn't called in response to a user gesture, or if the
// element does not support fullscreen.
if (!processingUserGesture() || !supportsFullscreen()) {
ec = INVALID_STATE_ERR;
return;
}
enterFullscreen();
}
void HTMLMediaElement::webkitExitFullScreen()
{
if (m_isFullscreen)
exitFullscreen();
}
bool HTMLMediaElement::webkitSupportsFullscreen()
{
return supportsFullscreen();
}
bool HTMLMediaElement::webkitDisplayingFullscreen()
{
return m_isFullscreen;
}
bool HTMLMediaElement::hasClosedCaptions() const
{
return m_player && m_player->hasClosedCaptions();
......
......@@ -132,12 +132,6 @@ public:
void play();
void pause();
// fullscreen
void webkitEnterFullScreen(ExceptionCode&);
void webkitExitFullScreen();
bool webkitSupportsFullscreen();
bool webkitDisplayingFullscreen();
// captions
bool webkitHasClosedCaptions() const;
bool webkitClosedCaptionsVisible() const;
......@@ -191,6 +185,8 @@ protected:
virtual void willMoveToNewOwnerDocument();
virtual void didMoveToNewOwnerDocument();
bool processingUserGesture() const;
private: // MediaPlayerClient
virtual void mediaPlayerNetworkStateChanged(MediaPlayer*);
virtual void mediaPlayerReadyStateChanged(MediaPlayer*);
......@@ -247,7 +243,6 @@ private:
void prepareForLoad();
bool processingUserGesture() const;
bool processingMediaPlayerCallback() const { return m_processingMediaPlayerCallback > 0; }
void beginProcessingMediaPlayerCallback() { ++m_processingMediaPlayerCallback; }
void endProcessingMediaPlayerCallback() { ASSERT(m_processingMediaPlayerCallback); --m_processingMediaPlayerCallback; }
......
......@@ -80,13 +80,6 @@ interface [Conditional=VIDEO] HTMLMediaElement : HTMLElement {
// WebKit extensions
attribute boolean webkitPreservesPitch;
readonly attribute boolean webkitSupportsFullscreen;
readonly attribute boolean webkitDisplayingFullscreen;
void webkitEnterFullScreen()
raises (DOMException);
void webkitExitFullScreen();
readonly attribute boolean webkitHasClosedCaptions;
attribute boolean webkitClosedCaptionsVisible;
};
......
......@@ -33,6 +33,7 @@
#include "CSSHelper.h"
#include "CSSPropertyNames.h"
#include "Document.h"
#include "ExceptionCode.h"
#include "HTMLImageLoader.h"
#include "HTMLNames.h"
#include "MappedAttribute.h"
......@@ -197,8 +198,6 @@ void HTMLVideoElement::updatePosterImage()
void HTMLVideoElement::paint(GraphicsContext* context, const IntRect& destRect)
{
// FIXME: We should also be able to paint the poster image.
MediaPlayer* player = HTMLMediaElement::player();
if (!player)
return;
......@@ -209,8 +208,6 @@ void HTMLVideoElement::paint(GraphicsContext* context, const IntRect& destRect)
void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& destRect)
{
// FIXME: We should also be able to paint the poster image.
MediaPlayer* player = HTMLMediaElement::player();
if (!player)
return;
......@@ -227,5 +224,37 @@ bool HTMLVideoElement::hasAvailableVideoFrame() const
return m_player->hasAvailableVideoFrame();
}
void HTMLVideoElement::webkitEnterFullScreen(ExceptionCode& ec)
{
if (m_isFullscreen)
return;
// Generate an exception if this isn't called in response to a user gesture, or if the
// element does not support fullscreen.
if (!processingUserGesture() || !supportsFullscreen()) {
ec = INVALID_STATE_ERR;
return;
}
enterFullscreen();
}
void HTMLVideoElement::webkitExitFullScreen()
{
if (m_isFullscreen)
exitFullscreen();
}
bool HTMLVideoElement::webkitSupportsFullscreen()
{
return supportsFullscreen();
}
bool HTMLVideoElement::webkitDisplayingFullscreen()
{
return m_isFullscreen;
}
}
#endif
......@@ -64,6 +64,12 @@ public:
const KURL& poster() const { return m_posterURL; }
void setPoster(const String&);
// fullscreen
void webkitEnterFullScreen(ExceptionCode&);
void webkitExitFullScreen();
bool webkitSupportsFullscreen();
bool webkitDisplayingFullscreen();
void updatePosterImage();
bool shouldDisplayPosterImage() const { return m_shouldDisplayPosterImage; }
......
......@@ -30,5 +30,13 @@ module html {
readonly attribute unsigned long videoWidth;
readonly attribute unsigned long videoHeight;
attribute [ConvertNullToNullString] DOMString poster;
readonly attribute boolean webkitSupportsFullscreen;
readonly attribute boolean webkitDisplayingFullscreen;
void webkitEnterFullScreen()
raises (DOMException);
void webkitExitFullScreen();
};
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment