Support W3C Full Screen API proposal
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2012 18:12:14 +0000 (18:12 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2012 18:12:14 +0000 (18:12 +0000)
commitfe5d0c0433b480b9b879a5c80264d178b0f58e4b
tree727da8cbc99337df57a884556b8e84e0ccc59a9d
parent96c94b4d81afbc8d8f4446fa1eb8e34ca1eb7bab
Support W3C Full Screen API proposal
https://bugs.webkit.org/show_bug.cgi?id=80660

Reviewed by Alexey Proskuryakov.

Source/WebCore:

Tests: fullscreen/full-screen-element-stack.html
       fullscreen/full-screen-enabled.html
       fullscreen/full-screen-restrictions.html

The W3C proposal for taking arbitrary elements into full-screen mode is significantly
different than the Mozilla proposal. For example, the W3C has proposed a lower-case "s"
in "Fullscreen", which means the W3C and Mozilla "requestFullscreen" APIs differ only by
in that lower-case "s". Annoying as this is, it does allow us to retain the semantics for
the Mozilla case (har!).

A significant difficulty is obeying the new W3C spec rules is that we would like to apply the
fullscreen CSS rules while exiting fullscreen mode, though the W3C spec insists that the
webkitFullscreenElement returns the new value immediately.  As such, we retain the m_fullScreenElement
variable (distinct from the top of the m_fullScreenElements stack) which is controlled by the
webkit{Will,Did}{Enter,Exit}FullScreen functions.

New APIs for the W3C Fullscreen spec:
* dom/Document.h:
(WebCore::Document::webkitFullscreenElement):
(WebCore::Document::webkitFullscreenEnabled):
* dom/Document.idl:
* dom/Element.cpp:
(WebCore::Element::webkitRequestFullscreen):
* dom/Element.h:
* dom/Element.idl:

* dom/Document.cpp:
(WebCore::Document::removedLastRef): Clear m_fullScreenElementStack.
(WebCore::Document::requestFullScreenForElement): Implement the W3C requirements.
(WebCore::Document::webkitExitFullscreen): Ditto.
(WebCore::Document::webkitCancelFullScreen): Implement in terms of webkitCancelFullscreen.
(WebCore::Document::webkitDidEnterFullScreenForElement):
(WebCore::Document::webkitWillExitFullScreenForElement):
(WebCore::Document::webkitDidExitFullScreenForElement):
(WebCore::Document::fullScreenChangeDelayTimerFired): Protect against items being
    added to the event and error queue by swapping out empty queues before starting.
(WebCore::Document::clearFullscreenElementStack): Simple accessor.
(WebCore::Document::popFullscreenElementStack): Ditto.
(WebCore::Document::pushFullscreenElementStack): Ditto.
* dom/Element.cpp:
(WebCore::Element::webkitRequestFullScreen):

Add new RuntimeEnabledFeatures functions for the added Document and Element functions.
* bindings/generic/RuntimeEnabledFeatures.h:
(RuntimeEnabledFeatures):
(WebCore::RuntimeEnabledFeatures::webkitFullscreenEnabledEnabled):
(WebCore::RuntimeEnabledFeatures::webkitFullscreenElementEnabled):
(WebCore::RuntimeEnabledFeatures::webkitExitFullscreenEnabled):
(WebCore::RuntimeEnabledFeatures::webkitRequestFullscreenEnabled):

Source/WebKit/mac:

Allow full screen elements to access the keyboard.

* WebView/WebView.mm:
(-[WebView _supportsFullScreenForElement:WebCore::withKeyboard:]):

Source/WebKit2:

Allow full screen elements to access the keyboard.

* UIProcess/WebFullScreenManagerProxy.cpp:
(WebKit::WebFullScreenManagerProxy::supportsFullScreen):
* WebProcess/FullScreen/WebFullScreenManager.cpp:
(WebKit::WebFullScreenManager::exitFullScreenForElement):

LayoutTests:

* fullscreen/full-screen-element-stack-expected.txt: Added.
* fullscreen/full-screen-element-stack.html: Added.
* fullscreen/full-screen-enabled-expected.txt: Added.
* fullscreen/full-screen-enabled.html: Added.
* fullscreen/full-screen-request-rejected.html:
* fullscreen/full-screen-request-removed.html:
* fullscreen/full-screen-restrictions-expected.txt: Added.
* fullscreen/full-screen-restrictions.html: Added.
* fullscreen/full-screen-test.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111028 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
LayoutTests/ChangeLog
LayoutTests/fullscreen/full-screen-element-stack-expected.txt [new file with mode: 0644]
LayoutTests/fullscreen/full-screen-element-stack.html [new file with mode: 0644]
LayoutTests/fullscreen/full-screen-enabled-expected.txt [new file with mode: 0644]
LayoutTests/fullscreen/full-screen-enabled.html [new file with mode: 0644]
LayoutTests/fullscreen/full-screen-request-rejected.html
LayoutTests/fullscreen/full-screen-request-removed.html
LayoutTests/fullscreen/full-screen-restrictions-expected.txt [new file with mode: 0644]
LayoutTests/fullscreen/full-screen-restrictions.html [new file with mode: 0644]
LayoutTests/fullscreen/full-screen-test.js
Source/WebCore/ChangeLog
Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Document.idl
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/Element.idl
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp
Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp
Tools/DumpRenderTree/mac/UIDelegate.mm