haikuwebkit/LayoutTests/fullscreen/full-screen-enabled.html

14 lines
712 B
HTML
Raw Permalink Normal View History

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: Canonical link: https://commits.webkit.org/98584@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111028 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-16 18:12:14 +00:00
<body>
<div>This tests the <code>fullscreenEnabled</code> property laid out in section 4 of the W3C
<a href="http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html">Full Screen API</a></div>
<script src="full-screen-test.js"></script>
<script>
var iframe = document.documentElement.appendChild(document.createElement('iframe'));
Accept 'allowfullscreen' in addition to 'webkitallowfullscreen'. https://bugs.webkit.org/show_bug.cgi?id=110374 Reviewed by Adam Barth. Source/WebCore: The fullscreen API also includes a new HTML attribute for iframes which permits its use. That attribute, 'allowfullcreen' is now included in the HTML specification [1] and is stable enough to remove the webkit prefix. [1] http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html#attr-iframe-allowfullscreen Tests: fullscreen/full-screen-enabled-prefixed.html fullscreen/full-screen-iframe-allowed-prefixed.html fullscreen/full-screen-iframe-with-mixed-allow-webkitallow-attribute.html * dom/Document.cpp: (WebCore::isAttributeOnAllOwners): (WebCore::Document::fullScreenIsAllowedForElement): (WebCore::Document::webkitFullscreenEnabled): * html/HTMLAttributeNames.in: LayoutTests: Two previous tests duplicated to preserve testing webkitallowfullscreen and then modified to test allowfullscreen. A new test 'full-screen-iframe-with-mixed-allow-webkitallow-attribute.html' added to test a mixed nesting of iframs with both allowfullscreen and webkitallowfullscreen. * fullscreen/full-screen-enabled-prefixed-expected.txt: Added. * fullscreen/full-screen-enabled-prefixed.html: Copied from LayoutTests/fullscreen/full-screen-enabled.html. * fullscreen/full-screen-enabled.html: * fullscreen/full-screen-iframe-allowed-prefixed-expected.txt: Added. * fullscreen/full-screen-iframe-allowed-prefixed.html: Copied from LayoutTests/fullscreen/full-screen-iframe-allowed.html. * fullscreen/full-screen-iframe-allowed.html: * fullscreen/full-screen-iframe-with-mixed-allow-webkitallow-attribute-expected.txt: * fullscreen/full-screen-iframe-with-mixed-allow-webkitallow-attribute.html: Added. * fullscreen/resources/full-screen-iframe-with-mixed-allow-webkitallow-iframe1.html: Added. * fullscreen/resources/full-screen-iframe-with-mixed-allow-webkitallow-iframe2.html: Added. Canonical link: https://commits.webkit.org/128686@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143533 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-02-21 00:32:26 +00:00
iframe.setAttribute('allowfullscreen', 'true');
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: Canonical link: https://commits.webkit.org/98584@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111028 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-16 18:12:14 +00:00
var iframe2 = document.documentElement.appendChild(document.createElement('iframe'));
Support 'allow="fullscreen"' feature policy https://bugs.webkit.org/show_bug.cgi?id=206806 <rdar://problem/55640448> Patch by Jer Noble <jer.noble@apple.com> on 2020-01-27 Reviewed by Youenn Fablet. Source/WebCore: Test: http/tests/fullscreen/fullscreen-feature-policy.html The unprefixed version of the Fullscreen API has deprecated the 'allowfullscreen' iframe attribute in favor of the 'allow="fullscreen"' style attribute used by Feature Policy. Add support for such, including the specified handling for the legacy 'allowfullscreen' attribute. Note: this patch will (intentionally) change the default behavior of <iframe>s. Previously any <iframe> without the "allowfullscreen" attribute would not be allowed to enter fullscreen mode. After this patch, <iframes> without the legacy attribute or an explicit fullscreen Feature Policy will be allowed to enter fullscreen so long as their origin is the same as the top document (and that all parent iframes are also allowed to enter fullscreen). * dom/FullscreenManager.cpp: (WebCore::FullscreenManager::requestFullscreenForElement): (WebCore::FullscreenManager::isFullscreenEnabled const): (WebCore::isAttributeOnAllOwners): Deleted. (WebCore::FullscreenManager::fullscreenIsAllowedForElement const): Deleted. * dom/FullscreenManager.h: * html/FeaturePolicy.cpp: (WebCore::isFeaturePolicyAllowedByDocumentAndAllOwners): (WebCore::FeaturePolicy::parse): (WebCore::FeaturePolicy::allows const): * html/FeaturePolicy.h: * html/HTMLIFrameElement.cpp: (WebCore::HTMLIFrameElement::parseAttribute): (WebCore::HTMLIFrameElement::featurePolicy const): * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::createRequest): (WebCore::isSyncXHRAllowedByFeaturePolicy): Deleted. LayoutTests: * fullscreen/full-screen-enabled-prefixed.html: * fullscreen/full-screen-enabled.html: * fullscreen/full-screen-frameset-expected.txt: Removed. * fullscreen/full-screen-frameset.html: Removed. * fullscreen/full-screen-iframe-not-allowed.html: * fullscreen/full-screen-restrictions.html: * http/tests/fullscreen/fullscreen-feature-policy-expected.txt: Added. * http/tests/fullscreen/fullscreen-feature-policy.html: Added. Canonical link: https://commits.webkit.org/219826@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255162 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-27 20:54:54 +00:00
iframe2.setAttribute('allow', "fullscreen 'none'");
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: Canonical link: https://commits.webkit.org/98584@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111028 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-16 18:12:14 +00:00
testExpected('iframe.contentDocument.webkitFullscreenEnabled', true);
testExpected('iframe2.contentDocument.webkitFullscreenEnabled', false);
endTest();
</script>