[CEF3] New feature: Need to support fullscreen api

Issue #562 resolved
Former user created an issue

Original issue 562 created by hongbo.min on 2012-03-31T05:22:25.000Z:

Fullscreen API is widely used in Web applications. CEF3 also needs to support such API. Reference http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html for details.

Comments (26)

  1. Marshall Greenblatt
    • changed status to open

    Comment [3.](https://code.google.com/p/chromiumembedded/issues/detail?id=562#c3) originally posted by magreenblatt on 2012-04-02T15:00:35.000Z:

    I don't think we should implement full-screen mode internal to CEF because the behavior may be framework- or application-dependent. For example, some frameworks or use cases may have special requirements for how a full-screen window is created and/or managed. It would be better to add a new callback and allow the client to implement.

    The new API could be:

    --- CefDisplayHandler ---

    Called to change a browser window to or from full-screen mode. Return true if full-screen mode was changed or false otherwise. virtual bool OnFullscreenModeChange(CefRefPtr<CefBrowser> browser, bool fullscreen) { return false; }

    --- CefBrowser ---

    Returns true if the browser window is currently in full-screen mode. virtual bool IsFullscreen();

    The PlatformToggleFullscreenModeForTab code in your patch can be added to cefclient as a sample implementation. Also, please run the tools/check\_style tool and fix any errors before posting a new patch.

  2. Former user Account Deleted

    Comment [5.](https://code.google.com/p/chromiumembedded/issues/detail?id=562#c5) originally posted by hongbo.min on 2012-04-17T06:24:27.000Z:

    Basically, I agree your point. However, after my further consideration, I think we can provide a default implementation in libcef, and meanwhile provide a client callback to allow application specific handling for fullscreen.

    The default implementation only takes effect in case of "fullscreen-enabled" switch is turned on.

    If client wants to provide their own implementation for fullscreen api, they should disable fullscreen-enabled and implement the callback.

    So in this way, client can leverage the default implementation at maximium without rewriting the fullscreen logic code.

    You opinion? Thanks

  3. Former user Account Deleted

    Comment 7. originally posted by ShenHui103 on 2012-10-22T06:44:00.000Z:

    I have integrated the code patch into CEF3, seems the video in web page was still not able to fullscreeen.

    I have aslo tried Version 1.963.439 of CEF1 release on December 22, 2011, the added CefBrowserSettings.fullscreen_enabled flag has no effect to fullscreen the page.

    Any advice ?

  4. Former user Account Deleted

    Comment 8. originally posted by ShenHui103 on 2012-10-24T10:39:03.000Z:

    Hello all,

    We have done some modification in source code of chromium and found that the fullscreen_enabled flag worked. We'd like to share the modification in the below.

    Target file:

    Target functions modified:
    void WebViewImpl::enterFullScreenForElement(WebCore::Element* element)

    void WebViewImpl::exitFullScreenForElement(WebCore::Element* element)
    // The client is exiting full screen, so don't send a notification.
    if (m_isCancelingFullScreen)

    I don't know whether any potential risks exist, so any advice will be much appreciated.

  5. Former user Account Deleted

    Comment 9. originally posted by pradyumnab on 2013-01-24T15:54:07.000Z:

    After applying the above changes and clicking on "fullscreen" button on the video the tab gets full screened and not the video. Also the video remains the normal size.

    Using Spy++ (from Visual Studio tools) I found that the hwnd is for the frame and the video element is part of the frame(hwnd). So increasing the size of the hwnd seems to be right.
    So why is the video not getting resized and the tab is?

    The change in patch is similar to the link given by Czarek in:

    Would there be any other approach?

    I am using the trunk version of Cef3 and am at revision@ 170167 for chrome and revision@ 960 for cef3

  6. Dmitry Azaraev

    Comment 10. originally posted by fddima on 2013-01-24T22:13:34.000Z:

    I'm can't understand why someone needed for special handling in CEF for fullscreen API?
    I'm making fullscreeen window for run CEF at fullscreen, while my application exactly work only in kiosks. Additional handling for F11 can be done by host application by resizing / placement window, ONLY WHEN IT NEEDED. Any other cases can be emulated by same way.
    I'm doesn't disput about useful about this feature - but, really, anyone can explain, why this feature must be provided by CEF, instead of implemented by application?

    PS: OnFullscreenModeChange? That is the shit? What my application can do useful on this event? Nothing, as for me.

  7. Marshall Greenblatt

    Comment 11. originally posted by magreenblatt on 2013-01-25T17:45:00.000Z:

    #commentcomment 10.: The HTML5 video player provides controls for entering full-screen mode, and there is also an existing JS API for controlling full-screen mode. The purpose of this change is to expose a callback so that the client application can implement this functionality when the button is pressed or the API is used.

  8. Former user Account Deleted

    Comment 14. originally posted by tsing.gao on 2014-01-09T03:08:57.000Z:

    Is this issue resolved ? I can not find the method on DisplayHandler neither the settings on browser settings.

  9. Former user Account Deleted

    Comment 16. originally posted by finn.hughes1 on 2014-03-28T12:33:36.000Z:

    I've got fullscreen working for me in the chrome 29 and 33 cef branches. My patch is based on Hongbo's but it needed a few tweaks and I'm linux based so have entirely dropped the windows code. I've also included Marshal's callback suggestion, however I didn't get the refusal of fullscreen working. Also I've not done anything with the "fullscreen-enabled" mentioned above.

    I've attached my patch against branch 1750 revision 1629. I've tested against 32bit fedora 18, and the same patch also works against branch 1547 revision 1491. I'm using cefpython so will also submit a cefpython patch to that project.

    Prior to this patch IsFullscreenForTabOrPending always returned false, unfortunately this doesn't completely refuse fullscreen and the element can end up trying to fullscreen whilst leaving the rest of the dom unchanged.

    I don't need to refuse fullscreen for my application so after some digging I left it TODO. What I found was that I could prevent fullscreen by hacking
    I just commented out the calls to pushFullscreenElementStack, I don't think that's very useful but if anyone else needs to get it working that should provide a helpful staring point.

  10. Former user Account Deleted

    Comment 17. originally posted by finn.hughes1 on 2014-03-28T12:35:36.000Z:

    I forgot to mention that I haven't included the autogenerated files as it adds a lot of noise, so after applying my patch you'll have to run ./translator.sh

  11. Former user Account Deleted

    Comment 18. originally posted by djonatanb on 2014-07-04T15:28:17.000Z:

    Hi guys, sorry if it is not the right place for that but can someone tell me if this fixes have something to do with a problem I have been facing when I need to go full screen inside of an iframe using CEF ? using allowfullscreen or webkitallowfullscreen hasn't helped

  12. Former user Account Deleted

    Comment 19. originally posted by finn.hughes1 on 2014-07-04T15:42:54.000Z:

    It seems likely, if you're asking the element to fullscreen and seeing it try but other elements in the dom not respond then my patch should help.

  13. Former user Account Deleted

    Comment 23. originally posted by megsmith2 on 2014-11-24T22:55:35.000Z:

    Any idea how to implement this using X instead of GTK?

  14. Marshall Greenblatt

    For the purposes of CEF we're interested in "tab fullscreen" [1]. The client should be notified and the fullscreen element should expand to take up the whole browser area. The client can then optionally resize the browser.

    Fullscreen mode via HTML5 and JavaScript works as follows:

    1. Press the full screen button in an HTML5 video or use the fullscreen JavaScript API.
    2. Get a call to RenderFrameImpl::enterFullscreen() in the renderer process which results in call to WebContentsImpl::EnterFullscreenMode() in the browser process.
    3. Calls WebContentsDelegate::EnterFullscreenModeForTab().
    4. If fullscreen is granted then WebContentsDelegate::IsFullscreenForTabOrPending() returns true and WebContentsDelegate::GetDisplayMode() returns blink::WebDisplayModeFullscreen.
    5. Call WasResized() which results in the fullscreen and display mode values being returned to the renderer process via RenderWidgetHostImpl::GetResizeParams() and RenderViewImpl::OnResize(). Note that the browser size does not actually need to change.

    The behavior for Flash plugins is different (and it currently works in CEF without changes). Fullscreen mode is triggered via PepperPluginInstance::FlashSetFullscreen() and Chromium then creates the fullscreen widget itself in RenderFrameImpl::CreatePepperFullscreenContainer(). Flash fullscreen can be disabled via RendererPreferences::plugin_fullscreen_allowed but there appears to be no way to have it instead use the code path described above. Related discussion: https://code.google.com/p/chromium/issues/detail?id=290403

    [1] See comments in Chrome's fullscreen_controller.h for an overview of fullscreen concepts: https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/ui/exclusive_access/fullscreen_controller.h&l=23

  15. Marshall Greenblatt

    Done in master revision d820080.

    • Add new CefDisplayHandler::OnFullscreenModeChange method.
    • Allow calls to CefBrowserHost::WasResized for windowed browsers.
    • Call WasResized internally so that fullscreen toggle displays correctly for HTML/JS content.
  16. Log in to comment