2010-02-01 Eric Carlson <eric.carlson@apple.com>
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Feb 2010 20:48:11 +0000 (20:48 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Feb 2010 20:48:11 +0000 (20:48 +0000)
        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: https://svn.webkit.org/repository/webkit/trunk@54143 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/Window/window-properties-expected.txt
LayoutTests/media/media-fullscreen-inline-expected.txt
LayoutTests/media/media-fullscreen-not-in-document-expected.txt
LayoutTests/media/media-fullscreen.js
WebCore/ChangeLog
WebCore/html/HTMLMediaElement.cpp
WebCore/html/HTMLMediaElement.h
WebCore/html/HTMLMediaElement.idl
WebCore/html/HTMLVideoElement.cpp
WebCore/html/HTMLVideoElement.h
WebCore/html/HTMLVideoElement.idl

index a639c83..4989f15 100644 (file)
@@ -1,3 +1,19 @@
+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.
index 1a92ee3..de53c27 100644 (file)
@@ -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]
index 7d0f5dc..b1949ac 100644 (file)
@@ -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)
index f83ebdd..5be194c 100644 (file)
@@ -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
 
index fde255c..30d7254 100644 (file)
@@ -1,16 +1,19 @@
 
 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)
index f29e0cc..bd064ae 100644 (file)
@@ -1,3 +1,25 @@
+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.
index fbd88d6..aad8268 100644 (file)
@@ -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();
index 68b7ce4..2dd0514 100644 (file)
@@ -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; }
index 1097e55..865ca5b 100644 (file)
@@ -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;
 };
index 1fae354..994a829 100644 (file)
@@ -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
index 834ec4c..c49ba02 100644 (file)
@@ -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; }
 
index f43bf82..3d630b6 100644 (file)
@@ -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();
+
     };
 }