Changeset 85699 in webkit


Ignore:
Timestamp:
May 3, 2011 6:28:38 PM (13 years ago)
Author:
jer.noble@apple.com
Message:

2011-05-02 Jer Noble <jer.noble@apple.com>

Reviewed by Adam Roben.

Implement FULLSCREEN_API on Windows, Part 3: WebKit2
https://bugs.webkit.org/show_bug.cgi?id=59845

Move WebFullScreenController into WebCore to facilitate code sharing between WebKit
and WebKit2. WebFullScreenController now uses a Client class to request work on its
behalf by WebKit and WebKit2. MediaPlayerPrivateFullscreenWindow now only creates a
CALayerHost once a root layer is set, as the CALayerHost was causing child window drawing
problems, and because a CALayerHost is overkill if the window is only drawing black to
its client area.

  • WebCore.vcproj/WebCore.vcproj:
  • platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp: (WebCore::MediaPlayerPrivateFullscreenWindow::MediaPlayerPrivateFullscreenWindow): Do not create

m_layerHost in the constructor.

(WebCore::MediaPlayerPrivateFullscreenWindow::createWindow): NULL check m_layerHost.
(WebCore::MediaPlayerPrivateFullscreenWindow::setRootChildLayer): Lazily instantiate m_layerHost.
(WebCore::MediaPlayerPrivateFullscreenWindow::wndProc): NULL check m_layerHost; if a root layer is

not present, fill the window with black in WM_PAINT.

  • platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h:
  • platform/graphics/win/FullScreenController.cpp: Renamed from Source/WebKit/win/WebFullScreenController.cpp.
  • platform/graphics/win/FullScreenController.h: Renamed from Source/WebKit/win/WebFullScreenController.h.
  • platform/graphics/win/FullScreenControllerClient.h: Split out from FullScreenController.h (WebCore::FullScreenControllerClient::~FullScreenControllerClient):

2011-05-02 Jer Noble <jer.noble@apple.com>

Reviewed by Adam Roben.

Implement FULLSCREEN_API on Windows, Part 3: WebKit2
https://bugs.webkit.org/show_bug.cgi?id=59845

Implementation of WebFullScreenController has been moved into WebCore, and
required virutal functions of WebFullScreenControllerClient have been added to
WebView. These functions are mostly simple accessors of existing ivars, but
m_fullScreenElement and its accessors have also been added to WebView.

  • WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::enterFullScreenForElement):
  • WebFullScreenController.cpp: Removed.
  • WebKit.vcproj/WebKit.vcproj:
  • WebView.cpp: (WebView::setFullScreenElement): Added accessor. (WebVIew::fullScreenElement): Ditto. (WebView::fullScreenClientWindow): Ditto. (WebView::fullScreenClientParentWindow): Ditto. (WebView::fullScreenClientSetParentWindow): Ditto. (WebView::fullScreenClientWillEnterFullScreen): Pass through to Document. (WebView::fullScreenClientDidEnterFullScreen): Ditto. (WebView::fullScreenClientWillExitFullScreen): Ditto. (WebView::fullScreenClientDidExitFullScreen): Ditto.
  • WebView.h:

2011-05-02 Jer Noble <jer.noble@apple.com>

Reviewed by Adam Roben.

Implement FULLSCREEN_API on Windows, Part 3: WebKit2
https://bugs.webkit.org/show_bug.cgi?id=59845

Implement a similar full screen mode to WebKit; Re-use the same
full screen window class used in WebKit in the new WebFullScreenController.
No animations (yet), so many of the stubs remain unimplemented.

  • UIProcess/win/WebView.cpp: (WebKit::WebView::onKeyEvent): Handle VK_ESCAPE and cancel full screen

mode if caught.

(WebKit::WebView::fullScreenController): Lazily instantiate m_fullScreenController.
(WebKit::WebView::fullScreenClientWindow): Added accessor.
(WebKit::WebView::fullScreenClientParentWindow): Ditto.
(WebKit::WebView::fullScreenClientSetParentWindow): Ditto.
(WebKit::WebView::fullScreenClientWillEnterFullScreen): Pass through to WebFullScreenManagerProxy.
(WebKit::WebView::fullScreenClientDidEnterFullScreen): Ditto.
(WebKit::WebView::fullScreenClientWillExitFullScreen): Ditto.
(WebKit::WebView::fullScreenClientDidExitFullScreen): Ditto.

  • UIProcess/win/WebView.h:
  • UIProcess/win/WebFullScreenManagerProxyWin.cpp: (WebKit::WebFullScreenManagerProxy::enterFullScreen): Pass through to

WebFullScreenController.

(WebKit::WebFullScreenManagerProxy::exitFullScreen): Ditto.

  • UIProcess/win/WebView.cpp: (WebKit::WebView::WebView): (WebKit::WebView::onKeyEvent): Handle the escape key and exit

full screen mode when detected.

(WebKit::WebView::fullScreenWindowController): Added.

  • UIProcess/win/WebView.h:
  • WebProcess/FullScreen/win/WebFullScreenManagerWin.cpp: (WebKit::WebFullScreenManagerWin::~WebFullScreenManagerWin): (WebKit::WebFullScreenManagerWin::setRootFullScreenLayer): Host the root

full screen layer if it gets detached.

  • WebProcess/FullScreen/win/WebFullScreenManagerWin.h:
  • win/WebKit2.vcproj:
Location:
trunk/Source
Files:
1 added
1 deleted
15 edited
1 copied
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r85697 r85699  
     12011-05-02  Jer Noble  <jer.noble@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        Implement FULLSCREEN_API on Windows, Part 3: WebKit2
     6        https://bugs.webkit.org/show_bug.cgi?id=59845
     7
     8        Move WebFullScreenController into WebCore to facilitate code sharing between WebKit
     9        and WebKit2.  WebFullScreenController now uses a Client class to request work on its
     10        behalf by WebKit and WebKit2.  MediaPlayerPrivateFullscreenWindow now only creates a
     11        CALayerHost once a root layer is set, as the CALayerHost was causing child window drawing
     12        problems, and because a CALayerHost is overkill if the window is only drawing black to
     13        its client area.
     14
     15        * WebCore.vcproj/WebCore.vcproj:
     16        * platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp:
     17        (WebCore::MediaPlayerPrivateFullscreenWindow::MediaPlayerPrivateFullscreenWindow): Do not create
     18            m_layerHost in the constructor.
     19        (WebCore::MediaPlayerPrivateFullscreenWindow::createWindow): NULL check m_layerHost.
     20        (WebCore::MediaPlayerPrivateFullscreenWindow::setRootChildLayer): Lazily instantiate m_layerHost.
     21        (WebCore::MediaPlayerPrivateFullscreenWindow::wndProc): NULL check m_layerHost; if a root layer is
     22            not present, fill the window with black in WM_PAINT.
     23        * platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h:
     24        * platform/graphics/win/FullScreenController.cpp: Renamed from Source/WebKit/win/WebFullScreenController.cpp.
     25        * platform/graphics/win/FullScreenController.h: Renamed from Source/WebKit/win/WebFullScreenController.h.
     26        * platform/graphics/win/FullScreenControllerClient.h: Split out from FullScreenController.h
     27        (WebCore::FullScreenControllerClient::~FullScreenControllerClient):
     28
    1292011-05-03  Brady Eidson  <beidson@apple.com>
    230
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r85382 r85699  
    2472224722                                >
    2472324723                        </File>
    24724                         <File
    24725                                 RelativePath="..\page\PageSerializer.cpp"
    24726                                 >
    24727                         </File>
    24728                         <File
    24729                                 RelativePath="..\page\PageSerializer.h"
    24730                                 >
    24731                         </File>
     24724                        <File
     24725                                RelativePath="..\page\PageSerializer.cpp"
     24726                                >
     24727                        </File>
     24728                        <File
     24729                                RelativePath="..\page\PageSerializer.h"
     24730                                >
     24731                        </File>
    2473224732                        <File
    2473324733                                RelativePath="..\page\Performance.cpp"
     
    2711427114                                        <File
    2711527115                                                RelativePath="..\platform\graphics\win\FontWin.cpp"
     27116                                                >
     27117                                        </File>
     27118                                        <File
     27119                                                RelativePath="..\platform\graphics\win\FullScreenController.cpp"
     27120                                                >
     27121                                        </File>
     27122                                        <File
     27123                                                RelativePath="..\platform\graphics\win\FullScreenController.h"
     27124                                                >
     27125                                        </File>
     27126                                        <File
     27127                                                RelativePath="..\platform\graphics\win\FullScreenControllerClient.h"
    2711627128                                                >
    2711727129                                        </File>
     
    2895328965                                        </File>
    2895428966                                        <File
     28967                                                RelativePath="..\platform\graphics\filters\arm\FEGaussianBlurNEON.cpp"
     28968                                                >
     28969                                        </File>
     28970                                        <File
     28971                                                RelativePath="..\platform\graphics\filters\arm\FEGaussianBlurNEON.h"
     28972                                                >
     28973                                        </File>
     28974                                        <File
    2895528975                                                RelativePath="..\platform\graphics\filters\FELighting.cpp"
    2895628976                                                >
     
    2896128981                                        </File>
    2896228982                                        <File
     28983                                                RelativePath="..\platform\graphics\filters\arm\FELightingNEON.cpp"
     28984                                                >
     28985                                        </File>
     28986                                        <File
     28987                                                RelativePath="..\platform\graphics\filters\arm\FELightingNEON.h"
     28988                                                >
     28989                                        </File>
     28990                                        <File
    2896328991                                                RelativePath="..\platform\graphics\filters\FEMerge.cpp"
    2896428992                                                >
     
    2905829086                                        <File
    2905929087                                                RelativePath="..\platform\graphics\filters\SpotLightSource.h"
    29060                                                 >
    29061                                         </File>
    29062                                         <File
    29063                                                 RelativePath="..\platform\graphics\filters\arm\FEGaussianBlurNEON.cpp"
    29064                                                 >
    29065                                         </File>
    29066                                         <File
    29067                                                 RelativePath="..\platform\graphics\filters\arm\FEGaussianBlurNEON.h"
    29068                                                 >
    29069                                         </File>
    29070                                         <File
    29071                                                 RelativePath="..\platform\graphics\filters\arm\FELightingNEON.cpp"
    29072                                                 >
    29073                                         </File>
    29074                                         <File
    29075                                                 RelativePath="..\platform\graphics\filters\arm\FELightingNEON.h"
    2907629088                                                >
    2907729089                                        </File>
     
    4270742719                        </File>
    4270842720                        <File
     42721                                RelativePath="..\dom\DataTransferItem.h"
     42722                                >
     42723                        </File>
     42724                        <File
    4270942725                                RelativePath="..\dom\DataTransferItems.cpp"
    4271042726                                >
     
    4275742773                                        />
    4275842774                                </FileConfiguration>
    42759                         </File>
    42760                         <File
    42761                                 RelativePath="..\dom\DataTransferItem.h"
    42762                                 >
    4276342775                        </File>
    4276442776                        <File
     
    6670666718                                </File>
    6670766719                                <File
     66720                                        RelativePath="..\inspector\front-end\UglifyJS\JavaScriptFormatter.js"
     66721                                        >
     66722                                </File>
     66723                                <File
    6670866724                                        RelativePath="..\inspector\front-end\JavaScriptFormatter.js"
    6670966725                                        >
     
    6674766763                                <File
    6674866764                                        RelativePath="..\inspector\front-end\PanelEnablerView.js"
    66749                                         >
    66750                                 </File>
    66751                                 <File
    66752                                         RelativePath="..\inspector\front-end\UglifyJS\JavaScriptFormatter.js"
    6675366765                                        >
    6675466766                                </File>
  • trunk/Source/WebCore/platform/graphics/win/FullScreenController.h

    r85697 r85699  
    2929#if ENABLE(FULLSCREEN_API)
    3030
    31 #include "WebKit.h"
    3231#include <wtf/OwnPtr.h>
    33 #include <wtf/RefPtr.h>
    3432
    3533namespace WebCore {
    36     class Element;
    37 }
    3834
    39 class WebView;
     35class FullScreenControllerClient;
    4036
    41 class WebFullScreenController {
     37class FullScreenController {
    4238public:
    43     WebFullScreenController(WebView*);
    44     ~WebFullScreenController();
     39    FullScreenController(FullScreenControllerClient*);
     40    ~FullScreenController();
    4541
    4642public:
    47     void setElement(PassRefPtr<WebCore::Element>);
    48     WebCore::Element* element() const;
    49 
    5043    void enterFullScreen();
    5144    void exitFullScreen();
     
    5649    class Private;
    5750    friend class Private;
    58     OwnPtr<WebFullScreenController::Private> m_private;
     51    OwnPtr<FullScreenController::Private> m_private;
    5952};
     53
     54}
    6055
    6156#endif
  • trunk/Source/WebCore/platform/graphics/win/FullScreenControllerClient.h

    r85697 r85699  
    2424 */
    2525
    26 #ifndef WebFullScreenController_h
    27 #define WebFullScreenController_h
     26#ifndef FullScreenControllerClient_h
     27#define FullScreenControllerClient_h
    2828
    2929#if ENABLE(FULLSCREEN_API)
    3030
    31 #include "WebKit.h"
    32 #include <wtf/OwnPtr.h>
    33 #include <wtf/RefPtr.h>
     31namespace WebCore {
    3432
    35 namespace WebCore {
    36     class Element;
     33class FullScreenControllerClient {
     34public:
     35    virtual HWND fullScreenClientWindow() const = 0;
     36    virtual HWND fullScreenClientParentWindow() const = 0;
     37    virtual void fullScreenClientSetParentWindow(HWND) = 0;
     38    virtual void fullScreenClientWillEnterFullScreen() = 0;
     39    virtual void fullScreenClientDidEnterFullScreen() = 0;
     40    virtual void fullScreenClientWillExitFullScreen() = 0;
     41    virtual void fullScreenClientDidExitFullScreen() = 0;
     42protected:
     43    virtual ~FullScreenControllerClient() { }
     44};
     45
    3746}
    38 
    39 class WebView;
    40 
    41 class WebFullScreenController {
    42 public:
    43     WebFullScreenController(WebView*);
    44     ~WebFullScreenController();
    45 
    46 public:
    47     void setElement(PassRefPtr<WebCore::Element>);
    48     WebCore::Element* element() const;
    49 
    50     void enterFullScreen();
    51     void exitFullScreen();
    52    
    53     bool isFullScreen() const;
    54 
    55 protected:
    56     class Private;
    57     friend class Private;
    58     OwnPtr<WebFullScreenController::Private> m_private;
    59 };
    6047
    6148#endif
  • trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp

    r84101 r85699  
    4545    : m_client(client)
    4646    , m_hwnd(0)
    47 #if USE(ACCELERATED_COMPOSITING)
    48     , m_layerTreeHost(CACFLayerTreeHost::create())
    49 #endif
    5047{
    5148}
     
    8380    IntRect monitorRect = mi.rcMonitor;
    8481   
    85     ::CreateWindowExW(WS_EX_TOOLWINDOW, windowClassName, L"", WS_POPUP | WS_VISIBLE,
     82    ::CreateWindowExW(WS_EX_TOOLWINDOW, windowClassName, L"", WS_POPUP,
    8683        monitorRect.x(), monitorRect.y(), monitorRect.width(), monitorRect.height(),
    8784        parentHwnd, 0, WebCore::instanceHandle(), this);
     
    8986
    9087#if USE(ACCELERATED_COMPOSITING)
    91     m_layerTreeHost->setWindow(m_hwnd);
     88    if (m_layerTreeHost)
     89        m_layerTreeHost->setWindow(m_hwnd);
    9290#endif
    9391
     
    106104    m_rootChild = rootChild;
    107105
    108     if (!m_rootChild)
    109         return;
     106    if (!m_rootChild) {
     107        m_layerTreeHost = nullptr;
     108        return;
     109    }
     110
     111    if (!m_layerTreeHost) {
     112        m_layerTreeHost = CACFLayerTreeHost::create();
     113        if (m_hwnd)
     114            m_layerTreeHost->setWindow(m_hwnd);
     115    }
    110116
    111117    m_layerTreeHost->setRootChildLayer(m_rootChild.get());
     
    149155        m_hwnd = 0;
    150156#if USE(ACCELERATED_COMPOSITING)
    151         m_layerTreeHost->setWindow(0);
     157        if (m_layerTreeHost)
     158            m_layerTreeHost->setWindow(0);
    152159#endif
    153160        break;
     
    158165                break;
    159166#if USE(ACCELERATED_COMPOSITING)
    160             m_layerTreeHost->resize();
    161             PlatformCALayer* rootLayer = m_rootChild->rootLayer();
    162             CGRect rootBounds = m_rootChild->rootLayer()->bounds();
    163             m_rootChild->setFrame(rootBounds);
    164             m_rootChild->setNeedsLayout();
     167            if (m_layerTreeHost) {
     168                m_layerTreeHost->resize();
     169                PlatformCALayer* rootLayer = m_rootChild->rootLayer();
     170                CGRect rootBounds = m_rootChild->rootLayer()->bounds();
     171                m_rootChild->setFrame(rootBounds);
     172                m_rootChild->setNeedsLayout();
     173            }
    165174#endif
    166175        }
     
    168177    case WM_PAINT:
    169178#if USE(ACCELERATED_COMPOSITING)
    170         m_layerTreeHost->paint();
    171         ::ValidateRect(m_hwnd, 0);
    172 #endif
    173         break;
    174     }
    175 
     179        if (m_layerTreeHost) {
     180            m_layerTreeHost->paint();
     181            ::ValidateRect(m_hwnd, 0);
     182        } else
     183#endif
     184        {
     185            PAINTSTRUCT ps;
     186            HDC hdc = ::BeginPaint(m_hwnd, &ps);
     187            ::FillRect(hdc, &ps.rcPaint, (HBRUSH)::GetStockObject(BLACK_BRUSH));
     188            ::EndPaint(m_hwnd, &ps);
     189        }
     190        break;
     191    case WM_PRINTCLIENT:
     192        {
     193            RECT clientRect;
     194            HDC context = (HDC)wParam;
     195            ::GetClientRect(m_hwnd, &clientRect);
     196            ::FillRect(context, &clientRect, (HBRUSH)::GetStockObject(BLACK_BRUSH));
     197        }
     198    }
    176199    if (m_client)
    177200        lResult = m_client->fullscreenClientWndProc(hWnd, message, wParam, lParam);
  • trunk/Source/WebKit/win/ChangeLog

    r85691 r85699  
     12011-05-02  Jer Noble  <jer.noble@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        Implement FULLSCREEN_API on Windows, Part 3: WebKit2
     6        https://bugs.webkit.org/show_bug.cgi?id=59845
     7
     8        Implementation of WebFullScreenController has been moved into WebCore, and
     9        required virutal functions of WebFullScreenControllerClient have been added to
     10        WebView.  These functions are mostly simple accessors of existing ivars, but
     11        m_fullScreenElement and its accessors have also been added to WebView.
     12
     13        * WebCoreSupport/WebChromeClient.cpp:
     14        (WebChromeClient::enterFullScreenForElement):
     15        * WebFullScreenController.cpp: Removed.
     16        * WebKit.vcproj/WebKit.vcproj:
     17        * WebView.cpp:
     18        (WebView::setFullScreenElement): Added accessor.
     19        (WebVIew::fullScreenElement): Ditto.
     20        (WebView::fullScreenClientWindow): Ditto.
     21        (WebView::fullScreenClientParentWindow): Ditto.
     22        (WebView::fullScreenClientSetParentWindow): Ditto.
     23        (WebView::fullScreenClientWillEnterFullScreen): Pass through to Document.
     24        (WebView::fullScreenClientDidEnterFullScreen): Ditto.
     25        (WebView::fullScreenClientWillExitFullScreen): Ditto.
     26        (WebView::fullScreenClientDidExitFullScreen): Ditto.
     27        * WebView.h:
     28
    1292011-05-03  Brian Weinstein  <bweinstein@apple.com>
    230
  • trunk/Source/WebKit/win/FullscreenVideoController.cpp

    r85653 r85699  
    278278
    279279    m_fullscreenWindow->createWindow(parentHwnd);
     280    ::ShowWindow(m_fullscreenWindow->hwnd(), SW_SHOW);
    280281#if USE(ACCELERATED_COMPOSITING)
    281282    m_fullscreenWindow->setRootChildLayer(m_rootChild);
  • trunk/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp

    r85393 r85699  
    3636#include "WebMutableURLRequest.h"
    3737#include "WebDesktopNotificationsDelegate.h"
    38 #include "WebFullScreenController.h"
    3938#include "WebSecurityOrigin.h"
    4039#include "WebView.h"
     
    4746#include <WebCore/FrameLoadRequest.h>
    4847#include <WebCore/FrameView.h>
     48#include <WebCore/FullScreenController.h>
    4949#include <WebCore/HTMLNames.h>
    5050#include <WebCore/Icon.h>
     
    905905    }
    906906
    907     m_webView->fullScreenController()->setElement(element);
     907    m_webView->setFullScreenElement(element);
    908908    m_webView->fullScreenController()->enterFullScreen();
    909909}
     
    919919    }
    920920
    921     ASSERT(element == m_webView->fullScreenController()->element());
     921    ASSERT(element == m_webView->fullScreenElement());
    922922    m_webView->fullScreenController()->exitFullScreen();
    923923}
  • trunk/Source/WebKit/win/WebKit.vcproj/WebKit.vcproj

    r85393 r85699  
    513513                        </File>
    514514                        <File
    515                                 RelativePath="..\WebFullScreenController.h"
    516                                 >
    517                         </File>
    518                         <File
    519515                                RelativePath="..\WebGeolocationPolicyListener.h"
    520516                                >
     
    930926                        <File
    931927                                RelativePath="..\WebFramePolicyListener.cpp"
    932                                 >
    933                         </File>
    934                         <File
    935                                 RelativePath="..\WebFullScreenController.cpp"
    936928                                >
    937929                        </File>
  • trunk/Source/WebKit/win/WebView.cpp

    r85684 r85699  
    163163
    164164#if ENABLE(FULLSCREEN_API)
    165 #include "WebFullScreenController.h"
     165#include <WebCore/FullScreenController.h>
    166166#endif
    167167
     
    67766776}
    67776777
    6778 WebFullScreenController* WebView::fullScreenController()
     6778FullScreenController* WebView::fullScreenController()
    67796779{
    67806780    if (!m_fullscreenController)
    6781         m_fullscreenController = adoptPtr(new WebFullScreenController(this));
     6781        m_fullscreenController = adoptPtr(new FullScreenController(this));
    67826782    return m_fullscreenController.get();
    67836783}
     6784
     6785void WebView::setFullScreenElement(PassRefPtr<Element> element)
     6786{
     6787    m_fullScreenElement = element;
     6788}
     6789
     6790HWND WebView::fullScreenClientWindow() const
     6791{
     6792    return m_viewWindow;
     6793}
     6794
     6795HWND WebView::fullScreenClientParentWindow() const
     6796{
     6797    return m_hostWindow;
     6798}
     6799
     6800void WebView::fullScreenClientSetParentWindow(HWND hostWindow)
     6801{
     6802    setHostWindow(reinterpret_cast<OLE_HANDLE>(hostWindow));
     6803}
     6804
     6805void WebView::fullScreenClientWillEnterFullScreen()
     6806{
     6807    ASSERT(m_fullScreenElement);
     6808    m_fullScreenElement->document()->webkitWillEnterFullScreenForElement(m_fullScreenElement.get());
     6809}
     6810
     6811void WebView::fullScreenClientDidEnterFullScreen()
     6812{
     6813    ASSERT(m_fullScreenElement);
     6814    m_fullScreenElement->document()->webkitDidEnterFullScreenForElement(m_fullScreenElement.get());
     6815}
     6816
     6817void WebView::fullScreenClientWillExitFullScreen()
     6818{
     6819    ASSERT(m_fullScreenElement);
     6820    m_fullScreenElement->document()->webkitWillExitFullScreenForElement(m_fullScreenElement.get());
     6821}
     6822
     6823void WebView::fullScreenClientDidExitFullScreen()
     6824{
     6825    ASSERT(m_fullScreenElement);
     6826    m_fullScreenElement->document()->webkitDidExitFullScreenForElement(m_fullScreenElement.get());
     6827    m_fullScreenElement = nullptr;
     6828}
     6829
     6830
    67846831#endif
  • trunk/Source/WebKit/win/WebView.h

    r85684 r85699  
    1515 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
    1616 * EXPRESS OR IMPLIED WARRANTIES, INCfLUDING, BUT NOT LIMITED TO, THE
    17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     17 * IMPLIED WARRANTIES OF MERCHANTABIuLITY AND FITNESS FOR A PARTICULAR
    1818 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
    1919 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     
    4545#include <WebCore/CACFLayerTreeHostClient.h>
    4646#include <WebCore/GraphicsLayerClient.h>
     47#endif
     48
     49#if ENABLE(FULLSCREEN_API)
     50#include <WebCore/FullScreenControllerClient.h>
     51#endif
    4752
    4853namespace WebCore {
     54#if USE(ACCELERATED_COMPOSITING)
    4955    class CACFLayerTreeHost;
     56#endif
     57    class FullScreenController;
    5058}
    51 #endif
    5259
    5360namespace WebCore {
     
    5865class WebBackForwardList;
    5966class WebFrame;
    60 class WebFullScreenController;
    6167class WebInspector;
    6268class WebInspectorClient;
    63 
    64 #if ENABLE(FULLSCREEN_API)
    65 class WebFullScreenController;
    66 #endif
    6769
    6870typedef WebCore::RefCountedGDIHandle<HBITMAP> RefCountedHBITMAP;
     
    8890    , WebCore::GraphicsLayerClient
    8991    , WebCore::CACFLayerTreeHostClient
     92#endif
     93#if ENABLE(FULLSCREEN_API)
     94    , WebCore::FullScreenControllerClient
    9095#endif
    9196{
     
    951956    bool supportsFullScreenForElement(const WebCore::Element*, bool withKeyboard) const;
    952957    bool isFullScreen() const;
    953     WebFullScreenController* fullScreenController();
     958    WebCore::FullScreenController* fullScreenController();
     959    void setFullScreenElement(PassRefPtr<WebCore::Element>);
     960    WebCore::Element* fullScreenElement() const { return m_fullScreenElement.get(); }
    954961#endif
    955962
     
    10161023
    10171024    virtual void windowReceivedMessage(HWND, UINT message, WPARAM, LPARAM);
     1025
     1026#if ENABLE(FULLSCREEN_API)
     1027    virtual HWND fullScreenClientWindow() const;
     1028    virtual HWND fullScreenClientParentWindow() const;
     1029    virtual void fullScreenClientSetParentWindow(HWND);
     1030    virtual void fullScreenClientWillEnterFullScreen();
     1031    virtual void fullScreenClientDidEnterFullScreen();
     1032    virtual void fullScreenClientWillExitFullScreen();
     1033    virtual void fullScreenClientDidExitFullScreen();
     1034#endif
    10181035
    10191036    ULONG m_refCount;
     
    11101127
    11111128#if ENABLE(FULLSCREEN_API)
    1112     OwnPtr<WebFullScreenController> m_fullscreenController;
     1129    RefPtr<WebCore::Element> m_fullScreenElement;
     1130    OwnPtr<WebCore::FullScreenController> m_fullscreenController;
    11131131#endif
    11141132};
  • trunk/Source/WebKit2/ChangeLog

    r85697 r85699  
     12011-05-02  Jer Noble  <jer.noble@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        Implement FULLSCREEN_API on Windows, Part 3: WebKit2
     6        https://bugs.webkit.org/show_bug.cgi?id=59845
     7
     8        Implement a similar full screen mode to WebKit; Re-use the same
     9        full screen window class used in WebKit in the new WebFullScreenController.
     10        No animations (yet), so many of the stubs remain unimplemented.
     11
     12        * UIProcess/win/WebView.cpp:
     13        (WebKit::WebView::onKeyEvent): Handle VK_ESCAPE and cancel full screen
     14            mode if caught.
     15        (WebKit::WebView::fullScreenController): Lazily instantiate m_fullScreenController.
     16        (WebKit::WebView::fullScreenClientWindow): Added accessor.
     17        (WebKit::WebView::fullScreenClientParentWindow): Ditto.
     18        (WebKit::WebView::fullScreenClientSetParentWindow): Ditto.
     19        (WebKit::WebView::fullScreenClientWillEnterFullScreen): Pass through to WebFullScreenManagerProxy.
     20        (WebKit::WebView::fullScreenClientDidEnterFullScreen): Ditto.
     21        (WebKit::WebView::fullScreenClientWillExitFullScreen): Ditto.
     22        (WebKit::WebView::fullScreenClientDidExitFullScreen): Ditto.
     23        * UIProcess/win/WebView.h:
     24        * UIProcess/win/WebFullScreenManagerProxyWin.cpp:
     25        (WebKit::WebFullScreenManagerProxy::enterFullScreen): Pass through to
     26            WebFullScreenController.
     27        (WebKit::WebFullScreenManagerProxy::exitFullScreen): Ditto.
     28        * UIProcess/win/WebView.cpp:
     29        (WebKit::WebView::WebView):
     30        (WebKit::WebView::onKeyEvent): Handle the escape key and exit
     31           full screen mode when detected.
     32        (WebKit::WebView::fullScreenWindowController): Added.
     33        * UIProcess/win/WebView.h:
     34        * WebProcess/FullScreen/win/WebFullScreenManagerWin.cpp:
     35        (WebKit::WebFullScreenManagerWin::~WebFullScreenManagerWin):
     36        (WebKit::WebFullScreenManagerWin::setRootFullScreenLayer): Host the root
     37            full screen layer if it gets detached.
     38        * WebProcess/FullScreen/win/WebFullScreenManagerWin.h:
     39        * win/WebKit2.vcproj:
     40
    1412011-05-03  Brady Eidson  <beidson@apple.com>
    242
  • trunk/Source/WebKit2/UIProcess/win/WebFullScreenManagerProxyWin.cpp

    r85389 r85699  
    2929#if ENABLE(FULLSCREEN_API)
    3030
     31#include "WebView.h"
     32#include <WebCore/FullScreenController.h>
    3133#include <WebCore/IntRect.h>
    3234
     
    3739    if (!m_webView)
    3840        return;
    39     // FIXME: Implement
     41    m_webView->fullScreenController()->enterFullScreen();
    4042}
    4143
     
    4446    if (!m_webView)
    4547        return;
    46     // FIXME: Implement
     48    m_webView->fullScreenController()->exitFullScreen();
    4749}
    4850
  • trunk/Source/WebKit2/UIProcess/win/WebView.cpp

    r84304 r85699  
    5656#include <wtf/text/WTFString.h>
    5757
     58#if ENABLE(FULLSCREEN_API)
     59#include "WebFullScreenManagerProxy.h"
     60#include <WebCore/FullScreenController.h>
     61#endif
     62
    5863namespace Ime {
    5964// We need these functions in a separate namespace, because in the global namespace they conflict
     
    300305    // Initialize the top level parent window and register it with the WindowMessageBroadcaster.
    301306    windowAncestryDidChange();
     307
     308#if ENABLE(FULLSCREEN_API)
     309    m_page->fullScreenManager()->setWebView(this);
     310#endif
    302311}
    303312
     
    609618LRESULT WebView::onKeyEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled)
    610619{
     620#if ENABLE(FULLSCREEN_API)
     621    // Trap the ESC key when in full screen mode.
     622    if (message == WM_KEYDOWN && wParam == VK_ESCAPE && m_fullScreenController && m_fullScreenController->isFullScreen()) {
     623        m_fullScreenController->exitFullScreen();
     624        return false;
     625    }
     626#endif
     627
    611628    m_page->handleKeyboardEvent(NativeWebKeyboardEvent(hWnd, message, wParam, lParam));
    612629
     
    16511668}
    16521669
     1670#if ENABLE(FULLSCREEN_API)
     1671FullScreenController* WebView::fullScreenController()
     1672{
     1673    if (!m_fullScreenController)
     1674        m_fullScreenController = adoptPtr(new FullScreenController(this));
     1675    return m_fullScreenController.get();
     1676}
     1677
     1678HWND WebView::fullScreenClientWindow() const
     1679{
     1680    return m_window;
     1681}
     1682
     1683HWND WebView::fullScreenClientParentWindow() const
     1684{
     1685    return ::GetParent(m_window);
     1686}
     1687
     1688void WebView::fullScreenClientSetParentWindow(HWND hostWindow)
     1689{
     1690    setParentWindow(hostWindow);
     1691}
     1692
     1693void WebView::fullScreenClientWillEnterFullScreen()
     1694{
     1695    page()->fullScreenManager()->willEnterFullScreen();
     1696}
     1697
     1698void WebView::fullScreenClientDidEnterFullScreen()
     1699{
     1700    page()->fullScreenManager()->didEnterFullScreen();
     1701}
     1702
     1703void WebView::fullScreenClientWillExitFullScreen()
     1704{
     1705    page()->fullScreenManager()->willExitFullScreen();
     1706}
     1707
     1708void WebView::fullScreenClientDidExitFullScreen()
     1709{
     1710    page()->fullScreenManager()->didExitFullScreen();
     1711}
     1712
     1713#endif
    16531714} // namespace WebKit
  • trunk/Source/WebKit2/UIProcess/win/WebView.h

    r84064 r85699  
    4141#include <wtf/RefPtr.h>
    4242
     43#if ENABLE(FULLSCREEN_API)
     44#include <WebCore/FullScreenControllerClient.h>
     45#endif
     46
     47namespace WebCore {
     48    class FullScreenController;
     49}
     50
    4351interface IDropTargetHelper;
    4452
     
    4755class DrawingAreaProxy;
    4856
    49 class WebView : public APIObject, public PageClient, WebCore::WindowMessageListener, public IDropTarget {
     57class WebView
     58    : public APIObject
     59    , public PageClient
     60    , WebCore::WindowMessageListener
     61    , public IDropTarget
     62#if ENABLE(FULLSCREEN_API)
     63    , WebCore::FullScreenControllerClient
     64#endif
     65{
    5066public:
    5167    static PassRefPtr<WebView> create(RECT rect, WebContext* context, WebPageGroup* pageGroup, HWND parentWindow)
     
    85101
    86102    WebPageProxy* page() const { return m_page.get(); }
     103
     104#if ENABLE(FULLSCREEN_API)
     105    WebCore::FullScreenController* fullScreenController();
     106#endif
    87107
    88108private:
     
    196216    virtual void windowReceivedMessage(HWND, UINT message, WPARAM, LPARAM);
    197217
     218#if ENABLE(FULLSCREEN_API)
     219    virtual HWND fullScreenClientWindow() const;
     220    virtual HWND fullScreenClientParentWindow() const;
     221    virtual void fullScreenClientSetParentWindow(HWND);
     222    virtual void fullScreenClientWillEnterFullScreen();
     223    virtual void fullScreenClientDidEnterFullScreen();
     224    virtual void fullScreenClientWillExitFullScreen();
     225    virtual void fullScreenClientDidExitFullScreen();
     226#endif
     227
    198228    HWND m_window;
    199229    HWND m_topLevelParentWindow;
     
    235265
    236266    bool m_gestureReachedScrollingLimit;
     267
     268#if ENABLE(FULLSCREEN_API)
     269    OwnPtr<WebCore::FullScreenController> m_fullScreenController;
     270#endif
    237271};
    238272
  • trunk/Source/WebKit2/WebProcess/FullScreen/win/WebFullScreenManagerWin.cpp

    r85389 r85699  
    3333#include "WebPage.h"
    3434#include "WebProcess.h"
     35#include <WebCore/Frame.h>
     36#include <WebCore/FrameView.h>
     37#include <WebCore/GraphicsLayer.h>
     38#include <WebCore/Page.h>
    3539#include <WebKitSystemInterface/WebKitSystemInterface.h>
    3640
     
    5660WebFullScreenManagerWin::~WebFullScreenManagerWin()
    5761{
     62    m_page->send(Messages::WebFullScreenManagerProxy::ExitAcceleratedCompositingMode());
    5863}
    5964
    60 void WebFullScreenManagerWin::setRootFullScreenLayer(WebCore::GraphicsLayer*)
     65void WebFullScreenManagerWin::setRootFullScreenLayer(WebCore::GraphicsLayer* layer)
    6166{
    62     // FIXME: Implement
     67    // Host the full screen layer if its given to us; otherwise it will be disconnected
     68    // from the layer heirarchy and cause an ASSERT during resync.
     69    // FIXME: Disable setting RenderLayer::setAnimating() to make this unnecessary.
     70    if (m_fullScreenRootLayer == layer)
     71        return;
     72    m_fullScreenRootLayer = layer;
     73
     74    if (!m_fullScreenRootLayer) {
     75        m_page->send(Messages::WebFullScreenManagerProxy::ExitAcceleratedCompositingMode());
     76        if (m_rootLayer) {
     77            m_rootLayer->removeAllChildren();
     78            m_rootLayer = 0;
     79        }
     80        return;
     81    }
     82
     83    if (!m_rootLayer) {
     84        m_rootLayer = GraphicsLayer::create(0);
     85#ifndef NDEBUG
     86        m_rootLayer->setName("Full screen root layer");
     87#endif
     88        m_rootLayer->setDrawsContent(false);
     89        m_rootLayer->setSize(getFullScreenRect().size());
     90    }
     91
     92    m_rootLayer->removeAllChildren();
     93
     94    if (m_fullScreenRootLayer)
     95        m_rootLayer->addChild(m_fullScreenRootLayer);
     96
     97    m_rootLayer->syncCompositingStateForThisLayerOnly();
     98    m_page->corePage()->mainFrame()->view()->syncCompositingStateIncludingSubframes();
    6399}
    64100
    65101void WebFullScreenManagerWin::beginEnterFullScreenAnimation(float)
    66102{
    67     // FIXME: Implement
     103    // FIXME: Add support for animating the content into full screen.
    68104}
    69105
    70106void WebFullScreenManagerWin::beginExitFullScreenAnimation(float)
    71107{
    72     // FIXME: Implement
     108    // FIXME: Add support for animating the content into full screen.
    73109}
    74110
  • trunk/Source/WebKit2/WebProcess/FullScreen/win/WebFullScreenManagerWin.h

    r85389 r85699  
    4646    virtual void beginEnterFullScreenAnimation(float duration);
    4747    virtual void beginExitFullScreenAnimation(float duration);
     48
     49    OwnPtr<WebCore::GraphicsLayer> m_rootLayer;
     50    WebCore::GraphicsLayer* m_fullScreenRootLayer;
    4851};
    4952
Note: See TracChangeset for help on using the changeset viewer.