Changeset 112867 in webkit


Ignore:
Timestamp:
Apr 2, 2012 6:06:37 AM (12 years ago)
Author:
Philippe Normand
Message:

[GTK][WK2] Initial FullScreen support
https://bugs.webkit.org/show_bug.cgi?id=75553

Reviewed by Martin Robinson.

Full screen display support in WebKitWebViewBase. Two functions
have been added to handle this. They're called by the
WebFullScreenManagerProxy when full screen display needs to be
managed for an HTML element.

  • UIProcess/API/gtk/WebKitWebViewBase.cpp:

(_WebKitWebViewBasePrivate):
(webkitWebViewBaseCreateWebPage):
(onFullscreenGtkKeyPressEvent):
(webkitWebViewBaseEnterFullScreen):
(webkitWebViewBaseExitFullScreen):

  • UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
  • UIProcess/WebFullScreenManagerProxy.h:

(WebKit):

  • UIProcess/gtk/WebFullScreenManagerProxyGtk.cpp:

(WebKit::WebFullScreenManagerProxy::enterFullScreen):
(WebKit::WebFullScreenManagerProxy::exitFullScreen):

Location:
trunk/Source/WebKit2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r112862 r112867  
     12012-03-16  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GTK][WK2] Initial FullScreen support
     4        https://bugs.webkit.org/show_bug.cgi?id=75553
     5
     6        Reviewed by Martin Robinson.
     7
     8        Full screen display support in WebKitWebViewBase. Two functions
     9        have been added to handle this. They're called by the
     10        WebFullScreenManagerProxy when full screen display needs to be
     11        managed for an HTML element.
     12
     13        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
     14        (_WebKitWebViewBasePrivate):
     15        (webkitWebViewBaseCreateWebPage):
     16        (onFullscreenGtkKeyPressEvent):
     17        (webkitWebViewBaseEnterFullScreen):
     18        (webkitWebViewBaseExitFullScreen):
     19        * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
     20        * UIProcess/WebFullScreenManagerProxy.h:
     21        (WebKit):
     22        * UIProcess/gtk/WebFullScreenManagerProxyGtk.cpp:
     23        (WebKit::WebFullScreenManagerProxy::enterFullScreen):
     24        (WebKit::WebFullScreenManagerProxy::exitFullScreen):
     25
    1262012-04-02  Sheriff Bot  <webkit.review.bot@gmail.com>
    227
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp

    r111276 r112867  
    5353#include <WebCore/RefPtrCairo.h>
    5454#include <WebCore/Region.h>
     55#include <gdk/gdk.h>
     56#include <gdk/gdkkeysyms.h>
    5557#include <wtf/gobject/GOwnPtr.h>
    5658#include <wtf/gobject/GRefPtr.h>
    5759#include <wtf/text/CString.h>
     60
     61#if ENABLE(FULLSCREEN_API)
     62#include "WebFullScreenManagerProxy.h"
     63#endif
    5864
    5965using namespace WebKit;
     
    7379    GRefPtr<AtkObject> accessible;
    7480    bool needsResizeOnMap;
     81#if ENABLE(FULLSCREEN_API)
     82    bool fullScreenModeActive;
     83#endif
    7584};
    7685
     
    277286    WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
    278287    WebKitWebViewBasePrivate* priv = webViewBase->priv;
     288
     289#if ENABLE(FULLSCREEN_API)
     290    if (priv->fullScreenModeActive) {
     291        switch (event->keyval) {
     292        case GDK_KEY_Escape:
     293        case GDK_KEY_f:
     294        case GDK_KEY_F:
     295            webkitWebViewBaseExitFullScreen(webViewBase);
     296            break;
     297        default:
     298            break;
     299        }
     300
     301        return TRUE;
     302    }
     303#endif
    279304
    280305    // Since WebProcess key event handling is not synchronous, handle the event in two passes.
     
    530555    priv->pageProxy = toImpl(context)->createWebPage(priv->pageClient.get(), toImpl(pageGroup));
    531556    priv->pageProxy->initializeWebPage();
     557
     558#if ENABLE(FULLSCREEN_API)
     559    priv->pageProxy->fullScreenManager()->setWebView(webkitWebViewBase);
     560#endif
    532561}
    533562
     
    577606    webkitWebViewBase->priv->shouldForwardNextKeyEvent = TRUE;
    578607}
     608
     609void webkitWebViewBaseEnterFullScreen(WebKitWebViewBase* webkitWebViewBase)
     610{
     611#if ENABLE(FULLSCREEN_API)
     612    WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv;
     613    if (priv->fullScreenModeActive)
     614        return;
     615
     616    WebFullScreenManagerProxy* fullScreenManagerProxy = priv->pageProxy->fullScreenManager();
     617
     618    fullScreenManagerProxy->willEnterFullScreen();
     619
     620    GtkWidget* topLevelWindow = gtk_widget_get_toplevel(GTK_WIDGET(webkitWebViewBase));
     621    if (gtk_widget_is_toplevel(topLevelWindow))
     622        gtk_window_fullscreen(GTK_WINDOW(topLevelWindow));
     623    fullScreenManagerProxy->didEnterFullScreen();
     624    priv->fullScreenModeActive = true;
     625#endif
     626}
     627
     628void webkitWebViewBaseExitFullScreen(WebKitWebViewBase* webkitWebViewBase)
     629{
     630#if ENABLE(FULLSCREEN_API)
     631    WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv;
     632    if (!priv->fullScreenModeActive)
     633        return;
     634
     635    WebFullScreenManagerProxy* fullScreenManagerProxy = priv->pageProxy->fullScreenManager();
     636    fullScreenManagerProxy->willExitFullScreen();
     637
     638    GtkWidget* topLevelWindow = gtk_widget_get_toplevel(GTK_WIDGET(webkitWebViewBase));
     639    if (gtk_widget_is_toplevel(topLevelWindow))
     640        gtk_window_unfullscreen(GTK_WINDOW(topLevelWindow));
     641    fullScreenManagerProxy->didExitFullScreen();
     642    priv->fullScreenModeActive = false;
     643#endif
     644}
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h

    r97012 r112867  
    5151void webkitWebViewBaseStartDrag(WebKitWebViewBase*, const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage);
    5252
     53void webkitWebViewBaseEnterFullScreen(WebKitWebViewBase*);
     54void webkitWebViewBaseExitFullScreen(WebKitWebViewBase*);
     55
    5356G_END_DECLS
    5457
  • trunk/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h

    r110215 r112867  
    4545#if PLATFORM(MAC)
    4646OBJC_CLASS WKView;
     47#elif PLATFORM(GTK)
     48typedef struct _WebKitWebViewBase WebKitWebViewBase;
    4749#endif
    4850
     
    5860typedef QObject PlatformWebView;
    5961#elif PLATFORM(GTK)
    60 class WebView;
    61 typedef WebView PlatformWebView;
     62typedef WebKitWebViewBase PlatformWebView;
    6263#endif
    6364
  • trunk/Source/WebKit2/UIProcess/gtk/WebFullScreenManagerProxyGtk.cpp

    r110223 r112867  
    2626#include "WebFullScreenManagerMessages.h"
    2727#include "WebFullScreenManagerProxyMessages.h"
     28#include "WebKitWebViewBasePrivate.h"
    2829#include "WebProcess.h"
    29 
    3030#include <WebCore/NotImplemented.h>
    3131
     
    4141void WebFullScreenManagerProxy::enterFullScreen()
    4242{
    43     notImplemented();
     43    if (!m_webView)
     44        return;
     45
     46    webkitWebViewBaseEnterFullScreen(m_webView);
    4447}
    4548
    4649void WebFullScreenManagerProxy::exitFullScreen()
    4750{
    48     notImplemented();
     51    if (!m_webView)
     52        return;
     53
     54    webkitWebViewBaseExitFullScreen(m_webView);
    4955}
    5056
Note: See TracChangeset for help on using the changeset viewer.