From dd91e772430dc294e3bf478c119ef8d43c0a3358 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 12 Mar 2012 14:11:15 +0100 Subject: Imported WebKit commit 3db4eb1820ac8fb03065d7ea73a4d9db1e8fea1a (http://svn.webkit.org/repository/webkit/trunk@110422) This includes build fixes for the latest qtbase/qtdeclarative as well as the final QML2 API. --- .../WebProcess/FullScreen/WebFullScreenManager.cpp | 68 +++++++++++----------- 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp') diff --git a/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp b/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp index 237fd4cf6..7e4a4e3c2 100644 --- a/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp +++ b/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp @@ -36,12 +36,34 @@ #include #include #include +#include +#include +#include +#include #include using namespace WebCore; namespace WebKit { +static IntRect screenRectOfContents(Element* element) +{ + ASSERT(element); +#if USE(ACCELERATED_COMPOSITING) + if (element->renderer() && element->renderer()->hasLayer() && element->renderer()->enclosingLayer()->isComposited()) { + FloatQuad contentsBox = static_cast(element->renderer()->enclosingLayer()->backing()->contentsBox()); + contentsBox = element->renderer()->localToAbsoluteQuad(contentsBox); + return element->renderer()->view()->frameView()->contentsToScreen(contentsBox.enclosingBoundingBox()); + } +#endif + return element->screenRect(); +} + +PassRefPtr WebFullScreenManager::create(WebPage* page) +{ + return adoptRef(new WebFullScreenManager(page)); +} + WebFullScreenManager::WebFullScreenManager(WebPage* page) : m_page(page) { @@ -49,7 +71,6 @@ WebFullScreenManager::WebFullScreenManager(WebPage* page) WebFullScreenManager::~WebFullScreenManager() { - } WebCore::Element* WebFullScreenManager::element() @@ -68,14 +89,13 @@ bool WebFullScreenManager::supportsFullScreen(bool withKeyboard) return false; return m_page->injectedBundleFullScreenClient().supportsFullScreen(m_page.get(), withKeyboard); - } void WebFullScreenManager::enterFullScreenForElement(WebCore::Element* element) { ASSERT(element); m_element = element; - m_initialFrame = m_element->screenRect(); + m_initialFrame = screenRectOfContents(m_element.get()); m_page->injectedBundleFullScreenClient().enterFullScreenForElement(m_page.get(), element); } @@ -86,61 +106,41 @@ void WebFullScreenManager::exitFullScreenForElement(WebCore::Element* element) m_page->injectedBundleFullScreenClient().exitFullScreenForElement(m_page.get(), element); } -void WebFullScreenManager::beganEnterFullScreenAnimation() -{ - m_page->send(Messages::WebFullScreenManagerProxy::BeganEnterFullScreenAnimation()); -} - -void WebFullScreenManager::finishedEnterFullScreenAnimation(bool completed) -{ - m_page->send(Messages::WebFullScreenManagerProxy::FinishedEnterFullScreenAnimation(completed)); -} - -void WebFullScreenManager::beganExitFullScreenAnimation() -{ - m_page->send(Messages::WebFullScreenManagerProxy::BeganExitFullScreenAnimation()); -} - -void WebFullScreenManager::finishedExitFullScreenAnimation(bool completed) -{ - m_page->send(Messages::WebFullScreenManagerProxy::FinishedExitFullScreenAnimation(completed)); -} - -IntRect WebFullScreenManager::getFullScreenRect() -{ - IntRect rect; - m_page->sendSync(Messages::WebFullScreenManagerProxy::GetFullScreenRect(), Messages::WebFullScreenManagerProxy::GetFullScreenRect::Reply(rect)); - return rect; -} - void WebFullScreenManager::willEnterFullScreen() { ASSERT(m_element); m_element->document()->webkitWillEnterFullScreenForElement(m_element.get()); - m_element->document()->setFullScreenRendererBackgroundColor(Color::transparent); + m_element->document()->updateLayout(); + m_page->forceRepaintWithoutCallback(); + m_finalFrame = screenRectOfContents(m_element.get()); + m_page->send(Messages::WebFullScreenManagerProxy::BeganEnterFullScreen(m_initialFrame, m_finalFrame)); } void WebFullScreenManager::didEnterFullScreen() { ASSERT(m_element); - m_element->document()->setFullScreenRendererBackgroundColor(Color::black); m_element->document()->webkitDidEnterFullScreenForElement(m_element.get()); } void WebFullScreenManager::willExitFullScreen() { ASSERT(m_element); + m_finalFrame = screenRectOfContents(m_element.get()); m_element->document()->webkitWillExitFullScreenForElement(m_element.get()); - m_element->document()->setFullScreenRendererBackgroundColor(Color::transparent); + m_page->send(Messages::WebFullScreenManagerProxy::BeganExitFullScreen(m_finalFrame, m_initialFrame)); } void WebFullScreenManager::didExitFullScreen() { ASSERT(m_element); m_element->document()->webkitDidExitFullScreenForElement(m_element.get()); - m_element->document()->setFullScreenRendererBackgroundColor(Color::black); } +void WebFullScreenManager::setAnimatingFullScreen(bool animating) +{ + ASSERT(m_element); + m_element->document()->setAnimatingFullScreen(animating); +} } // namespace WebKit -- cgit v1.2.1