summaryrefslogtreecommitdiff
path: root/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-03-12 14:11:15 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-03-12 14:11:15 +0100
commitdd91e772430dc294e3bf478c119ef8d43c0a3358 (patch)
tree6f33ce4d5872a5691e0291eb45bf6ab373a5f567 /Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp
parentad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (diff)
downloadqtwebkit-dd91e772430dc294e3bf478c119ef8d43c0a3358.tar.gz
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.
Diffstat (limited to 'Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp')
-rw-r--r--Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp68
1 files changed, 34 insertions, 34 deletions
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 <WebCore/Color.h>
#include <WebCore/Element.h>
#include <WebCore/Page.h>
+#include <WebCore/RenderLayer.h>
+#include <WebCore/RenderLayerBacking.h>
+#include <WebCore/RenderObject.h>
+#include <WebCore/RenderView.h>
#include <WebCore/Settings.h>
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<FloatRect>(element->renderer()->enclosingLayer()->backing()->contentsBox());
+ contentsBox = element->renderer()->localToAbsoluteQuad(contentsBox);
+ return element->renderer()->view()->frameView()->contentsToScreen(contentsBox.enclosingBoundingBox());
+ }
+#endif
+ return element->screenRect();
+}
+
+PassRefPtr<WebFullScreenManager> 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