Commit d9d59ff9 authored by jer.noble@apple.com's avatar jer.noble@apple.com

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.

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
parent f894f68c
2011-01-05 Jer Noble <jer@kokode.apple.com>
Reviewed by Simon Fraser.
Implement WebKit Full Screen support.
https://bugs.webkit.org/show_bug.cgi?id=49481
rdar://problem/8247444
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:
2011-01-07 James Robinson <jamesr@chromium.org>
Revert "Implement mozilla's animationTime property"
......
EXPECTED (document.webkitFullScreen == 'false') OK
EXPECTED (document.webkitIsFullScreen == 'false') OK
EXPECTED (document.webkitCancelFullScreen != 'undefined') OK
EXPECTED (document.webkitCurrentFullScreenElement == 'null') OK
EXPECTED (document.onwebkitfullscreenchange == 'null') OK
......
......@@ -3,7 +3,7 @@
<span></span>
<script>
span = document.getElementsByTagName('span')[0];
testExpected("document.webkitFullScreen", false);
testExpected("document.webkitIsFullScreen", false);
testExpected("document.webkitCancelFullScreen", undefined, "!=");
testExpected("document.webkitCurrentFullScreenElement", null);
testExpected("document.onwebkitfullscreenchange", null)
......
EXPECTED (document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color') != 'rgb(0, 255, 0)') OK
EXPECTED (document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color') != 'rgb(255, 0, 0)') OK
EXPECTED (document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('color') != 'rgb(0, 0, 255)') OK
EXPECTED (document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color') == 'rgba(0, 0, 0, 0)') OK
EXPECTED (document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color') == 'rgba(0, 0, 0, 0)') OK
EXPECTED (document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('color') == 'rgb(0, 0, 0)') OK
EVENT(webkitfullscreenchange)
EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLElement]') OK
EXPECTED (document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color') == 'rgb(0, 255, 0)') OK
......@@ -8,8 +8,8 @@ EXPECTED (document.defaultView.getComputedStyle(document.documentElement, null).
EXPECTED (document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('color') == 'rgb(0, 0, 255)') OK
EVENT(webkitfullscreenchange)
EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLHtmlElement]') OK
EXPECTED (document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color') == 'rgb(0, 255, 0)') OK
EXPECTED (document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color') != 'rgb(255, 0, 0)') OK
EXPECTED (document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color') == 'rgba(0, 0, 0, 0)') OK
EXPECTED (document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color') == 'rgb(0, 255, 0)') OK
EXPECTED (document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('color') == 'rgb(0, 0, 255)') OK
END OF TEST
......@@ -22,9 +22,9 @@
var span = document.getElementsByTagName('span')[0];
testExpected("document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color')", "rgb(0, 255, 0)", "!=");
testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color')", "rgb(255, 0, 0)", "!=");
testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('color')", "rgb(0, 0, 255)", "!=");
testExpected("document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color')", "rgba(0, 0, 0, 0)");
testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color')", "rgba(0, 0, 0, 0)");
testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('color')", "rgb(0, 0, 0)");
var spanEnteredFullScreen = function(event) {
testExpected("document.webkitCurrentFullScreenElement", span);
......@@ -38,8 +38,8 @@
var documentEnteredFullScreen = function(event) {
testExpected("document.webkitCurrentFullScreenElement", document.documentElement);
testExpected("document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color')", "rgb(0, 255, 0)");
testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color')", "rgb(255, 0, 0)", "!=");
testExpected("document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color')", "rgba(0, 0, 0, 0)");
testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color')", "rgb(0, 255, 0)");
testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('color')", "rgb(0, 0, 255)");
endTest();
};
......
EVENT(webkitfullscreenchange) TEST(document.webkitFullScreen==true) OK
EVENT(webkitfullscreenchange) TEST(document.webkitIsFullScreen==true) OK
END OF TEST
......@@ -6,7 +6,7 @@
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
endTest();
} else {
waitForEventTestAndEnd(document, 'webkitfullscreenchange', "document.webkitFullScreen==true");
waitForEventTestAndEnd(document, 'webkitfullscreenchange', "document.webkitIsFullScreen==true");
document.documentElement.webkitRequestFullScreen();
}
</script>
2010-12-17 Jer Noble <jer@kokode.apple.com>
Reviewed by Simon Fraser.
Implement WebKit Full Screen support.
https://bugs.webkit.org/show_bug.cgi?id=49481
rdar://problem/8247444
Mark for export all those WebCore functions needed by WebFullscreenController.
* WebCore.exp.in:
2010-12-17 Jer Noble <jer@kokode.apple.com>
Reviewed by Simon Fraser.
Implement WebKit Full Screen support.
https://bugs.webkit.org/show_bug.cgi?id=49481
rdar://problem/8247444
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.
2010-12-17 Jer Noble <jer@kokode.apple.com>
Reviewed by Simon Fraser.
Implement WebKit Full Screen support.
https://bugs.webkit.org/show_bug.cgi?id=49481
rdar://problem/8247444
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:
2010-12-17 Jer Noble <jer@kokode.apple.com>
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.
https://bugs.webkit.org/show_bug.cgi?id=49481
rdar://problem/8247444
* 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.
2010-12-17 Jer Noble <jer@kokode.apple.com>
Reviewed by Simon Fraser.
Implement WebKit Full Screen support.
https://bugs.webkit.org/show_bug.cgi?id=49481
rdar://problem/8247444
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.
2011-01-07 James Robinson <jamesr@chromium.org>
Revert "Implement mozilla's animationTime property"
......
......@@ -1165,6 +1165,7 @@ __ZNK7WebCore7Element19boundsInWindowSpaceEv
__ZNK7WebCore7Element9innerTextEv
__ZNK7WebCore7IntRect8containsERKS0_
__ZNK7WebCore7IntRect10intersectsERKS0_
__ZNK7WebCore7Element10screenRectEv
__ZNK7WebCore7IntRectcv6CGRectEv
__ZNK7WebCore7IntRectcv7_NSRectEv
__ZNK7WebCore7IntSizecv7_NSSizeEv
......@@ -1606,7 +1607,6 @@ _wkSupportsMultipartXMixedReplace
#endif
#if ENABLE(VIDEO)
__ZN7WebCore16HTMLMediaElement10screenRectEv
__ZN7WebCore16HTMLMediaElement12endScrubbingEv
__ZN7WebCore16HTMLMediaElement14beginScrubbingEv
__ZN7WebCore16HTMLMediaElement14exitFullscreenEv
......@@ -1638,6 +1638,13 @@ __ZN7WebCore8Document33webkitDidExitFullScreenForElementEPNS_7ElementE
__ZN7WebCore8Document34webkitDidEnterFullScreenForElementEPNS_7ElementE
__ZN7WebCore8Document34webkitWillExitFullScreenForElementEPNS_7ElementE
__ZN7WebCore8Document35webkitWillEnterFullScreenForElementEPNS_7ElementE
__ZN7WebCore8Document25setFullScreenRendererSizeERKNS_7IntSizeE
__ZN7WebCore8Document36setFullScreenRendererBackgroundColorENS_5ColorE
__ZNK7WebCore8Document9domWindowEv
__ZNK7WebCore16HTMLMediaElement5endedEv
__ZNK7WebCore16HTMLMediaElement6pausedEv
__ZN7WebCore8Document12updateLayoutEv
__ZNK7WebCore4Node16traverseNextNodeEPKS0_
#endif
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
......
......@@ -5338,6 +5338,8 @@
C6D74AE409AA290A000B0A52 /* ModifySelectionListLevel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6D74AE309AA290A000B0A52 /* ModifySelectionListLevel.cpp */; };
CA3BF67C10D99BAE00E6CE53 /* ScrollAnimator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */; };
CA3BF67E10D99BAE00E6CE53 /* ScrollAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */; };
CDEA7C841276230400B846DD /* RenderFullScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = CDEA7C821276230400B846DD /* RenderFullScreen.h */; };
CDEA7C851276230400B846DD /* RenderFullScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDEA7C831276230400B846DD /* RenderFullScreen.cpp */; };
CE02F0C411E83ADD00C6684A /* ScriptControllerBase.h in Headers */ = {isa = PBXBuildFile; fileRef = CE02F0C311E83ADD00C6684A /* ScriptControllerBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
CE057FA51220731100A476D5 /* DocumentMarkerController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE057FA31220731100A476D5 /* DocumentMarkerController.cpp */; };
CE057FA61220731100A476D5 /* DocumentMarkerController.h in Headers */ = {isa = PBXBuildFile; fileRef = CE057FA41220731100A476D5 /* DocumentMarkerController.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -11644,6 +11646,8 @@
CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollAnimator.cpp; sourceTree = "<group>"; };
CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollAnimator.h; sourceTree = "<group>"; };
CD4E0AFA11F7BC27009D3811 /* fullscreen.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = fullscreen.css; sourceTree = "<group>"; };
CDEA7C821276230400B846DD /* RenderFullScreen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderFullScreen.h; sourceTree = "<group>"; };
CDEA7C831276230400B846DD /* RenderFullScreen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderFullScreen.cpp; sourceTree = "<group>"; };
CE02F0C311E83ADD00C6684A /* ScriptControllerBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptControllerBase.h; sourceTree = "<group>"; };
CE057FA31220731100A476D5 /* DocumentMarkerController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentMarkerController.cpp; sourceTree = "<group>"; };
CE057FA41220731100A476D5 /* DocumentMarkerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentMarkerController.h; sourceTree = "<group>"; };
......@@ -18550,6 +18554,8 @@
0FD3080D117CF7E700A791F7 /* RenderFrameBase.h */,
A871DECA0A1530C700B12A68 /* RenderFrameSet.cpp */,
A871DEC90A1530C700B12A68 /* RenderFrameSet.h */,
CDEA7C831276230400B846DD /* RenderFullScreen.cpp */,
CDEA7C821276230400B846DD /* RenderFullScreen.h */,
BCEA482A097D93020094C9E4 /* RenderHTMLCanvas.cpp */,
BCEA482B097D93020094C9E4 /* RenderHTMLCanvas.h */,
0FD308D3117D168400A791F7 /* RenderIFrame.cpp */,
......@@ -19296,6 +19302,7 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
CDEA7C841276230400B846DD /* RenderFullScreen.h in Headers */,
B5B5DC6A119BB3D5002A8790 /* AbstractDatabase.h in Headers */,
41E1B1D10FF5986900576B3B /* AbstractWorker.h in Headers */,
29A8122E0FBB9C1D00510293 /* AccessibilityARIAGridCell.h in Headers */,
......@@ -24968,6 +24975,7 @@
7EE6847512D26E7000E79415 /* ResourceLoaderCFNet.cpp in Sources */,
93F1D5BA12D532C400832BEC /* WebKitLoseContext.cpp in Sources */,
93F1D5C012D5335600832BEC /* JSWebKitLoseContext.cpp in Sources */,
CDEA7C851276230400B846DD /* RenderFullScreen.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -603,7 +603,7 @@ static void loadFullDefaultStyle()
#if ENABLE(FULLSCREEN_API)
static void loadFullScreenRulesIfNeeded(Document* document)
{
if (!document->webkitFullScreen())
if (!document->webkitIsFullScreen())
return;
// Full-screen rules.
String fullscreenRules = String(fullscreenUserAgentStyleSheet, sizeof(fullscreenUserAgentStyleSheet)) + RenderTheme::defaultTheme()->extraDefaultStyleSheet();
......@@ -2664,17 +2664,15 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme
// element is an element in the document, the 'full-screen' pseudoclass applies to
// that element. Also, an <iframe>, <object> or <embed> element whose child browsing
// context's Document is in the fullscreen state has the 'full-screen' pseudoclass applied.
if (!e->document()->webkitFullScreen())
if (!e->document()->webkitIsFullScreen())
return false;
if (e != e->document()->webkitCurrentFullScreenElement())
return false;
return true;
case CSSSelector::PseudoFullScreenDocument:
// While a Document is in the fullscreen state, the 'full-screen-document' pseudoclass applies
// to the root element of that Document.
if (!e->document()->webkitFullScreen())
return false;
if (e != e->document()->documentElement())
// to all elements of that Document.
if (!e->document()->webkitIsFullScreen())
return false;
return true;
#endif
......
:-webkit-full-screen {
position:fixed;
top:0;
left:0;
right:0;
bottom:0;
background-color: white;
}
:root:full-screen-document:not(:full-screen) {
......@@ -11,15 +7,16 @@
}
video:-webkit-full-screen {
width: 100%;
height: 100%
image-fit: fill;
background-color: black;
width: auto;
height: 100%;
max-width: 100%;
}
img:-webkit-full-screen {
width: 100%;
width: auto;
height: 100%;
image-fit: fill;
max-width: 100%;
}
video:-webkit-full-page-media:-webkit-full-screen::-webkit-media-controls-panel {
......
......@@ -203,6 +203,10 @@
#include "HTMLNoScriptElement.h"
#endif
#if ENABLE(FULLSCREEN_API)
#include "RenderFullScreen.h"
#endif
using namespace std;
using namespace WTF;
using namespace Unicode;
......@@ -414,6 +418,8 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML, con
#if ENABLE(FULLSCREEN_API)
, m_isFullScreen(0)
, m_areKeysEnabledInFullScreen(0)
, m_fullScreenRenderer(0)
, m_fullScreenChangeDelayTimer(this, &Document::fullScreenChangeDelayTimerFired)
#endif
, m_loadEventDelayCount(0)
, m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired)
......@@ -1816,6 +1822,11 @@ void Document::detach()
// indicate destruction mode, i.e. attached() but renderer == 0
setRenderer(0);
#if ENABLE(FULLSCREEN_API)
if (m_fullScreenRenderer)
setFullScreenRenderer(0);
#endif
m_hoverNode = 0;
m_focusedNode = 0;
......@@ -3372,9 +3383,12 @@ void Document::nodeWillBeRemoved(Node* n)
ASSERT(n);
if (n->contains(m_fullScreenElement.get())) {
ASSERT(n != documentElement());
setFullScreenRenderer(0);
m_fullScreenElement = documentElement();
m_fullScreenElement->setNeedsStyleRecalc();
m_fullScreenElement->dispatchEvent(Event::create(eventNames().webkitfullscreenchangeEvent, true, false));
m_fullScreenElement->detach();
updateStyleIfNeeded();
m_fullScreenChangeDelayTimer.startOneShot(0);
}
#endif
}
......@@ -4822,19 +4836,29 @@ void Document::webkitWillEnterFullScreenForElement(Element* element)
m_fullScreenElement = element;
m_isFullScreen = true;
documentElement()->setNeedsStyleRecalc(FullStyleChange);
m_fullScreenElement->setNeedsStyleRecalc(FullStyleChange);
updateStyleIfNeeded();
m_fullScreenElement->dispatchEvent(Event::create(eventNames().webkitfullscreenchangeEvent, true, false));
if (m_fullScreenElement != documentElement())
m_fullScreenElement->detach();
recalcStyle(Force);
if (m_fullScreenRenderer)
m_fullScreenRenderer->setAnimating(true);
}
void Document::webkitDidEnterFullScreenForElement(Element*)
{
if (m_fullScreenRenderer)
m_fullScreenRenderer->setAnimating(false);
m_fullScreenChangeDelayTimer.startOneShot(0);
}
void Document::webkitWillExitFullScreenForElement(Element*)
{
if (m_fullScreenRenderer)
m_fullScreenRenderer->setAnimating(true);
recalcStyle(Force);
}
void Document::webkitDidExitFullScreenForElement(Element* element)
......@@ -4843,16 +4867,62 @@ void Document::webkitDidExitFullScreenForElement(Element* element)
m_isFullScreen = false;
m_areKeysEnabledInFullScreen = false;
// m_fullScreenElement has already been cleared; recalc the style of
// the passed in element instead.
element->setNeedsStyleRecalc(FullStyleChange);
if (element != documentElement())
documentElement()->setNeedsStyleRecalc(FullStyleChange);
updateStyleIfNeeded();
if (m_fullScreenRenderer)
m_fullScreenRenderer->remove();
element->dispatchEvent(Event::create(eventNames().webkitfullscreenchangeEvent, true, false));
if (m_fullScreenElement != documentElement())
m_fullScreenElement->detach();
setFullScreenRenderer(0);
recalcStyle(Force);
m_fullScreenChangeDelayTimer.startOneShot(0);
}
void Document::setFullScreenRenderer(RenderFullScreen* renderer)
{
m_fullScreenRenderer = renderer;
// This notification can come in after the page has been destroyed.
if (page())
page()->chrome()->client()->fullScreenRendererChanged(m_fullScreenRenderer);
}
void Document::setFullScreenRendererSize(const IntSize& size)
{
ASSERT(m_fullScreenRenderer);
if (!m_fullScreenRenderer)
return;
if (m_fullScreenRenderer) {
RefPtr<RenderStyle> newStyle = RenderStyle::clone(m_fullScreenRenderer->style());
newStyle->setWidth(Length(size.width(), WebCore::Fixed));
newStyle->setHeight(Length(size.height(), WebCore::Fixed));
newStyle->setTop(Length(0, WebCore::Fixed));
newStyle->setLeft(Length(0, WebCore::Fixed));
m_fullScreenRenderer->setStyle(newStyle);
}
}
void Document::setFullScreenRendererBackgroundColor(Color backgroundColor)
{
if (!m_fullScreenRenderer)
return;
RefPtr<RenderStyle> newStyle = RenderStyle::clone(m_fullScreenRenderer->style());
newStyle->setBackgroundColor(backgroundColor);
m_fullScreenRenderer->setStyle(newStyle);
}
void Document::fullScreenChangeDelayTimerFired(Timer<Document>*)
{
Element* element = m_fullScreenElement.get();
if (!element)
element = documentElement();
element->dispatchEvent(Event::create(eventNames().webkitfullscreenchangeEvent, true, false));
}
#endif
void Document::decrementLoadEventDelayCount()
......
......@@ -108,6 +108,7 @@ class Range;
class RegisteredEventListener;
class RenderArena;
class RenderView;
class RenderFullScreen;
class ScriptableDocumentParser;
class ScriptElementData;
class SecurityOrigin;
......@@ -1039,7 +1040,7 @@ public:
const QualifiedName& idAttributeName() const { return m_idAttributeName; }
#if ENABLE(FULLSCREEN_API)
bool webkitFullScreen() const { return m_isFullScreen; }
bool webkitIsFullScreen() const { return m_isFullScreen; }
bool webkitFullScreenKeyboardInputAllowed() const { return m_isFullScreen && m_areKeysEnabledInFullScreen; }
Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement.get(); }
void webkitRequestFullScreenForElement(Element*, unsigned short flags);
......@@ -1049,6 +1050,14 @@ public:
void webkitDidEnterFullScreenForElement(Element*);
void webkitWillExitFullScreenForElement(Element*);
void webkitDidExitFullScreenForElement(Element*);
void setFullScreenRenderer(RenderFullScreen*);
RenderFullScreen* fullScreenRenderer() const { return m_fullScreenRenderer; }
void setFullScreenRendererSize(const IntSize&);
void setFullScreenRendererBackgroundColor(Color);
void fullScreenChangeDelayTimerFired(Timer<Document>*);
#endif
// Used to allow element that loads data without going through a FrameLoader to delay the 'load' event.
......@@ -1368,6 +1377,8 @@ private:
bool m_isFullScreen;
bool m_areKeysEnabledInFullScreen;
RefPtr<Element> m_fullScreenElement;
RenderFullScreen* m_fullScreenRenderer;
Timer<Document> m_fullScreenChangeDelayTimer;
#endif
int m_loadEventDelayCount;
......
......@@ -243,7 +243,7 @@ module core {
#endif
#if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API
readonly attribute boolean webkitFullScreen;
readonly attribute boolean webkitIsFullScreen;
readonly attribute boolean webkitFullScreenKeyboardInputAllowed;
readonly attribute Element webkitCurrentFullScreenElement;
void webkitCancelFullScreen();
......
......@@ -558,6 +558,13 @@ PassRefPtr<ClientRect> Element::getBoundingClientRect() const
adjustFloatRectForAbsoluteZoom(result, renderer());
return ClientRect::create(result);
}
IntRect Element::screenRect() const
{
if (!renderer())
return IntRect();
return renderer()->view()->frameView()->contentsToScreen(renderer()->absoluteBoundingBoxRect());
}
static inline bool shouldIgnoreAttributeCase(const Element* e)
{
......
......@@ -169,6 +169,9 @@ public:
PassRefPtr<ClientRectList> getClientRects() const;
PassRefPtr<ClientRect> getBoundingClientRect() const;
// Returns the absolute bounding box translated into screen coordinates:
IntRect screenRect() const;
void removeAttribute(const String& name, ExceptionCode&);
void removeAttributeNS(const String& namespaceURI, const String& localName, ExceptionCode&);
......
......@@ -69,7 +69,10 @@
#include "ProcessingInstruction.h"
#include "ProgressEvent.h"
#include "RegisteredEventListener.h"
#include "RenderBlock.h"
#include "RenderBox.h"
#include "RenderFullScreen.h"
#include "RenderView.h"
#include "ScopedEventQueue.h"
#include "ScriptController.h"
#include "SelectorNodeList.h"
......@@ -1357,6 +1360,21 @@ void Node::createRendererIfNeeded()
ASSERT(parent);
RenderObject* parentRenderer = parent->renderer();
RenderObject* nextRenderer = this->nextRenderer();
#if ENABLE(FULLSCREEN_API)
// If this node is a fullscreen node, create a new anonymous full screen
// renderer.
if (document()->webkitIsFullScreen() && document()->webkitCurrentFullScreenElement() == this) {
RenderFullScreen* fullscreenRenderer = new (document()->renderArena()) RenderFullScreen(document());
fullscreenRenderer->setStyle(RenderFullScreen::createFullScreenStyle());
parentRenderer->addChild(fullscreenRenderer, 0);
parentRenderer = fullscreenRenderer;
nextRenderer = 0;
document()->setFullScreenRenderer(fullscreenRenderer);
}
#endif
if (parentRenderer && parentRenderer->canHaveChildren() && parent->childShouldCreateRenderer(this)) {
RefPtr<RenderStyle> style = styleForRenderer();
if (rendererIsNeeded(style.get())) {
......@@ -1366,7 +1384,7 @@ void Node::createRendererIfNeeded()
else {
setRenderer(r);
renderer()->setAnimatableStyle(style.release());
parentRenderer->addChild(renderer(), nextRenderer());
parentRenderer->addChild(renderer(), nextRenderer);
}
}
}
......