-
jer.noble@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=49481 rdar://problem/8247444 Patch by Jer Noble <jer@kokode.apple.com> on 2010-12-17 Reviewed by Simon Fraser. Mark for export all those WebCore functions needed by WebFullscreenController. * WebCore.exp.in: WebCore: Implement WebKit Full Screen support. https://bugs.webkit.org/show_bug.cgi?id=49481 rdar://problem/8247444 Patch by Jer Noble <jer@kokode.apple.com> on 2010-12-17 Reviewed by Simon Fraser. screenRect is useful for more than just HTMLMediaElements. Promote it into Element. * dom/Element.cpp: Moved into Element from HTMLMediaElement. * dom/Element.h: Ditto. * dom/Node.cpp: * html/HTMLMediaElement.cpp: Moved screenRect into Element. * html/HTMLMediaElement.h: Ditto. * WebCore.exp.in: Modify the exports list to reflect the new symbol name. WebCore: Implement WebKit Full Screen support. https://bugs.webkit.org/show_bug.cgi?id=49481 rdar://problem/8247444 Patch by Jer Noble <jer@kokode.apple.com> on 2010-12-17 Reviewed by Simon Fraser. The RenderFullScreen is intended to be used by clients of that API to allow a DOM subtree to be rendered outside its original Frame. Because of this, there are a few areas of the rendering code which need to be special cased: RenderFullScreen layers should not be clipped to the viewport, as they will almost always be rendering outside the viewport area; RenderFullScreen graphics layers should not be reparented by the RenderLayerCompositor, as the client will likely want to reparent the platformLayer into their own fullscreen platform window; the FrameView must update the RenderFullScreen graphics layer tree separately from the root layer, as the two trees are disconnected. * page/FrameView.cpp: (WebCore::FrameView::updateCompositingLayers): Special treatment for fullscreen renderer. (WebCore::FrameView::syncCompositingStateRecursive): Ditto. (WebCore::FrameView::paintContents): Ditto. * rendering/RenderLayer.h: Add a new ContentChangeType enum entry for FullScreen. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::contentChanged): Add support for above. * rendering/RenderLayerBacking.cpp: (WebCore::layerOrAncestorIsFullScreen): New function. (WebCore::RenderLayerBacking::updateCompositedBounds): Do not clip if the layerOrAncestorIsFullScreen. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree): Special treatment for fullscreen renderer. (WebCore::RenderLayerCompositor::requiresCompositingLayer): Ditto. (WebCore::RenderLayerCompositor::requiresCompositingForFullScreen): Ditto. * rendering/RenderLayerCompositor.h: WebCore: Implement WebKit Full Screen support. https://bugs.webkit.org/show_bug.cgi?id=49481 rdar://problem/8247444 Patch by Jer Noble <jer@kokode.apple.com> on 2010-12-17 Reviewed by Simon Fraser. Implemented non-accelerated fullscreen support. The Document will now vend a RenderFullScreen object for clients to use to relocate the fullscreen element subtree. * css/CSSStyleSelector.cpp: (WebCore::loadFullScreenRulesIfNeeded): Change webkitFullScreen -> webkitIsFullScreen. (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): Ditto. * dom/Document.cpp: (WebCore::Document::Document): Initialize m_fullScreenRenderer. (WebCore::Document::detach): Call setFullScreenRenderer(0). (WebCore::Document::nodeWillBeRemoved): Replicate the logic in webkitWillEnterFullScreenForElement. (WebCore::Document::webkitWillEnterFullScreenForElement): Detach the fullscreen element to cause a new RenderFullScreen renderer to be created with the new fullscreen element. (WebCore::Document::webkitDidEnterFullScreenForElement): Notify clients of a fullscreen change here, rather in "willEnter", to avoid reentrancy problems when clients remove nodes in response to webkitfullscreenchange events. (WebCore::Document::webkitWillExitFullScreenForElement): Recalculate the fullscreen element's style. (WebCore::Document::webkitDidExitFullScreenForElement): Ditto. (WebCore::Document::setFullScreenRenderer): Accessor for m_fullScreenRenderer. (WebCore::Document::setFullScreenRendererSize): Set the style on the m_fullScreenRenderer with a new size; this keeps clients from having to access the renderer's style directly. (WebCore::Document::setFullScreenRendererBackgroundColor): Ditto. * dom/Document.h: (WebCore::Document::webkitIsFullScreen): Change webkitFullScreen -> webkitIsFullScreen. (WebCore::Document::fullScreenRenderer): Accessor. * dom/Document.idl: * dom/Node.cpp: (WebCore::Node::createRendererIfNeeded): If the document is in fullscreen mode, create a RenderFullScreen object to insert between the fullscreen element and its parent. * page/ChromeClient.h: (WebCore::ChromeClient::fullScreenRendererChanged): Added. * rendering/MediaControlElements.cpp: (WebCore::MediaControlFullscreenButtonElement::defaultEventHandler): Change webkitFullScreen -> webkitIsFullScreen. WebCore: Implement WebKit Full Screen support. https://bugs.webkit.org/show_bug.cgi?id=49481 rdar://problem/8247444 Patch by Jer Noble <jer@kokode.apple.com> on 2010-12-17 Reviewed by Simon Fraser. This patch introduces a new RenderObject type: RenderFullScreen. The RenderFullScreen renderer will be used to implement new FullScreen APIs. Because the RenderFullScreen object will be the parent of the current fullscreen element, the style rules for fullscreen objects must change to match. * WebCore.xcodeproj/project.pbxproj: * rendering/RenderFullScreen.cpp: Added. (RenderFullScreen::setAnimating): Sets the m_isAnimating flag. (RenderFullScreen::createFullScreenStyle): Returns a new RenderStyle containing the default stye for RenderFullScreen objects. * rendering/RenderFullScreen.h: Added. (WebCore::RenderFullScreen::isRenderFullScreen): Added. Overrides the RenderObject version. * rendering/RenderObject.h: (WebCore::RenderObject::isRenderFullScreen): Added. Used for type-checking RenderFullScreen objects. * css/fullscreen.css: Modified the contained fullscreen styles. WebKit/mac: Implement WebKit Full Screen support. https://bugs.webkit.org/show_bug.cgi?id=49481 rdar://problem/8247444 Patch by Jer Noble <jer@kokode.apple.com> on 2011-01-05 Reviewed by Simon Fraser. Support the new fullscreen Chrome client requests. WebView will pass through these requests to a WebFullscreenController. * WebCoreSupport/WebChromeClient.h: Add fullScreenRendererChanged(). * WebView/WebView.mm: (-[WebView _supportsFullScreenForElement:WebCore::]): Check to see if the fullscreen pref has been enabled. (-[WebView _enterFullScreenForElement:WebCore::]): Create a WebFullScreenController. (-[WebView _exitFullScreenForElement:WebCore::]): Request that the WebFullScreenController exit fullscreen. (-[WebView _fullScreenRendererChanged:WebCore::]): Notify the WebFullScreenController that its renderer has changed. * WebView/WebViewData.h: Add ivar newFullscreenController. Patch by Jer Noble <jer@kokode.apple.com> on 2011-01-05 Reviewed by Simon Fraser. This patch implements the FullScreen APIs using the new RenderFullScreen renderer and the new Document client APIs. The RenderFullScreen renderer's CALayer is hosted in a new, fullscreen window, and a custom CAAnimation animates that layer between the initial screen rect of the full screen element, to its final value. WebFullscreenController will swap the WebView out of its original window, and into the fullscreen window. The controller will replace the WebView with a placeholder view, so that if the placeholder moves or resized while the WebView is absent, the WebView will move back to the correct location when exiting fullscreen. * WebView/WebFullscreenController.h: Added. * WebView/WebFullscreenController.mm: Added. (-[WebFullscreenController windowDidExitFullscreen:]): Close the fullscreen window. (-[WebFullscreenController windowDidEnterFullscreen:]): Swap the webView back into the fullscreen window. (-[WebFullscreenController animationDidStop:finished:]): Call windowDid{Exit|Enter}FullScreen as appropriate. (-[WebFullscreenController applicationDidResignActive:]): (-[WebFullscreenController applicationDidChangeScreenParameters:]): Resize the fullscreen window to match the new screen parameters. (-[WebFullscreenController enterFullscreen:]): Set up the animation that will take the fullscreen element from its original screen rect into fullscreen. (-[WebFullscreenController exitFullscreen]): Swap the webView back into its original window. Set up the animation that will take the fullscreen element back into its original screen rect. (-[WebFullscreenController _updatePowerAssertions]): Now checks _isAnyMoviePlaying to determine whether to disable screensaver and sleep. (-[WebFullscreenController _isAnyMoviePlaying]): Walks through the sub-tree starting at the fullscreen element looking for HTMLVideoElements; returns whether any are found to be playing. (-[WebFullscreenController _animationDuration]): Returns the current animation duration, affected by control and shift keys. (-[WebFullscreenWindow canBecomeKeyWindow]): Allow the window to become key. (-[WebFullscreenWindow keyDown:]): Handle the 'Esc' key. (-[WebFullscreenWindow cancelOperation:]): Request to exit fullscreen. (-[WebFullscreenWindow rendererLayer]): Convenience accessor. (-[WebFullscreenWindow setRendererLayer:]): Ditto. (-[WebFullscreenWindow backgroundLayer]): Ditto. (-[WebFullscreenWindow animationView]): Ditto. (MediaEventListener::MediaEventListener): Implements the EventListener protocol. (MediaEventListener::handleEvent): Tells its delegate to _updatePowerAssertions. LayoutTests: Implement WebKit Full Screen support. https://bugs.webkit.org/show_bug.cgi?id=49481 rdar://problem/8247444 Patch by Jer Noble <jer@kokode.apple.com> on 2011-01-05 Reviewed by Simon Fraser. Update the tests with new API names and spec values. * fullscreen/full-screen-api-expected.txt: * fullscreen/full-screen-api.html: * fullscreen/full-screen-css.html: * fullscreen/full-screen-request-expected.txt: * fullscreen/full-screen-request.html: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75277 268f45cc-cd09-0410-ab3c-d52691b4dbfc
d9d59ff9