Expose a flag so that fullscreen video on android can work with FULLSCREEN_API
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Apr 2012 20:27:35 +0000 (20:27 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Apr 2012 20:27:35 +0000 (20:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=84414

Patch by Min Qin <qinmin@google.com> on 2012-04-30
Reviewed by Darin Fisher.

Source/WebCore:

No tests, just exposing the flag, and will be used by android later.
Sorry, there is a merge error during the previous commit, resolved now

* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::setControls):
(WebCore):
(WebCore::MediaPlayer::enterFullscreen):
(WebCore::MediaPlayer::exitFullscreen):
* platform/graphics/MediaPlayer.h:
(MediaPlayer):
* platform/graphics/MediaPlayerPrivate.h:
(MediaPlayerPrivateInterface):
(WebCore::MediaPlayerPrivateInterface::enterFullscreen):

Source/WebKit/chromium:

On android, the fullscreen video was implemented by passing a java
surfaceView to an android mediaplayer class.
The implementation of that logic should happen in WebKit::WebMediaPlayer.
This change makes it possble for WebViewImpl::enterFullScreenForElement()
to call WebMediaPlayer->enterFullscreen(), thus solving the issue.

Sorry, there is a merge error during the previous commit, resolved now

No new tests. This just exposes the flag so later it can be used by android.

* features.gypi:
* public/WebMediaPlayer.h:
(WebMediaPlayer):
(WebKit::WebMediaPlayer::enterFullscreen):
(WebKit::WebMediaPlayer::exitFullscreen):
* src/WebMediaPlayerClientImpl.cpp:
(WebKit):
(WebKit::WebMediaPlayerClientImpl::enterFullscreen):
(WebKit::WebMediaPlayerClientImpl::exitFullscreen):
* src/WebMediaPlayerClientImpl.h:
(WebMediaPlayerClientImpl):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::enterFullScreenForElement):
(WebKit::WebViewImpl::exitFullScreenForElement):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@115661 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/MediaPlayer.cpp
Source/WebCore/platform/graphics/MediaPlayer.h
Source/WebCore/platform/graphics/MediaPlayerPrivate.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/features.gypi
Source/WebKit/chromium/public/WebMediaPlayer.h
Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h
Source/WebKit/chromium/src/WebViewImpl.cpp

index d157d6c..c3c7c63 100644 (file)
@@ -1,3 +1,24 @@
+2012-04-30  Min Qin  <qinmin@google.com>
+
+        Expose a flag so that fullscreen video on android can work with FULLSCREEN_API
+        https://bugs.webkit.org/show_bug.cgi?id=84414
+
+        Reviewed by Darin Fisher.
+
+        No tests, just exposing the flag, and will be used by android later.
+        Sorry, there is a merge error during the previous commit, resolved now
+
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::MediaPlayer::setControls):
+        (WebCore):
+        (WebCore::MediaPlayer::enterFullscreen):
+        (WebCore::MediaPlayer::exitFullscreen):
+        * platform/graphics/MediaPlayer.h:
+        (MediaPlayer):
+        * platform/graphics/MediaPlayerPrivate.h:
+        (MediaPlayerPrivateInterface):
+        (WebCore::MediaPlayerPrivateInterface::enterFullscreen):
+
 2012-04-30  Nate Chapin  <japhet@chromium.org>
 
         Move more of committing and starting to write a Document
 2012-04-30  Nate Chapin  <japhet@chromium.org>
 
         Move more of committing and starting to write a Document
index 1e81857..b141463 100644 (file)
@@ -766,17 +766,19 @@ void MediaPlayer::setMediaPlayerProxy(WebMediaPlayerProxy* proxy)
 void MediaPlayer::setControls(bool controls)
 {
     m_private->setControls(controls);
 void MediaPlayer::setControls(bool controls)
 {
     m_private->setControls(controls);
-}    
+}
+#endif
 
 
-void MediaPlayer::enterFullscreen()
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) || ENABLE(NATIVE_FULLSCREEN_VIDEO)
+bool MediaPlayer::enterFullscreen() const
 {
 {
-    m_private->enterFullscreen();
-}    
+    return m_private->enterFullscreen();
+}
 
 void MediaPlayer::exitFullscreen()
 {
     m_private->exitFullscreen();
 
 void MediaPlayer::exitFullscreen()
 {
     m_private->exitFullscreen();
-}    
+}
 #endif
 
 #if USE(ACCELERATED_COMPOSITING)
 #endif
 
 #if USE(ACCELERATED_COMPOSITING)
index 429e5fc..1f1e4b4 100644 (file)
@@ -324,7 +324,10 @@ public:
     void deliverNotification(MediaPlayerProxyNotificationType notification);
     void setMediaPlayerProxy(WebMediaPlayerProxy* proxy);
     void setControls(bool);
     void deliverNotification(MediaPlayerProxyNotificationType notification);
     void setMediaPlayerProxy(WebMediaPlayerProxy* proxy);
     void setControls(bool);
-    void enterFullscreen();
+#endif
+
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) || ENABLE(NATIVE_FULLSCREEN_VIDEO)
+    bool enterFullscreen() const;
     void exitFullscreen();
 #endif
 
     void exitFullscreen();
 #endif
 
index ff55d1b..6196215 100644 (file)
@@ -115,7 +115,10 @@ public:
     virtual void deliverNotification(MediaPlayerProxyNotificationType) = 0;
     virtual void setMediaPlayerProxy(WebMediaPlayerProxy*) = 0;
     virtual void setControls(bool) { }
     virtual void deliverNotification(MediaPlayerProxyNotificationType) = 0;
     virtual void setMediaPlayerProxy(WebMediaPlayerProxy*) = 0;
     virtual void setControls(bool) { }
-    virtual void enterFullscreen() { }
+#endif
+
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) || ENABLE(NATIVE_FULLSCREEN_VIDEO)
+    virtual bool enterFullscreen() const { return false; }
     virtual void exitFullscreen() { }
 #endif
 
     virtual void exitFullscreen() { }
 #endif
 
index 9a6b840..8b2f18a 100644 (file)
@@ -1,3 +1,35 @@
+2012-04-30  Min Qin  <qinmin@google.com>
+
+        Expose a flag so that fullscreen video on android can work with FULLSCREEN_API
+        https://bugs.webkit.org/show_bug.cgi?id=84414
+
+        Reviewed by Darin Fisher.
+
+        On android, the fullscreen video was implemented by passing a java
+        surfaceView to an android mediaplayer class.
+        The implementation of that logic should happen in WebKit::WebMediaPlayer.
+        This change makes it possble for WebViewImpl::enterFullScreenForElement()
+        to call WebMediaPlayer->enterFullscreen(), thus solving the issue.
+
+        Sorry, there is a merge error during the previous commit, resolved now
+
+        No new tests. This just exposes the flag so later it can be used by android.
+
+        * features.gypi:
+        * public/WebMediaPlayer.h:
+        (WebMediaPlayer):
+        (WebKit::WebMediaPlayer::enterFullscreen):
+        (WebKit::WebMediaPlayer::exitFullscreen):
+        * src/WebMediaPlayerClientImpl.cpp:
+        (WebKit):
+        (WebKit::WebMediaPlayerClientImpl::enterFullscreen):
+        (WebKit::WebMediaPlayerClientImpl::exitFullscreen):
+        * src/WebMediaPlayerClientImpl.h:
+        (WebMediaPlayerClientImpl):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::enterFullScreenForElement):
+        (WebKit::WebViewImpl::exitFullScreenForElement):
+
 2012-04-30  Gavin Peters  <gavinp@chromium.org>
 
         Unreviewed.  Rolled DEPS.
 2012-04-30  Gavin Peters  <gavinp@chromium.org>
 
         Unreviewed.  Rolled DEPS.
index 5fb2e9f..9aaee70 100644 (file)
       ['OS=="android"', {
         'feature_defines': [
           'ENABLE_CALENDAR_PICKER=0',
       ['OS=="android"', {
         'feature_defines': [
           'ENABLE_CALENDAR_PICKER=0',
+          'ENABLE_NATIVE_FULLSCREEN_VIDEO=1',
           'ENABLE_PAGE_POPUP=0',
           'ENABLE_WEB_AUDIO=0',
         ],
       }, {
         'feature_defines': [
           'ENABLE_CALENDAR_PICKER=1',
           'ENABLE_PAGE_POPUP=0',
           'ENABLE_WEB_AUDIO=0',
         ],
       }, {
         'feature_defines': [
           'ENABLE_CALENDAR_PICKER=1',
+          'ENABLE_NATIVE_FULLSCREEN_VIDEO=0',
           'ENABLE_PAGE_POPUP=1',
           'ENABLE_WEB_AUDIO=1',
         ],
           'ENABLE_PAGE_POPUP=1',
           'ENABLE_WEB_AUDIO=1',
         ],
index c3a48c7..a2a9fb9 100644 (file)
@@ -183,6 +183,11 @@ public:
     virtual MediaKeyException generateKeyRequest(const WebString& keySystem, const unsigned char* initData, unsigned initDataLength) { return MediaKeyExceptionKeySystemNotSupported; }
     virtual MediaKeyException addKey(const WebString& keySystem, const unsigned char* key, unsigned keyLength, const unsigned char* initData, unsigned initDataLength, const WebString& sessionId) { return MediaKeyExceptionKeySystemNotSupported; }
     virtual MediaKeyException cancelKeyRequest(const WebString& keySystem, const WebString& sessionId) { return MediaKeyExceptionKeySystemNotSupported; }
     virtual MediaKeyException generateKeyRequest(const WebString& keySystem, const unsigned char* initData, unsigned initDataLength) { return MediaKeyExceptionKeySystemNotSupported; }
     virtual MediaKeyException addKey(const WebString& keySystem, const unsigned char* key, unsigned keyLength, const unsigned char* initData, unsigned initDataLength, const WebString& sessionId) { return MediaKeyExceptionKeySystemNotSupported; }
     virtual MediaKeyException cancelKeyRequest(const WebString& keySystem, const WebString& sessionId) { return MediaKeyExceptionKeySystemNotSupported; }
+
+    // Instuct WebMediaPlayer to enter/exit fullscreen.
+    // Returns true if the player can enter fullscreen.
+    virtual bool enterFullscreen() { return false; }
+    virtual void exitFullscreen() { }
 };
 
 } // namespace WebKit
 };
 
 } // namespace WebKit
index 58b6396..958474e 100644 (file)
@@ -339,6 +339,21 @@ void WebMediaPlayerClientImpl::pause()
         m_webMediaPlayer->pause();
 }
 
         m_webMediaPlayer->pause();
 }
 
+#if ENABLE(NATIVE_FULLSCREEN_VIDEO)
+bool WebMediaPlayerClientImpl::enterFullscreen() const
+{
+    if (m_webMediaPlayer)
+        return m_webMediaPlayer->enterFullscreen();
+    return false;
+}
+
+void WebMediaPlayerClientImpl::exitFullscreen()
+{
+    if (m_webMediaPlayer)
+        m_webMediaPlayer->exitFullscreen();
+}
+#endif
+
 #if ENABLE(MEDIA_SOURCE)
 WebCore::MediaPlayer::AddIdStatus WebMediaPlayerClientImpl::sourceAddId(const String& id, const String& type)
 {
 #if ENABLE(MEDIA_SOURCE)
 WebCore::MediaPlayer::AddIdStatus WebMediaPlayerClientImpl::sourceAddId(const String& id, const String& type)
 {
index 2e9e083..d462cfa 100644 (file)
@@ -134,6 +134,10 @@ public:
     virtual unsigned droppedFrameCount() const;
     virtual unsigned audioDecodedByteCount() const;
     virtual unsigned videoDecodedByteCount() const;
     virtual unsigned droppedFrameCount() const;
     virtual unsigned audioDecodedByteCount() const;
     virtual unsigned videoDecodedByteCount() const;
+#if ENABLE(NATIVE_FULLSCREEN_VIDEO)
+    virtual bool enterFullscreen() const;
+    virtual void exitFullscreen();
+#endif
 
 #if ENABLE(WEB_AUDIO)
     virtual WebCore::AudioSourceProvider* audioSourceProvider();
 
 #if ENABLE(WEB_AUDIO)
     virtual WebCore::AudioSourceProvider* audioSourceProvider();
index 32c61a2..d6353c2 100644 (file)
@@ -1581,6 +1581,15 @@ void WebViewImpl::enterFullScreenForElement(WebCore::Element* element)
         return;
     }
 
         return;
     }
 
+#if ENABLE(NATIVE_FULLSCREEN_VIDEO)
+    if (element && element->isMediaElement()) {
+        HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(element);
+        if (mediaElement->player() && mediaElement->player()->enterFullscreen())
+            m_provisionalFullScreenElement = element;
+        return;
+    }
+#endif
+
     // We need to transition to fullscreen mode.
     if (m_client && m_client->enterFullScreen())
         m_provisionalFullScreenElement = element;
     // We need to transition to fullscreen mode.
     if (m_client && m_client->enterFullScreen())
         m_provisionalFullScreenElement = element;
@@ -1591,6 +1600,14 @@ void WebViewImpl::exitFullScreenForElement(WebCore::Element* element)
     // The client is exiting full screen, so don't send a notification.
     if (m_isCancelingFullScreen)
         return;
     // The client is exiting full screen, so don't send a notification.
     if (m_isCancelingFullScreen)
         return;
+#if ENABLE(NATIVE_FULLSCREEN_VIDEO)
+    if (element && element->isMediaElement()) {
+        HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(element);
+        if (mediaElement->player())
+            mediaElement->player()->exitFullscreen();
+        return;
+    }
+#endif
     if (m_client)
         m_client->exitFullScreen();
 }
     if (m_client)
         m_client->exitFullScreen();
 }