summaryrefslogtreecommitdiff
path: root/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-07 11:22:47 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-07 11:22:47 +0100
commitcfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch)
tree24d68c6f61c464ecba1e05670b80390ea3b0e50c /Source/WebKit2/WebProcess/WebPage/WebPage.cpp
parent69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff)
downloadqtwebkit-cfd86b747d32ac22246a1aa908eaa720c63a88c1.tar.gz
Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733)
New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes.
Diffstat (limited to 'Source/WebKit2/WebProcess/WebPage/WebPage.cpp')
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.cpp132
1 files changed, 92 insertions, 40 deletions
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
index 3d8583d8d..2312e84c3 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -31,6 +31,7 @@
#include "DataReference.h"
#include "DecoderAdapter.h"
#include "DrawingArea.h"
+#include "DrawingAreaMessages.h"
#include "InjectedBundle.h"
#include "InjectedBundleBackForwardList.h"
#include "InjectedBundleUserMessageCoders.h"
@@ -60,15 +61,18 @@
#include "WebEventConversion.h"
#include "WebFrame.h"
#include "WebFullScreenManager.h"
+#include "WebFullScreenManagerMessages.h"
#include "WebGeolocationClient.h"
#include "WebGeometry.h"
#include "WebImage.h"
#include "WebInspector.h"
#include "WebInspectorClient.h"
+#include "WebInspectorMessages.h"
#include "WebNotificationClient.h"
#include "WebOpenPanelResultListener.h"
#include "WebPageCreationParameters.h"
#include "WebPageGroupProxy.h"
+#include "WebPageMessages.h"
#include "WebPageProxyMessages.h"
#include "WebPopupMenu.h"
#include "WebPreferencesStore.h"
@@ -176,6 +180,10 @@
#include <wtf/RefCountedLeakCounter.h>
#endif
+#if USE(COORDINATED_GRAPHICS)
+#include "LayerTreeCoordinatorMessages.h"
+#endif
+
using namespace JSC;
using namespace WebCore;
using namespace std;
@@ -355,6 +363,20 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
setMediaVolume(parameters.mediaVolume);
+ WebProcess::shared().addMessageReceiver(Messages::WebPage::messageReceiverName(), m_pageID, this);
+
+ // FIXME: This should be done in the object constructors, and the objects themselves should be message receivers.
+ WebProcess::shared().addMessageReceiver(Messages::DrawingArea::messageReceiverName(), m_pageID, this);
+#if USE(COORDINATED_GRAPHICS)
+ WebProcess::shared().addMessageReceiver(Messages::LayerTreeCoordinator::messageReceiverName(), m_pageID, this);
+#endif
+#if ENABLE(INSPECTOR)
+ WebProcess::shared().addMessageReceiver(Messages::WebInspector::messageReceiverName(), m_pageID, this);
+#endif
+#if ENABLE(FULLSCREEN_API)
+ WebProcess::shared().addMessageReceiver(Messages::WebFullScreenManager::messageReceiverName(), m_pageID, this);
+#endif
+
#ifndef NDEBUG
webPageCounter.increment();
#endif
@@ -372,6 +394,20 @@ WebPage::~WebPage()
for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it)
(*it)->webPageDestroyed();
+ WebProcess::shared().removeMessageReceiver(Messages::WebPage::messageReceiverName(), m_pageID);
+
+ // FIXME: This should be done in the object destructors, and the objects themselves should be message receivers.
+ WebProcess::shared().removeMessageReceiver(Messages::DrawingArea::messageReceiverName(), m_pageID);
+#if USE(COORDINATED_GRAPHICS)
+ WebProcess::shared().removeMessageReceiver(Messages::LayerTreeCoordinator::messageReceiverName(), m_pageID);
+#endif
+#if ENABLE(INSPECTOR)
+ WebProcess::shared().removeMessageReceiver(Messages::WebInspector::messageReceiverName(), m_pageID);
+#endif
+#if ENABLE(FULLSCREEN_API)
+ WebProcess::shared().removeMessageReceiver(Messages::WebFullScreenManager::messageReceiverName(), m_pageID);
+#endif
+
#ifndef NDEBUG
webPageCounter.decrement();
#endif
@@ -455,20 +491,28 @@ void WebPage::initializeInjectedBundleDiagnosticLoggingClient(WKBundlePageDiagno
PassRefPtr<Plugin> WebPage::createPlugin(WebFrame* frame, HTMLPlugInElement* pluginElement, const Plugin::Parameters& parameters)
{
String pluginPath;
- bool blocked;
-
+ uint32_t pluginLoadPolicy;
if (!WebProcess::shared().connection()->sendSync(
Messages::WebProcessProxy::GetPluginPath(parameters.mimeType, parameters.url.string()),
- Messages::WebProcessProxy::GetPluginPath::Reply(pluginPath, blocked), 0)) {
+ Messages::WebProcessProxy::GetPluginPath::Reply(pluginPath, pluginLoadPolicy), 0)) {
return 0;
}
- if (blocked) {
+ switch (static_cast<PluginModuleLoadPolicy>(pluginLoadPolicy)) {
+ case PluginModuleLoadNormally:
+ break;
+
+ case PluginModuleBlocked:
if (pluginElement->renderer()->isEmbeddedObject())
toRenderEmbeddedObject(pluginElement->renderer())->setPluginUnavailabilityReason(RenderEmbeddedObject::InsecurePluginVersion);
send(Messages::WebPageProxy::DidBlockInsecurePluginVersion(parameters.mimeType, parameters.url.string()));
return 0;
+
+ case PluginModuleInactive:
+ if (pluginElement->renderer()->isEmbeddedObject())
+ toRenderEmbeddedObject(pluginElement->renderer())->setPluginUnavailabilityReason(RenderEmbeddedObject::PluginInactive);
+ return 0;
}
if (pluginPath.isNull()) {
@@ -630,6 +674,20 @@ PassRefPtr<ImmutableArray> WebPage::trackedRepaintRects()
return ImmutableArray::adopt(vector);
}
+static PluginView* focusedPluginViewForFrame(Frame* frame)
+{
+ if (!frame->document()->isPluginDocument())
+ return 0;
+
+ PluginDocument* pluginDocument = static_cast<PluginDocument*>(frame->document());
+
+ if (pluginDocument->focusedNode() != pluginDocument->pluginNode())
+ return 0;
+
+ PluginView* pluginView = static_cast<PluginView*>(pluginDocument->pluginWidget());
+ return pluginView;
+}
+
static PluginView* pluginViewForFrame(Frame* frame)
{
if (!frame->document()->isPluginDocument())
@@ -646,7 +704,7 @@ void WebPage::executeEditingCommand(const String& commandName, const String& arg
if (!frame)
return;
- if (PluginView* pluginView = pluginViewForFrame(frame)) {
+ if (PluginView* pluginView = focusedPluginViewForFrame(frame)) {
pluginView->handleEditingCommand(commandName, argument);
return;
}
@@ -660,7 +718,7 @@ bool WebPage::isEditingCommandEnabled(const String& commandName)
if (!frame)
return false;
- if (PluginView* pluginView = pluginViewForFrame(frame))
+ if (PluginView* pluginView = focusedPluginViewForFrame(frame))
return pluginView->isEditingCommandEnabled(commandName);
Editor::Command command = frame->editor()->command(commandName);
@@ -926,32 +984,6 @@ void WebPage::setFixedVisibleContentRect(const IntRect& rect)
m_page->mainFrame()->view()->setFixedVisibleContentRect(rect);
}
-void WebPage::setResizesToContentsUsingLayoutSize(const IntSize& targetLayoutSize)
-{
- ASSERT(m_useFixedLayout);
- ASSERT(!targetLayoutSize.isEmpty());
-
- FrameView* view = m_page->mainFrame()->view();
-
- view->setDelegatesScrolling(true);
- view->setUseFixedLayout(true);
- view->setPaintsEntireContents(true);
-
- if (view->fixedLayoutSize() == targetLayoutSize)
- return;
-
- m_page->settings()->setAcceleratedCompositingForFixedPositionEnabled(true);
- m_page->settings()->setFixedElementsLayoutRelativeToFrame(true);
- m_page->settings()->setFixedPositionCreatesStackingContext(true);
-#if ENABLE(SMOOTH_SCROLLING)
- // Ensure we don't do animated scrolling in the WebProcess when scrolling is delegated.
- m_page->settings()->setEnableScrollAnimator(false);
-#endif
-
- // Always reset even when empty. This also takes care of the relayout.
- setFixedLayoutSize(targetLayoutSize);
-}
-
void WebPage::resizeToContentsIfNeeded()
{
ASSERT(m_useFixedLayout);
@@ -990,7 +1022,8 @@ void WebPage::sendViewportAttributesChanged()
ViewportAttributes attr = computeViewportAttributes(m_page->viewportArguments(), minimumLayoutFallbackWidth, deviceWidth, deviceHeight, m_page->deviceScaleFactor(), m_viewportSize);
- setResizesToContentsUsingLayoutSize(IntSize(static_cast<int>(attr.layoutSize.width()), static_cast<int>(attr.layoutSize.height())));
+ // This also takes care of the relayout.
+ setFixedLayoutSize(IntSize(static_cast<int>(attr.layoutSize.width()), static_cast<int>(attr.layoutSize.height())));
send(Messages::WebPageProxy::DidChangeViewportProperties(attr));
}
@@ -1152,12 +1185,31 @@ float WebPage::deviceScaleFactor() const
void WebPage::setUseFixedLayout(bool fixed)
{
+ // Do not overwrite current settings if initially setting it to false.
+ if (m_useFixedLayout == fixed)
+ return;
m_useFixedLayout = fixed;
+ m_page->settings()->setFixedElementsLayoutRelativeToFrame(fixed);
+#if USE(COORDINATED_GRAPHICS)
+ m_page->settings()->setAcceleratedCompositingForFixedPositionEnabled(fixed);
+ m_page->settings()->setFixedPositionCreatesStackingContext(fixed);
+#endif
+
+#if USE(TILED_BACKING_STORE) && ENABLE(SMOOTH_SCROLLING)
+ // Delegated scrolling will be enabled when the FrameView is created if fixed layout is enabled.
+ // Ensure we don't do animated scrolling in the WebProcess in that case.
+ m_page->settings()->setEnableScrollAnimator(!fixed);
+#endif
+
FrameView* view = mainFrameView();
if (!view)
return;
+#if USE(TILED_BACKING_STORE)
+ view->setDelegatesScrolling(fixed);
+ view->setPaintsEntireContents(fixed);
+#endif
view->setUseFixedLayout(fixed);
if (!fixed)
setFixedLayoutSize(IntSize());
@@ -1166,7 +1218,7 @@ void WebPage::setUseFixedLayout(bool fixed)
void WebPage::setFixedLayoutSize(const IntSize& size)
{
FrameView* view = mainFrameView();
- if (!view)
+ if (!view || view->fixedLayoutSize() == size)
return;
view->setFixedLayoutSize(size);
@@ -1573,7 +1625,7 @@ void WebPage::validateCommand(const String& commandName, uint64_t callbackID)
int32_t state = 0;
Frame* frame = m_page->focusController()->focusedOrMainFrame();
if (frame) {
- if (PluginView* pluginView = pluginViewForFrame(frame))
+ if (PluginView* pluginView = focusedPluginViewForFrame(frame))
isEnabled = pluginView->isEditingCommandEnabled(commandName);
else {
Editor::Command command = frame->editor()->command(commandName);
@@ -1854,7 +1906,7 @@ void WebPage::didStartPageTransition()
void WebPage::didCompletePageTransition()
{
-#if PLATFORM(QT)
+#if USE(TILED_BACKING_STORE)
if (m_mainFrame->coreFrame()->view()->delegatesScrolling())
// Wait until the UI process sent us the visible rect it wants rendered.
send(Messages::WebPageProxy::PageTransitionViewportReady());
@@ -3449,12 +3501,12 @@ static bool canPluginHandleResponse(const ResourceResponse& response)
{
#if ENABLE(NETSCAPE_PLUGIN_API)
String pluginPath;
- bool blocked;
+ uint32_t pluginLoadPolicy;
- if (!WebProcess::shared().connection()->sendSync(Messages::WebProcessProxy::GetPluginPath(response.mimeType(), response.url().string()), Messages::WebProcessProxy::GetPluginPath::Reply(pluginPath, blocked), 0))
+ if (!WebProcess::shared().connection()->sendSync(Messages::WebProcessProxy::GetPluginPath(response.mimeType(), response.url().string()), Messages::WebProcessProxy::GetPluginPath::Reply(pluginPath, pluginLoadPolicy), 0))
return false;
-
- return !blocked && !pluginPath.isEmpty();
+
+ return pluginLoadPolicy != PluginModuleBlocked && !pluginPath.isEmpty();
#else
return false;
#endif