summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/UIProcess
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/UIProcess')
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKAPICast.h4
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKBackForwardList.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKContext.cpp6
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKContextPrivate.h4
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKCredential.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKDownload.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKFrame.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKInspector.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPage.cpp23
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPage.h25
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPreferences.cpp21
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPreferences.h4
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h4
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WebKit2.h5
-rw-r--r--Source/WebKit2/UIProcess/API/C/gtk/WKAPICastGtk.h42
-rw-r--r--Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp59
-rw-r--r--Source/WebKit2/UIProcess/API/C/gtk/WKView.h49
-rw-r--r--Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/C/win/WKView.cpp11
-rw-r--r--Source/WebKit2/UIProcess/API/C/win/WKView.h4
-rw-r--r--Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm7
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PDFViewController.mm1
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PageClientImpl.h11
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm50
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKPrintingView.h61
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm585
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm5
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKView.h3
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKView.mm693
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKViewInternal.h9
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h36
-rw-r--r--Source/WebKit2/UIProcess/API/qt/ClientImpl.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwkpage.cpp33
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwkpage.h3
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwkpage_p.h13
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwkpreferences.cpp1
-rw-r--r--Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp1
-rw-r--r--Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp1
-rw-r--r--Source/WebKit2/UIProcess/Authentication/WebCredential.cpp1
-rw-r--r--Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp1
-rw-r--r--Source/WebKit2/UIProcess/BackingStore.cpp13
-rw-r--r--Source/WebKit2/UIProcess/BackingStore.h7
-rw-r--r--Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp19
-rw-r--r--Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h21
-rw-r--r--Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp1
-rw-r--r--Source/WebKit2/UIProcess/DrawingAreaProxy.cpp7
-rw-r--r--Source/WebKit2/UIProcess/DrawingAreaProxy.h23
-rw-r--r--Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in9
-rw-r--r--Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp107
-rw-r--r--Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h21
-rw-r--r--Source/WebKit2/UIProcess/FindIndicator.cpp25
-rw-r--r--Source/WebKit2/UIProcess/FindIndicator.h9
-rw-r--r--Source/WebKit2/UIProcess/GenericCallback.h109
-rw-r--r--Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp1
-rw-r--r--Source/WebKit2/UIProcess/GeolocationPermissionRequestProxy.cpp1
-rw-r--r--Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp1
-rw-r--r--Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h6
-rw-r--r--Source/WebKit2/UIProcess/Launcher/ThreadLauncher.cpp1
-rw-r--r--Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp1
-rw-r--r--Source/WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp1
-rw-r--r--Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm43
-rw-r--r--Source/WebKit2/UIProcess/Launcher/mac/ThreadLauncherMac.mm13
-rw-r--r--Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp171
-rw-r--r--Source/WebKit2/UIProcess/Launcher/qt/ThreadLauncherQt.cpp6
-rw-r--r--Source/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp1
-rw-r--r--Source/WebKit2/UIProcess/Launcher/win/ThreadLauncherWin.cpp1
-rw-r--r--Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.cpp21
-rw-r--r--Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.h10
-rw-r--r--Source/WebKit2/UIProcess/PageClient.h11
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp1
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp5
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp15
-rw-r--r--Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp2
-rw-r--r--Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm15
-rw-r--r--Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm9
-rw-r--r--Source/WebKit2/UIProcess/Plugins/qt/PluginInfoStoreQt.cpp1
-rw-r--r--Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp1
-rw-r--r--Source/WebKit2/UIProcess/ResponsivenessTimer.cpp1
-rw-r--r--Source/WebKit2/UIProcess/TextChecker.h2
-rw-r--r--Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp41
-rw-r--r--Source/WebKit2/UIProcess/VisitedLinkProvider.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebBackForwardList.cpp45
-rw-r--r--Source/WebKit2/UIProcess/WebBackForwardList.h2
-rw-r--r--Source/WebKit2/UIProcess/WebContext.cpp20
-rw-r--r--Source/WebKit2/UIProcess/WebContext.h7
-rw-r--r--Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebContextMenuProxy.cpp2
-rw-r--r--Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebDownloadClient.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebEditCommandProxy.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebFindClient.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebFormClient.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebFormSubmissionListenerProxy.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebFrameListenerProxy.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebFrameProxy.cpp5
-rw-r--r--Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebGeolocationProvider.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebHistoryClient.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebInspectorProxy.cpp7
-rw-r--r--Source/WebKit2/UIProcess/WebInspectorProxy.h15
-rw-r--r--Source/WebKit2/UIProcess/WebLoaderClient.cpp11
-rw-r--r--Source/WebKit2/UIProcess/WebLoaderClient.h5
-rw-r--r--Source/WebKit2/UIProcess/WebNavigationData.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebPageContextMenuClient.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebPageGroup.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.cpp421
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.h87
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.messages.in25
-rw-r--r--Source/WebKit2/UIProcess/WebPolicyClient.cpp21
-rw-r--r--Source/WebKit2/UIProcess/WebPolicyClient.h11
-rw-r--r--Source/WebKit2/UIProcess/WebPopupMenuProxy.h7
-rw-r--r--Source/WebKit2/UIProcess/WebPreferences.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebProcessManager.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebProcessProxy.cpp21
-rw-r--r--Source/WebKit2/UIProcess/WebProcessProxy.h20
-rw-r--r--Source/WebKit2/UIProcess/WebResourceLoadClient.cpp5
-rw-r--r--Source/WebKit2/UIProcess/WebResourceLoadClient.h2
-rw-r--r--Source/WebKit2/UIProcess/WebUIClient.cpp9
-rw-r--r--Source/WebKit2/UIProcess/WebUIClient.h2
-rw-r--r--Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp16
-rw-r--r--Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp7
-rw-r--r--Source/WebKit2/UIProcess/cf/WebPreferencesCF.cpp1
-rw-r--r--Source/WebKit2/UIProcess/gtk/ChunkedUpdateDrawingAreaProxyGtk.cpp94
-rw-r--r--Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp1
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp1
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp1
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp1
-rw-r--r--Source/WebKit2/UIProcess/mac/BackingStoreMac.mm15
-rw-r--r--Source/WebKit2/UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm17
-rw-r--r--Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm34
-rw-r--r--Source/WebKit2/UIProcess/mac/TextCheckerMac.mm23
-rw-r--r--Source/WebKit2/UIProcess/mac/WebContextMac.mm16
-rw-r--r--Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h9
-rw-r--r--Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm13
-rw-r--r--Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm1
-rw-r--r--Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm9
-rw-r--r--Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h13
-rw-r--r--Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm47
-rw-r--r--Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm7
-rw-r--r--Source/WebKit2/UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp3
-rw-r--r--Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp1
-rw-r--r--Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp1
-rw-r--r--Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp13
-rw-r--r--Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp1
-rw-r--r--Source/WebKit2/UIProcess/qt/WebContextQt.cpp9
-rw-r--r--Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp1
-rw-r--r--Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp1
-rw-r--r--Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp3
-rw-r--r--Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h2
-rw-r--r--Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp1
-rw-r--r--Source/WebKit2/UIProcess/win/BackingStoreWin.cpp109
-rw-r--r--Source/WebKit2/UIProcess/win/ChunkedUpdateDrawingAreaProxyWin.cpp1
-rw-r--r--Source/WebKit2/UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp5
-rw-r--r--Source/WebKit2/UIProcess/win/TextCheckerWin.cpp2
-rw-r--r--Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp1
-rw-r--r--Source/WebKit2/UIProcess/win/WebContextWin.cpp6
-rw-r--r--Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp10
-rw-r--r--Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp1
-rw-r--r--Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp16
-rw-r--r--Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h2
-rw-r--r--Source/WebKit2/UIProcess/win/WebView.cpp597
-rw-r--r--Source/WebKit2/UIProcess/win/WebView.h52
184 files changed, 3485 insertions, 1004 deletions
diff --git a/Source/WebKit2/UIProcess/API/C/WKAPICast.h b/Source/WebKit2/UIProcess/API/C/WKAPICast.h
index 15cb7ee..5ce3b1f 100644
--- a/Source/WebKit2/UIProcess/API/C/WKAPICast.h
+++ b/Source/WebKit2/UIProcess/API/C/WKAPICast.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -230,4 +231,7 @@ inline WebCore::CredentialPersistence toCredentialPersistence(WKCredentialPersis
#include "WKAPICastWin.h"
#endif
+#if defined(BUILDING_GTK__)
+#include "WKAPICastGtk.h"
+#endif
#endif // WKAPICast_h
diff --git a/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp b/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp
index 0997577..5319c2a 100644
--- a/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKAuthenticationChallenge.h"
#include "AuthenticationChallengeProxy.h"
diff --git a/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp b/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp
index 959f5c2..bcb175d 100644
--- a/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKAuthenticationDecisionListener.h"
#include "AuthenticationDecisionListener.h"
diff --git a/Source/WebKit2/UIProcess/API/C/WKBackForwardList.cpp b/Source/WebKit2/UIProcess/API/C/WKBackForwardList.cpp
index c2343ca..d7af883 100644
--- a/Source/WebKit2/UIProcess/API/C/WKBackForwardList.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKBackForwardList.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKBackForwardList.h"
#include "WebBackForwardList.h"
diff --git a/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp
index 2165737..5f6a222 100644
--- a/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKBackForwardListItem.h"
#include "WKAPICast.h"
diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.cpp b/Source/WebKit2/UIProcess/API/C/WKContext.cpp
index c207225..82bd13d 100644
--- a/Source/WebKit2/UIProcess/API/C/WKContext.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKContext.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKContext.h"
#include "WKContextPrivate.h"
@@ -176,3 +177,8 @@ void WKContextStopMemorySampler(WKContextRef contextRef)
{
toImpl(contextRef)->stopMemorySampler();
}
+
+void WKContextSetDatabaseDirectory(WKContextRef contextRef, WKStringRef databaseDirectory)
+{
+ toImpl(contextRef)->setDatabaseDirectory(toImpl(databaseDirectory)->string());
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h
index 8bcb1b6..bcd24a5 100644
--- a/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h
+++ b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h
@@ -54,6 +54,10 @@ WK_EXPORT void WKContextRegisterURLSchemeAsSecure(WKContextRef context, WKString
WK_EXPORT void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef context, WKStringRef urlScheme);
+// FIXME: This function is only effective if called before the Web process is launched. But
+// we should really change this setting to be on WebPreferences and changeable at runtime.
+WK_EXPORT void WKContextSetDatabaseDirectory(WKContextRef context, WKStringRef databaseDirectory);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/C/WKCredential.cpp b/Source/WebKit2/UIProcess/API/C/WKCredential.cpp
index 25e1185..997fd7a 100644
--- a/Source/WebKit2/UIProcess/API/C/WKCredential.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKCredential.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKCredential.h"
#include "WebCredential.h"
diff --git a/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp b/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp
index 226ef8c..c29d63c 100644
--- a/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKDatabaseManager.h"
#include "WebDatabaseManagerProxy.h"
diff --git a/Source/WebKit2/UIProcess/API/C/WKDownload.cpp b/Source/WebKit2/UIProcess/API/C/WKDownload.cpp
index 8960e2a..45dea68 100644
--- a/Source/WebKit2/UIProcess/API/C/WKDownload.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKDownload.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKDownload.h"
#include "DownloadProxy.h"
diff --git a/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.cpp b/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.cpp
index ae98831..842c534 100644
--- a/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKFormSubmissionListener.h"
#include "WKAPICast.h"
diff --git a/Source/WebKit2/UIProcess/API/C/WKFrame.cpp b/Source/WebKit2/UIProcess/API/C/WKFrame.cpp
index cce572a..af4006e 100644
--- a/Source/WebKit2/UIProcess/API/C/WKFrame.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKFrame.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKFrame.h"
#include "WKAPICast.h"
diff --git a/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.cpp b/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.cpp
index d44d0d3..3bb6730 100644
--- a/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKFramePolicyListener.h"
#include "WKAPICast.h"
diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp
index ed399ad..3b75855 100644
--- a/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKGeolocationManager.h"
#include "WKAPICast.h"
diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.cpp b/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.cpp
index ca52798..cd1757c 100644
--- a/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKGeolocationPermissionRequest.h"
#include "GeolocationPermissionRequestProxy.h"
diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp b/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp
index 7977369..5ce85c1 100644
--- a/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKGeolocationPosition.h"
#include "WKAPICast.h"
diff --git a/Source/WebKit2/UIProcess/API/C/WKInspector.cpp b/Source/WebKit2/UIProcess/API/C/WKInspector.cpp
index 7a87265..325db5a 100644
--- a/Source/WebKit2/UIProcess/API/C/WKInspector.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKInspector.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKInspector.h"
#if ENABLE(INSPECTOR)
diff --git a/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp b/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp
index 90eb142..fd0ddab 100644
--- a/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKNavigationData.h"
#include "WKAPICast.h"
diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp
index 3cf89cf..8b78d6d 100644
--- a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKOpenPanelParameters.h"
#include "WKAPICast.h"
diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.cpp b/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.cpp
index 5b143f2..8c79318 100644
--- a/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKOpenPanelResultListener.h"
#include "WKAPICast.h"
diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.cpp b/Source/WebKit2/UIProcess/API/C/WKPage.cpp
index 82daa4b..1d5763f 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPage.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKPage.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKPage.h"
#include "WKPagePrivate.h"
@@ -290,6 +291,16 @@ WKSize WKPageFixedLayoutSize(WKPageRef pageRef)
return toAPI(toImpl(pageRef)->fixedLayoutSize());
}
+bool WKPageHasHorizontalScrollbar(WKPageRef pageRef)
+{
+ return toImpl(pageRef)->hasHorizontalScrollbar();
+}
+
+bool WKPageHasVerticalScrollbar(WKPageRef pageRef)
+{
+ return toImpl(pageRef)->hasVerticalScrollbar();
+}
+
void WKPageFindString(WKPageRef pageRef, WKStringRef string, WKFindOptions options, unsigned maxMatchCount)
{
toImpl(pageRef)->findString(toImpl(string)->string(), toFindOptions(options), maxMatchCount);
@@ -429,3 +440,15 @@ void WKPageGetContentsAsString_b(WKPageRef pageRef, WKPageGetSourceForFrameBlock
WKPageGetContentsAsString(pageRef, Block_copy(block), callContentsAsStringBlockBlockAndDispose);
}
#endif
+
+void WKPageForceRepaint(WKPageRef pageRef, void* context, WKPageForceRepaintFunction callback)
+{
+ toImpl(pageRef)->forceRepaint(VoidCallback::create(context, callback));
+}
+
+WK_EXPORT WKURLRef WKPageCopyPendingAPIRequestURL(WKPageRef pageRef)
+{
+ if (toImpl(pageRef)->pendingAPIRequestURL().isNull())
+ return 0;
+ return toCopiedURLAPI(toImpl(pageRef)->pendingAPIRequestURL());
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.h b/Source/WebKit2/UIProcess/API/C/WKPage.h
index e4bf162..e6ebc5c 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPage.h
+++ b/Source/WebKit2/UIProcess/API/C/WKPage.h
@@ -60,6 +60,7 @@ typedef void (*WKPageDidDisplayInsecureContentForFrameCallback)(WKPageRef page,
typedef void (*WKPageDidRunInsecureContentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
typedef bool (*WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback)(WKPageRef page, WKFrameRef frame, WKProtectionSpaceRef protectionSpace, const void *clientInfo);
typedef void (*WKPageDidReceiveAuthenticationChallengeInFrameCallback)(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo);
+typedef void (*WKPageDidChangeBackForwardListCallback)(WKPageRef page, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void *clientInfo);
struct WKPageLoaderClient {
int version;
@@ -91,14 +92,14 @@ struct WKPageLoaderClient {
WKPageCallback processDidBecomeResponsive;
WKPageCallback processDidCrash;
- WKPageCallback didChangeBackForwardList;
+ WKPageDidChangeBackForwardListCallback didChangeBackForwardList;
};
typedef struct WKPageLoaderClient WKPageLoaderClient;
// Policy Client.
-typedef void (*WKPageDecidePolicyForNavigationActionCallback)(WKPageRef page, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo);
-typedef void (*WKPageDecidePolicyForNewWindowActionCallback)(WKPageRef page, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo);
-typedef void (*WKPageDecidePolicyForMIMETypeCallback)(WKPageRef page, WKStringRef MIMEType, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo);
+typedef void (*WKPageDecidePolicyForNavigationActionCallback)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
+typedef void (*WKPageDecidePolicyForNewWindowActionCallback)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
+typedef void (*WKPageDecidePolicyForMIMETypeCallback)(WKPageRef page, WKFrameRef frame, WKStringRef MIMEType, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
struct WKPagePolicyClient {
int version;
@@ -120,7 +121,7 @@ struct WKPageFormClient {
typedef struct WKPageFormClient WKPageFormClient;
// Resource Load Client.
-typedef void (*WKPageDidInitiateLoadForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, WKURLRequestRef request, const void* clientInfo);
+typedef void (*WKPageDidInitiateLoadForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, WKURLRequestRef request, bool pageIsProvisionallyLoading, const void* clientInfo);
typedef void (*WKPageDidSendRequestForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, WKURLRequestRef request, WKURLResponseRef redirectResponse, const void* clientInfo);
typedef void (*WKPageDidReceiveResponseForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, WKURLResponseRef response, const void* clientInfo);
typedef void (*WKPageDidReceiveContentLengthForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, uint64_t contentLength, const void* clientInfo);
@@ -167,6 +168,7 @@ typedef float (*WKPageFooterHeightCallback)(WKPageRef page, WKFrameRef frame, co
typedef void (*WKPageDrawHeaderCallback)(WKPageRef page, WKFrameRef frame, WKRect rect, const void* clientInfo);
typedef void (*WKPageDrawFooterCallback)(WKPageRef page, WKFrameRef frame, WKRect rect, const void* clientInfo);
typedef void (*WKPagePrintFrameCallback)(WKPageRef page, WKFrameRef frame, const void* clientInfo);
+typedef void (*WKPageDidCompleteRubberBandForMainFrameCallback)(WKPageRef page, WKSize initialOverhang, const void* clientInfo);
struct WKPageUIClient {
int version;
@@ -203,6 +205,7 @@ struct WKPageUIClient {
WKPageDrawFooterCallback drawFooter;
WKPagePrintFrameCallback printFrame;
WKPageCallback runModal;
+ WKPageDidCompleteRubberBandForMainFrameCallback didCompleteRubberBandForMainFrame;
};
typedef struct WKPageUIClient WKPageUIClient;
@@ -305,8 +308,11 @@ WK_EXPORT double WKPageGetScaleFactor(WKPageRef page);
WK_EXPORT void WKPageSetUseFixedLayout(WKPageRef page, bool fixed);
WK_EXPORT void WKPageSetFixedLayoutSize(WKPageRef page, WKSize size);
-WK_EXPORT bool WKPageUseFixedLayout(WKPageRef pageRef);
-WK_EXPORT WKSize WKPageFixedLayoutSize(WKPageRef pageRef);
+WK_EXPORT bool WKPageUseFixedLayout(WKPageRef page);
+WK_EXPORT WKSize WKPageFixedLayoutSize(WKPageRef page);
+
+WK_EXPORT bool WKPageHasHorizontalScrollbar(WKPageRef page);
+WK_EXPORT bool WKPageHasVerticalScrollbar(WKPageRef page);
WK_EXPORT void WKPageFindString(WKPageRef page, WKStringRef string, WKFindOptions findOptions, unsigned maxMatchCount);
WK_EXPORT void WKPageHideFindUI(WKPageRef page);
@@ -341,6 +347,11 @@ typedef void (^WKPageGetContentsAsStringBlock)(WKStringRef, WKErrorRef);
WK_EXPORT void WKPageGetContentsAsString_b(WKPageRef page, WKPageGetContentsAsStringBlock block);
#endif
+typedef void (*WKPageForceRepaintFunction)(WKErrorRef, void*);
+WK_EXPORT void WKPageForceRepaint(WKPageRef page, void* context, WKPageForceRepaintFunction function);
+
+WK_EXPORT WKURLRef WKPageCopyPendingAPIRequestURL(WKPageRef page);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp b/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp
index 6c10014..8a4d86a 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKPageGroup.h"
#include "WKAPICast.h"
diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
index 379859c..97e9403 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKPreferences.h"
#include "WKPreferencesPrivate.h"
@@ -330,6 +331,16 @@ bool WKPreferencesGetCompositingRepaintCountersVisible(WKPreferencesRef preferen
return toImpl(preferencesRef)->compositingRepaintCountersVisible();
}
+void WKPreferencesSetWebGLEnabled(WKPreferencesRef preferencesRef, bool flag)
+{
+ toImpl(preferencesRef)->setWebGLEnabled(flag);
+}
+
+bool WKPreferencesGetWebGLEnabled(WKPreferencesRef preferencesRef)
+{
+ return toImpl(preferencesRef)->webGLEnabled();
+}
+
void WKPreferencesSetNeedsSiteSpecificQuirks(WKPreferencesRef preferencesRef, bool flag)
{
toImpl(preferencesRef)->setNeedsSiteSpecificQuirks(flag);
@@ -449,3 +460,13 @@ bool WKPreferencesGetDOMPasteAllowed(WKPreferencesRef preferencesRef)
{
return toImpl(preferencesRef)->domPasteAllowed();
}
+
+void WKPreferencesSetJavaScriptCanAccessClipboard(WKPreferencesRef preferencesRef, bool enabled)
+{
+ toImpl(preferencesRef)->setJavaScriptCanAccessClipboard(enabled);
+}
+
+bool WKPreferencesGetJavaScriptCanAccessClipboard(WKPreferencesRef preferencesRef)
+{
+ return toImpl(preferencesRef)->javaScriptCanAccessClipboard();
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.h b/Source/WebKit2/UIProcess/API/C/WKPreferences.h
index 8116575..5c6c478 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPreferences.h
+++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.h
@@ -146,6 +146,10 @@ WK_EXPORT bool WKPreferencesGetAuthorAndUserStylesEnabled(WKPreferencesRef prefe
WK_EXPORT void WKPreferencesSetShouldPrintBackgrounds(WKPreferencesRef preferences, bool shouldPrintBackgrounds);
WK_EXPORT bool WKPreferencesGetShouldPrintBackgrounds(WKPreferencesRef preferences);
+// Defaults to false.
+WK_EXPORT void WKPreferencesSetJavaScriptCanAccessClipboard(WKPreferencesRef preferencesRef, bool enabled);
+WK_EXPORT bool WKPreferencesGetJavaScriptCanAccessClipboard(WKPreferencesRef preferencesRef);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
index 7408c8e..ff9beec 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
+++ b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
@@ -60,6 +60,10 @@ WK_EXPORT void WKPreferencesSetCompositingRepaintCountersVisible(WKPreferencesRe
WK_EXPORT bool WKPreferencesGetCompositingRepaintCountersVisible(WKPreferencesRef);
// Defaults to false.
+WK_EXPORT void WKPreferencesSetWebGLEnabled(WKPreferencesRef, bool);
+WK_EXPORT bool WKPreferencesGetWebGLEnabled(WKPreferencesRef);
+
+// Defaults to false.
WK_EXPORT void WKPreferencesSetNeedsSiteSpecificQuirks(WKPreferencesRef, bool);
WK_EXPORT bool WKPreferencesGetNeedsSiteSpecificQuirks(WKPreferencesRef);
diff --git a/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp b/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp
index c72ee98..7e764b9 100644
--- a/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKProtectionSpace.h"
#include "WebProtectionSpace.h"
diff --git a/Source/WebKit2/UIProcess/API/C/WebKit2.h b/Source/WebKit2/UIProcess/API/C/WebKit2.h
index 02a339f..47d7c7b 100644
--- a/Source/WebKit2/UIProcess/API/C/WebKit2.h
+++ b/Source/WebKit2/UIProcess/API/C/WebKit2.h
@@ -42,6 +42,7 @@
#include <WebKit2/WKGeolocationManager.h>
#include <WebKit2/WKGeolocationPermissionRequest.h>
#include <WebKit2/WKGeolocationPosition.h>
+#include <WebKit2/WKGraphicsContext.h>
#include <WebKit2/WKMutableArray.h>
#include <WebKit2/WKMutableDictionary.h>
#include <WebKit2/WKNavigationData.h>
@@ -56,7 +57,9 @@
#include <WebKit2/WKURLRequest.h>
#include <WebKit2/WKURLResponse.h>
-#if !(defined(__APPLE__) && __APPLE__) || (defined(__OBJC__) && __OBJC__)
+#if defined(__OBJC__) && __OBJC__
+#import <WebKit2/WKView.h>
+#elif !(defined(__APPLE__) && __APPLE__)
#include <WebKit2/WKView.h>
#endif
diff --git a/Source/WebKit2/UIProcess/API/C/gtk/WKAPICastGtk.h b/Source/WebKit2/UIProcess/API/C/gtk/WKAPICastGtk.h
new file mode 100644
index 0000000..79c1133
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/gtk/WKAPICastGtk.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKAPICastGtk_h
+#define WKAPICastGtk_h
+
+#ifndef WKAPICast_h
+#error "Please #include \"WKAPICast.h\" instead of this file directly."
+#endif
+
+namespace WebKit {
+
+class WebView;
+
+WK_ADD_API_MAPPING(WKViewRef, WebView)
+
+}
+
+#endif // WKAPICastGtk_h
diff --git a/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp b/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp
new file mode 100644
index 0000000..aa88151
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WKView.h"
+
+#include "WKAPICast.h"
+#include "WebView.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+#include <wtf/text/StringImpl.h>
+
+using namespace WebKit;
+using namespace WebCore;
+
+WKViewRef WKViewCreate(GdkRectangle rect, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
+{
+ RefPtr<WebView> view = WebView::create(rect, toImpl(contextRef), toImpl(pageGroupRef));
+ return toAPI(view.release().leakRef());
+}
+
+GtkWidget* WKViewGetWindow(WKViewRef viewRef)
+{
+ return toImpl(viewRef)->window();
+}
+
+WKPageRef WKViewGetPage(WKViewRef viewRef)
+{
+ return toAPI(toImpl(viewRef)->page());
+}
+
+WKURLRef WKURLCreateWithURL(const char* url)
+{
+ return toCopiedURLAPI(StringImpl::create(url).leakRef());
+}
diff --git a/Source/WebKit2/UIProcess/API/C/gtk/WKView.h b/Source/WebKit2/UIProcess/API/C/gtk/WKView.h
new file mode 100644
index 0000000..5415fd3
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/gtk/WKView.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKView_h
+#define WKView_h
+
+#include <WebKit2/WKBase.h>
+#include <gtk/gtk.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKViewRef WKViewCreate(GdkRectangle rect, WKContextRef context, WKPageGroupRef pageGroup);
+
+WK_EXPORT GtkWidget* WKViewGetWindow(WKViewRef view);
+
+WK_EXPORT WKPageRef WKViewGetPage(WKViewRef view);
+
+WK_EXPORT WKURLRef WKURLCreateWithURL(const char*);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKView_h */
diff --git a/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp b/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp
index 9906c81..110951f 100644
--- a/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp
+++ b/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKContext.h"
#include "WKContextPrivateWin.h"
diff --git a/Source/WebKit2/UIProcess/API/C/win/WKView.cpp b/Source/WebKit2/UIProcess/API/C/win/WKView.cpp
index 612661e..62603fe 100644
--- a/Source/WebKit2/UIProcess/API/C/win/WKView.cpp
+++ b/Source/WebKit2/UIProcess/API/C/win/WKView.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKView.h"
#include "WKAPICast.h"
@@ -70,3 +71,13 @@ void WKViewSetInitialFocus(WKViewRef viewRef, bool forward)
{
toImpl(viewRef)->setInitialFocus(forward);
}
+
+void WKViewSetFindIndicatorCallback(WKViewRef viewRef, WKViewFindIndicatorCallback callback, void* context)
+{
+ toImpl(viewRef)->setFindIndicatorCallback(callback, context);
+}
+
+WKViewFindIndicatorCallback WKViewGetFindIndicatorCallback(WKViewRef viewRef, void** context)
+{
+ return toImpl(viewRef)->getFindIndicatorCallback(context);
+}
diff --git a/Source/WebKit2/UIProcess/API/C/win/WKView.h b/Source/WebKit2/UIProcess/API/C/win/WKView.h
index f4226cd..213897e 100644
--- a/Source/WebKit2/UIProcess/API/C/win/WKView.h
+++ b/Source/WebKit2/UIProcess/API/C/win/WKView.h
@@ -46,6 +46,10 @@ WK_EXPORT void WKViewWindowAncestryDidChange(WKViewRef view);
WK_EXPORT void WKViewSetIsInWindow(WKViewRef view, bool isInWindow);
WK_EXPORT void WKViewSetInitialFocus(WKViewRef view, bool forward);
+typedef void (*WKViewFindIndicatorCallback)(WKViewRef, HBITMAP selectionBitmap, RECT selectionRectInWindowCoordinates, bool fadeout, void*);
+WK_EXPORT void WKViewSetFindIndicatorCallback(WKViewRef view, WKViewFindIndicatorCallback callback, void* context);
+WK_EXPORT WKViewFindIndicatorCallback WKViewGetFindIndicatorCallback(WKViewRef view, void** context);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp b/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp
index 00c3595..7b3cf6e 100644
--- a/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp
+++ b/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKViewPrivate.h"
#include "WKAPICast.h"
diff --git a/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp b/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp
index 0f2c946..f2f1883 100644
--- a/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp
+++ b/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp
@@ -18,6 +18,7 @@
*
*/
+#include "config.h"
#include "WKStringQt.h"
#include "WKAPICast.h"
diff --git a/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.cpp b/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.cpp
index 74eca86..f9111f7 100644
--- a/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.cpp
+++ b/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.cpp
@@ -18,6 +18,7 @@
*
*/
+#include "config.h"
#include "WKURLQt.h"
#include "WKAPICast.h"
diff --git a/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm b/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm
index 5b93a9e..e622c9d 100644
--- a/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm
+++ b/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm
@@ -23,10 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "FindIndicatorWindow.h"
+#import "config.h"
+#import "FindIndicatorWindow.h"
-#include "FindIndicator.h"
-#include <WebCore/GraphicsContext.h>
+#import "FindIndicator.h"
+#import <WebCore/GraphicsContext.h>
static const double bounceAnimationDuration = 0.12;
static const double timeBeforeFadeStarts = bounceAnimationDuration + 0.2;
diff --git a/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm b/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm
index a92c2d4..6ab425d 100644
--- a/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm
+++ b/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import "config.h"
#import "PDFViewController.h"
#import "DataReference.h"
diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
index 625b8f6..b557c1a 100644
--- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
+++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
@@ -60,6 +60,7 @@ private:
virtual bool isViewInWindow();
virtual void processDidCrash();
+ virtual void pageClosed();
virtual void didRelaunchProcess();
virtual void takeFocus(bool direction);
virtual void toolTipChanged(const String& oldToolTip, const String& newToolTip);
@@ -75,23 +76,29 @@ private:
virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
- virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&);
+ virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled);
virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*);
virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut);
+ virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
+ virtual void exitAcceleratedCompositingMode();
+
#if USE(ACCELERATED_COMPOSITING)
virtual void pageDidEnterAcceleratedCompositing();
virtual void pageDidLeaveAcceleratedCompositing();
#endif
- virtual void accessibilityChildTokenReceived(const CoreIPC::DataReference&);
+ virtual void accessibilityWebProcessTokenReceived(const CoreIPC::DataReference&);
virtual void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled);
+ virtual void setAutodisplay(bool);
virtual CGContextRef containingWindowGraphicsContext();
+ virtual void didChangeScrollbarsForMainFrame() const;
+
virtual void didCommitLoadForMainFrame(bool useCustomRepresentation);
virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&);
diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
index 60be5bc..fd70a67 100644
--- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
+++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
@@ -23,11 +23,12 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import "NativeWebKeyboardEvent.h"
+#import "config.h"
#import "PageClientImpl.h"
#import "DataReference.h"
#import "FindIndicator.h"
+#import "NativeWebKeyboardEvent.h"
#import "WKAPICast.h"
#import "WKStringCF.h"
#import "WKViewInternal.h"
@@ -43,6 +44,10 @@
#import <wtf/text/CString.h>
#import <wtf/text/WTFString.h>
+@interface NSApplication (WebNSApplicationDetails)
+- (NSCursor *)_cursorRectCursor;
+@end
+
using namespace WebCore;
@interface WebEditCommandObjC : NSObject
@@ -177,6 +182,11 @@ void PageClientImpl::processDidCrash()
{
[m_wkView _processDidCrash];
}
+
+void PageClientImpl::pageClosed()
+{
+ [m_wkView _pageClosed];
+}
void PageClientImpl::didRelaunchProcess()
{
@@ -195,7 +205,8 @@ void PageClientImpl::toolTipChanged(const String& oldToolTip, const String& newT
void PageClientImpl::setCursor(const WebCore::Cursor& cursor)
{
- [m_wkView _setCursor:cursor.platformCursor()];
+ if (![NSApp _cursorRectCursor])
+ [m_wkView _setCursor:cursor.platformCursor()];
}
void PageClientImpl::setViewportArguments(const WebCore::ViewportArguments&)
@@ -297,10 +308,14 @@ FloatRect PageClientImpl::convertToUserSpace(const FloatRect& rect)
return [m_wkView _convertToUserSpace:rect];
}
-void PageClientImpl::didNotHandleKeyEvent(const NativeWebKeyboardEvent& event)
+void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool wasEventHandled)
{
NSEvent* nativeEvent = event.nativeEvent();
- if ([nativeEvent type] == NSKeyDown) {
+ if ([nativeEvent type] != NSKeyDown)
+ return;
+ if (wasEventHandled)
+ [NSCursor setHiddenUntilMouseMoves:YES];
+ else {
[m_wkView _setEventBeingResent:nativeEvent];
[[NSApplication sharedApplication] sendEvent:nativeEvent];
}
@@ -321,13 +336,23 @@ void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, b
[m_wkView _setFindIndicator:findIndicator fadeOut:fadeOut];
}
-void PageClientImpl::accessibilityChildTokenReceived(const CoreIPC::DataReference& data)
+void PageClientImpl::accessibilityWebProcessTokenReceived(const CoreIPC::DataReference& data)
{
NSData* remoteToken = [NSData dataWithBytes:data.data() length:data.size()];
- [m_wkView _setAccessibilityChildToken:remoteToken];
+ [m_wkView _setAccessibilityWebProcessToken:remoteToken];
}
#if USE(ACCELERATED_COMPOSITING)
+void PageClientImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
+{
+ [m_wkView _enterAcceleratedCompositingMode:layerTreeContext];
+}
+
+void PageClientImpl::exitAcceleratedCompositingMode()
+{
+ [m_wkView _exitAcceleratedCompositingMode];
+}
+
void PageClientImpl::pageDidEnterAcceleratedCompositing()
{
[m_wkView _pageDidEnterAcceleratedCompositing];
@@ -344,11 +369,24 @@ void PageClientImpl::setComplexTextInputEnabled(uint64_t pluginComplexTextInputI
[m_wkView _setComplexTextInputEnabled:complexTextInputEnabled pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier];
}
+void PageClientImpl::setAutodisplay(bool newState)
+{
+ if (!newState && [[m_wkView window] isAutodisplay])
+ [m_wkView displayIfNeeded];
+
+ [[m_wkView window] setAutodisplay:newState];
+}
+
CGContextRef PageClientImpl::containingWindowGraphicsContext()
{
return static_cast<CGContextRef>([[[m_wkView window] graphicsContext] graphicsPort]);
}
+void PageClientImpl::didChangeScrollbarsForMainFrame() const
+{
+ [m_wkView _didChangeScrollbarsForMainFrame];
+}
+
void PageClientImpl::didCommitLoadForMainFrame(bool useCustomRepresentation)
{
[m_wkView _setPageHasCustomRepresentation:useCustomRepresentation];
diff --git a/Source/WebKit2/UIProcess/API/mac/WKPrintingView.h b/Source/WebKit2/UIProcess/API/mac/WKPrintingView.h
new file mode 100644
index 0000000..3f7a692
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/mac/WKPrintingView.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/IntRectHash.h>
+#import <wtf/RetainPtr.h>
+
+@class WKPrintingViewData;
+
+namespace WebKit {
+ class WebFrameProxy;
+}
+
+@interface WKPrintingView : NSView {
+@public
+ NSPrintOperation *_printOperation; // WKPrintingView is owned by the operation.
+
+ RefPtr<WebKit::WebFrameProxy> _webFrame;
+ Vector<WebCore::IntRect> _printingPageRects;
+ double _totalScaleFactorForPrinting;
+ HashMap<WebCore::IntRect, Vector<uint8_t> > _pagePreviews;
+
+ Vector<uint8_t> _printedPagesData;
+ RetainPtr<CGPDFDocumentRef> _printedPagesPDFDocument;
+
+ uint64_t _expectedComputedPagesCallback;
+ HashMap<uint64_t, WebCore::IntRect> _expectedPreviewCallbacks;
+ uint64_t _latestExpectedPreviewCallback;
+ uint64_t _expectedPrintCallback;
+
+ BOOL _isPrintingFromSecondaryThread;
+ Mutex _printingCallbackMutex;
+ ThreadCondition _printingCallbackCondition;
+
+ NSTimer *_autodisplayResumeTimer;
+}
+
+- (id)initWithFrameProxy:(WebKit::WebFrameProxy*)frame;
+
+@end
diff --git a/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm b/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm
new file mode 100644
index 0000000..28ba153
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm
@@ -0,0 +1,585 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "WKPrintingView.h"
+
+#import "Logging.h"
+#import "PrintInfo.h"
+#import "WebData.h"
+#import "WebPageProxy.h"
+
+using namespace WebKit;
+using namespace WebCore;
+
+NSString * const WebKitOriginalTopPrintingMarginKey = @"WebKitOriginalTopMargin";
+NSString * const WebKitOriginalBottomPrintingMarginKey = @"WebKitOriginalBottomMargin";
+
+NSString * const NSPrintInfoDidChangeNotification = @"NSPrintInfoDidChange";
+
+static BOOL isForcingPreviewUpdate;
+
+@implementation WKPrintingView
+
+- (id)initWithFrameProxy:(WebFrameProxy*)frame
+{
+ self = [super init]; // No frame rect to pass to NSView.
+ if (!self)
+ return nil;
+
+ _webFrame = frame;
+
+ return self;
+}
+
+- (BOOL)isFlipped
+{
+ return YES;
+}
+
+- (void)_suspendAutodisplay
+{
+ // A drawRect: call on WKView causes a switch to screen mode, which is slow due to relayout, and we want to avoid that.
+ // Disabling autodisplay will prevent random updates from causing this, but resizing the window will still work.
+ if (_autodisplayResumeTimer) {
+ [_autodisplayResumeTimer invalidate];
+ _autodisplayResumeTimer = nil;
+ } else
+ _webFrame->page()->setAutodisplay(false);
+}
+
+- (void)_delayedResumeAutodisplayTimerFired
+{
+ ASSERT(isMainThread());
+
+ _autodisplayResumeTimer = nil;
+ _webFrame->page()->setAutodisplay(true);
+}
+
+- (void)_delayedResumeAutodisplay
+{
+ // AppKit calls endDocument/beginDocument when print option change. We don't want to switch between print and screen mode just for that,
+ // and enabling autodisplay may result in switching into screen mode. So, autodisplay is only resumed on next run loop iteration.
+ if (!_autodisplayResumeTimer) {
+ _autodisplayResumeTimer = [NSTimer timerWithTimeInterval:0 target:self selector:@selector(_delayedResumeAutodisplayTimerFired) userInfo:nil repeats:NO];
+ // The timer must be scheduled on main thread, because printing thread may finish before it fires.
+ [[NSRunLoop mainRunLoop] addTimer:_autodisplayResumeTimer forMode:NSDefaultRunLoopMode];
+ }
+}
+
+- (void)_adjustPrintingMarginsForHeaderAndFooter
+{
+ NSPrintInfo *info = [_printOperation printInfo];
+ NSMutableDictionary *infoDictionary = [info dictionary];
+
+ // We need to modify the top and bottom margins in the NSPrintInfo to account for the space needed by the
+ // header and footer. Because this method can be called more than once on the same NSPrintInfo (see 5038087),
+ // we stash away the unmodified top and bottom margins the first time this method is called, and we read from
+ // those stashed-away values on subsequent calls.
+ double originalTopMargin;
+ double originalBottomMargin;
+ NSNumber *originalTopMarginNumber = [infoDictionary objectForKey:WebKitOriginalTopPrintingMarginKey];
+ if (!originalTopMarginNumber) {
+ ASSERT(![infoDictionary objectForKey:WebKitOriginalBottomPrintingMarginKey]);
+ originalTopMargin = [info topMargin];
+ originalBottomMargin = [info bottomMargin];
+ [infoDictionary setObject:[NSNumber numberWithDouble:originalTopMargin] forKey:WebKitOriginalTopPrintingMarginKey];
+ [infoDictionary setObject:[NSNumber numberWithDouble:originalBottomMargin] forKey:WebKitOriginalBottomPrintingMarginKey];
+ } else {
+ ASSERT([originalTopMarginNumber isKindOfClass:[NSNumber class]]);
+ ASSERT([[infoDictionary objectForKey:WebKitOriginalBottomPrintingMarginKey] isKindOfClass:[NSNumber class]]);
+ originalTopMargin = [originalTopMarginNumber doubleValue];
+ originalBottomMargin = [[infoDictionary objectForKey:WebKitOriginalBottomPrintingMarginKey] doubleValue];
+ }
+
+ CGFloat scale = [info scalingFactor];
+ [info setTopMargin:originalTopMargin + _webFrame->page()->headerHeight(_webFrame.get()) * scale];
+ [info setBottomMargin:originalBottomMargin + _webFrame->page()->footerHeight(_webFrame.get()) * scale];
+}
+
+- (BOOL)_isPrintingPreview
+{
+ // <rdar://problem/8901041> Please add an API returning whether the current print operation is for preview.
+ // Assuming that if NSPrintOperation is allowed to spawn a thread for printing, it will. Print preview doesn't spawn a thread.
+ return !_isPrintingFromSecondaryThread;
+}
+
+- (void)_updatePreview
+{
+ // <rdar://problem/8900923> Please add an API to force print preview update.
+ ASSERT(!isForcingPreviewUpdate);
+ isForcingPreviewUpdate = YES;
+ [[NSNotificationCenter defaultCenter] postNotificationName:NSPrintInfoDidChangeNotification object:nil];
+ isForcingPreviewUpdate = NO;
+}
+
+- (BOOL)_hasPageRects
+{
+ // WebCore always prints at least one page.
+ return !_printingPageRects.isEmpty();
+}
+
+- (NSUInteger)_firstPrintedPageNumber
+{
+ // Need to directly access the dictionary because -[NSPrintOperation pageRange] verifies pagination, potentially causing recursion.
+ return [[[[_printOperation printInfo] dictionary] objectForKey:NSPrintFirstPage] unsignedIntegerValue];
+}
+
+- (NSUInteger)_lastPrintedPageNumber
+{
+ ASSERT([self _hasPageRects]);
+
+ // Need to directly access the dictionary because -[NSPrintOperation pageRange] verifies pagination, potentially causing recursion.
+ NSUInteger firstPage = [[[[_printOperation printInfo] dictionary] objectForKey:NSPrintFirstPage] unsignedIntegerValue];
+ NSUInteger lastPage = [[[[_printOperation printInfo] dictionary] objectForKey:NSPrintLastPage] unsignedIntegerValue];
+ if (lastPage - firstPage >= _printingPageRects.size())
+ return _printingPageRects.size();
+ return lastPage;
+}
+
+- (uint64_t)_expectedPreviewCallbackForRect:(const IntRect&)rect
+{
+ for (HashMap<uint64_t, WebCore::IntRect>::iterator iter = _expectedPreviewCallbacks.begin(); iter != _expectedPreviewCallbacks.end(); ++iter) {
+ if (iter->second == rect)
+ return iter->first;
+ }
+ return 0;
+}
+
+struct IPCCallbackContext {
+ RetainPtr<WKPrintingView> view;
+ uint64_t callbackID;
+};
+
+static void pageDidDrawToPDF(WKDataRef dataRef, WKErrorRef, void* untypedContext)
+{
+ ASSERT(isMainThread());
+
+ OwnPtr<IPCCallbackContext> context = adoptPtr(static_cast<IPCCallbackContext*>(untypedContext));
+ WKPrintingView *view = context->view.get();
+ WebData* data = toImpl(dataRef);
+
+ if (context->callbackID == view->_expectedPrintCallback) {
+ ASSERT(![view _isPrintingPreview]);
+ ASSERT(view->_printedPagesData.isEmpty());
+ ASSERT(!view->_printedPagesPDFDocument);
+ if (data)
+ view->_printedPagesData.append(data->bytes(), data->size());
+ view->_expectedPrintCallback = 0;
+ view->_printingCallbackCondition.signal();
+ } else {
+ // If the user has already changed print setup, then this response is obsolete. And this callback is not in response to the latest request,
+ // then the user has already moved to another page - we'll cache the response, but won't draw it.
+ HashMap<uint64_t, WebCore::IntRect>::iterator iter = view->_expectedPreviewCallbacks.find(context->callbackID);
+ if (iter != view->_expectedPreviewCallbacks.end()) {
+ ASSERT([view _isPrintingPreview]);
+
+ if (data) {
+ pair<HashMap<WebCore::IntRect, Vector<uint8_t> >::iterator, bool> entry = view->_pagePreviews.add(iter->second, Vector<uint8_t>());
+ entry.first->second.append(data->bytes(), data->size());
+ }
+ bool receivedResponseToLatestRequest = view->_latestExpectedPreviewCallback == context->callbackID;
+ view->_latestExpectedPreviewCallback = 0;
+ view->_expectedPreviewCallbacks.remove(context->callbackID);
+ if (receivedResponseToLatestRequest)
+ [view _updatePreview];
+ }
+ }
+}
+
+- (void)_preparePDFDataForPrintingOnSecondaryThread
+{
+ ASSERT(isMainThread());
+
+ if (!_webFrame->page()) {
+ _printingCallbackCondition.signal();
+ return;
+ }
+
+ MutexLocker lock(_printingCallbackMutex);
+
+ ASSERT([self _hasPageRects]);
+ ASSERT(_printedPagesData.isEmpty());
+ ASSERT(!_printedPagesPDFDocument);
+ ASSERT(!_expectedPrintCallback);
+
+ NSUInteger firstPage = [self _firstPrintedPageNumber];
+ NSUInteger lastPage = [self _lastPrintedPageNumber];
+
+ ASSERT(firstPage > 0);
+ ASSERT(firstPage <= lastPage);
+ LOG(View, "WKPrintingView requesting PDF data for pages %u...%u", firstPage, lastPage);
+
+ // Return to printing mode if we're already back to screen (e.g. due to window resizing).
+ _webFrame->page()->beginPrinting(_webFrame.get(), PrintInfo([_printOperation printInfo]));
+
+ IPCCallbackContext* context = new IPCCallbackContext;
+ RefPtr<DataCallback> callback = DataCallback::create(context, pageDidDrawToPDF);
+ _expectedPrintCallback = callback->callbackID();
+
+ context->view = self;
+ context->callbackID = callback->callbackID();
+
+ _webFrame->page()->drawPagesToPDF(_webFrame.get(), firstPage - 1, lastPage - firstPage + 1, callback.get());
+}
+
+static void pageDidComputePageRects(const Vector<WebCore::IntRect>& pageRects, double totalScaleFactorForPrinting, WKErrorRef, void* untypedContext)
+{
+ ASSERT(isMainThread());
+
+ OwnPtr<IPCCallbackContext> context = adoptPtr(static_cast<IPCCallbackContext*>(untypedContext));
+ WKPrintingView *view = context->view.get();
+
+ // If the user has already changed print setup, then this response is obsolete.
+ if (context->callbackID == view->_expectedComputedPagesCallback) {
+ ASSERT(isMainThread());
+ ASSERT(view->_expectedPreviewCallbacks.isEmpty());
+ ASSERT(!view->_latestExpectedPreviewCallback);
+ ASSERT(!view->_expectedPrintCallback);
+ ASSERT(view->_pagePreviews.isEmpty());
+ view->_expectedComputedPagesCallback = 0;
+
+ view->_printingPageRects = pageRects;
+ view->_totalScaleFactorForPrinting = totalScaleFactorForPrinting;
+
+ const IntRect& lastPrintingPageRect = view->_printingPageRects[view->_printingPageRects.size() - 1];
+ NSRect newFrameSize = NSMakeRect(0, 0,
+ ceil(lastPrintingPageRect.maxX() * view->_totalScaleFactorForPrinting),
+ ceil(lastPrintingPageRect.maxY() * view->_totalScaleFactorForPrinting));
+ LOG(View, "WKPrintingView setting frame size to x:%g y:%g width:%g height:%g", newFrameSize.origin.x, newFrameSize.origin.y, newFrameSize.size.width, newFrameSize.size.height);
+ [view setFrame:newFrameSize];
+
+ if ([view _isPrintingPreview]) {
+ // Show page count, and ask for an actual image to replace placeholder.
+ [view _updatePreview];
+ } else {
+ // When printing, request everything we'll need beforehand.
+ [view _preparePDFDataForPrintingOnSecondaryThread];
+ }
+ }
+}
+
+- (BOOL)_askPageToComputePageRects
+{
+ ASSERT(isMainThread());
+
+ if (!_webFrame->page())
+ return NO;
+
+ ASSERT(!_expectedComputedPagesCallback);
+
+ IPCCallbackContext* context = new IPCCallbackContext;
+ RefPtr<ComputedPagesCallback> callback = ComputedPagesCallback::create(context, pageDidComputePageRects);
+ _expectedComputedPagesCallback = callback->callbackID();
+ context->view = self;
+ context->callbackID = _expectedComputedPagesCallback;
+
+ _webFrame->page()->computePagesForPrinting(_webFrame.get(), PrintInfo([_printOperation printInfo]), callback.release());
+ return YES;
+}
+
+static void prepareDataForPrintingOnSecondaryThread(void* untypedContext)
+{
+ ASSERT(isMainThread());
+
+ WKPrintingView *view = static_cast<WKPrintingView *>(untypedContext);
+ MutexLocker lock(view->_printingCallbackMutex);
+
+ // We may have received page rects while a message to call this function traveled from secondary thread to main one.
+ if ([view _hasPageRects]) {
+ [view _preparePDFDataForPrintingOnSecondaryThread];
+ return;
+ }
+
+ // A request for pages has already been made, just wait for it to finish.
+ if (view->_expectedComputedPagesCallback)
+ return;
+
+ [view _askPageToComputePageRects];
+}
+
+- (BOOL)knowsPageRange:(NSRangePointer)range
+{
+ LOG(View, "-[WKPrintingView %p knowsPageRange:], %s, %s", self, [self _hasPageRects] ? "print data is available" : "print data is not available yet", isMainThread() ? "on main thread" : "on secondary thread");
+ ASSERT(_printOperation == [NSPrintOperation currentOperation]);
+
+ // Assuming that once we switch to printing from a secondary thread, we don't go back.
+ ASSERT(!_isPrintingFromSecondaryThread || !isMainThread());
+ if (!isMainThread())
+ _isPrintingFromSecondaryThread = YES;
+
+ [self _suspendAutodisplay];
+
+ [self _adjustPrintingMarginsForHeaderAndFooter];
+
+ if ([self _hasPageRects])
+ *range = NSMakeRange(1, _printingPageRects.size());
+ else if (!isMainThread()) {
+ ASSERT(![self _isPrintingPreview]);
+ MutexLocker lock(_printingCallbackMutex);
+ callOnMainThread(prepareDataForPrintingOnSecondaryThread, self);
+ _printingCallbackCondition.wait(_printingCallbackMutex);
+ *range = NSMakeRange(1, _printingPageRects.size());
+ } else {
+ ASSERT([self _isPrintingPreview]);
+
+ // If a request for pages hasn't already been made, make it now.
+ if (!_expectedComputedPagesCallback)
+ [self _askPageToComputePageRects];
+
+ *range = NSMakeRange(1, NSIntegerMax);
+ }
+ return YES;
+}
+
+- (unsigned)_pageForRect:(NSRect)rect
+{
+ // Assuming that rect exactly matches one of the pages.
+ for (size_t i = 0; i < _printingPageRects.size(); ++i) {
+ IntRect currentRect(_printingPageRects[i]);
+ currentRect.scale(_totalScaleFactorForPrinting);
+ if (rect.origin.y == currentRect.y() && rect.origin.x == currentRect.x())
+ return i + 1;
+ }
+ ASSERT_NOT_REACHED();
+ return 0; // Invalid page number.
+}
+
+- (void)_drawPDFDocument:(CGPDFDocumentRef)pdfDocument page:(unsigned)page atPoint:(NSPoint)point
+{
+ if (!pdfDocument) {
+ LOG_ERROR("Couldn't create a PDF document with data passed for preview");
+ return;
+ }
+
+ CGPDFPageRef pdfPage = CGPDFDocumentGetPage(pdfDocument, page);
+ if (!pdfPage) {
+ LOG_ERROR("Preview data doesn't have page %d", page);
+ return;
+ }
+
+ NSGraphicsContext *nsGraphicsContext = [NSGraphicsContext currentContext];
+ CGContextRef context = static_cast<CGContextRef>([nsGraphicsContext graphicsPort]);
+
+ CGContextSaveGState(context);
+ CGContextTranslateCTM(context, point.x, point.y);
+ CGContextScaleCTM(context, _totalScaleFactorForPrinting, -_totalScaleFactorForPrinting);
+ CGContextTranslateCTM(context, 0, -CGPDFPageGetBoxRect(pdfPage, kCGPDFMediaBox).size.height);
+ CGContextDrawPDFPage(context, pdfPage);
+ CGContextRestoreGState(context);
+}
+
+- (void)_drawPreview:(NSRect)nsRect
+{
+ ASSERT(isMainThread());
+
+ IntRect rect(nsRect);
+ rect.scale(1 / _totalScaleFactorForPrinting);
+ HashMap<WebCore::IntRect, Vector<uint8_t> >::iterator pagePreviewIterator = _pagePreviews.find(rect);
+ if (pagePreviewIterator == _pagePreviews.end()) {
+ // It's too early to ask for page preview if we don't even know page size and scale.
+ if ([self _hasPageRects]) {
+ if (uint64_t existingCallback = [self _expectedPreviewCallbackForRect:rect]) {
+ // We've already asked for a preview of this page, and are waiting for response.
+ // There is no need to ask again.
+ _latestExpectedPreviewCallback = existingCallback;
+ } else {
+ // Preview isn't available yet, request it asynchronously.
+ if (!_webFrame->page())
+ return;
+
+ // Return to printing mode if we're already back to screen (e.g. due to window resizing).
+ _webFrame->page()->beginPrinting(_webFrame.get(), PrintInfo([_printOperation printInfo]));
+
+ IPCCallbackContext* context = new IPCCallbackContext;
+ RefPtr<DataCallback> callback = DataCallback::create(context, pageDidDrawToPDF);
+ _latestExpectedPreviewCallback = callback->callbackID();
+ _expectedPreviewCallbacks.add(_latestExpectedPreviewCallback, rect);
+
+ context->view = self;
+ context->callbackID = callback->callbackID();
+
+ _webFrame->page()->drawRectToPDF(_webFrame.get(), rect, callback.get());
+ return;
+ }
+ }
+
+ // FIXME: Draw a placeholder
+ return;
+ }
+
+ const Vector<uint8_t>& pdfData = pagePreviewIterator->second;
+ RetainPtr<CGDataProviderRef> pdfDataProvider(AdoptCF, CGDataProviderCreateWithData(0, pdfData.data(), pdfData.size(), 0));
+ RetainPtr<CGPDFDocumentRef> pdfDocument(AdoptCF, CGPDFDocumentCreateWithProvider(pdfDataProvider.get()));
+
+ [self _drawPDFDocument:pdfDocument.get() page:1 atPoint:NSMakePoint(nsRect.origin.x, nsRect.origin.y)];
+}
+
+- (void)drawRect:(NSRect)nsRect
+{
+ LOG(View, "WKPrintingView %p printing rect x:%g, y:%g, width:%g, height:%g%s", self, nsRect.origin.x, nsRect.origin.y, nsRect.size.width, nsRect.size.height, [self _isPrintingPreview] ? " for preview" : "");
+
+ ASSERT(_printOperation == [NSPrintOperation currentOperation]);
+
+ if (!_webFrame->page())
+ return;
+
+ if ([self _isPrintingPreview]) {
+ [self _drawPreview:nsRect];
+ return;
+ }
+
+ ASSERT(!isMainThread());
+ ASSERT(!_printedPagesData.isEmpty()); // Prepared by knowsPageRange:
+
+ if (!_printedPagesPDFDocument) {
+ RetainPtr<CGDataProviderRef> pdfDataProvider(AdoptCF, CGDataProviderCreateWithData(0, _printedPagesData.data(), _printedPagesData.size(), 0));
+ _printedPagesPDFDocument.adoptCF(CGPDFDocumentCreateWithProvider(pdfDataProvider.get()));
+ }
+
+ unsigned printedPageNumber = [self _pageForRect:nsRect] - [self _firstPrintedPageNumber] + 1;
+ [self _drawPDFDocument:_printedPagesPDFDocument.get() page:printedPageNumber atPoint:NSMakePoint(nsRect.origin.x, nsRect.origin.y)];
+}
+
+- (void)_drawPageBorderWithSizeOnMainThread:(NSSize)borderSize
+{
+ ASSERT(isMainThread());
+
+ // When printing from a secondary thread, the main thread doesn't have graphics context and printing operation set up.
+ NSGraphicsContext *currentContext = [NSGraphicsContext currentContext];
+ [NSGraphicsContext setCurrentContext:[_printOperation context]];
+
+ ASSERT(![NSPrintOperation currentOperation]);
+ [NSPrintOperation setCurrentOperation:_printOperation];
+
+ [self drawPageBorderWithSize:borderSize];
+
+ [NSPrintOperation setCurrentOperation:nil];
+ [NSGraphicsContext setCurrentContext:currentContext];
+}
+
+- (void)drawPageBorderWithSize:(NSSize)borderSize
+{
+ ASSERT(NSEqualSizes(borderSize, [[_printOperation printInfo] paperSize]));
+ ASSERT(_printOperation == [NSPrintOperation currentOperation]);
+
+ if (!isMainThread()) {
+ // Don't call the client from a secondary thread.
+ NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[WKPrintingView instanceMethodSignatureForSelector:@selector(_drawPageBorderWithSizeOnMainThread:)]];
+ [invocation setSelector:@selector(_drawPageBorderWithSizeOnMainThread:)];
+ [invocation setArgument:&borderSize atIndex:2];
+ [invocation performSelectorOnMainThread:@selector(invokeWithTarget:) withObject:self waitUntilDone:YES];
+ return;
+ }
+
+ if (!_webFrame->page())
+ return;
+
+ // The header and footer rect height scales with the page, but the width is always
+ // all the way across the printed page (inset by printing margins).
+ NSPrintInfo *printInfo = [_printOperation printInfo];
+ CGFloat scale = [printInfo scalingFactor];
+ NSSize paperSize = [printInfo paperSize];
+ CGFloat headerFooterLeft = [printInfo leftMargin] / scale;
+ CGFloat headerFooterWidth = (paperSize.width - ([printInfo leftMargin] + [printInfo rightMargin])) / scale;
+ NSRect footerRect = NSMakeRect(headerFooterLeft, [printInfo bottomMargin] / scale - _webFrame->page()->footerHeight(_webFrame.get()), headerFooterWidth, _webFrame->page()->footerHeight(_webFrame.get()));
+ NSRect headerRect = NSMakeRect(headerFooterLeft, (paperSize.height - [printInfo topMargin]) / scale, headerFooterWidth, _webFrame->page()->headerHeight(_webFrame.get()));
+
+ NSGraphicsContext *currentContext = [NSGraphicsContext currentContext];
+ [currentContext saveGraphicsState];
+ NSRectClip(headerRect);
+ _webFrame->page()->drawHeader(_webFrame.get(), headerRect);
+ [currentContext restoreGraphicsState];
+
+ [currentContext saveGraphicsState];
+ NSRectClip(footerRect);
+ _webFrame->page()->drawFooter(_webFrame.get(), footerRect);
+ [currentContext restoreGraphicsState];
+}
+
+- (NSRect)rectForPage:(NSInteger)page
+{
+ ASSERT(_printOperation == [NSPrintOperation currentOperation]);
+ if (![self _hasPageRects]) {
+ LOG(View, "-[WKPrintingView %p rectForPage:%d] - data is not yet available", self, (int)page);
+ // We must be still calculating the page range.
+ ASSERT(_expectedComputedPagesCallback);
+ return NSMakeRect(0, 0, 1, 1);
+ }
+
+ IntRect rect = _printingPageRects[page - 1];
+ rect.scale(_totalScaleFactorForPrinting);
+ LOG(View, "-[WKPrintingView %p rectForPage:%d] -> x %d, y %d, width %d, height %d", self, (int)page, rect.x(), rect.y(), rect.width(), rect.height());
+ return rect;
+}
+
+// Temporary workaround for <rdar://problem/8944535>. Force correct printout positioning.
+- (NSPoint)locationOfPrintRect:(NSRect)aRect
+{
+ ASSERT(_printOperation == [NSPrintOperation currentOperation]);
+ return NSMakePoint([[_printOperation printInfo] leftMargin], [[_printOperation printInfo] bottomMargin]);
+}
+
+- (void)beginDocument
+{
+ ASSERT(_printOperation == [NSPrintOperation currentOperation]);
+
+ // Forcing preview update gets us here, but page setup hasn't actually changed.
+ if (isForcingPreviewUpdate)
+ return;
+
+ LOG(View, "-[WKPrintingView %p beginDocument]", self);
+
+ [super beginDocument];
+
+ [self _suspendAutodisplay];
+}
+
+- (void)endDocument
+{
+ ASSERT(_printOperation == [NSPrintOperation currentOperation]);
+
+ // Forcing preview update gets us here, but page setup hasn't actually changed.
+ if (isForcingPreviewUpdate)
+ return;
+
+ LOG(View, "-[WKPrintingView %p endDocument] - clearing cached data", self);
+
+ // Both existing data and pending responses are now obsolete.
+ _printingPageRects.clear();
+ _totalScaleFactorForPrinting = 1;
+ _pagePreviews.clear();
+ _printedPagesData.clear();
+ _printedPagesPDFDocument = nullptr;
+ _expectedComputedPagesCallback = 0;
+ _expectedPreviewCallbacks.clear();
+ _latestExpectedPreviewCallback = 0;
+ _expectedPrintCallback = 0;
+
+ [self _delayedResumeAutodisplay];
+
+ [super endDocument];
+}
+@end
diff --git a/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm b/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm
index b7dae31..3b69a1d 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm
+++ b/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm
@@ -23,9 +23,10 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "WKTextInputWindowController.h"
+#import "config.h"
+#import "WKTextInputWindowController.h"
-#include <WebKitSystemInterface.h>
+#import <WebKitSystemInterface.h>
@interface WKTextInputPanel : NSPanel {
NSTextView *_inputTextView;
diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.h b/Source/WebKit2/UIProcess/API/mac/WKView.h
index 618bbc4..8c1826c 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKView.h
+++ b/Source/WebKit2/UIProcess/API/mac/WKView.h
@@ -31,6 +31,7 @@
WK_EXPORT
@interface WKView : NSView <NSTextInput> {
WKViewData *_data;
+ unsigned _frameSizeUpdatesDisabledCount;
}
- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef;
@@ -39,6 +40,8 @@ WK_EXPORT
- (NSPrintOperation *)printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(WKFrameRef)frameRef;
- (BOOL)canChangeFrameLayout:(WKFrameRef)frameRef;
+- (void)setFrame:(NSRect)rect andScrollBy:(NSSize)offset;
+
@property(readonly) WKPageRef pageRef;
@property BOOL drawsBackground;
diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm
index 400239d..da29e04 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import "config.h"
#import "WKView.h"
#import "ChunkedUpdateDrawingAreaProxy.h"
@@ -31,19 +32,22 @@
#import "FindIndicator.h"
#import "FindIndicatorWindow.h"
#import "LayerBackedDrawingAreaProxy.h"
+#import "LayerTreeContext.h"
#import "Logging.h"
#import "NativeWebKeyboardEvent.h"
#import "PDFViewController.h"
#import "PageClientImpl.h"
#import "PasteboardTypes.h"
-#import "PrintInfo.h"
#import "Region.h"
#import "RunLoop.h"
#import "TextChecker.h"
#import "TextCheckerState.h"
#import "WKAPICast.h"
+#import "WKPrintingView.h"
#import "WKStringCF.h"
#import "WKTextInputWindowController.h"
+#import "WKViewInternal.h"
+#import "WKViewPrivate.h"
#import "WebContext.h"
#import "WebEventFactory.h"
#import "WebPage.h"
@@ -71,12 +75,9 @@
- (void)speakString:(NSString *)string;
@end
-@interface NSView (Details)
-- (void)_recursiveDisplayRectIfNeededIgnoringOpacity:(NSRect)rect isVisibleRect:(BOOL)isVisibleRect rectIsVisibleRectForView:(NSView *)visibleView topView:(BOOL)topView;
-@end
-
@interface NSWindow (Details)
- (NSRect)_growBoxRect;
+- (void)_setShowOpaqueGrowBoxForOwner:(id)owner;
- (BOOL)_updateGrowBoxForWindowFrameChange;
@end
@@ -97,9 +98,6 @@ typedef HashMap<String, ValidationVector> ValidationMap;
}
-NSString* const WebKitOriginalTopPrintingMarginKey = @"WebKitOriginalTopMargin";
-NSString* const WebKitOriginalBottomPrintingMarginKey = @"WebKitOriginalBottomMargin";
-
@interface WKViewData : NSObject {
@public
OwnPtr<PageClientImpl> _pageClient;
@@ -110,8 +108,11 @@ NSString* const WebKitOriginalBottomPrintingMarginKey = @"WebKitOriginalBottomMa
id _trackingRectOwner;
void* _trackingRectUserData;
+ RetainPtr<NSView> _layerHostingView;
+
+ // FIXME: Remove _oldLayerHostingView.
#if USE(ACCELERATED_COMPOSITING)
- NSView *_layerHostingView;
+ NSView *_oldLayerHostingView;
#endif
RetainPtr<id> _remoteAccessibilityChild;
@@ -128,6 +129,8 @@ NSString* const WebKitOriginalBottomPrintingMarginKey = @"WebKitOriginalBottomMa
NSEvent *_keyDownEventBeingResent;
Vector<KeypressCommand> _commandsList;
+ NSSize _resizeScrollOffset;
+
// The identifier of the plug-in we want to send complex text input to, or 0 if there is none.
uint64_t _pluginComplexTextInputIdentifier;
@@ -135,50 +138,21 @@ NSString* const WebKitOriginalBottomPrintingMarginKey = @"WebKitOriginalBottomMa
unsigned _selectionStart;
unsigned _selectionEnd;
- Vector<IntRect> _printingPageRects;
- double _totalScaleFactorForPrinting;
-
bool _inBecomeFirstResponder;
bool _inResignFirstResponder;
NSEvent *_mouseDownEvent;
BOOL _ignoringMouseDraggedEvents;
BOOL _dragHasStarted;
-}
-@end
-@implementation WKViewData
-@end
-
-@interface WebFrameWrapper : NSObject {
-@public
- RefPtr<WebFrameProxy> _frame;
+#if ENABLE(GESTURE_EVENTS)
+ id _endGestureMonitor;
+#endif
}
-
-- (id)initWithFrameProxy:(WebFrameProxy*)frame;
-- (WebFrameProxy*)webFrame;
@end
-@implementation WebFrameWrapper
-
-- (id)initWithFrameProxy:(WebFrameProxy*)frame
-{
- self = [super init];
- if (!self)
- return nil;
-
- _frame = frame;
- return self;
-}
-
-- (WebFrameProxy*)webFrame
-{
- return _frame.get();
-}
-
+@implementation WKViewData
@end
-NSString * const PrintedFrameKey = @"WebKitPrintedFrameKey";
-
@interface NSObject (NSTextInputContextDetails)
- (BOOL)wantsToHandleMouseEvents;
- (BOOL)handleMouseEvent:(NSEvent *)event;
@@ -186,11 +160,10 @@ NSString * const PrintedFrameKey = @"WebKitPrintedFrameKey";
@implementation WKView
+// FIXME: Remove this once we no longer want to be able to go back to the old drawing area.
static bool useNewDrawingArea()
{
- static bool useNewDrawingArea = getenv("USE_NEW_DRAWING_AREA");
-
- return useNewDrawingArea;
+ return true;
}
- (id)initWithFrame:(NSRect)frame
@@ -211,6 +184,24 @@ static bool useNewDrawingArea()
[types release];
}
+- (void)_updateRemoteAccessibilityRegistration:(BOOL)registerProcess
+{
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ // When the tree is connected/disconnected, the remote accessibility registration
+ // needs to be updated with the pid of the remote process. If the process is going
+ // away, that information is not present in WebProcess
+ pid_t pid = 0;
+ if (registerProcess && _data->_page->process())
+ pid = _data->_page->process()->processIdentifier();
+ else if (!registerProcess) {
+ pid = WKAXRemoteProcessIdentifier(_data->_remoteAccessibilityChild.get());
+ _data->_remoteAccessibilityChild = nil;
+ }
+ if (pid)
+ WKAXRegisterRemoteProcess(registerProcess, pid);
+#endif
+}
+
- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef
{
self = [super initWithFrame:frame];
@@ -239,12 +230,6 @@ static bool useNewDrawingArea()
WebContext::statistics().wkViewCount++;
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
- NSData *remoteToken = (NSData *)WKAXRemoteTokenForElement(self);
- CoreIPC::DataReference dataToken = CoreIPC::DataReference(reinterpret_cast<const uint8_t*>([remoteToken bytes]), [remoteToken length]);
- _data->_page->sendAccessibilityPresenterToken(dataToken);
-#endif
-
return self;
}
@@ -312,19 +297,35 @@ static bool useNewDrawingArea()
return YES;
}
+- (void)viewWillStartLiveResize
+{
+ _data->_page->viewWillStartLiveResize();
+}
+
+- (void)viewDidEndLiveResize
+{
+ _data->_page->viewWillEndLiveResize();
+}
+
- (BOOL)isFlipped
{
return YES;
}
+- (void)setFrame:(NSRect)rect andScrollBy:(NSSize)offset
+{
+ ASSERT(NSEqualSizes(_data->_resizeScrollOffset, NSZeroSize));
+
+ _data->_resizeScrollOffset = offset;
+ [self setFrame:rect];
+}
+
- (void)setFrameSize:(NSSize)size
{
[super setFrameSize:size];
-
- if (!_data->_page->drawingArea())
- return;
- _data->_page->drawingArea()->setSize(IntSize(size));
+ if (![self frameSizeUpdatesDisabled])
+ [self _setDrawingAreaSize:size];
}
- (void)_updateWindowAndViewFrames
@@ -366,6 +367,8 @@ static const SelectorNameMap* createSelectorExceptionMap()
map->add(@selector(pageDownAndModifySelection:), "MovePageDownAndModifySelection");
map->add(@selector(pageUp:), "MovePageUp");
map->add(@selector(pageUpAndModifySelection:), "MovePageUpAndModifySelection");
+ map->add(@selector(scrollPageDown:), "ScrollPageForward");
+ map->add(@selector(scrollPageUp:), "ScrollPageBackward");
return map;
}
@@ -392,16 +395,143 @@ static String commandNameForSelector(SEL selector)
#define WEBCORE_COMMAND(command) - (void)command:(id)sender { _data->_page->executeEditCommand(commandNameForSelector(_cmd)); }
+WEBCORE_COMMAND(alignCenter)
+WEBCORE_COMMAND(alignJustified)
+WEBCORE_COMMAND(alignLeft)
+WEBCORE_COMMAND(alignRight)
WEBCORE_COMMAND(copy)
WEBCORE_COMMAND(cut)
-WEBCORE_COMMAND(paste)
WEBCORE_COMMAND(delete)
+WEBCORE_COMMAND(deleteBackward)
+WEBCORE_COMMAND(deleteBackwardByDecomposingPreviousCharacter)
+WEBCORE_COMMAND(deleteForward)
+WEBCORE_COMMAND(deleteToBeginningOfLine)
+WEBCORE_COMMAND(deleteToBeginningOfParagraph)
+WEBCORE_COMMAND(deleteToEndOfLine)
+WEBCORE_COMMAND(deleteToEndOfParagraph)
+WEBCORE_COMMAND(deleteToMark)
+WEBCORE_COMMAND(deleteWordBackward)
+WEBCORE_COMMAND(deleteWordForward)
+WEBCORE_COMMAND(ignoreSpelling)
+WEBCORE_COMMAND(indent)
+WEBCORE_COMMAND(insertBacktab)
+WEBCORE_COMMAND(insertLineBreak)
+WEBCORE_COMMAND(insertNewline)
+WEBCORE_COMMAND(insertNewlineIgnoringFieldEditor)
+WEBCORE_COMMAND(insertParagraphSeparator)
+WEBCORE_COMMAND(insertTab)
+WEBCORE_COMMAND(insertTabIgnoringFieldEditor)
+WEBCORE_COMMAND(makeTextWritingDirectionLeftToRight)
+WEBCORE_COMMAND(makeTextWritingDirectionNatural)
+WEBCORE_COMMAND(makeTextWritingDirectionRightToLeft)
+WEBCORE_COMMAND(moveBackward)
+WEBCORE_COMMAND(moveBackwardAndModifySelection)
+WEBCORE_COMMAND(moveDown)
+WEBCORE_COMMAND(moveDownAndModifySelection)
+WEBCORE_COMMAND(moveForward)
+WEBCORE_COMMAND(moveForwardAndModifySelection)
+WEBCORE_COMMAND(moveLeft)
+WEBCORE_COMMAND(moveLeftAndModifySelection)
+WEBCORE_COMMAND(moveParagraphBackwardAndModifySelection)
+WEBCORE_COMMAND(moveParagraphForwardAndModifySelection)
+WEBCORE_COMMAND(moveRight)
+WEBCORE_COMMAND(moveRightAndModifySelection)
+WEBCORE_COMMAND(moveToBeginningOfDocument)
+WEBCORE_COMMAND(moveToBeginningOfDocumentAndModifySelection)
+WEBCORE_COMMAND(moveToBeginningOfLine)
+WEBCORE_COMMAND(moveToBeginningOfLineAndModifySelection)
+WEBCORE_COMMAND(moveToBeginningOfParagraph)
+WEBCORE_COMMAND(moveToBeginningOfParagraphAndModifySelection)
+WEBCORE_COMMAND(moveToBeginningOfSentence)
+WEBCORE_COMMAND(moveToBeginningOfSentenceAndModifySelection)
+WEBCORE_COMMAND(moveToEndOfDocument)
+WEBCORE_COMMAND(moveToEndOfDocumentAndModifySelection)
+WEBCORE_COMMAND(moveToEndOfLine)
+WEBCORE_COMMAND(moveToEndOfLineAndModifySelection)
+WEBCORE_COMMAND(moveToEndOfParagraph)
+WEBCORE_COMMAND(moveToEndOfParagraphAndModifySelection)
+WEBCORE_COMMAND(moveToEndOfSentence)
+WEBCORE_COMMAND(moveToEndOfSentenceAndModifySelection)
+WEBCORE_COMMAND(moveToLeftEndOfLine)
+WEBCORE_COMMAND(moveToLeftEndOfLineAndModifySelection)
+WEBCORE_COMMAND(moveToRightEndOfLine)
+WEBCORE_COMMAND(moveToRightEndOfLineAndModifySelection)
+WEBCORE_COMMAND(moveUp)
+WEBCORE_COMMAND(moveUpAndModifySelection)
+WEBCORE_COMMAND(moveWordBackward)
+WEBCORE_COMMAND(moveWordBackwardAndModifySelection)
+WEBCORE_COMMAND(moveWordForward)
+WEBCORE_COMMAND(moveWordForwardAndModifySelection)
+WEBCORE_COMMAND(moveWordLeft)
+WEBCORE_COMMAND(moveWordLeftAndModifySelection)
+WEBCORE_COMMAND(moveWordRight)
+WEBCORE_COMMAND(moveWordRightAndModifySelection)
+WEBCORE_COMMAND(outdent)
+WEBCORE_COMMAND(pageDown)
+WEBCORE_COMMAND(pageDownAndModifySelection)
+WEBCORE_COMMAND(pageUp)
+WEBCORE_COMMAND(pageUpAndModifySelection)
+WEBCORE_COMMAND(paste)
WEBCORE_COMMAND(pasteAsPlainText)
+WEBCORE_COMMAND(scrollPageDown)
+WEBCORE_COMMAND(scrollPageUp)
+WEBCORE_COMMAND(scrollToBeginningOfDocument)
+WEBCORE_COMMAND(scrollToEndOfDocument)
WEBCORE_COMMAND(selectAll)
+WEBCORE_COMMAND(selectLine)
+WEBCORE_COMMAND(selectParagraph)
+WEBCORE_COMMAND(selectSentence)
+WEBCORE_COMMAND(selectToMark)
+WEBCORE_COMMAND(selectWord)
+WEBCORE_COMMAND(setMark)
+WEBCORE_COMMAND(subscript)
+WEBCORE_COMMAND(superscript)
+WEBCORE_COMMAND(swapWithMark)
WEBCORE_COMMAND(takeFindStringFromSelection)
+WEBCORE_COMMAND(transpose)
+WEBCORE_COMMAND(underline)
+WEBCORE_COMMAND(unscript)
+WEBCORE_COMMAND(yank)
+WEBCORE_COMMAND(yankAndSelect)
#undef WEBCORE_COMMAND
+/*
+
+When possible, editing-related methods should be implemented in WebCore with the
+EditorCommand mechanism and invoked via WEBCORE_COMMAND, rather than implementing
+individual methods here with Mac-specific code.
+
+Editing-related methods still unimplemented that are implemented in WebKit1:
+
+- (void)capitalizeWord:(id)sender;
+- (void)centerSelectionInVisibleArea:(id)sender;
+- (void)changeFont:(id)sender;
+- (void)complete:(id)sender;
+- (void)copyFont:(id)sender;
+- (void)lowercaseWord:(id)sender;
+- (void)makeBaseWritingDirectionLeftToRight:(id)sender;
+- (void)makeBaseWritingDirectionNatural:(id)sender;
+- (void)makeBaseWritingDirectionRightToLeft:(id)sender;
+- (void)pasteFont:(id)sender;
+- (void)scrollLineDown:(id)sender;
+- (void)scrollLineUp:(id)sender;
+- (void)showGuessPanel:(id)sender;
+- (void)uppercaseWord:(id)sender;
+
+Some other editing-related methods still unimplemented:
+
+- (void)changeCaseOfLetter:(id)sender;
+- (void)copyRuler:(id)sender;
+- (void)insertContainerBreak:(id)sender;
+- (void)insertDoubleQuoteIgnoringSubstitution:(id)sender;
+- (void)insertSingleQuoteIgnoringSubstitution:(id)sender;
+- (void)pasteRuler:(id)sender;
+- (void)toggleRuler:(id)sender;
+- (void)transposeWords:(id)sender;
+
+*/
+
// Menu items validation
static NSMenuItem *menuItem(id <NSValidatedUserInterfaceItem> item)
@@ -791,6 +921,41 @@ EVENT_HANDLER(scrollWheel, Wheel)
[self _mouseHandler:event];
}
+#if ENABLE(GESTURE_EVENTS)
+
+static const short kIOHIDEventTypeScroll = 6;
+
+- (void)shortCircuitedEndGestureWithEvent:(NSEvent *)event
+{
+ if ([event subtype] != kIOHIDEventTypeScroll)
+ return;
+
+ WebGestureEvent webEvent = WebEventFactory::createWebGestureEvent(event, self);
+ _data->_page->handleGestureEvent(webEvent);
+
+ if (_data->_endGestureMonitor) {
+ [NSEvent removeMonitor:_data->_endGestureMonitor];
+ _data->_endGestureMonitor = nil;
+ }
+}
+
+- (void)beginGestureWithEvent:(NSEvent *)event
+{
+ if ([event subtype] != kIOHIDEventTypeScroll)
+ return;
+
+ WebGestureEvent webEvent = WebEventFactory::createWebGestureEvent(event, self);
+ _data->_page->handleGestureEvent(webEvent);
+
+ if (!_data->_endGestureMonitor) {
+ _data->_endGestureMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskEndGesture handler:^(NSEvent *blockEvent) {
+ [self shortCircuitedEndGestureWithEvent:blockEvent];
+ return blockEvent;
+ }];
+ }
+}
+#endif
+
- (void)doCommandBySelector:(SEL)selector
{
if (selector != @selector(noop:))
@@ -830,6 +995,9 @@ EVENT_HANDLER(scrollWheel, Wheel)
- (BOOL)_handleStyleKeyEquivalent:(NSEvent *)event
{
+ if (!_data->_page->selectionState().isContentEditable)
+ return NO;
+
if (([event modifierFlags] & NSDeviceIndependentModifierFlagsMask) != NSCommandKeyMask)
return NO;
@@ -875,27 +1043,6 @@ EVENT_HANDLER(scrollWheel, Wheel)
return [self _handleStyleKeyEquivalent:event] || [super performKeyEquivalent:event];
}
-- (void)_setEventBeingResent:(NSEvent *)event
-{
- _data->_keyDownEventBeingResent = [event retain];
-}
-
-- (Vector<KeypressCommand>&)_interceptKeyEvent:(NSEvent *)theEvent
-{
- _data->_commandsList.clear();
- // interpretKeyEvents will trigger one or more calls to doCommandBySelector or setText
- // that will populate the commandsList vector.
- [self interpretKeyEvents:[NSArray arrayWithObject:theEvent]];
- return _data->_commandsList;
-}
-
-- (void)_getTextInputState:(unsigned)start selectionEnd:(unsigned)end underlines:(Vector<WebCore::CompositionUnderline>&)lines
-{
- start = _data->_selectionStart;
- end = _data->_selectionEnd;
- lines = _data->_underlines;
-}
-
- (void)keyUp:(NSEvent *)theEvent
{
_data->_page->handleKeyboardEvent(NativeWebKeyboardEvent(theEvent, self));
@@ -1165,15 +1312,22 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
{
// Temporarily enable the resize indicator to make a the _ownsWindowGrowBox calculation work.
BOOL wasShowingIndicator = [[self window] showsResizeIndicator];
- [[self window] setShowsResizeIndicator:YES];
+ if (!wasShowingIndicator)
+ [[self window] setShowsResizeIndicator:YES];
BOOL ownsGrowBox = [self _ownsWindowGrowBox];
_data->_page->setWindowResizerSize(ownsGrowBox ? enclosingIntRect([[self window] _growBoxRect]).size() : IntSize());
-
+
+ if (ownsGrowBox)
+ [[self window] _setShowOpaqueGrowBoxForOwner:(_data->_page->hasHorizontalScrollbar() || _data->_page->hasVerticalScrollbar() ? self : nil)];
+ else
+ [[self window] _setShowOpaqueGrowBoxForOwner:nil];
+
// Once WebCore can draw the window resizer, this should read:
// if (wasShowingIndicator)
// [[self window] setShowsResizeIndicator:!ownsGrowBox];
- [[self window] setShowsResizeIndicator:wasShowingIndicator];
+ if (!wasShowingIndicator)
+ [[self window] setShowsResizeIndicator:NO];
return ownsGrowBox;
}
@@ -1228,11 +1382,27 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
_data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible | WebPageProxy::ViewIsInWindow);
[self _updateWindowVisibility];
[self _updateWindowAndViewFrames];
+
+ // Initialize remote accessibility when the window connection has been established.
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ NSData *remoteElementToken = WKAXRemoteTokenForElement(self);
+ NSData *remoteWindowToken = WKAXRemoteTokenForElement([self window]);
+ CoreIPC::DataReference elementToken = CoreIPC::DataReference(reinterpret_cast<const uint8_t*>([remoteElementToken bytes]), [remoteElementToken length]);
+ CoreIPC::DataReference windowToken = CoreIPC::DataReference(reinterpret_cast<const uint8_t*>([remoteWindowToken bytes]), [remoteWindowToken length]);
+ _data->_page->registerUIProcessAccessibilityTokens(elementToken, windowToken);
+#endif
+
} else {
_data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
_data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive | WebPageProxy::ViewIsInWindow);
- }
+#if ENABLE(GESTURE_EVENTS)
+ if (_data->_endGestureMonitor) {
+ [NSEvent removeMonitor:_data->_endGestureMonitor];
+ _data->_endGestureMonitor = nil;
+ }
+#endif
+ }
}
- (void)_windowDidBecomeKey:(NSNotification *)notification
@@ -1264,13 +1434,34 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
[self _updateWindowAndViewFrames];
}
+static void drawPageBackground(CGContextRef context, WebPageProxy* page, const IntRect& rect)
+{
+ if (!page->drawsBackground())
+ return;
+
+ CGContextSaveGState(context);
+ CGContextSetBlendMode(context, kCGBlendModeCopy);
+
+ CGColorRef backgroundColor;
+ if (page->drawsTransparentBackground())
+ backgroundColor = CGColorGetConstantColor(kCGColorClear);
+ else
+ backgroundColor = CGColorGetConstantColor(kCGColorWhite);
+
+ CGContextSetFillColorWithColor(context, backgroundColor);
+ CGContextFillRect(context, rect);
+
+ CGContextRestoreGState(context);
+}
+
- (void)drawRect:(NSRect)rect
{
LOG(View, "drawRect: x:%g, y:%g, width:%g, height:%g", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
+ _data->_page->endPrinting();
if (useNewDrawingArea()) {
- if (DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(_data->_page->drawingArea())) {
- CGContextRef context = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
+ CGContextRef context = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
+ if (DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(_data->_page->drawingArea())) {
const NSRect *rectsBeingDrawn;
NSInteger numRectsBeingDrawn;
[self getRectsBeingDrawn:&rectsBeingDrawn count:&numRectsBeingDrawn];
@@ -1278,11 +1469,13 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
Region unpaintedRegion;
IntRect rect = enclosingIntRect(rectsBeingDrawn[i]);
drawingArea->paint(context, rect, unpaintedRegion);
+
+ Vector<IntRect> unpaintedRects = unpaintedRegion.rects();
+ for (size_t i = 0; i < unpaintedRects.size(); ++i)
+ drawPageBackground(context, _data->_page.get(), unpaintedRects[i]);
}
- } else if (_data->_page->drawsBackground()) {
- [_data->_page->drawsTransparentBackground() ? [NSColor clearColor] : [NSColor whiteColor] set];
- NSRectFill(rect);
- }
+ } else
+ drawPageBackground(context, _data->_page.get(), enclosingIntRect(rect));
_data->_page->didDraw();
return;
@@ -1313,14 +1506,6 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
_data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
}
-- (void)_setAccessibilityChildToken:(NSData *)data
-{
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
- _data->_remoteAccessibilityChild = WKAXRemoteElementForToken((CFDataRef)data);
- WKAXInitializeRemoteElementWithWindow(_data->_remoteAccessibilityChild.get(), [self window]);
-#endif
-}
-
- (BOOL)accessibilityIsIgnored
{
return NO;
@@ -1353,9 +1538,12 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
- (NSView *)hitTest:(NSPoint)point
{
NSView *hitView = [super hitTest:point];
-#if USE(ACCELERATED_COMPOSITING)
if (hitView && _data && hitView == _data->_layerHostingView)
hitView = self;
+
+#if USE(ACCELERATED_COMPOSITING)
+ if (hitView && _data && hitView == _data->_oldLayerHostingView)
+ hitView = self;
#endif
return hitView;
}
@@ -1365,190 +1553,30 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
return (NSInteger)self;
}
-static void setFrameBeingPrinted(NSPrintOperation *printOperation, WebFrameProxy* frame)
-{
- RetainPtr<WebFrameWrapper> frameWrapper(AdoptNS, [[WebFrameWrapper alloc] initWithFrameProxy:frame]);
- [[[printOperation printInfo] dictionary] setObject:frameWrapper.get() forKey:PrintedFrameKey];
-}
-
-static WebFrameProxy* frameBeingPrinted()
-{
- return [[[[[NSPrintOperation currentOperation] printInfo] dictionary] objectForKey:PrintedFrameKey] webFrame];
-}
-static float currentPrintOperationScale()
-{
- ASSERT([NSPrintOperation currentOperation]);
- ASSERT([[[[NSPrintOperation currentOperation] printInfo] dictionary] objectForKey:NSPrintScalingFactor]);
- return [[[[[NSPrintOperation currentOperation] printInfo] dictionary] objectForKey:NSPrintScalingFactor] floatValue];
-}
-
-- (void)_adjustPrintingMarginsForHeaderAndFooter
+- (BOOL)canChangeFrameLayout:(WKFrameRef)frameRef
{
- NSPrintOperation *printOperation = [NSPrintOperation currentOperation];
- NSPrintInfo *info = [printOperation printInfo];
- NSMutableDictionary *infoDictionary = [info dictionary];
-
- // We need to modify the top and bottom margins in the NSPrintInfo to account for the space needed by the
- // header and footer. Because this method can be called more than once on the same NSPrintInfo (see 5038087),
- // we stash away the unmodified top and bottom margins the first time this method is called, and we read from
- // those stashed-away values on subsequent calls.
- float originalTopMargin;
- float originalBottomMargin;
- NSNumber *originalTopMarginNumber = [infoDictionary objectForKey:WebKitOriginalTopPrintingMarginKey];
- if (!originalTopMarginNumber) {
- ASSERT(![infoDictionary objectForKey:WebKitOriginalBottomPrintingMarginKey]);
- originalTopMargin = [info topMargin];
- originalBottomMargin = [info bottomMargin];
- [infoDictionary setObject:[NSNumber numberWithFloat:originalTopMargin] forKey:WebKitOriginalTopPrintingMarginKey];
- [infoDictionary setObject:[NSNumber numberWithFloat:originalBottomMargin] forKey:WebKitOriginalBottomPrintingMarginKey];
- } else {
- ASSERT([originalTopMarginNumber isKindOfClass:[NSNumber class]]);
- ASSERT([[infoDictionary objectForKey:WebKitOriginalBottomPrintingMarginKey] isKindOfClass:[NSNumber class]]);
- originalTopMargin = [originalTopMarginNumber floatValue];
- originalBottomMargin = [[infoDictionary objectForKey:WebKitOriginalBottomPrintingMarginKey] floatValue];
- }
-
- float scale = currentPrintOperationScale();
- [info setTopMargin:originalTopMargin + _data->_page->headerHeight(frameBeingPrinted()) * scale];
- [info setBottomMargin:originalBottomMargin + _data->_page->footerHeight(frameBeingPrinted()) * scale];
+ // PDF documents are already paginated, so we can't change them to add headers and footers.
+ return !toImpl(frameRef)->isMainFrame() || !_data->_pdfViewController;
}
- (NSPrintOperation *)printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(WKFrameRef)frameRef
{
LOG(View, "Creating an NSPrintOperation for frame '%s'", toImpl(frameRef)->url().utf8().data());
- NSPrintOperation *printOperation;
// Only the top frame can currently contain a PDF view.
if (_data->_pdfViewController) {
- ASSERT(toImpl(frameRef)->isMainFrame());
- printOperation = _data->_pdfViewController->makePrintOperation(printInfo);
- } else
- printOperation = [NSPrintOperation printOperationWithView:self printInfo:printInfo];
-
- setFrameBeingPrinted(printOperation, toImpl(frameRef));
- return printOperation;
-}
-
-- (BOOL)canChangeFrameLayout:(WKFrameRef)frameRef
-{
- // PDF documents are already paginated, so we can't change them to add headers and footers.
- return !toImpl(frameRef)->isMainFrame() || !_data->_pdfViewController;
-}
-
-// Return the number of pages available for printing
-- (BOOL)knowsPageRange:(NSRangePointer)range
-{
- LOG(View, "knowsPageRange:");
- WebFrameProxy* frame = frameBeingPrinted();
- ASSERT(frame);
-
- if (frame->isMainFrame() && _data->_pdfViewController)
- return [super knowsPageRange:range];
-
- [self _adjustPrintingMarginsForHeaderAndFooter];
-
- _data->_page->computePagesForPrinting(frame, PrintInfo([[NSPrintOperation currentOperation] printInfo]), _data->_printingPageRects, _data->_totalScaleFactorForPrinting);
-
- *range = NSMakeRange(1, _data->_printingPageRects.size());
- return YES;
-}
-
-// Take over printing. AppKit applies incorrect clipping, and doesn't print pages beyond the first one.
-- (void)_recursiveDisplayRectIfNeededIgnoringOpacity:(NSRect)rect isVisibleRect:(BOOL)isVisibleRect rectIsVisibleRectForView:(NSView *)visibleView topView:(BOOL)topView
-{
- // FIXME: This check isn't right for some non-printing cases, such as capturing into a buffer using cacheDisplayInRect:toBitmapImageRep:.
- if ([NSGraphicsContext currentContextDrawingToScreen]) {
- _data->_page->endPrinting();
- [super _recursiveDisplayRectIfNeededIgnoringOpacity:rect isVisibleRect:isVisibleRect rectIsVisibleRectForView:visibleView topView:topView];
- return;
- }
-
- LOG(View, "Printing rect x:%g, y:%g, width:%g, height:%g", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
-
- ASSERT(self == visibleView);
- ASSERT(frameBeingPrinted());
-
- WebFrameProxy* frame = frameBeingPrinted();
- ASSERT(frame);
-
- _data->_page->beginPrinting(frame, PrintInfo([[NSPrintOperation currentOperation] printInfo]));
-
- // FIXME: This is optimized for print preview. Get the whole document at once when actually printing.
- Vector<uint8_t> pdfData;
- _data->_page->drawRectToPDF(frame, IntRect(rect), pdfData);
-
- RetainPtr<CGDataProviderRef> pdfDataProvider(AdoptCF, CGDataProviderCreateWithData(0, pdfData.data(), pdfData.size(), 0));
- RetainPtr<CGPDFDocumentRef> pdfDocument(AdoptCF, CGPDFDocumentCreateWithProvider(pdfDataProvider.get()));
- if (!pdfDocument) {
- LOG_ERROR("Couldn't create a PDF document with data passed for printing");
- return;
- }
-
- CGPDFPageRef pdfPage = CGPDFDocumentGetPage(pdfDocument.get(), 1);
- if (!pdfPage) {
- LOG_ERROR("Printing data doesn't have page 1");
- return;
+ if (!toImpl(frameRef)->isMainFrame())
+ return 0;
+ return _data->_pdfViewController->makePrintOperation(printInfo);
+ } else {
+ RetainPtr<WKPrintingView> printingView(AdoptNS, [[WKPrintingView alloc] initWithFrameProxy:toImpl(frameRef)]);
+ // NSPrintOperation takes ownership of the view.
+ NSPrintOperation *printOperation = [NSPrintOperation printOperationWithView:printingView.get()];
+ [printOperation setCanSpawnSeparateThread:YES];
+ printingView->_printOperation = printOperation;
+ return printOperation;
}
-
- NSGraphicsContext *nsGraphicsContext = [NSGraphicsContext currentContext];
- CGContextRef context = static_cast<CGContextRef>([nsGraphicsContext graphicsPort]);
-
- CGContextSaveGState(context);
- // Flip the destination.
- CGContextScaleCTM(context, 1, -1);
- CGContextTranslateCTM(context, 0, -rect.size.height);
- CGContextDrawPDFPage(context, pdfPage);
- CGContextRestoreGState(context);
-}
-
-- (void)drawPageBorderWithSize:(NSSize)borderSize
-{
- ASSERT(NSEqualSizes(borderSize, [[[NSPrintOperation currentOperation] printInfo] paperSize]));
-
- // The header and footer rect height scales with the page, but the width is always
- // all the way across the printed page (inset by printing margins).
- NSPrintOperation *printOperation = [NSPrintOperation currentOperation];
- NSPrintInfo *printInfo = [printOperation printInfo];
- float scale = currentPrintOperationScale();
- NSSize paperSize = [printInfo paperSize];
- float headerFooterLeft = [printInfo leftMargin] / scale;
- float headerFooterWidth = (paperSize.width - ([printInfo leftMargin] + [printInfo rightMargin])) / scale;
- WebFrameProxy* frame = frameBeingPrinted();
- NSRect footerRect = NSMakeRect(headerFooterLeft, [printInfo bottomMargin] / scale - _data->_page->footerHeight(frame), headerFooterWidth, _data->_page->footerHeight(frame));
- NSRect headerRect = NSMakeRect(headerFooterLeft, (paperSize.height - [printInfo topMargin]) / scale, headerFooterWidth, _data->_page->headerHeight(frame));
-
- NSGraphicsContext *currentContext = [NSGraphicsContext currentContext];
- [currentContext saveGraphicsState];
- NSRectClip(headerRect);
- _data->_page->drawHeader(frame, headerRect);
- [currentContext restoreGraphicsState];
-
- [currentContext saveGraphicsState];
- NSRectClip(footerRect);
- _data->_page->drawFooter(frame, footerRect);
- [currentContext restoreGraphicsState];
-}
-
-// FIXME 3491344: This is an AppKit-internal method that we need to override in order
-// to get our shrink-to-fit to work with a custom pagination scheme. We can do this better
-// if AppKit makes it SPI/API.
-- (CGFloat)_provideTotalScaleFactorForPrintOperation:(NSPrintOperation *)printOperation
-{
- return _data->_totalScaleFactorForPrinting;
-}
-
-// Return the drawing rectangle for a particular page number
-- (NSRect)rectForPage:(NSInteger)page
-{
- WebFrameProxy* frame = frameBeingPrinted();
- ASSERT(frame);
-
- if (frame->isMainFrame() && _data->_pdfViewController)
- return [super rectForPage:page];
-
- LOG(View, "rectForPage:%d -> x %d, y %d, width %d, height %d\n", (int)page, _data->_printingPageRects[page - 1].x(), _data->_printingPageRects[page - 1].y(), _data->_printingPageRects[page - 1].width(), _data->_printingPageRects[page - 1].height());
- return _data->_printingPageRects[page - 1];
}
@end
@@ -1575,6 +1603,12 @@ static float currentPrintOperationScale()
- (void)_processDidCrash
{
[self setNeedsDisplay:YES];
+ [self _updateRemoteAccessibilityRegistration:NO];
+}
+
+- (void)_pageClosed
+{
+ [self _updateRemoteAccessibilityRegistration:NO];
}
- (void)_didRelaunchProcess
@@ -1610,6 +1644,27 @@ static float currentPrintOperationScale()
}
}
+- (void)_setEventBeingResent:(NSEvent *)event
+{
+ _data->_keyDownEventBeingResent = [event retain];
+}
+
+- (Vector<KeypressCommand>&)_interceptKeyEvent:(NSEvent *)theEvent
+{
+ _data->_commandsList.clear();
+ // interpretKeyEvents will trigger one or more calls to doCommandBySelector or setText
+ // that will populate the commandsList vector.
+ [self interpretKeyEvents:[NSArray arrayWithObject:theEvent]];
+ return _data->_commandsList;
+}
+
+- (void)_getTextInputState:(unsigned)start selectionEnd:(unsigned)end underlines:(Vector<WebCore::CompositionUnderline>&)lines
+{
+ start = _data->_selectionStart;
+ end = _data->_selectionEnd;
+ lines = _data->_underlines;
+}
+
- (NSRect)_convertToDeviceSpace:(NSRect)rect
{
return toDeviceSpace(rect, [self window]);
@@ -1750,7 +1805,7 @@ static float currentPrintOperationScale()
#if USE(ACCELERATED_COMPOSITING)
- (void)_startAcceleratedCompositing:(CALayer *)rootLayer
{
- if (!_data->_layerHostingView) {
+ if (!_data->_oldLayerHostingView) {
NSView *hostingView = [[NSView alloc] initWithFrame:[self bounds]];
#if !defined(BUILDING_ON_LEOPARD)
[hostingView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
@@ -1758,7 +1813,7 @@ static float currentPrintOperationScale()
[self addSubview:hostingView];
[hostingView release];
- _data->_layerHostingView = hostingView;
+ _data->_oldLayerHostingView = hostingView;
}
// Make a container layer, which will get sized/positioned by AppKit and CA.
@@ -1792,8 +1847,8 @@ static float currentPrintOperationScale()
[viewLayer setTransform:CATransform3DMakeScale(scaleFactor, scaleFactor, 1)];
#endif
- [_data->_layerHostingView setLayer:viewLayer];
- [_data->_layerHostingView setWantsLayer:YES];
+ [_data->_oldLayerHostingView setLayer:viewLayer];
+ [_data->_oldLayerHostingView setWantsLayer:YES];
// Parent our root layer in the container layer
[viewLayer addSublayer:rootLayer];
@@ -1801,11 +1856,11 @@ static float currentPrintOperationScale()
- (void)_stopAcceleratedCompositing
{
- if (_data->_layerHostingView) {
- [_data->_layerHostingView setLayer:nil];
- [_data->_layerHostingView setWantsLayer:NO];
- [_data->_layerHostingView removeFromSuperview];
- _data->_layerHostingView = nil;
+ if (_data->_oldLayerHostingView) {
+ [_data->_oldLayerHostingView setLayer:nil];
+ [_data->_oldLayerHostingView setWantsLayer:NO];
+ [_data->_oldLayerHostingView removeFromSuperview];
+ _data->_oldLayerHostingView = nil;
}
}
@@ -1830,12 +1885,46 @@ static float currentPrintOperationScale()
}
}
- newDrawingArea->setSize(IntSize([self frame].size));
+ newDrawingArea->setSize(IntSize([self frame].size), IntSize());
_data->_page->drawingArea()->detachCompositingContext();
_data->_page->setDrawingArea(newDrawingArea.release());
}
+- (void)_enterAcceleratedCompositingMode:(const LayerTreeContext&)layerTreeContext
+{
+ ASSERT(!_data->_layerHostingView);
+ ASSERT(!layerTreeContext.isEmpty());
+
+ // Create an NSView that will host our layer tree.
+ _data->_layerHostingView.adoptNS([[NSView alloc] initWithFrame:[self bounds]]);
+ [_data->_layerHostingView.get() setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+ [self addSubview:_data->_layerHostingView.get()];
+
+ // Create a root layer that will back the NSView.
+ RetainPtr<CALayer> rootLayer(AdoptNS, [[CALayer alloc] init]);
+#ifndef NDEBUG
+ [rootLayer.get() setName:@"Hosting root layer"];
+#endif
+
+ CALayer *renderLayer = WKMakeRenderLayer(layerTreeContext.contextID);
+ [rootLayer.get() addSublayer:renderLayer];
+
+ [_data->_layerHostingView.get() setLayer:rootLayer.get()];
+ [_data->_layerHostingView.get() setWantsLayer:YES];
+}
+
+- (void)_exitAcceleratedCompositingMode
+{
+ ASSERT(_data->_layerHostingView);
+
+ [_data->_layerHostingView.get() setLayer:nil];
+ [_data->_layerHostingView.get() setWantsLayer:NO];
+ [_data->_layerHostingView.get() removeFromSuperview];
+
+ _data->_layerHostingView = nullptr;
+}
+
- (void)_pageDidEnterAcceleratedCompositing
{
[self _switchToDrawingAreaTypeIfNecessary:DrawingAreaInfo::LayerBacked];
@@ -1848,6 +1937,14 @@ static float currentPrintOperationScale()
}
#endif // USE(ACCELERATED_COMPOSITING)
+- (void)_setAccessibilityWebProcessToken:(NSData *)data
+{
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ _data->_remoteAccessibilityChild = WKAXRemoteElementForToken(data);
+ [self _updateRemoteAccessibilityRegistration:YES];
+#endif
+}
+
- (void)_setComplexTextInputEnabled:(BOOL)complexTextInputEnabled pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier
{
BOOL inputSourceChanged = _data->_pluginComplexTextInputIdentifier;
@@ -1922,4 +2019,42 @@ static float currentPrintOperationScale()
_data->_dragHasStarted = NO;
}
+- (void)_setDrawingAreaSize:(NSSize)size
+{
+ if (!_data->_page->drawingArea())
+ return;
+
+ _data->_page->drawingArea()->setSize(IntSize(size), IntSize(_data->_resizeScrollOffset));
+ _data->_resizeScrollOffset = NSZeroSize;
+}
+
+- (void)_didChangeScrollbarsForMainFrame
+{
+ [self _updateGrowBoxForWindowFrameChange];
+}
+
+@end
+
+@implementation WKView (Private)
+
+- (void)disableFrameSizeUpdates
+{
+ _frameSizeUpdatesDisabledCount++;
+}
+
+- (void)enableFrameSizeUpdates
+{
+ if (!_frameSizeUpdatesDisabledCount)
+ return;
+
+ if (!(--_frameSizeUpdatesDisabledCount))
+ [self _setDrawingAreaSize:[self frame].size];
+}
+
+- (BOOL)frameSizeUpdatesDisabled
+{
+ return _frameSizeUpdatesDisabledCount > 0;
+}
+
@end
+
diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
index cba241d..9e77e30 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
+++ b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
@@ -36,6 +36,7 @@ namespace WebKit {
- (PassOwnPtr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy;
- (BOOL)_isFocused;
- (void)_processDidCrash;
+- (void)_pageClosed;
- (void)_didRelaunchProcess;
- (void)_takeFocus:(BOOL)direction;
- (void)_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip;
@@ -48,6 +49,9 @@ namespace WebKit {
- (NSRect)_convertToUserSpace:(NSRect)rect;
- (void)_setFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut;
+- (void)_enterAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext;
+- (void)_exitAcceleratedCompositingMode;
+
#if USE(ACCELERATED_COMPOSITING)
- (void)_startAcceleratedCompositing:(CALayer *)rootLayer;
- (void)_stopAcceleratedCompositing;
@@ -55,7 +59,7 @@ namespace WebKit {
- (void)_pageDidLeaveAcceleratedCompositing;
#endif
-- (void)_setAccessibilityChildToken:(NSData *)data;
+- (void)_setAccessibilityWebProcessToken:(NSData *)data;
- (void)_setComplexTextInputEnabled:(BOOL)complexTextInputEnabled pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier;
- (void)_setPageHasCustomRepresentation:(BOOL)pageHasCustomRepresentation;
@@ -64,4 +68,7 @@ namespace WebKit {
- (void)_setCustomRepresentationZoomFactor:(double)zoomFactor;
- (void)_setDragImage:(NSImage *)image at:(NSPoint)clientPoint linkDrag:(BOOL)linkDrag;
+- (void)_setDrawingAreaSize:(NSSize)size;
+
+- (void)_didChangeScrollbarsForMainFrame;
@end
diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h b/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h
new file mode 100644
index 0000000..5d6125e
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+@interface WKView (Private)
+
+// Stops updating the size of the page as the WKView frame size updates.
+// This should always be followed by enableFrameSizeUpdates. Calls can be nested.
+- (void)disableFrameSizeUpdates;
+// Immediately updates the size of the page to match WKView's frame size
+// and allows subsequent updates as the frame size is set. Calls can be nested.
+- (void)enableFrameSizeUpdates;
+- (BOOL)frameSizeUpdatesDisabled;
+
+@end
diff --git a/Source/WebKit2/UIProcess/API/qt/ClientImpl.cpp b/Source/WebKit2/UIProcess/API/qt/ClientImpl.cpp
index 642e529..8197236 100644
--- a/Source/WebKit2/UIProcess/API/qt/ClientImpl.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/ClientImpl.cpp
@@ -17,6 +17,7 @@
Boston, MA 02110-1301, USA.
*/
+#include "config.h"
#include "ClientImpl.h"
#include "WebFrameProxy.h"
diff --git a/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp b/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp
index ec23760..748b1bd 100644
--- a/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp
@@ -18,6 +18,7 @@
*
*/
+#include "config.h"
#include "qgraphicswkview.h"
#include "ChunkedUpdateDrawingAreaProxy.h"
diff --git a/Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp b/Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp
index b17c100..5f05f93 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp
@@ -18,6 +18,7 @@
*
*/
+#include "config.h"
#include "qwkcontext.h"
#include "qwkcontext_p.h"
diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp b/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp
index 72c1322..16e1cdd 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp
@@ -18,6 +18,7 @@
*
*/
+#include "config.h"
#include "qwkpage.h"
#include "qwkpage_p.h"
@@ -89,6 +90,7 @@ QWKPagePrivate::QWKPagePrivate(QWKPage* qq, QWKContext* c)
, preferences(0)
, createNewPageFn(0)
, backingStoreType(QGraphicsWKView::Simple)
+ , isConnectedToEngine(true)
{
memset(actions, 0, sizeof(actions));
page = context->d->context->createWebPage(this, 0);
@@ -183,6 +185,16 @@ bool QWKPagePrivate::isViewInWindow()
return true;
}
+void QWKPagePrivate::enterAcceleratedCompositingMode(const LayerTreeContext&)
+{
+ // FIXME: Implement.
+}
+
+void QWKPagePrivate::exitAcceleratedCompositingMode()
+{
+ // FIXME: Implement.
+}
+
void QWKPagePrivate::pageDidRequestScroll(const IntSize& delta)
{
emit q->scrollRequested(delta.width(), delta.height());
@@ -220,7 +232,7 @@ void QWKPagePrivate::selectionChanged(bool, bool, bool, bool)
{
}
-void QWKPagePrivate::didNotHandleKeyEvent(const NativeWebKeyboardEvent&)
+void QWKPagePrivate::doneWithKeyEvent(const NativeWebKeyboardEvent&, bool)
{
}
@@ -391,6 +403,15 @@ void QWKPagePrivate::didRelaunchProcess()
QGraphicsWKView* wkView = static_cast<QGraphicsWKView*>(view);
if (wkView)
q->setViewportSize(wkView->size().toSize());
+
+ isConnectedToEngine = true;
+ emit q->engineConnectionChanged(true);
+}
+
+void QWKPagePrivate::processDidCrash()
+{
+ isConnectedToEngine = false;
+ emit q->engineConnectionChanged(false);
}
QWKPage::QWKPage(QWKContext* context)
@@ -459,7 +480,8 @@ QWKPage::QWKPage(QWKContext* context)
0, /* drawHeader */
0, /* drawFooter */
0, /* printFrame */
- 0 /* runModal */
+ 0, /* runModal */
+ 0 /* didCompleteRubberBandForMainFrame */
};
WKPageSetPageUIClient(pageRef(), &uiClient);
}
@@ -622,7 +644,7 @@ QString QWKPage::title() const
void QWKPage::setViewportSize(const QSize& size)
{
if (d->page->drawingArea())
- d->page->drawingArea()->setSize(IntSize(size));
+ d->page->drawingArea()->setSize(IntSize(size), IntSize());
}
qreal QWKPage::textZoomFactor() const
@@ -775,4 +797,9 @@ void QWKPagePrivate::didFindZoomableArea(const IntRect& area)
emit q->zoomableAreaFound(QRect(area));
}
+bool QWKPage::isConnectedToEngine() const
+{
+ return d->isConnectedToEngine;
+}
+
#include "moc_qwkpage.cpp"
diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpage.h b/Source/WebKit2/UIProcess/API/qt/qwkpage.h
index e0bb4c3..cb7933a 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwkpage.h
+++ b/Source/WebKit2/UIProcess/API/qt/qwkpage.h
@@ -117,6 +117,8 @@ public:
void findZoomableAreaForPoint(const QPoint&);
+ bool isConnectedToEngine() const;
+
public:
Q_SIGNAL void statusBarMessage(const QString&);
Q_SIGNAL void titleChanged(const QString&);
@@ -133,6 +135,7 @@ public:
Q_SIGNAL void zoomableAreaFound(const QRect&);
Q_SIGNAL void focusNextPrevChild(bool);
Q_SIGNAL void showContextMenu(QMenu*);
+ Q_SIGNAL void engineConnectionChanged(bool connected);
protected:
void timerEvent(QTimerEvent*);
diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h b/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h
index 420ff62..65f64ff 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h
@@ -22,6 +22,7 @@
#define qwkpage_p_h
#include "DrawingAreaProxy.h"
+#include "LayerTreeContext.h"
#include "PageClient.h"
#include "qwkpage.h"
#include "qgraphicswkview.h"
@@ -35,6 +36,8 @@
class QGraphicsWKView;
class QWKPreferences;
+using namespace WebKit;
+
class QWKPagePrivate : WebKit::PageClient {
public:
QWKPagePrivate(QWKPage*, QWKContext*);
@@ -57,11 +60,14 @@ public:
virtual bool isViewInWindow();
#if USE(ACCELERATED_COMPOSITING)
+ virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
+ virtual void exitAcceleratedCompositingMode();
void pageDidEnterAcceleratedCompositing() { }
void pageDidLeaveAcceleratedCompositing() { }
#endif // USE(ACCELERATED_COMPOSITING)
virtual void pageDidRequestScroll(const WebCore::IntSize&);
- virtual void processDidCrash() { }
+ virtual void processDidCrash();
+ virtual void pageClosed() { }
virtual void didRelaunchProcess();
virtual void didChangeContentsSize(const WebCore::IntSize&);
virtual void didFindZoomableArea(const WebCore::IntRect&);
@@ -73,7 +79,7 @@ public:
virtual void clearAllEditCommands();
virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
- virtual void didNotHandleKeyEvent(const WebKit::NativeWebKeyboardEvent&);
+ virtual void doneWithKeyEvent(const WebKit::NativeWebKeyboardEvent&, bool wasEventHandled);
virtual void selectionChanged(bool, bool, bool, bool);
virtual PassRefPtr<WebKit::WebPopupMenuProxy> createPopupMenuProxy(WebKit::WebPageProxy*);
virtual PassRefPtr<WebKit::WebContextMenuProxy> createContextMenuProxy(WebKit::WebPageProxy*);
@@ -84,6 +90,7 @@ public:
virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&);
virtual double customRepresentationZoomFactor() { return 1; }
virtual void setCustomRepresentationZoomFactor(double) { }
+ virtual void didChangeScrollbarsForMainFrame() const { }
void paint(QPainter* painter, QRect);
@@ -122,6 +129,8 @@ public:
QPoint tripleClick;
QBasicTimer tripleClickTimer;
QGraphicsWKView::BackingStoreType backingStoreType;
+
+ bool isConnectedToEngine;
};
class QtViewportAttributesPrivate : public QSharedData {
diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpreferences.cpp b/Source/WebKit2/UIProcess/API/qt/qwkpreferences.cpp
index dea18aa..4ba18a3 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwkpreferences.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qwkpreferences.cpp
@@ -17,6 +17,7 @@
Boston, MA 02110-1301, USA.
*/
+#include "config.h"
#include "qwkpreferences.h"
#include "WKPageGroup.h"
diff --git a/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp b/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp
index 07b39b2..ffe8bac 100644
--- a/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp
+++ b/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "AuthenticationChallengeProxy.h"
#include "AuthenticationDecisionListener.h"
diff --git a/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp b/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp
index ddcc6c6..a3987cd 100644
--- a/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp
+++ b/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "AuthenticationDecisionListener.h"
#include "AuthenticationChallengeProxy.h"
diff --git a/Source/WebKit2/UIProcess/Authentication/WebCredential.cpp b/Source/WebKit2/UIProcess/Authentication/WebCredential.cpp
index b9a346e..0b429a7 100644
--- a/Source/WebKit2/UIProcess/Authentication/WebCredential.cpp
+++ b/Source/WebKit2/UIProcess/Authentication/WebCredential.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebCredential.h"
namespace WebKit {
diff --git a/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp b/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp
index 1671371..3d38e22 100644
--- a/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp
+++ b/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebProtectionSpace.h"
#include <WebCore/SharedBuffer.h>
diff --git a/Source/WebKit2/UIProcess/BackingStore.cpp b/Source/WebKit2/UIProcess/BackingStore.cpp
index b468b6b..f9a2672 100644
--- a/Source/WebKit2/UIProcess/BackingStore.cpp
+++ b/Source/WebKit2/UIProcess/BackingStore.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "BackingStore.h"
#include "ShareableBitmap.h"
@@ -30,7 +31,7 @@
using namespace WebCore;
-#if !PLATFORM(MAC)
+#if !PLATFORM(MAC) && !PLATFORM(WIN)
#error "This class is not ready for use by other ports yet."
#endif
@@ -44,7 +45,6 @@ PassOwnPtr<BackingStore> BackingStore::create(const IntSize& size, WebPageProxy*
BackingStore::BackingStore(const IntSize& size, WebPageProxy* webPageProxy)
: m_size(size)
, m_webPageProxy(webPageProxy)
- , m_latestUpdateTimestamp(0)
{
ASSERT(!m_size.isEmpty());
}
@@ -55,20 +55,13 @@ BackingStore::~BackingStore()
void BackingStore::incorporateUpdate(const UpdateInfo& updateInfo)
{
- if (updateInfo.timestamp < m_latestUpdateTimestamp) {
- // The update is too old, discard it.
- return;
- }
-
- ASSERT(m_size == updateInfo.viewSize);
+// ASSERT(m_size == updateInfo.viewSize);
RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(updateInfo.updateRectBounds.size(), updateInfo.bitmapHandle);
if (!bitmap)
return;
incorporateUpdate(bitmap.get(), updateInfo);
-
- m_latestUpdateTimestamp = updateInfo.timestamp;
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/BackingStore.h b/Source/WebKit2/UIProcess/BackingStore.h
index a3ea065..eacd99e 100644
--- a/Source/WebKit2/UIProcess/BackingStore.h
+++ b/Source/WebKit2/UIProcess/BackingStore.h
@@ -32,6 +32,8 @@
#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
+#elif PLATFORM(WIN)
+#include <wtf/OwnPtr.h>
#endif
namespace WebCore {
@@ -55,6 +57,8 @@ public:
#if PLATFORM(MAC)
typedef CGContextRef PlatformGraphicsContext;
+#elif PLATFORM(WIN)
+ typedef HDC PlatformGraphicsContext;
#endif
void paint(PlatformGraphicsContext, const WebCore::IntRect&);
@@ -68,13 +72,14 @@ private:
WebCore::IntSize m_size;
WebPageProxy* m_webPageProxy;
- double m_latestUpdateTimestamp;
#if PLATFORM(MAC)
CGContextRef backingStoreContext();
RetainPtr<CGLayerRef> m_cgLayer;
RetainPtr<CGContextRef> m_bitmapContext;
+#elif PLATFORM(WIN)
+ OwnPtr<HBITMAP> m_bitmap;
#endif
};
diff --git a/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp b/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp
index 22e9c84..58cac4f 100644
--- a/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp
+++ b/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ChunkedUpdateDrawingAreaProxy.h"
#include "DrawingAreaMessageKinds.h"
@@ -47,6 +49,9 @@ ChunkedUpdateDrawingAreaProxy::ChunkedUpdateDrawingAreaProxy(PlatformWebView* we
, m_isWaitingForDidSetFrameNotification(false)
, m_isVisible(true)
, m_forceRepaintWhenResumingPainting(false)
+#if PLATFORM(GTK)
+ , m_backingStoreImage(0)
+#endif
, m_webView(webView)
{
}
@@ -65,7 +70,7 @@ bool ChunkedUpdateDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingCo
if (page->process()->isLaunching())
return false;
- OwnPtr<CoreIPC::ArgumentDecoder> arguments = page->process()->connection()->waitFor(DrawingAreaProxyLegacyMessage::DidSetSize, page->pageID(), 0.04);
+ OwnPtr<CoreIPC::ArgumentDecoder> arguments = page->process()->connection()->deprecatedWaitFor(DrawingAreaProxyLegacyMessage::DidSetSize, page->pageID(), 0.04);
if (arguments)
didReceiveMessage(page->process()->connection(), CoreIPC::MessageID(DrawingAreaProxyLegacyMessage::DidSetSize), arguments.get());
}
@@ -91,12 +96,12 @@ void ChunkedUpdateDrawingAreaProxy::setPageIsVisible(bool isVisible)
if (!m_isVisible) {
// Tell the web process that it doesn't need to paint anything for now.
- page->process()->send(DrawingAreaLegacyMessage::SuspendPainting, page->pageID(), CoreIPC::In(info().identifier));
+ page->process()->deprecatedSend(DrawingAreaLegacyMessage::SuspendPainting, page->pageID(), CoreIPC::In(info().identifier));
return;
}
// The page is now visible, resume painting.
- page->process()->send(DrawingAreaLegacyMessage::ResumePainting, page->pageID(), CoreIPC::In(info().identifier, m_forceRepaintWhenResumingPainting));
+ page->process()->deprecatedSend(DrawingAreaLegacyMessage::ResumePainting, page->pageID(), CoreIPC::In(info().identifier, m_forceRepaintWhenResumingPainting));
m_forceRepaintWhenResumingPainting = false;
}
@@ -113,9 +118,6 @@ void ChunkedUpdateDrawingAreaProxy::didSetSize(UpdateChunk* updateChunk)
invalidateBackingStore();
if (!updateChunk->isEmpty())
drawUpdateChunkIntoBackingStore(updateChunk);
-
- WebPageProxy* page = this->page();
- page->process()->responsivenessTimer()->stop();
}
void ChunkedUpdateDrawingAreaProxy::update(UpdateChunk* updateChunk)
@@ -131,7 +133,7 @@ void ChunkedUpdateDrawingAreaProxy::update(UpdateChunk* updateChunk)
}
WebPageProxy* page = this->page();
- page->process()->send(DrawingAreaLegacyMessage::DidUpdate, page->pageID(), CoreIPC::In(info().identifier));
+ page->process()->deprecatedSend(DrawingAreaLegacyMessage::DidUpdate, page->pageID(), CoreIPC::In(info().identifier));
}
void ChunkedUpdateDrawingAreaProxy::sendSetSize()
@@ -143,8 +145,7 @@ void ChunkedUpdateDrawingAreaProxy::sendSetSize()
return;
m_isWaitingForDidSetFrameNotification = true;
- m_webPageProxy->process()->responsivenessTimer()->start();
- m_webPageProxy->process()->send(DrawingAreaLegacyMessage::SetSize, m_webPageProxy->pageID(), CoreIPC::In(info().identifier, m_size));
+ m_webPageProxy->process()->deprecatedSend(DrawingAreaLegacyMessage::SetSize, m_webPageProxy->pageID(), CoreIPC::In(info().identifier, m_size));
}
void ChunkedUpdateDrawingAreaProxy::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
diff --git a/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h b/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h
index 348d04f..7d7a5f4 100644
--- a/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h
+++ b/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h
@@ -1,5 +1,7 @@
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ * Copyright (C) 2011 Igalia S.L
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,22 +25,20 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef DrawingAreaProxyUpdateChunk_h
-#define DrawingAreaProxyUpdateChunk_h
+#ifndef ChunkedUpdateDrawingAreaProxy_h
+#define ChunkedUpdateDrawingAreaProxy_h
#include "DrawingAreaProxy.h"
#include <WebCore/IntSize.h>
#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
-#ifdef __OBJC__
-@class WKView;
-#else
-class WKView;
-#endif
+OBJC_CLASS WKView;
#elif PLATFORM(QT)
#include <QImage>
class QGraphicsWKView;
+#elif PLATFORM(GTK)
+typedef struct _cairo_surface cairo_surface_t;
#endif
namespace WebKit {
@@ -53,6 +53,9 @@ class WebView;
typedef WebView PlatformWebView;
#elif PLATFORM(QT)
typedef QGraphicsWKView PlatformWebView;
+#elif PLATFORM(GTK)
+class WebView;
+typedef WebView PlatformWebView;
#endif
class ChunkedUpdateDrawingAreaProxy : public DrawingAreaProxy {
@@ -99,6 +102,8 @@ private:
OwnPtr<HBITMAP> m_backingStoreBitmap;
#elif PLATFORM(QT)
QImage m_backingStoreImage;
+#elif PLATFORM(GTK)
+ cairo_surface_t* m_backingStoreImage;
#endif
PlatformWebView* m_webView;
@@ -106,4 +111,4 @@ private:
} // namespace WebKit
-#endif // DrawingAreaProxyUpdateChunk_h
+#endif // ChunkedUpdateDrawingAreaProxy_h
diff --git a/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
index fcc4a75..55168bc 100644
--- a/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
+++ b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "DownloadProxy.h"
#include "DataReference.h"
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp b/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp
index fa16641..3d1f1aa 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "DrawingAreaProxy.h"
#include "WebPageProxy.h"
@@ -34,7 +35,6 @@ namespace WebKit {
DrawingAreaProxy::DrawingAreaProxy(DrawingAreaInfo::Type type, WebPageProxy* webPageProxy)
: m_info(type, nextIdentifier())
, m_webPageProxy(webPageProxy)
- , m_size(webPageProxy->viewSize())
{
}
@@ -48,12 +48,13 @@ DrawingAreaInfo::Identifier DrawingAreaProxy::nextIdentifier()
return ++nextID;
}
-void DrawingAreaProxy::setSize(const IntSize& size)
+void DrawingAreaProxy::setSize(const IntSize& size, const IntSize& scrollOffset)
{
- if (m_size == size)
+ if (m_size == size && scrollOffset.isZero())
return;
m_size = size;
+ m_scrollOffset += scrollOffset;
sizeDidChange();
}
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.h b/Source/WebKit2/UIProcess/DrawingAreaProxy.h
index 3eb24da..f802241 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxy.h
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -31,19 +32,24 @@
#if PLATFORM(QT)
class QPainter;
+#elif PLATFORM(GTK)
+typedef struct _cairo cairo_t;
#endif
namespace WebKit {
+class LayerTreeContext;
+class UpdateInfo;
class WebPageProxy;
-struct UpdateInfo;
-
+
#if PLATFORM(MAC)
typedef CGContextRef PlatformDrawingContext;
#elif PLATFORM(WIN)
typedef HDC PlatformDrawingContext;
#elif PLATFORM(QT)
typedef QPainter* PlatformDrawingContext;
+#elif PLATFORM(GTK)
+typedef cairo_t* PlatformDrawingContext;
#endif
class DrawingAreaProxy {
@@ -54,7 +60,7 @@ public:
virtual ~DrawingAreaProxy();
-#ifdef __APPLE__
+#if PLATFORM(MAC) || PLATFORM(WIN)
void didReceiveDrawingAreaProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
#endif
@@ -79,7 +85,7 @@ public:
const DrawingAreaInfo& info() const { return m_info; }
const WebCore::IntSize& size() const { return m_size; }
- void setSize(const WebCore::IntSize&);
+ void setSize(const WebCore::IntSize&, const WebCore::IntSize& scrollOffset);
protected:
explicit DrawingAreaProxy(DrawingAreaInfo::Type, WebPageProxy*);
@@ -88,12 +94,17 @@ protected:
WebPageProxy* m_webPageProxy;
WebCore::IntSize m_size;
+ WebCore::IntSize m_scrollOffset;
private:
// CoreIPC message handlers.
// FIXME: These should be pure virtual.
- virtual void update(const UpdateInfo&) { }
- virtual void didSetSize(const UpdateInfo&) { }
+ virtual void update(uint64_t sequenceNumber, const UpdateInfo&) { }
+ virtual void didSetSize(uint64_t sequenceNumber, const UpdateInfo&, const LayerTreeContext&) { }
+#if USE(ACCELERATED_COMPOSITING)
+ virtual void enterAcceleratedCompositingMode(uint64_t sequenceNumber, const LayerTreeContext&) { }
+ virtual void exitAcceleratedCompositingMode(uint64_t sequenceNumber, const UpdateInfo&) { }
+#endif
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in b/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in
index ec065c7..a2b5e26 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in
@@ -21,6 +21,11 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
messages -> DrawingAreaProxy {
- Update(WebKit::UpdateInfo updateInfo)
- DidSetSize(WebKit::UpdateInfo updateInfo)
+ Update(uint64_t sequenceNumber, WebKit::UpdateInfo updateInfo)
+ DidSetSize(uint64_t sequenceNumber, WebKit::UpdateInfo updateInfo, WebKit::LayerTreeContext context)
+
+#if USE(ACCELERATED_COMPOSITING)
+ EnterAcceleratedCompositingMode(uint64_t sequenceNumber, WebKit::LayerTreeContext context)
+ ExitAcceleratedCompositingMode(uint64_t sequenceNumber, WebKit::UpdateInfo updateInfo)
+#endif
}
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
index 3207094..6a65841 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
@@ -23,15 +23,18 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "DrawingAreaProxyImpl.h"
#include "DrawingAreaMessages.h"
+#include "DrawingAreaProxyMessages.h"
+#include "LayerTreeContext.h"
#include "Region.h"
#include "UpdateInfo.h"
#include "WebPageProxy.h"
#include "WebProcessProxy.h"
-#ifndef __APPLE__
+#if !PLATFORM(MAC) && !PLATFORM(WIN)
#error "This drawing area is not ready for use by other ports yet."
#endif
@@ -47,11 +50,15 @@ PassOwnPtr<DrawingAreaProxyImpl> DrawingAreaProxyImpl::create(WebPageProxy* webP
DrawingAreaProxyImpl::DrawingAreaProxyImpl(WebPageProxy* webPageProxy)
: DrawingAreaProxy(DrawingAreaInfo::Impl, webPageProxy)
, m_isWaitingForDidSetSize(false)
+ , m_lastDidSetSizeSequenceNumber(0)
{
}
DrawingAreaProxyImpl::~DrawingAreaProxyImpl()
{
+ // Make sure to exit accelerated compositing mode.
+ if (isInAcceleratedCompositingMode())
+ exitAcceleratedCompositingMode();
}
void DrawingAreaProxyImpl::paint(BackingStore::PlatformGraphicsContext context, const IntRect& rect, Region& unpaintedRegion)
@@ -61,6 +68,18 @@ void DrawingAreaProxyImpl::paint(BackingStore::PlatformGraphicsContext context,
if (!m_backingStore)
return;
+ ASSERT(!isInAcceleratedCompositingMode());
+
+ if (m_isWaitingForDidSetSize) {
+ // Wait for a DidSetSize message that contains the new bits before we paint
+ // what's currently in the backing store.
+ waitForAndDispatchDidSetSize();
+
+ // Dispatching DidSetSize could destroy our backing store or change the compositing mode.
+ if (!m_backingStore || isInAcceleratedCompositingMode())
+ return;
+ }
+
m_backingStore->paint(context, rect);
unpaintedRegion.subtract(IntRect(IntPoint(), m_backingStore->size()));
}
@@ -112,29 +131,71 @@ void DrawingAreaProxyImpl::detachCompositingContext()
ASSERT_NOT_REACHED();
}
-void DrawingAreaProxyImpl::update(const UpdateInfo& updateInfo)
+void DrawingAreaProxyImpl::update(uint64_t sequenceNumber, const UpdateInfo& updateInfo)
{
+ if (sequenceNumber < m_lastDidSetSizeSequenceNumber)
+ return;
+
// FIXME: Handle the case where the view is hidden.
incorporateUpdate(updateInfo);
m_webPageProxy->process()->send(Messages::DrawingArea::DidUpdate(), m_webPageProxy->pageID());
}
-void DrawingAreaProxyImpl::didSetSize(const UpdateInfo& updateInfo)
+void DrawingAreaProxyImpl::didSetSize(uint64_t sequenceNumber, const UpdateInfo& updateInfo, const LayerTreeContext& layerTreeContext)
{
+ ASSERT(sequenceNumber > m_lastDidSetSizeSequenceNumber);
+ m_lastDidSetSizeSequenceNumber = sequenceNumber;
+
ASSERT(m_isWaitingForDidSetSize);
m_isWaitingForDidSetSize = false;
if (m_size != updateInfo.viewSize)
sendSetSize();
+ if (layerTreeContext != m_layerTreeContext) {
+ if (!m_layerTreeContext.isEmpty()) {
+ exitAcceleratedCompositingMode();
+ ASSERT(m_layerTreeContext.isEmpty());
+ }
+
+ if (!layerTreeContext.isEmpty()) {
+ enterAcceleratedCompositingMode(layerTreeContext);
+ ASSERT(layerTreeContext == m_layerTreeContext);
+ }
+ }
+
+ if (isInAcceleratedCompositingMode()) {
+ ASSERT(!m_backingStore);
+ return;
+ }
+
m_backingStore = nullptr;
+ incorporateUpdate(updateInfo);
+}
+
+void DrawingAreaProxyImpl::enterAcceleratedCompositingMode(uint64_t sequenceNumber, const LayerTreeContext& layerTreeContext)
+{
+ if (sequenceNumber < m_lastDidSetSizeSequenceNumber)
+ return;
+
+ enterAcceleratedCompositingMode(layerTreeContext);
+}
+
+void DrawingAreaProxyImpl::exitAcceleratedCompositingMode(uint64_t sequenceNumber, const UpdateInfo& updateInfo)
+{
+ if (sequenceNumber < m_lastDidSetSizeSequenceNumber)
+ return;
+
+ exitAcceleratedCompositingMode();
incorporateUpdate(updateInfo);
}
void DrawingAreaProxyImpl::incorporateUpdate(const UpdateInfo& updateInfo)
{
+ ASSERT(!isInAcceleratedCompositingMode());
+
if (updateInfo.updateRectBounds.isEmpty())
return;
@@ -164,7 +225,45 @@ void DrawingAreaProxyImpl::sendSetSize()
return;
m_isWaitingForDidSetSize = true;
- m_webPageProxy->process()->send(Messages::DrawingArea::SetSize(m_size), m_webPageProxy->pageID());
+ m_webPageProxy->process()->send(Messages::DrawingArea::SetSize(m_size, m_scrollOffset), m_webPageProxy->pageID());
+ m_scrollOffset = IntSize();
+
+ if (!m_layerTreeContext.isEmpty()) {
+ // Wait for the DidSetSize message. Normally we don this in DrawingAreaProxyImpl::paint, but that
+ // function is never called when in accelerated compositing mode.
+ waitForAndDispatchDidSetSize();
+ }
+}
+
+void DrawingAreaProxyImpl::waitForAndDispatchDidSetSize()
+{
+ ASSERT(m_isWaitingForDidSetSize);
+
+ if (!m_webPageProxy->isValid())
+ return;
+ if (m_webPageProxy->process()->isLaunching())
+ return;
+
+ // The timeout, in seconds, we use when waiting for a DidSetSize message when we're asked to paint.
+ static const double didSetSizeTimeout = 0.5;
+ m_webPageProxy->process()->connection()->waitForAndDispatchImmediately<Messages::DrawingAreaProxy::DidSetSize>(m_webPageProxy->pageID(), didSetSizeTimeout);
+}
+
+void DrawingAreaProxyImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
+{
+ ASSERT(!isInAcceleratedCompositingMode());
+
+ m_backingStore = nullptr;
+ m_layerTreeContext = layerTreeContext;
+ m_webPageProxy->enterAcceleratedCompositingMode(layerTreeContext);
+}
+
+void DrawingAreaProxyImpl::exitAcceleratedCompositingMode()
+{
+ ASSERT(isInAcceleratedCompositingMode());
+
+ m_layerTreeContext = LayerTreeContext();
+ m_webPageProxy->exitAcceleratedCompositingMode();
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
index bf7b878..f776b09 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
@@ -28,6 +28,7 @@
#include "BackingStore.h"
#include "DrawingAreaProxy.h"
+#include "LayerTreeContext.h"
namespace WebKit {
@@ -54,16 +55,30 @@ private:
virtual void detachCompositingContext();
// CoreIPC message handlers
- virtual void update(const UpdateInfo&);
- virtual void didSetSize(const UpdateInfo&);
-
+ virtual void update(uint64_t sequenceNumber, const UpdateInfo&);
+ virtual void didSetSize(uint64_t sequenceNumber, const UpdateInfo&, const LayerTreeContext&);
+ virtual void enterAcceleratedCompositingMode(uint64_t sequenceNumber, const LayerTreeContext&);
+ virtual void exitAcceleratedCompositingMode(uint64_t sequenceNumber, const UpdateInfo&);
+
void incorporateUpdate(const UpdateInfo&);
void sendSetSize();
+ void waitForAndDispatchDidSetSize();
+
+ void enterAcceleratedCompositingMode(const LayerTreeContext&);
+ void exitAcceleratedCompositingMode();
+ bool isInAcceleratedCompositingMode() const { return !m_layerTreeContext.isEmpty(); }
+
+ // The current layer tree context.
+ LayerTreeContext m_layerTreeContext;
+
// Whether we've sent a SetSize message and are now waiting for a DidSetSize message.
// Used to throttle SetSize messages so we don't send them faster than the Web process can handle.
bool m_isWaitingForDidSetSize;
+ // The sequence number of the last DidSetSize message
+ uint64_t m_lastDidSetSizeSequenceNumber;
+
OwnPtr<BackingStore> m_backingStore;
};
diff --git a/Source/WebKit2/UIProcess/FindIndicator.cpp b/Source/WebKit2/UIProcess/FindIndicator.cpp
index f1357e7..d6ac461 100644
--- a/Source/WebKit2/UIProcess/FindIndicator.cpp
+++ b/Source/WebKit2/UIProcess/FindIndicator.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "FindIndicator.h"
#include "ShareableBitmap.h"
@@ -76,18 +77,18 @@ static const int gradientLightAlpha = 255;
namespace WebKit {
-PassRefPtr<FindIndicator> FindIndicator::create(const FloatRect& selectionRect, const Vector<FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle)
+PassRefPtr<FindIndicator> FindIndicator::create(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle)
{
- RefPtr<ShareableBitmap> contentImage = ShareableBitmap::create(enclosingIntRect(selectionRect).size(), contentImageHandle);
+ RefPtr<ShareableBitmap> contentImage = ShareableBitmap::create(enclosingIntRect(selectionRectInWindowCoordinates).size(), contentImageHandle);
if (!contentImage)
return 0;
- return adoptRef(new FindIndicator(selectionRect, textRects, contentImage.release()));
+ return adoptRef(new FindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImage.release()));
}
-FindIndicator::FindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, PassRefPtr<ShareableBitmap> contentImage)
- : m_selectionRect(selectionRect)
- , m_textRects(textRects)
+FindIndicator::FindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, PassRefPtr<ShareableBitmap> contentImage)
+ : m_selectionRectInWindowCoordinates(selectionRectInWindowCoordinates)
+ , m_textRectsInSelectionRectCoordinates(textRectsInSelectionRectCoordinates)
, m_contentImage(contentImage)
{
}
@@ -107,9 +108,9 @@ static FloatRect inflateRect(const FloatRect& rect, float inflateX, float inflat
FloatRect FindIndicator::frameRect() const
{
- return FloatRect(m_selectionRect.x() - leftBorderThickness, m_selectionRect.y() - topBorderThickness,
- m_selectionRect.width() + rightBorderThickness + leftBorderThickness,
- m_selectionRect.height() + topBorderThickness + bottomBorderThickness);
+ return FloatRect(m_selectionRectInWindowCoordinates.x() - leftBorderThickness, m_selectionRectInWindowCoordinates.y() - topBorderThickness,
+ m_selectionRectInWindowCoordinates.width() + rightBorderThickness + leftBorderThickness,
+ m_selectionRectInWindowCoordinates.height() + topBorderThickness + bottomBorderThickness);
}
static Color lightBorderColor()
@@ -142,8 +143,8 @@ static Path pathWithRoundedRect(const FloatRect& pathRect, float radius)
void FindIndicator::draw(GraphicsContext& graphicsContext, const IntRect& dirtyRect)
{
- for (size_t i = 0; i < m_textRects.size(); ++i) {
- FloatRect textRect = m_textRects[i];
+ for (size_t i = 0; i < m_textRectsInSelectionRectCoordinates.size(); ++i) {
+ FloatRect textRect = m_textRectsInSelectionRectCoordinates[i];
textRect.move(leftBorderThickness, topBorderThickness);
graphicsContext.save();
@@ -156,7 +157,7 @@ void FindIndicator::draw(GraphicsContext& graphicsContext, const IntRect& dirtyR
graphicsContext.save();
FloatRect innerPathRect = inflateRect(textRect, horizontalPaddingInsideLightBorder, verticalPaddingInsideLightBorder);
graphicsContext.clip(pathWithRoundedRect(innerPathRect, cornerRadius));
- RefPtr<Gradient> gradient = Gradient::create(FloatPoint(innerPathRect.x(), innerPathRect.y()), FloatPoint(innerPathRect.x(), innerPathRect.bottom()));
+ RefPtr<Gradient> gradient = Gradient::create(FloatPoint(innerPathRect.x(), innerPathRect.y()), FloatPoint(innerPathRect.x(), innerPathRect.maxY()));
gradient->addColorStop(0, gradientLightColor());
gradient->addColorStop(1, gradientDarkColor());
graphicsContext.setFillGradient(gradient);
diff --git a/Source/WebKit2/UIProcess/FindIndicator.h b/Source/WebKit2/UIProcess/FindIndicator.h
index 997d537..69088ce 100644
--- a/Source/WebKit2/UIProcess/FindIndicator.h
+++ b/Source/WebKit2/UIProcess/FindIndicator.h
@@ -42,12 +42,13 @@ class ShareableBitmap;
class FindIndicator : public RefCounted<FindIndicator> {
public:
- static PassRefPtr<FindIndicator> create(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle);
+ static PassRefPtr<FindIndicator> create(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle);
~FindIndicator();
+ WebCore::FloatRect selectionRectInWindowCoordinates() const { return m_selectionRectInWindowCoordinates; }
WebCore::FloatRect frameRect() const;
- const Vector<WebCore::FloatRect>& textRects() const { return m_textRects; }
+ const Vector<WebCore::FloatRect>& textRects() const { return m_textRectsInSelectionRectCoordinates; }
ShareableBitmap* contentImage() const { return m_contentImage.get(); }
@@ -56,8 +57,8 @@ public:
private:
FindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, PassRefPtr<ShareableBitmap> contentImage);
- WebCore::FloatRect m_selectionRect;
- Vector<WebCore::FloatRect> m_textRects;
+ WebCore::FloatRect m_selectionRectInWindowCoordinates;
+ Vector<WebCore::FloatRect> m_textRectsInSelectionRectCoordinates;
RefPtr<ShareableBitmap> m_contentImage;
};
diff --git a/Source/WebKit2/UIProcess/GenericCallback.h b/Source/WebKit2/UIProcess/GenericCallback.h
index b72314a..c34414a 100644
--- a/Source/WebKit2/UIProcess/GenericCallback.h
+++ b/Source/WebKit2/UIProcess/GenericCallback.h
@@ -35,6 +35,115 @@
namespace WebKit {
+class VoidCallback : public RefCounted<VoidCallback> {
+public:
+ typedef void (*CallbackFunction)(WKErrorRef, void*);
+
+ static PassRefPtr<VoidCallback> create(void* context, CallbackFunction callback)
+ {
+ return adoptRef(new VoidCallback(context, callback));
+ }
+
+ VoidCallback()
+ {
+ ASSERT(!m_callback);
+ }
+
+ void performCallback()
+ {
+ ASSERT(m_callback);
+
+ m_callback(0, m_context);
+
+ m_callback = 0;
+ }
+
+ void invalidate()
+ {
+ ASSERT(m_callback);
+
+ RefPtr<WebError> error = WebError::create();
+ m_callback(toAPI(error.get()), m_context);
+
+ m_callback = 0;
+ }
+
+ uint64_t callbackID() const { return m_callbackID; }
+
+private:
+ static uint64_t generateCallbackID()
+ {
+ static uint64_t uniqueCallbackID = 1;
+ return uniqueCallbackID++;
+ }
+
+ VoidCallback(void* context, CallbackFunction callback)
+ : m_context(context)
+ , m_callback(callback)
+ , m_callbackID(generateCallbackID())
+ {
+ }
+
+ void* m_context;
+ CallbackFunction m_callback;
+ uint64_t m_callbackID;
+};
+
+// FIXME: Make a version of GenericCallback with two arguments, and define ComputedPagesCallback as a specialization.
+class ComputedPagesCallback : public RefCounted<ComputedPagesCallback> {
+public:
+ typedef void (*CallbackFunction)(const Vector<WebCore::IntRect>&, double, WKErrorRef, void*);
+
+ static PassRefPtr<ComputedPagesCallback> create(void* context, CallbackFunction callback)
+ {
+ return adoptRef(new ComputedPagesCallback(context, callback));
+ }
+
+ ~ComputedPagesCallback()
+ {
+ ASSERT(!m_callback);
+ }
+
+ void performCallbackWithReturnValue(const Vector<WebCore::IntRect>& returnValue1, double returnValue2)
+ {
+ ASSERT(m_callback);
+
+ m_callback(returnValue1, returnValue2, 0, m_context);
+
+ m_callback = 0;
+ }
+
+ void invalidate()
+ {
+ ASSERT(m_callback);
+
+ RefPtr<WebError> error = WebError::create();
+ m_callback(Vector<WebCore::IntRect>(), 0, toAPI(error.get()), m_context);
+
+ m_callback = 0;
+ }
+
+ uint64_t callbackID() const { return m_callbackID; }
+
+private:
+ static uint64_t generateCallbackID()
+ {
+ static uint64_t uniqueCallbackID = 1;
+ return uniqueCallbackID++;
+ }
+
+ ComputedPagesCallback(void* context, CallbackFunction callback)
+ : m_context(context)
+ , m_callback(callback)
+ , m_callbackID(generateCallbackID())
+ {
+ }
+
+ void* m_context;
+ CallbackFunction m_callback;
+ uint64_t m_callbackID;
+};
+
template<typename APIReturnValueType, typename InternalReturnValueType = typename APITypeInfo<APIReturnValueType>::ImplType>
class GenericCallback : public RefCounted<GenericCallback<APIReturnValueType, InternalReturnValueType> > {
public:
diff --git a/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp b/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp
index 285e329..38bbd6a 100644
--- a/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp
+++ b/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "GeolocationPermissionRequestManagerProxy.h"
#include "WebPageMessages.h"
diff --git a/Source/WebKit2/UIProcess/GeolocationPermissionRequestProxy.cpp b/Source/WebKit2/UIProcess/GeolocationPermissionRequestProxy.cpp
index 9766ad2..4cd1736 100644
--- a/Source/WebKit2/UIProcess/GeolocationPermissionRequestProxy.cpp
+++ b/Source/WebKit2/UIProcess/GeolocationPermissionRequestProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "GeolocationPermissionRequestProxy.h"
#include "GeolocationPermissionRequestManagerProxy.h"
diff --git a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp
index 507edfa..15a7450 100644
--- a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ProcessLauncher.h"
#include "WorkQueue.h"
diff --git a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h
index 31efd4d..8a1cd01 100644
--- a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h
+++ b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h
@@ -56,6 +56,7 @@ public:
#if PLATFORM(MAC)
static const cpu_type_t MatchCurrentArchitecture = 0;
cpu_type_t architecture;
+ bool executableHeap;
#endif
};
@@ -72,11 +73,6 @@ public:
static bool getProcessTypeFromString(const char*, ProcessType&);
-#if PLATFORM(QT)
- friend class ProcessLauncherHelper;
- static QLocalSocket* takePendingConnection();
-#endif
-
private:
ProcessLauncher(Client*, const LaunchOptions& launchOptions);
diff --git a/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.cpp b/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.cpp
index 69e4893..d331749 100644
--- a/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ThreadLauncher.h"
#include "RunLoop.h"
diff --git a/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp b/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp
index 2565a48..04d8a03 100644
--- a/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ProcessLauncher.h"
#include "Connection.h"
diff --git a/Source/WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp b/Source/WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp
index 2841e0a..b5fda40 100644
--- a/Source/WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ThreadLauncher.h"
#include "NotImplemented.h"
diff --git a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
index a725d6b..92f5ad3 100644
--- a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
+++ b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
@@ -23,24 +23,25 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "ProcessLauncher.h"
-
-#include "RunLoop.h"
-#include "WebProcess.h"
-#include "WebKitSystemInterface.h"
-#include <crt_externs.h>
-#include <mach-o/dyld.h>
-#include <mach/machine.h>
-#include <runtime/InitializeThreading.h>
-#include <servers/bootstrap.h>
-#include <spawn.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RetainPtr.h>
-#include <wtf/Threading.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/WTFString.h>
+#import "config.h"
+#import "ProcessLauncher.h"
+
+#import "RunLoop.h"
+#import "WebProcess.h"
+#import "WebKitSystemInterface.h"
+#import <crt_externs.h>
+#import <mach-o/dyld.h>
+#import <mach/machine.h>
+#import <runtime/InitializeThreading.h>
+#import <servers/bootstrap.h>
+#import <spawn.h>
+#import <sys/param.h>
+#import <sys/stat.h>
+#import <wtf/PassRefPtr.h>
+#import <wtf/RetainPtr.h>
+#import <wtf/Threading.h>
+#import <wtf/text/CString.h>
+#import <wtf/text/WTFString.h>
using namespace WebCore;
@@ -230,6 +231,12 @@ void ProcessLauncher::launchProcess()
// Start suspended so we can set up the termination notification handler.
flags |= POSIX_SPAWN_START_SUSPENDED;
+#ifndef BUILDING_ON_SNOW_LEOPARD
+ static const int allowExecutableHeapFlag = 0x2000;
+ if (m_launchOptions.executableHeap)
+ flags |= allowExecutableHeapFlag;
+#endif
+
posix_spawnattr_setflags(&attr, flags);
pid_t processIdentifier;
diff --git a/Source/WebKit2/UIProcess/Launcher/mac/ThreadLauncherMac.mm b/Source/WebKit2/UIProcess/Launcher/mac/ThreadLauncherMac.mm
index 8aac275..c15073b 100644
--- a/Source/WebKit2/UIProcess/Launcher/mac/ThreadLauncherMac.mm
+++ b/Source/WebKit2/UIProcess/Launcher/mac/ThreadLauncherMac.mm
@@ -23,13 +23,14 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "ThreadLauncher.h"
+#import "config.h"
+#import "ThreadLauncher.h"
-#include "RunLoop.h"
-#include "WebProcess.h"
-#include "WebSystemInterface.h"
-#include <runtime/InitializeThreading.h>
-#include <wtf/Threading.h>
+#import "RunLoop.h"
+#import "WebProcess.h"
+#import "WebSystemInterface.h"
+#import <runtime/InitializeThreading.h>
+#import <wtf/Threading.h>
namespace WebKit {
diff --git a/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp b/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp
index 7dff894..85c3651 100644
--- a/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp
@@ -24,20 +24,13 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ProcessLauncher.h"
#include "Connection.h"
-#include "CleanupHandler.h"
#include "NotImplemented.h"
#include "RunLoop.h"
#include "WebProcess.h"
-#include <runtime/InitializeThreading.h>
-#include <string>
-#include <wtf/HashSet.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/Threading.h>
-#include <wtf/text/WTFString.h>
-
#include <QApplication>
#include <QDebug>
#include <QFile>
@@ -45,52 +38,27 @@
#include <QMetaType>
#include <QProcess>
#include <QString>
-
#include <QtCore/qglobal.h>
-
+#include <errno.h>
+#include <fcntl.h>
+#include <runtime/InitializeThreading.h>
+#include <string>
#include <sys/resource.h>
+#include <sys/socket.h>
#include <unistd.h>
+#include <wtf/HashSet.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/Threading.h>
+#include <wtf/text/WTFString.h>
+#if defined Q_OS_LINUX
+#include <sys/prctl.h>
+#include <signal.h>
+#endif
using namespace WebCore;
namespace WebKit {
-class ProcessLauncherHelper : public QObject {
- Q_OBJECT
-public:
- ~ProcessLauncherHelper();
- void launch(WebKit::ProcessLauncher*);
- QLocalSocket* takePendingConnection();
- static ProcessLauncherHelper* instance();
-
- const QString serverName() const { return m_server.serverName(); }
-
-private:
- ProcessLauncherHelper();
- QLocalServer m_server;
- QList<WorkItem*> m_items;
-
- Q_SLOT void newConnection();
-};
-
-Q_GLOBAL_STATIC(WTF::HashSet<QProcess*>, processes);
-
-static void cleanupAtExit()
-{
- // Terminate our web process(es).
- WTF::HashSet<QProcess*>::const_iterator end = processes()->end();
- for (WTF::HashSet<QProcess*>::const_iterator it = processes()->begin(); it != end; ++it) {
- QProcess* process = *it;
- process->disconnect(process);
- process->terminate();
- if (!process->waitForFinished(200))
- process->kill();
- }
-
- // Do not leave the socket file behind.
- QLocalServer::removeServer(ProcessLauncherHelper::instance()->serverName());
-}
-
class QtWebProcess : public QProcess
{
Q_OBJECT
@@ -98,32 +66,20 @@ public:
QtWebProcess(QObject* parent = 0)
: QProcess(parent)
{
- static bool isRegistered = false;
- if (!isRegistered) {
- qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
- isRegistered = true;
- }
-
- connect(this, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(processStateChanged(QProcess::ProcessState)));
}
-private slots:
- void processStateChanged(QProcess::ProcessState state);
+protected:
+ virtual void setupChildProcess();
};
-void QtWebProcess::processStateChanged(QProcess::ProcessState state)
+void QtWebProcess::setupChildProcess()
{
- QProcess* process = qobject_cast<QProcess*>(sender());
- if (!process)
- return;
-
- if (state == QProcess::Running)
- processes()->add(process);
- else if (state == QProcess::NotRunning)
- processes()->remove(process);
+#if defined Q_OS_LINUX
+ prctl(PR_SET_PDEATHSIG, SIGKILL);
+#endif
}
-void ProcessLauncherHelper::launch(WebKit::ProcessLauncher* launcher)
+void ProcessLauncher::launchProcess()
{
QString applicationPath = "%1 %2";
@@ -133,12 +89,38 @@ void ProcessLauncherHelper::launch(WebKit::ProcessLauncher* launcher)
applicationPath = applicationPath.arg("QtWebProcess");
}
- QString program(applicationPath.arg(m_server.serverName()));
+ int sockets[2];
+ if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sockets) == -1) {
+ qDebug() << "Creation of socket failed with errno:" << errno;
+ ASSERT_NOT_REACHED();
+ return;
+ }
+
+ // Don't expose the ui socket to the web process
+ while (fcntl(sockets[1], F_SETFD, FD_CLOEXEC) == -1) {
+ if (errno != EINTR) {
+ ASSERT_NOT_REACHED();
+ while (close(sockets[0]) == -1 && errno == EINTR) { }
+ while (close(sockets[1]) == -1 && errno == EINTR) { }
+ return;
+ }
+ }
+
+ QString program(applicationPath.arg(sockets[0]));
QProcess* webProcess = new QtWebProcess();
webProcess->setProcessChannelMode(QProcess::ForwardedChannels);
webProcess->start(program);
+ // Don't expose the web socket to possible future web processes
+ while (fcntl(sockets[0], F_SETFD, FD_CLOEXEC) == -1) {
+ if (errno != EINTR) {
+ ASSERT_NOT_REACHED();
+ delete webProcess;
+ return;
+ }
+ }
+
if (!webProcess->waitForStarted()) {
qDebug() << "Failed to start" << program;
ASSERT_NOT_REACHED();
@@ -148,55 +130,7 @@ void ProcessLauncherHelper::launch(WebKit::ProcessLauncher* launcher)
setpriority(PRIO_PROCESS, webProcess->pid(), 10);
- m_items.append(WorkItem::create(launcher, &WebKit::ProcessLauncher::didFinishLaunchingProcess, webProcess, m_server.serverName()).leakPtr());
-}
-
-QLocalSocket* ProcessLauncherHelper::takePendingConnection()
-{
- return m_server.nextPendingConnection();
-}
-
-ProcessLauncherHelper::~ProcessLauncherHelper()
-{
- m_server.close();
-}
-
-ProcessLauncherHelper::ProcessLauncherHelper()
-{
- srandom(time(0));
- if (!m_server.listen("QtWebKit" + QString::number(random()))) {
- qDebug() << "Failed to create server socket.";
- ASSERT_NOT_REACHED();
- }
- connect(&m_server, SIGNAL(newConnection()), this, SLOT(newConnection()));
-}
-
-ProcessLauncherHelper* ProcessLauncherHelper::instance()
-{
- static ProcessLauncherHelper* result = 0;
- if (!result) {
- result = new ProcessLauncherHelper();
-
- // The purpose of the following line is to ensure that our static is initialized before the exit handler is installed.
- processes()->clear();
-
- atexit(cleanupAtExit);
- }
- return result;
-}
-
-void ProcessLauncherHelper::newConnection()
-{
- ASSERT(!m_items.isEmpty());
-
- m_items[0]->execute();
- delete m_items[0];
- m_items.pop_front();
-}
-
-void ProcessLauncher::launchProcess()
-{
- ProcessLauncherHelper::instance()->launch(this);
+ RunLoop::main()->scheduleWork(WorkItem::create(this, &WebKit::ProcessLauncher::didFinishLaunchingProcess, webProcess, sockets[1]));
}
void ProcessLauncher::terminateProcess()
@@ -208,14 +142,9 @@ void ProcessLauncher::terminateProcess()
m_processIdentifier->terminate();
}
-QLocalSocket* ProcessLauncher::takePendingConnection()
-{
- return ProcessLauncherHelper::instance()->takePendingConnection();
-}
-
void ProcessLauncher::platformInvalidate()
{
- notImplemented();
+
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/Launcher/qt/ThreadLauncherQt.cpp b/Source/WebKit2/UIProcess/Launcher/qt/ThreadLauncherQt.cpp
index 471a424..313091e 100644
--- a/Source/WebKit2/UIProcess/Launcher/qt/ThreadLauncherQt.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/qt/ThreadLauncherQt.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ThreadLauncher.h"
#include "RunLoop.h"
@@ -54,7 +55,7 @@ static void* webThreadBody(void* /* context */)
// FIXME: We do not support threaded mode for now.
- WebProcess::shared().initialize("foo", RunLoop::current());
+ WebProcess::shared().initialize(-1, RunLoop::current());
RunLoop::run();
return 0;
@@ -70,8 +71,7 @@ CoreIPC::Connection::Identifier ThreadLauncher::createWebThread()
return 0;
}
- QString serverIdentifier = QString::number(connectionIdentifier);
- return serverIdentifier;
+ return connectionIdentifier;
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp b/Source/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp
index 7165a18..8981e80 100644
--- a/Source/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ProcessLauncher.h"
#include "Connection.h"
diff --git a/Source/WebKit2/UIProcess/Launcher/win/ThreadLauncherWin.cpp b/Source/WebKit2/UIProcess/Launcher/win/ThreadLauncherWin.cpp
index b8b2f64..2094fc6 100644
--- a/Source/WebKit2/UIProcess/Launcher/win/ThreadLauncherWin.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/win/ThreadLauncherWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ThreadLauncher.h"
#include "RunLoop.h"
diff --git a/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.cpp b/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.cpp
index ffa91de..fbbff43 100644
--- a/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.cpp
+++ b/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.cpp
@@ -23,10 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if USE(ACCELERATED_COMPOSITING)
-
+#include "config.h"
#include "LayerBackedDrawingAreaProxy.h"
+#if USE(ACCELERATED_COMPOSITING)
+
#include "DrawingAreaMessageKinds.h"
#include "DrawingAreaProxyMessageKinds.h"
#include "MessageID.h"
@@ -55,7 +56,7 @@ LayerBackedDrawingAreaProxy::~LayerBackedDrawingAreaProxy()
{
}
-#if !PLATFORM(WIN)
+#if !PLATFORM(WIN) && !PLATFORM(MAC)
bool LayerBackedDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext context)
{
return true;
@@ -80,8 +81,7 @@ void LayerBackedDrawingAreaProxy::sizeDidChange()
m_isWaitingForDidSetFrameNotification = true;
- page->process()->responsivenessTimer()->start();
- page->process()->send(DrawingAreaLegacyMessage::SetSize, page->pageID(), CoreIPC::In(info().identifier, m_size));
+ page->process()->deprecatedSend(DrawingAreaLegacyMessage::SetSize, page->pageID(), CoreIPC::In(info().identifier, m_size));
}
#if !PLATFORM(MAC) && !PLATFORM(WIN)
@@ -103,12 +103,12 @@ void LayerBackedDrawingAreaProxy::setPageIsVisible(bool isVisible)
if (!m_isVisible) {
// Tell the web process that it doesn't need to paint anything for now.
- page->process()->send(DrawingAreaLegacyMessage::SuspendPainting, page->pageID(), CoreIPC::In(info().identifier));
+ page->process()->deprecatedSend(DrawingAreaLegacyMessage::SuspendPainting, page->pageID(), CoreIPC::In(info().identifier));
return;
}
// The page is now visible.
- page->process()->send(DrawingAreaLegacyMessage::ResumePainting, page->pageID(), CoreIPC::In(info().identifier));
+ page->process()->deprecatedSend(DrawingAreaLegacyMessage::ResumePainting, page->pageID(), CoreIPC::In(info().identifier));
// FIXME: We should request a full repaint here if needed.
}
@@ -118,16 +118,13 @@ void LayerBackedDrawingAreaProxy::didSetSize(const IntSize& size)
m_isWaitingForDidSetFrameNotification = false;
if (size != m_lastSetViewSize)
- setSize(m_lastSetViewSize);
-
- WebPageProxy* page = this->page();
- page->process()->responsivenessTimer()->stop();
+ setSize(m_lastSetViewSize, IntSize());
}
void LayerBackedDrawingAreaProxy::update()
{
WebPageProxy* page = this->page();
- page->process()->send(DrawingAreaLegacyMessage::DidUpdate, page->pageID(), CoreIPC::In(info().identifier));
+ page->process()->deprecatedSend(DrawingAreaLegacyMessage::DidUpdate, page->pageID(), CoreIPC::In(info().identifier));
}
void LayerBackedDrawingAreaProxy::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
diff --git a/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.h b/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.h
index bbaa643..31aca5c 100644
--- a/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.h
+++ b/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.h
@@ -33,13 +33,9 @@
#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
-#ifdef __OBJC__
-@class CALayer;
-@class WKView;
-#else
-class CALayer;
-class WKView;
-#endif
+
+OBJC_CLASS CALayer;
+OBJC_CLASS WKView;
#endif
namespace WebKit {
diff --git a/Source/WebKit2/UIProcess/PageClient.h b/Source/WebKit2/UIProcess/PageClient.h
index e483aef..4eb1860 100644
--- a/Source/WebKit2/UIProcess/PageClient.h
+++ b/Source/WebKit2/UIProcess/PageClient.h
@@ -79,6 +79,7 @@ public:
virtual void processDidCrash() = 0;
virtual void didRelaunchProcess() = 0;
+ virtual void pageClosed() = 0;
virtual void takeFocus(bool direction) = 0;
virtual void toolTipChanged(const String&, const String&) = 0;
@@ -98,7 +99,7 @@ public:
virtual void clearAllEditCommands() = 0;
virtual void setEditCommandState(const String& commandName, bool isEnabled, int state) = 0;
#if PLATFORM(MAC)
- virtual void accessibilityChildTokenReceived(const CoreIPC::DataReference&) = 0;
+ virtual void accessibilityWebProcessTokenReceived(const CoreIPC::DataReference&) = 0;
virtual void interceptKeyEvent(const NativeWebKeyboardEvent&, Vector<WebCore::KeypressCommand>& commandName, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline>& underlines) = 0;
virtual void setDragImage(const WebCore::IntPoint& clientPosition, const WebCore::IntSize& imageSize, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) = 0;
#endif
@@ -108,7 +109,7 @@ public:
virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) = 0;
virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) = 0;
- virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&) = 0;
+ virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) = 0;
virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) = 0;
virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) = 0;
@@ -116,6 +117,9 @@ public:
virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut) = 0;
#if USE(ACCELERATED_COMPOSITING)
+ virtual void enterAcceleratedCompositingMode(const LayerTreeContext&) = 0;
+ virtual void exitAcceleratedCompositingMode() = 0;
+
virtual void pageDidEnterAcceleratedCompositing() = 0;
virtual void pageDidLeaveAcceleratedCompositing() = 0;
#endif
@@ -126,10 +130,13 @@ public:
#if PLATFORM(MAC)
virtual void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled) = 0;
+ virtual void setAutodisplay(bool) = 0;
virtual CGContextRef containingWindowGraphicsContext() = 0;
#endif
+ virtual void didChangeScrollbarsForMainFrame() const = 0;
+
// Custom representations.
virtual void didCommitLoadForMainFrame(bool useCustomRepresentation) = 0;
virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&) = 0;
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp
index f4fb5ad..b3d9183 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "PluginInfoStore.h"
#include <WebCore/KURL.h>
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp
index ff44e25..bca9689 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp
@@ -23,10 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if ENABLE(PLUGIN_PROCESS)
-
+#include "config.h"
#include "PluginProcessManager.h"
+#if ENABLE(PLUGIN_PROCESS)
+
#include "PluginInfoStore.h"
#include "PluginProcessProxy.h"
#include "WebContext.h"
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
index 093a31f..4b3b3c0 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
@@ -23,10 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if ENABLE(PLUGIN_PROCESS)
-
+#include "config.h"
#include "PluginProcessProxy.h"
+#if ENABLE(PLUGIN_PROCESS)
+
#include "MachPort.h"
#include "PluginProcessCreationParameters.h"
#include "PluginProcessManager.h"
@@ -51,6 +52,9 @@ PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManage
launchOptions.processType = ProcessLauncher::PluginProcess;
#if PLATFORM(MAC)
launchOptions.architecture = pluginInfo.pluginArchitecture;
+
+ // FIXME: This shouldn't be true for all plug-ins.
+ launchOptions.executableHeap = true;
#endif
m_processLauncher = ProcessLauncher::create(this, launchOptions);
@@ -71,8 +75,9 @@ void PluginProcessProxy::createWebProcessConnection(WebProcessProxy* webProcessP
return;
}
- // Ask the plug-in process to create a connection.
- m_connection->send(Messages::PluginProcess::CreateWebProcessConnection(), 0);
+ // Ask the plug-in process to create a connection. Since the plug-in can be waiting for a synchronous reply
+ // we need to make sure that this message is always processed, even when the plug-in is waiting for a synchronus reply.
+ m_connection->send(Messages::PluginProcess::CreateWebProcessConnection(), 0, CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply);
}
void PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch()
@@ -126,7 +131,7 @@ void PluginProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connectio
platformInitializePluginProcess(parameters);
// Initialize the plug-in host process.
- m_connection->send(Messages::PluginProcess::Initialize(parameters), 0);
+ m_connection->send(Messages::PluginProcess::InitializePluginProcess(parameters), 0);
// Send all our pending requests.
for (unsigned i = 0; i < m_numPendingConnectionRequests; ++i)
diff --git a/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp b/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp
index 8a6e86c..f06f0e5 100644
--- a/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp
@@ -24,7 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-
+#include "config.h"
#include "PluginInfoStore.h"
#include "NotImplemented.h"
diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm
index b787101..fb4329e 100644
--- a/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm
+++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm
@@ -23,13 +23,14 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "PluginInfoStore.h"
-
-#include "NetscapePluginModule.h"
-#include "WebKitSystemInterface.h"
-#include <WebCore/WebCoreNSStringExtras.h>
-#include <wtf/HashSet.h>
-#include <wtf/RetainPtr.h>
+#import "config.h"
+#import "PluginInfoStore.h"
+
+#import "NetscapePluginModule.h"
+#import "WebKitSystemInterface.h"
+#import <WebCore/WebCoreNSStringExtras.h>
+#import <wtf/HashSet.h>
+#import <wtf/RetainPtr.h>
using namespace WebCore;
diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
index eaf8aef..2adc473 100644
--- a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
+++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
@@ -23,12 +23,13 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if ENABLE(PLUGIN_PROCESS)
+#import "config.h"
+#import "PluginProcessProxy.h"
-#include "PluginProcessProxy.h"
+#if ENABLE(PLUGIN_PROCESS)
-#include "PluginProcessCreationParameters.h"
-#include "WebKitSystemInterface.h"
+#import "PluginProcessCreationParameters.h"
+#import "WebKitSystemInterface.h"
namespace WebKit {
diff --git a/Source/WebKit2/UIProcess/Plugins/qt/PluginInfoStoreQt.cpp b/Source/WebKit2/UIProcess/Plugins/qt/PluginInfoStoreQt.cpp
index fc77663..4d76467 100644
--- a/Source/WebKit2/UIProcess/Plugins/qt/PluginInfoStoreQt.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/qt/PluginInfoStoreQt.cpp
@@ -25,6 +25,7 @@
// Note: this file is only for UNIX. On other platforms we can reuse the native implementation.
+#include "config.h"
#include "PluginInfoStore.h"
#include "NetscapePluginModule.h"
diff --git a/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp b/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp
index 1e0c251..2138131 100644
--- a/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "PluginInfoStore.h"
#include "NetscapePluginModule.h"
diff --git a/Source/WebKit2/UIProcess/ResponsivenessTimer.cpp b/Source/WebKit2/UIProcess/ResponsivenessTimer.cpp
index da54a7e..903c17a 100644
--- a/Source/WebKit2/UIProcess/ResponsivenessTimer.cpp
+++ b/Source/WebKit2/UIProcess/ResponsivenessTimer.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ResponsivenessTimer.h"
#include "WorkItem.h"
diff --git a/Source/WebKit2/UIProcess/TextChecker.h b/Source/WebKit2/UIProcess/TextChecker.h
index 7415da3..fc347fe 100644
--- a/Source/WebKit2/UIProcess/TextChecker.h
+++ b/Source/WebKit2/UIProcess/TextChecker.h
@@ -30,7 +30,7 @@
namespace WebKit {
-class TextCheckerState;
+struct TextCheckerState;
class TextChecker {
public:
diff --git a/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp b/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp
index b687192..3b3334f 100644
--- a/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp
+++ b/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "TiledDrawingAreaProxy.h"
#if ENABLE(TILED_BACKING_STORE)
@@ -82,7 +83,7 @@ void TiledDrawingAreaProxy::sizeDidChange()
m_isWaitingForDidSetFrameNotification = true;
page->process()->responsivenessTimer()->start();
- page->process()->send(DrawingAreaLegacyMessage::SetSize, page->pageID(), CoreIPC::In(m_size));
+ page->process()->deprecatedSend(DrawingAreaLegacyMessage::SetSize, page->pageID(), CoreIPC::In(m_size));
}
void TiledDrawingAreaProxy::setPageIsVisible(bool isVisible)
@@ -98,12 +99,12 @@ void TiledDrawingAreaProxy::setPageIsVisible(bool isVisible)
if (!m_isVisible) {
// Tell the web process that it doesn't need to paint anything for now.
- page->process()->send(DrawingAreaLegacyMessage::SuspendPainting, page->pageID(), CoreIPC::In());
+ page->process()->deprecatedSend(DrawingAreaLegacyMessage::SuspendPainting, page->pageID(), CoreIPC::In());
return;
}
// The page is now visible.
- page->process()->send(DrawingAreaLegacyMessage::ResumePainting, page->pageID(), CoreIPC::In());
+ page->process()->deprecatedSend(DrawingAreaLegacyMessage::ResumePainting, page->pageID(), CoreIPC::In());
// FIXME: We should request a full repaint here if needed.
}
@@ -114,7 +115,7 @@ void TiledDrawingAreaProxy::didSetSize(const IntSize& viewSize)
m_isWaitingForDidSetFrameNotification = false;
if (viewSize != m_lastSetViewSize)
- setSize(m_lastSetViewSize);
+ setSize(m_lastSetViewSize, IntSize());
WebPageProxy* page = this->page();
page->process()->responsivenessTimer()->stop();
@@ -177,7 +178,7 @@ void TiledDrawingAreaProxy::didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC:
void TiledDrawingAreaProxy::requestTileUpdate(int tileID, const IntRect& dirtyRect)
{
- page()->process()->connection()->send(DrawingAreaLegacyMessage::RequestTileUpdate, page()->pageID(), CoreIPC::In(tileID, dirtyRect, contentsScale()));
+ page()->process()->connection()->deprecatedSend(DrawingAreaLegacyMessage::RequestTileUpdate, page()->pageID(), CoreIPC::In(tileID, dirtyRect, contentsScale()));
}
void TiledDrawingAreaProxy::waitUntilUpdatesComplete()
@@ -188,7 +189,7 @@ void TiledDrawingAreaProxy::waitUntilUpdatesComplete()
float scale;
unsigned pendingUpdateCount;
static const double tileUpdateTimeout = 10.0;
- OwnPtr<CoreIPC::ArgumentDecoder> arguments = page()->process()->connection()->waitFor(DrawingAreaProxyLegacyMessage::TileUpdated, page()->pageID(), tileUpdateTimeout);
+ OwnPtr<CoreIPC::ArgumentDecoder> arguments = page()->process()->connection()->deprecatedWaitFor(DrawingAreaProxyLegacyMessage::TileUpdated, page()->pageID(), tileUpdateTimeout);
if (!arguments)
break;
if (!arguments->decode(CoreIPC::Out(tileID, updateChunk, scale, pendingUpdateCount)))
@@ -232,22 +233,22 @@ void TiledDrawingAreaProxy::setKeepAndCoverAreaMultipliers(const FloatSize& keep
void TiledDrawingAreaProxy::takeSnapshot(const IntSize& size, const IntRect& contentsRect)
{
WebPageProxy* page = this->page();
- page->process()->send(DrawingAreaLegacyMessage::TakeSnapshot, page->pageID(), CoreIPC::Out(size, contentsRect));
+ page->process()->deprecatedSend(DrawingAreaLegacyMessage::TakeSnapshot, page->pageID(), CoreIPC::Out(size, contentsRect));
}
void TiledDrawingAreaProxy::invalidate(const IntRect& contentsDirtyRect)
{
IntRect dirtyRect(mapFromContents(contentsDirtyRect));
- TiledDrawingAreaTile::Coordinate topLeft = tileCoordinateForPoint(dirtyRect.topLeft());
- TiledDrawingAreaTile::Coordinate bottomRight = tileCoordinateForPoint(dirtyRect.bottomRight());
+ TiledDrawingAreaTile::Coordinate topLeft = tileCoordinateForPoint(dirtyRect.location());
+ TiledDrawingAreaTile::Coordinate bottomRight = tileCoordinateForPoint(IntPoint(dirtyRect.maxX(), dirtyRect.maxY()));
IntRect coverRect = calculateCoverRect(m_previousVisibleRect);
Vector<TiledDrawingAreaTile::Coordinate> tilesToRemove;
- for (unsigned yCoordinate = topLeft.y(); yCoordinate <= bottomRight.y(); ++yCoordinate) {
- for (unsigned xCoordinate = topLeft.x(); xCoordinate <= bottomRight.x(); ++xCoordinate) {
+ for (unsigned yCoordinate = topLeft.y(); yCoordinate < bottomRight.y(); ++yCoordinate) {
+ for (unsigned xCoordinate = topLeft.x(); xCoordinate < bottomRight.x(); ++xCoordinate) {
RefPtr<TiledDrawingAreaTile> currentTile = tileAt(TiledDrawingAreaTile::Coordinate(xCoordinate, yCoordinate));
if (!currentTile)
continue;
@@ -337,11 +338,11 @@ bool TiledDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext co
IntRect dirtyRect = mapFromContents(rect);
- TiledDrawingAreaTile::Coordinate topLeft = tileCoordinateForPoint(dirtyRect.topLeft());
- TiledDrawingAreaTile::Coordinate bottomRight = tileCoordinateForPoint(dirtyRect.bottomRight());
+ TiledDrawingAreaTile::Coordinate topLeft = tileCoordinateForPoint(dirtyRect.location());
+ TiledDrawingAreaTile::Coordinate bottomRight = tileCoordinateForPoint(IntPoint(dirtyRect.maxX(), dirtyRect.maxY()));
- for (unsigned yCoordinate = topLeft.y(); yCoordinate <= bottomRight.y(); ++yCoordinate) {
- for (unsigned xCoordinate = topLeft.x(); xCoordinate <= bottomRight.x(); ++xCoordinate) {
+ for (unsigned yCoordinate = topLeft.y(); yCoordinate < bottomRight.y(); ++yCoordinate) {
+ for (unsigned xCoordinate = topLeft.x(); xCoordinate < bottomRight.x(); ++xCoordinate) {
TiledDrawingAreaTile::Coordinate currentCoordinate(xCoordinate, yCoordinate);
RefPtr<TiledDrawingAreaTile> currentTile = tileAt(currentCoordinate);
if (currentTile && currentTile->isReadyToPaint())
@@ -435,10 +436,10 @@ void TiledDrawingAreaProxy::createTiles()
Vector<TiledDrawingAreaTile::Coordinate> tilesToCreate;
unsigned requiredTileCount = 0;
bool hasVisibleCheckers = false;
- TiledDrawingAreaTile::Coordinate topLeft = tileCoordinateForPoint(coverRect.topLeft());
- TiledDrawingAreaTile::Coordinate bottomRight = tileCoordinateForPoint(coverRect.bottomRight());
- for (unsigned yCoordinate = topLeft.y(); yCoordinate <= bottomRight.y(); ++yCoordinate) {
- for (unsigned xCoordinate = topLeft.x(); xCoordinate <= bottomRight.x(); ++xCoordinate) {
+ TiledDrawingAreaTile::Coordinate topLeft = tileCoordinateForPoint(visibleRect.location());
+ TiledDrawingAreaTile::Coordinate bottomRight = tileCoordinateForPoint(IntPoint(visibleRect.maxX(), visibleRect.maxY()));
+ for (unsigned yCoordinate = topLeft.y(); yCoordinate < bottomRight.y(); ++yCoordinate) {
+ for (unsigned xCoordinate = topLeft.x(); xCoordinate < bottomRight.x(); ++xCoordinate) {
TiledDrawingAreaTile::Coordinate currentCoordinate(xCoordinate, yCoordinate);
// Distance is 0 for all currently visible tiles.
double distance = tileDistance(visibleRect, currentCoordinate);
@@ -541,7 +542,7 @@ void TiledDrawingAreaProxy::removeTile(const TiledDrawingAreaTile::Coordinate& c
if (!tile->hasBackBufferUpdatePending())
return;
WebPageProxy* page = this->page();
- page->process()->send(DrawingAreaLegacyMessage::CancelTileUpdate, page->pageID(), CoreIPC::In(tile->ID()));
+ page->process()->deprecatedSend(DrawingAreaLegacyMessage::CancelTileUpdate, page->pageID(), CoreIPC::In(tile->ID()));
}
IntRect TiledDrawingAreaProxy::mapToContents(const IntRect& rect) const
diff --git a/Source/WebKit2/UIProcess/VisitedLinkProvider.cpp b/Source/WebKit2/UIProcess/VisitedLinkProvider.cpp
index 6beafff..94b595a 100644
--- a/Source/WebKit2/UIProcess/VisitedLinkProvider.cpp
+++ b/Source/WebKit2/UIProcess/VisitedLinkProvider.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "VisitedLinkProvider.h"
#include "SharedMemory.h"
diff --git a/Source/WebKit2/UIProcess/WebBackForwardList.cpp b/Source/WebKit2/UIProcess/WebBackForwardList.cpp
index b351418..5c567b5 100644
--- a/Source/WebKit2/UIProcess/WebBackForwardList.cpp
+++ b/Source/WebKit2/UIProcess/WebBackForwardList.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebBackForwardList.h"
#include "WebPageProxy.h"
@@ -30,7 +31,6 @@
namespace WebKit {
static const unsigned DefaultCapacity = 100;
-static const unsigned NoCurrentItemIndex = UINT_MAX;
WebBackForwardList::WebBackForwardList(WebPageProxy* page)
: m_page(page)
@@ -39,6 +39,7 @@ WebBackForwardList::WebBackForwardList(WebPageProxy* page)
, m_closed(true)
, m_enabled(true)
{
+ ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size());
}
WebBackForwardList::~WebBackForwardList()
@@ -58,15 +59,21 @@ void WebBackForwardList::pageClosed()
void WebBackForwardList::addItem(WebBackForwardListItem* newItem)
{
+ ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size());
+
if (m_capacity == 0 || !m_enabled)
return;
+ Vector<RefPtr<APIObject> > removedItems;
+
// Toss anything in the forward list
if (m_current != NoCurrentItemIndex) {
unsigned targetSize = m_current + 1;
+ removedItems.reserveCapacity(m_entries.size() - targetSize);
while (m_entries.size() > targetSize) {
if (m_page)
m_page->backForwardRemovedItem(m_entries.last()->itemID());
+ removedItems.append(m_entries.last().release());
m_entries.removeLast();
}
}
@@ -76,6 +83,7 @@ void WebBackForwardList::addItem(WebBackForwardListItem* newItem)
if (m_entries.size() == m_capacity && (m_current != 0 || m_capacity == 1)) {
if (m_page)
m_page->backForwardRemovedItem(m_entries[0]->itemID());
+ removedItems.append(m_entries[0].release());
m_entries.remove(0);
m_current--;
}
@@ -84,11 +92,15 @@ void WebBackForwardList::addItem(WebBackForwardListItem* newItem)
m_current++;
if (m_page)
- m_page->didChangeBackForwardList();
+ m_page->didChangeBackForwardList(newItem, &removedItems);
+
+ ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size());
}
void WebBackForwardList::goToItem(WebBackForwardListItem* item)
{
+ ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size());
+
if (!m_entries.size() || !item)
return;
@@ -100,12 +112,14 @@ void WebBackForwardList::goToItem(WebBackForwardListItem* item)
if (index < m_entries.size()) {
m_current = index;
if (m_page)
- m_page->didChangeBackForwardList();
+ m_page->didChangeBackForwardList(0, 0);
}
}
WebBackForwardListItem* WebBackForwardList::currentItem()
{
+ ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size());
+
if (m_current != NoCurrentItemIndex)
return m_entries[m_current].get();
return 0;
@@ -113,6 +127,8 @@ WebBackForwardListItem* WebBackForwardList::currentItem()
WebBackForwardListItem* WebBackForwardList::backItem()
{
+ ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size());
+
if (m_current && m_current != NoCurrentItemIndex)
return m_entries[m_current - 1].get();
return 0;
@@ -120,6 +136,8 @@ WebBackForwardListItem* WebBackForwardList::backItem()
WebBackForwardListItem* WebBackForwardList::forwardItem()
{
+ ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size());
+
if (m_entries.size() && m_current < m_entries.size() - 1)
return m_entries[m_current + 1].get();
return 0;
@@ -127,6 +145,8 @@ WebBackForwardListItem* WebBackForwardList::forwardItem()
WebBackForwardListItem* WebBackForwardList::itemAtIndex(int index)
{
+ ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size());
+
// Do range checks without doing math on index to avoid overflow.
if (index < -static_cast<int>(m_current))
return 0;
@@ -139,16 +159,22 @@ WebBackForwardListItem* WebBackForwardList::itemAtIndex(int index)
int WebBackForwardList::backListCount()
{
+ ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size());
+
return m_current == NoCurrentItemIndex ? 0 : m_current;
}
int WebBackForwardList::forwardListCount()
{
+ ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size());
+
return m_current == NoCurrentItemIndex ? 0 : static_cast<int>(m_entries.size()) - (m_current + 1);
}
PassRefPtr<ImmutableArray> WebBackForwardList::backListAsImmutableArrayWithLimit(unsigned limit)
{
+ ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size());
+
unsigned backListSize = static_cast<unsigned>(backListCount());
unsigned size = std::min(backListSize, limit);
if (!size)
@@ -166,6 +192,8 @@ PassRefPtr<ImmutableArray> WebBackForwardList::backListAsImmutableArrayWithLimit
PassRefPtr<ImmutableArray> WebBackForwardList::forwardListAsImmutableArrayWithLimit(unsigned limit)
{
+ ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size());
+
unsigned size = std::min(static_cast<unsigned>(forwardListCount()), limit);
if (!size)
return ImmutableArray::create();
@@ -183,6 +211,8 @@ PassRefPtr<ImmutableArray> WebBackForwardList::forwardListAsImmutableArrayWithLi
void WebBackForwardList::clear()
{
+ ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size());
+
size_t size = m_entries.size();
if (size <= 1)
return;
@@ -196,13 +226,20 @@ void WebBackForwardList::clear()
}
}
+ Vector<RefPtr<APIObject> > removedItems;
+ removedItems.reserveCapacity(m_entries.size() - 1);
+ for (size_t i = 0; i < m_entries.size(); ++i) {
+ if (i != m_current)
+ removedItems.append(m_entries[i].release());
+ }
+
m_entries.shrink(1);
m_entries[0] = currentItem.release();
m_current = 0;
if (m_page)
- m_page->didChangeBackForwardList();
+ m_page->didChangeBackForwardList(0, &removedItems);
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebBackForwardList.h b/Source/WebKit2/UIProcess/WebBackForwardList.h
index f51ab26..3376771 100644
--- a/Source/WebKit2/UIProcess/WebBackForwardList.h
+++ b/Source/WebKit2/UIProcess/WebBackForwardList.h
@@ -83,6 +83,8 @@ public:
#endif
private:
+ static const unsigned NoCurrentItemIndex = UINT_MAX;
+
WebBackForwardList(WebPageProxy*);
virtual Type type() const { return APIType; }
diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp
index 1bb6bc4..5411a36 100644
--- a/Source/WebKit2/UIProcess/WebContext.cpp
+++ b/Source/WebKit2/UIProcess/WebContext.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebContext.h"
#include "DownloadProxy.h"
@@ -51,6 +52,8 @@
#include <wtf/RefCountedLeakCounter.h>
#endif
+#define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, process()->connection())
+
using namespace WebCore;
namespace WebKit {
@@ -176,6 +179,7 @@ void WebContext::ensureWebProcess()
parameters.cacheModel = m_cacheModel;
parameters.languageCode = defaultLanguage();
parameters.applicationCacheDirectory = applicationCacheDirectory();
+ parameters.databaseDirectory = databaseDirectory();
parameters.clearResourceCaches = m_clearResourceCachesForNewWebProcess;
parameters.clearApplicationCache = m_clearApplicationCacheForNewWebProcess;
#if PLATFORM(MAC)
@@ -200,7 +204,7 @@ void WebContext::ensureWebProcess()
for (size_t i = 0; i != m_pendingMessagesToPostToInjectedBundle.size(); ++i) {
pair<String, RefPtr<APIObject> >& message = m_pendingMessagesToPostToInjectedBundle[i];
- m_process->send(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(message.first, WebContextUserMessageEncoder(message.second.get())));
+ m_process->deprecatedSend(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(message.first, WebContextUserMessageEncoder(message.second.get())));
}
m_pendingMessagesToPostToInjectedBundle.clear();
}
@@ -277,7 +281,7 @@ void WebContext::postMessageToInjectedBundle(const String& messageName, APIObjec
// FIXME: We should consider returning false from this function if the messageBody cannot
// be encoded.
- m_process->send(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(messageName, WebContextUserMessageEncoder(messageBody)));
+ m_process->deprecatedSend(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(messageName, WebContextUserMessageEncoder(messageBody)));
}
// InjectedBundle client
@@ -297,6 +301,7 @@ void WebContext::didReceiveSynchronousMessageFromInjectedBundle(const String& me
void WebContext::didNavigateWithNavigationData(uint64_t pageID, const WebNavigationDataStore& store, uint64_t frameID)
{
WebFrameProxy* frame = m_process->webFrame(frameID);
+ MESSAGE_CHECK(frame);
if (!frame->page())
return;
@@ -306,6 +311,7 @@ void WebContext::didNavigateWithNavigationData(uint64_t pageID, const WebNavigat
void WebContext::didPerformClientRedirect(uint64_t pageID, const String& sourceURLString, const String& destinationURLString, uint64_t frameID)
{
WebFrameProxy* frame = m_process->webFrame(frameID);
+ MESSAGE_CHECK(frame);
if (!frame->page())
return;
@@ -315,6 +321,7 @@ void WebContext::didPerformClientRedirect(uint64_t pageID, const String& sourceU
void WebContext::didPerformServerRedirect(uint64_t pageID, const String& sourceURLString, const String& destinationURLString, uint64_t frameID)
{
WebFrameProxy* frame = m_process->webFrame(frameID);
+ MESSAGE_CHECK(frame);
if (!frame->page())
return;
@@ -324,6 +331,7 @@ void WebContext::didPerformServerRedirect(uint64_t pageID, const String& sourceU
void WebContext::didUpdateHistoryTitle(uint64_t pageID, const String& title, const String& url, uint64_t frameID)
{
WebFrameProxy* frame = m_process->webFrame(frameID);
+ MESSAGE_CHECK(frame);
if (!frame->page())
return;
@@ -602,4 +610,12 @@ void WebContext::stopMemorySampler()
m_process->send(Messages::WebProcess::StopMemorySampler(), 0);
}
+String WebContext::databaseDirectory() const
+{
+ if (!m_overrideDatabaseDirectory.isEmpty())
+ return m_overrideDatabaseDirectory;
+
+ return platformDefaultDatabaseDirectory();
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebContext.h b/Source/WebKit2/UIProcess/WebContext.h
index e973160..ebf1914 100644
--- a/Source/WebKit2/UIProcess/WebContext.h
+++ b/Source/WebKit2/UIProcess/WebContext.h
@@ -137,6 +137,8 @@ public:
};
static Statistics& statistics();
+ void setDatabaseDirectory(const String& dir) { m_overrideDatabaseDirectory = dir; }
+
private:
WebContext(ProcessModel, const String& injectedBundlePath);
@@ -162,6 +164,9 @@ private:
static void languageChanged(void* context);
void languageChanged();
+ String databaseDirectory() const;
+ String platformDefaultDatabaseDirectory() const;
+
ProcessModel m_processModel;
// FIXME: In the future, this should be one or more WebProcessProxies.
@@ -203,6 +208,8 @@ private:
#if PLATFORM(WIN)
bool m_shouldPaintNativeControls;
#endif
+
+ String m_overrideDatabaseDirectory;
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp b/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp
index 97613f8..24e6271 100644
--- a/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp
+++ b/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebContextInjectedBundleClient.h"
#include "WKAPICast.h"
diff --git a/Source/WebKit2/UIProcess/WebContextMenuProxy.cpp b/Source/WebKit2/UIProcess/WebContextMenuProxy.cpp
index 887a260..4c4cb26 100644
--- a/Source/WebKit2/UIProcess/WebContextMenuProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebContextMenuProxy.cpp
@@ -22,6 +22,8 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+
+#include "config.h"
#include "WebContextMenuProxy.h"
namespace WebKit {
diff --git a/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp
index 1bc0303..96488fb 100644
--- a/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebDatabaseManagerProxy.h"
#include "ImmutableArray.h"
diff --git a/Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.cpp b/Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.cpp
index 8ba3a0e..2f3c767 100644
--- a/Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.cpp
+++ b/Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebDatabaseManagerProxyClient.h"
#include "WKAPICast.h"
diff --git a/Source/WebKit2/UIProcess/WebDownloadClient.cpp b/Source/WebKit2/UIProcess/WebDownloadClient.cpp
index d6a7bcb..4b1b756 100644
--- a/Source/WebKit2/UIProcess/WebDownloadClient.cpp
+++ b/Source/WebKit2/UIProcess/WebDownloadClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebDownloadClient.h"
#include "WKAPICast.h"
diff --git a/Source/WebKit2/UIProcess/WebEditCommandProxy.cpp b/Source/WebKit2/UIProcess/WebEditCommandProxy.cpp
index 9a816e3..568faa1 100644
--- a/Source/WebKit2/UIProcess/WebEditCommandProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebEditCommandProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebEditCommandProxy.h"
#include "WebPageMessages.h"
diff --git a/Source/WebKit2/UIProcess/WebFindClient.cpp b/Source/WebKit2/UIProcess/WebFindClient.cpp
index e2e8de5..c8df91d 100644
--- a/Source/WebKit2/UIProcess/WebFindClient.cpp
+++ b/Source/WebKit2/UIProcess/WebFindClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebFindClient.h"
#include "WKAPICast.h"
#include <wtf/text/WTFString.h>
diff --git a/Source/WebKit2/UIProcess/WebFormClient.cpp b/Source/WebKit2/UIProcess/WebFormClient.cpp
index 159a34c..ecddbcc 100644
--- a/Source/WebKit2/UIProcess/WebFormClient.cpp
+++ b/Source/WebKit2/UIProcess/WebFormClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebFormClient.h"
#include "ImmutableDictionary.h"
diff --git a/Source/WebKit2/UIProcess/WebFormSubmissionListenerProxy.cpp b/Source/WebKit2/UIProcess/WebFormSubmissionListenerProxy.cpp
index 10564a4..dcc864a 100644
--- a/Source/WebKit2/UIProcess/WebFormSubmissionListenerProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebFormSubmissionListenerProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebFormSubmissionListenerProxy.h"
namespace WebKit {
diff --git a/Source/WebKit2/UIProcess/WebFrameListenerProxy.cpp b/Source/WebKit2/UIProcess/WebFrameListenerProxy.cpp
index c4e38ee..b998f58 100644
--- a/Source/WebKit2/UIProcess/WebFrameListenerProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebFrameListenerProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebFrameListenerProxy.h"
#include "WebFrameProxy.h"
diff --git a/Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.cpp b/Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.cpp
index 865d352..5764533 100644
--- a/Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebFramePolicyListenerProxy.h"
#include "WebFrameProxy.h"
diff --git a/Source/WebKit2/UIProcess/WebFrameProxy.cpp b/Source/WebKit2/UIProcess/WebFrameProxy.cpp
index 779cf61..2df22c6 100644
--- a/Source/WebKit2/UIProcess/WebFrameProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebFrameProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebFrameProxy.h"
#include "WebCertificateInfo.h"
@@ -137,16 +138,13 @@ void WebFrameProxy::didStartProvisionalLoad(const String& url)
void WebFrameProxy::didReceiveServerRedirectForProvisionalLoad(const String& url)
{
- ASSERT(!url.isEmpty());
ASSERT(m_loadState == LoadStateProvisional);
- ASSERT(!m_provisionalURL.isEmpty());
m_provisionalURL = url;
}
void WebFrameProxy::didFailProvisionalLoad()
{
ASSERT(m_loadState == LoadStateProvisional);
- ASSERT(!m_provisionalURL.isEmpty());
m_loadState = LoadStateFinished;
m_provisionalURL = String();
}
@@ -174,7 +172,6 @@ void WebFrameProxy::didFailLoad()
{
ASSERT(m_loadState == LoadStateCommitted);
ASSERT(m_provisionalURL.isEmpty());
- ASSERT(!m_url.isEmpty());
m_loadState = LoadStateFinished;
m_title = String();
}
diff --git a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp
index 0842ca6..eae4935 100644
--- a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebGeolocationManagerProxy.h"
#include "WebContext.h"
diff --git a/Source/WebKit2/UIProcess/WebGeolocationProvider.cpp b/Source/WebKit2/UIProcess/WebGeolocationProvider.cpp
index c48ee89..c382235 100644
--- a/Source/WebKit2/UIProcess/WebGeolocationProvider.cpp
+++ b/Source/WebKit2/UIProcess/WebGeolocationProvider.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebGeolocationProvider.h"
#include "WKAPICast.h"
diff --git a/Source/WebKit2/UIProcess/WebHistoryClient.cpp b/Source/WebKit2/UIProcess/WebHistoryClient.cpp
index d0ca71b..ca6cf94 100644
--- a/Source/WebKit2/UIProcess/WebHistoryClient.cpp
+++ b/Source/WebKit2/UIProcess/WebHistoryClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebHistoryClient.h"
#include "WKAPICast.h"
diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp
index dfeff6a..2b282a1 100644
--- a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebInspectorProxy.h"
#if ENABLE(INSPECTOR)
@@ -69,6 +70,7 @@ WebInspectorProxy::~WebInspectorProxy()
void WebInspectorProxy::invalidate()
{
+ m_page->close();
platformClose();
m_page = 0;
@@ -156,6 +158,11 @@ void WebInspectorProxy::togglePageProfiling()
m_isProfilingPage = !m_isProfilingPage;
}
+bool WebInspectorProxy::isInspectorPage(WebPageProxy* page)
+{
+ return page->pageGroup() == inspectorPageGroup();
+}
+
// Called by WebInspectorProxy messages
void WebInspectorProxy::createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters& inspectorPageParameters)
{
diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.h b/Source/WebKit2/UIProcess/WebInspectorProxy.h
index cc0725a..ac618c6 100644
--- a/Source/WebKit2/UIProcess/WebInspectorProxy.h
+++ b/Source/WebKit2/UIProcess/WebInspectorProxy.h
@@ -36,15 +36,10 @@
#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
-#ifdef __OBJC__
-@class NSWindow;
-@class WKView;
-@class WebInspectorProxyObjCAdapter;
-#else
-class NSWindow;
-class WKView;
-class WebInspectorProxyObjCAdapter;
-#endif
+
+OBJC_CLASS NSWindow;
+OBJC_CLASS WKView;
+OBJC_CLASS WebInspectorProxyObjCAdapter;
#endif
namespace WebKit {
@@ -98,6 +93,8 @@ public:
CoreIPC::SyncReplyMode didReceiveSyncWebInspectorProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
#endif
+ static bool isInspectorPage(WebPageProxy*);
+
private:
WebInspectorProxy(WebPageProxy* page);
diff --git a/Source/WebKit2/UIProcess/WebLoaderClient.cpp b/Source/WebKit2/UIProcess/WebLoaderClient.cpp
index 0b14a17..96adb85 100644
--- a/Source/WebKit2/UIProcess/WebLoaderClient.cpp
+++ b/Source/WebKit2/UIProcess/WebLoaderClient.cpp
@@ -23,8 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebLoaderClient.h"
+#include "ImmutableArray.h"
+#include "WebBackForwardListItem.h"
#include "WKAPICast.h"
#include <string.h>
@@ -208,12 +211,16 @@ void WebLoaderClient::processDidCrash(WebPageProxy* page)
m_client.processDidCrash(toAPI(page), m_client.clientInfo);
}
-void WebLoaderClient::didChangeBackForwardList(WebPageProxy* page)
+void WebLoaderClient::didChangeBackForwardList(WebPageProxy* page, WebBackForwardListItem* addedItem, Vector<RefPtr<APIObject> >* removedItems)
{
if (!m_client.didChangeBackForwardList)
return;
- m_client.didChangeBackForwardList(toAPI(page), m_client.clientInfo);
+ RefPtr<ImmutableArray> removedItemsArray;
+ if (removedItems && !removedItems->isEmpty())
+ removedItemsArray = ImmutableArray::adopt(*removedItems);
+
+ m_client.didChangeBackForwardList(toAPI(page), toAPI(addedItem), toAPI(removedItemsArray.get()), m_client.clientInfo);
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebLoaderClient.h b/Source/WebKit2/UIProcess/WebLoaderClient.h
index 0c250fe..6600876 100644
--- a/Source/WebKit2/UIProcess/WebLoaderClient.h
+++ b/Source/WebKit2/UIProcess/WebLoaderClient.h
@@ -30,6 +30,8 @@
#include "SameDocumentNavigationType.h"
#include "WKPage.h"
#include <wtf/Forward.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
namespace WebCore {
class ResourceError;
@@ -40,6 +42,7 @@ namespace WebKit {
class APIObject;
class AuthenticationChallengeProxy;
class AuthenticationDecisionListener;
+class WebBackForwardListItem;
class WebFrameProxy;
class WebPageProxy;
class WebProtectionSpace;
@@ -73,7 +76,7 @@ public:
void processDidBecomeResponsive(WebPageProxy*);
void processDidCrash(WebPageProxy*);
- void didChangeBackForwardList(WebPageProxy*);
+ void didChangeBackForwardList(WebPageProxy*, WebBackForwardListItem* addedItem, Vector<RefPtr<APIObject> >* removedItems);
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebNavigationData.cpp b/Source/WebKit2/UIProcess/WebNavigationData.cpp
index c4f17f3..eefc7d0 100644
--- a/Source/WebKit2/UIProcess/WebNavigationData.cpp
+++ b/Source/WebKit2/UIProcess/WebNavigationData.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebNavigationData.h"
namespace WebKit {
diff --git a/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.cpp b/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.cpp
index de2d174..288a736 100644
--- a/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebOpenPanelResultListenerProxy.h"
#include "ImmutableArray.h"
diff --git a/Source/WebKit2/UIProcess/WebPageContextMenuClient.cpp b/Source/WebKit2/UIProcess/WebPageContextMenuClient.cpp
index 73220b2..480a56e 100644
--- a/Source/WebKit2/UIProcess/WebPageContextMenuClient.cpp
+++ b/Source/WebKit2/UIProcess/WebPageContextMenuClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPageContextMenuClient.h"
#include "Logging.h"
diff --git a/Source/WebKit2/UIProcess/WebPageGroup.cpp b/Source/WebKit2/UIProcess/WebPageGroup.cpp
index 901b393..aa4cfb7 100644
--- a/Source/WebKit2/UIProcess/WebPageGroup.cpp
+++ b/Source/WebKit2/UIProcess/WebPageGroup.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPageGroup.h"
#include "WebPageProxy.h"
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp
index 0be2f11..2582547 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPageProxy.h"
#include "AuthenticationChallengeProxy.h"
@@ -65,6 +66,13 @@
#include "WebProtectionSpace.h"
#include "WebSecurityOrigin.h"
#include "WebURLRequest.h"
+#if PLATFORM(WIN)
+#include "WebDragSource.h"
+#include <WebCore/BitmapInfo.h>
+#include <WebCore/COMPtr.h>
+#include <WebCore/WCDataObject.h>
+#include <shlobj.h>
+#endif
#include <WebCore/DragData.h>
#include <WebCore/FloatRect.h>
#include <WebCore/MIMETypeRegistry.h>
@@ -113,10 +121,14 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, WebContext* context, WebPageG
, m_isValid(true)
, m_isClosed(false)
, m_isInPrintingMode(false)
+ , m_isPerformingDOMPrintOperation(false)
, m_inDecidePolicyForMIMEType(false)
, m_syncMimeTypePolicyActionIsValid(false)
, m_syncMimeTypePolicyAction(PolicyUse)
, m_syncMimeTypePolicyDownloadID(0)
+ , m_inDecidePolicyForNavigationAction(false)
+ , m_syncNavigationActionPolicyActionIsValid(false)
+ , m_syncNavigationActionPolicyAction(PolicyUse)
, m_processingWheelEvent(false)
, m_processingMouseMoveEvent(false)
, m_pageID(pageID)
@@ -128,6 +140,8 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, WebContext* context, WebPageG
, m_pendingLearnOrIgnoreWordMessageCount(0)
, m_mainFrameHasCustomRepresentation(false)
, m_currentDragOperation(DragOperationNone)
+ , m_mainFrameHasHorizontalScrollbar(false)
+ , m_mainFrameHasVerticalScrollbar(false)
{
#ifndef NDEBUG
webPageProxyCounter.increment();
@@ -227,9 +241,13 @@ void WebPageProxy::reattachToWebProcessWithItem(WebBackForwardListItem* item)
m_backForwardList->goToItem(item);
reattachToWebProcess();
-
- if (item)
- process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
+
+ if (!item)
+ return;
+
+ SandboxExtension::Handle sandboxExtensionHandle;
+ initializeSandboxExtensionHandle(KURL(KURL(), item->url()), sandboxExtensionHandle);
+ process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID(), sandboxExtensionHandle), m_pageID);
}
void WebPageProxy::initializeWebPage()
@@ -254,6 +272,7 @@ void WebPageProxy::close()
m_isClosed = true;
m_backForwardList->pageClosed();
+ m_pageClient->pageClosed();
process()->disconnectFramesFromPage(this);
m_mainFrame = 0;
@@ -274,8 +293,13 @@ void WebPageProxy::close()
m_toolTip = String();
+ m_mainFrameHasHorizontalScrollbar = false;
+ m_mainFrameHasVerticalScrollbar = false;
+
+ invalidateCallbackMap(m_voidCallbacks);
invalidateCallbackMap(m_dataCallbacks);
invalidateCallbackMap(m_stringCallbacks);
+ invalidateCallbackMap(m_computedPagesCallbacks);
Vector<WebEditCommandProxy*> editCommandVector;
copyToVector(m_editCommandSet, editCommandVector);
@@ -306,16 +330,22 @@ bool WebPageProxy::tryClose()
return false;
}
-static void initializeSandboxExtensionHandle(const KURL& url, SandboxExtension::Handle& sandboxExtensionHandle)
+void WebPageProxy::initializeSandboxExtensionHandle(const KURL& url, SandboxExtension::Handle& sandboxExtensionHandle)
{
if (!url.isLocalFile())
return;
+ // Don't give the inspector full access to the file system.
+ if (WebInspectorProxy::isInspectorPage(this))
+ return;
+
SandboxExtension::createHandle("/", SandboxExtension::ReadOnly, sandboxExtensionHandle);
}
void WebPageProxy::loadURL(const String& url)
{
+ setPendingAPIRequestURL(url);
+
if (!isValid())
reattachToWebProcess();
@@ -326,6 +356,8 @@ void WebPageProxy::loadURL(const String& url)
void WebPageProxy::loadURLRequest(WebURLRequest* urlRequest)
{
+ setPendingAPIRequestURL(urlRequest->resourceRequest().url());
+
if (!isValid())
reattachToWebProcess();
@@ -369,6 +401,9 @@ void WebPageProxy::stopLoading()
void WebPageProxy::reload(bool reloadFromOrigin)
{
+ if (m_backForwardList->currentItem())
+ setPendingAPIRequestURL(m_backForwardList->currentItem()->url());
+
if (!isValid()) {
reattachToWebProcessWithItem(m_backForwardList->currentItem());
return;
@@ -379,15 +414,21 @@ void WebPageProxy::reload(bool reloadFromOrigin)
void WebPageProxy::goForward()
{
- if (!isValid()) {
- reattachToWebProcessWithItem(m_backForwardList->forwardItem());
+ if (isValid() && !canGoForward())
return;
- }
- if (!canGoForward())
+ WebBackForwardListItem* forwardItem = m_backForwardList->forwardItem();
+ if (forwardItem)
+ setPendingAPIRequestURL(forwardItem->url());
+
+ if (!isValid()) {
+ reattachToWebProcessWithItem(forwardItem);
return;
+ }
- process()->send(Messages::WebPage::GoForward(m_backForwardList->forwardItem()->itemID()), m_pageID);
+ SandboxExtension::Handle sandboxExtensionHandle;
+ initializeSandboxExtensionHandle(KURL(KURL(), forwardItem->url()), sandboxExtensionHandle);
+ process()->send(Messages::WebPage::GoForward(forwardItem->itemID(), sandboxExtensionHandle), m_pageID);
}
bool WebPageProxy::canGoForward() const
@@ -397,15 +438,21 @@ bool WebPageProxy::canGoForward() const
void WebPageProxy::goBack()
{
- if (!isValid()) {
- reattachToWebProcessWithItem(m_backForwardList->backItem());
+ if (isValid() && !canGoBack())
return;
- }
- if (!canGoBack())
+ WebBackForwardListItem* backItem = m_backForwardList->backItem();
+ if (backItem)
+ setPendingAPIRequestURL(backItem->url());
+
+ if (!isValid()) {
+ reattachToWebProcessWithItem(backItem);
return;
+ }
- process()->send(Messages::WebPage::GoBack(m_backForwardList->backItem()->itemID()), m_pageID);
+ SandboxExtension::Handle sandboxExtensionHandle;
+ initializeSandboxExtensionHandle(KURL(KURL(), backItem->url()), sandboxExtensionHandle);
+ process()->send(Messages::WebPage::GoBack(backItem->itemID(), sandboxExtensionHandle), m_pageID);
}
bool WebPageProxy::canGoBack() const
@@ -420,12 +467,14 @@ void WebPageProxy::goToBackForwardItem(WebBackForwardListItem* item)
return;
}
- process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
+ SandboxExtension::Handle sandboxExtensionHandle;
+ initializeSandboxExtensionHandle(KURL(KURL(), item->url()), sandboxExtensionHandle);
+ process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID(), sandboxExtensionHandle), m_pageID);
}
-void WebPageProxy::didChangeBackForwardList()
+void WebPageProxy::didChangeBackForwardList(WebBackForwardListItem* added, Vector<RefPtr<APIObject> >* removed)
{
- m_loaderClient.didChangeBackForwardList(this);
+ m_loaderClient.didChangeBackForwardList(this, added, removed);
}
@@ -467,6 +516,16 @@ void WebPageProxy::setDrawsTransparentBackground(bool drawsTransparentBackground
process()->send(Messages::WebPage::SetDrawsTransparentBackground(drawsTransparentBackground), m_pageID);
}
+void WebPageProxy::viewWillStartLiveResize()
+{
+ process()->send(Messages::WebPage::ViewWillStartLiveResize(), m_pageID);
+}
+
+void WebPageProxy::viewWillEndLiveResize()
+{
+ process()->send(Messages::WebPage::ViewWillEndLiveResize(), m_pageID);
+}
+
void WebPageProxy::setViewNeedsDisplay(const IntRect& rect)
{
m_pageClient->setViewNeedsDisplay(rect);
@@ -609,7 +668,13 @@ void WebPageProxy::performDragControllerAction(DragControllerAction action, WebC
{
if (!isValid())
return;
+#if PLATFORM(WIN)
+ // FIXME: We should pass the drag data map only on DragEnter.
+ process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(),
+ dragData->draggingSourceOperationMask(), dragData->dragDataMap(), dragData->flags()), m_pageID);
+#else
process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(), dragData->draggingSourceOperationMask(), dragStorageName, dragData->flags()), m_pageID);
+#endif
}
void WebPageProxy::didPerformDragControllerAction(uint64_t resultOperation)
@@ -628,6 +693,63 @@ void WebPageProxy::setDragImage(const WebCore::IntPoint& clientPosition, const I
}
#endif
+#if PLATFORM(WIN)
+
+void WebPageProxy::startDragDrop(const IntPoint& imageOrigin, const IntPoint& dragPoint, uint64_t okEffect,
+ const HashMap<UINT, Vector<String> >& dataMap, const IntSize& dragImageSize, const SharedMemory::Handle& dragImageHandle, bool isLinkDrag)
+{
+ COMPtr<WCDataObject> dataObject;
+ WCDataObject::createInstance(&dataObject, dataMap);
+
+ RefPtr<SharedMemory> memoryBuffer = SharedMemory::create(dragImageHandle, SharedMemory::ReadOnly);
+ if (!memoryBuffer)
+ return;
+
+ RefPtr<WebDragSource> source = WebDragSource::createInstance();
+ if (!source)
+ return;
+
+ COMPtr<IDragSourceHelper> helper;
+ if (FAILED(::CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER, IID_IDragSourceHelper, reinterpret_cast<LPVOID*>(&helper))))
+ return;
+
+ BitmapInfo bitmapInfo = BitmapInfo::create(dragImageSize);
+ void* bits;
+ OwnPtr<HBITMAP> hbmp(::CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, &bits, 0, 0));
+ memcpy(bits, memoryBuffer->data(), memoryBuffer->size());
+
+ SHDRAGIMAGE sdi;
+ sdi.sizeDragImage.cx = bitmapInfo.bmiHeader.biWidth;
+ sdi.sizeDragImage.cy = bitmapInfo.bmiHeader.biHeight;
+ sdi.crColorKey = 0xffffffff;
+ sdi.hbmpDragImage = hbmp.leakPtr();
+ sdi.ptOffset.x = dragPoint.x() - imageOrigin.x();
+ sdi.ptOffset.y = dragPoint.y() - imageOrigin.y();
+ if (isLinkDrag)
+ sdi.ptOffset.y = bitmapInfo.bmiHeader.biHeight - sdi.ptOffset.y;
+
+ helper->InitializeFromBitmap(&sdi, dataObject.get());
+
+ DWORD effect = DROPEFFECT_NONE;
+
+ DragOperation operation = DragOperationNone;
+ if (::DoDragDrop(dataObject.get(), source.get(), okEffect, &effect) == DRAGDROP_S_DROP) {
+ if (effect & DROPEFFECT_COPY)
+ operation = DragOperationCopy;
+ else if (effect & DROPEFFECT_LINK)
+ operation = DragOperationLink;
+ else if (effect & DROPEFFECT_MOVE)
+ operation = DragOperationMove;
+ }
+ POINT globalPoint;
+ ::GetCursorPos(&globalPoint);
+ POINT localPoint = globalPoint;
+ ::ScreenToClient(m_pageClient->nativeWindow(), &localPoint);
+
+ dragEnded(localPoint, globalPoint, operation);
+}
+#endif
+
void WebPageProxy::dragEnded(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t operation)
{
if (!isValid())
@@ -701,6 +823,17 @@ void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event)
process()->send(Messages::WebPage::KeyEvent(event), m_pageID);
}
+#if ENABLE(GESTURE_EVENTS)
+void WebPageProxy::handleGestureEvent(const WebGestureEvent& event)
+{
+ if (!isValid())
+ return;
+
+ process()->responsivenessTimer()->start();
+ process()->send(Messages::WebPage::GestureEvent(event), m_pageID);
+}
+#endif
+
#if ENABLE(TOUCH_EVENTS)
void WebPageProxy::handleTouchEvent(const WebTouchEvent& event)
{
@@ -730,6 +863,14 @@ void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* fr
return;
}
+ // If we received a policy decision while in decidePolicyForNavigationAction the decision will
+ // be sent back to the web process by decidePolicyForNavigationAction.
+ if (m_inDecidePolicyForNavigationAction) {
+ m_syncNavigationActionPolicyActionIsValid = true;
+ m_syncNavigationActionPolicyAction = action;
+ return;
+ }
+
process()->send(Messages::WebPage::DidReceivePolicyDecision(frame->frameID(), listenerID, action, downloadID), m_pageID);
}
@@ -890,10 +1031,6 @@ void WebPageProxy::scaleWebView(double scale, const IntPoint& origin)
if (!isValid())
return;
- if (m_viewScaleFactor == scale)
- return;
-
- m_viewScaleFactor = scale;
process()->send(Messages::WebPage::ScaleWebView(scale, origin), m_pageID);
}
@@ -923,6 +1060,11 @@ void WebPageProxy::setFixedLayoutSize(const IntSize& size)
process()->send(Messages::WebPage::SetFixedLayoutSize(size), m_pageID);
}
+void WebPageProxy::viewScaleFactorDidChange(double scaleFactor)
+{
+ m_viewScaleFactor = scaleFactor;
+}
+
void WebPageProxy::findString(const String& string, FindOptions options, unsigned maxMatchCount)
{
process()->send(Messages::WebPage::FindString(string, options, maxMatchCount), m_pageID);
@@ -1002,6 +1144,20 @@ void WebPageProxy::getWebArchiveOfFrame(WebFrameProxy* frame, PassRefPtr<DataCal
process()->send(Messages::WebPage::GetWebArchiveOfFrame(frame->frameID(), callbackID), m_pageID);
}
+void WebPageProxy::forceRepaint(PassRefPtr<VoidCallback> prpCallback)
+{
+ RefPtr<VoidCallback> callback = prpCallback;
+
+ if (!isValid()) {
+ callback->invalidate();
+ return;
+ }
+
+ uint64_t callbackID = callback->callbackID();
+ m_voidCallbacks.set(callbackID, callback.get());
+ process()->send(Messages::WebPage::ForceRepaint(callbackID), m_pageID);
+}
+
void WebPageProxy::preferencesDidChange()
{
if (!isValid())
@@ -1022,7 +1178,7 @@ void WebPageProxy::setResizesToContentsUsingLayoutSize(const WebCore::IntSize& t
void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
{
-#ifdef __APPLE__
+#if PLATFORM(MAC) || PLATFORM(WIN)
if (messageID.is<CoreIPC::MessageClassDrawingAreaProxy>()) {
m_drawingArea->didReceiveDrawingAreaProxyMessage(connection, messageID, arguments);
return;
@@ -1138,17 +1294,30 @@ void WebPageProxy::didRestoreFrameFromPageCache(uint64_t frameID, uint64_t paren
parentFrame->appendChild(subframe);
}
+
+// Always start progress at initialProgressValue. This helps provide feedback as
+// soon as a load starts.
+
+static const double initialProgressValue = 0.1;
+
+double WebPageProxy::estimatedProgress() const
+{
+ if (!pendingAPIRequestURL().isNull())
+ return initialProgressValue;
+ return m_estimatedProgress;
+}
+
void WebPageProxy::didStartProgress()
{
- m_estimatedProgress = 0.0;
-
+ m_estimatedProgress = initialProgressValue;
+
m_loaderClient.didStartProgress(this);
}
void WebPageProxy::didChangeProgress(double value)
{
m_estimatedProgress = value;
-
+
m_loaderClient.didChangeProgress(this);
}
@@ -1161,6 +1330,8 @@ void WebPageProxy::didFinishProgress()
void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const String& url, bool loadingSubstituteDataForUnreachableURL, CoreIPC::ArgumentDecoder* arguments)
{
+ clearPendingAPIRequestURL();
+
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
if (!arguments->decode(messageDecoder))
@@ -1366,13 +1537,6 @@ void WebPageProxy::didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::Argu
m_loaderClient.didRunInsecureContentForFrame(this, frame, userData.get());
}
-void WebPageProxy::didReceiveAccessibilityPageToken(const CoreIPC::DataReference& data)
-{
-#if PLATFORM(MAC)
- m_pageClient->accessibilityChildTokenReceived(data);
-#endif
-}
-
void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value)
{
WebFrameProxy* frame = process()->webFrame(frameID);
@@ -1384,9 +1548,16 @@ void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value)
}
// PolicyClient
-
-void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, uint32_t opaqueNavigationType, uint32_t opaqueModifiers, int32_t opaqueMouseButton, const String& url, uint64_t listenerID)
+void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, uint32_t opaqueNavigationType, uint32_t opaqueModifiers, int32_t opaqueMouseButton, const ResourceRequest& request, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction)
{
+ RefPtr<APIObject> userData;
+ WebContextUserMessageDecoder messageDecoder(userData, context());
+ if (!arguments->decode(messageDecoder))
+ return;
+
+ if (request.url() != pendingAPIRequestURL())
+ clearPendingAPIRequestURL();
+
WebFrameProxy* frame = process()->webFrame(frameID);
MESSAGE_CHECK(frame);
@@ -1395,12 +1566,31 @@ void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, uint32_t op
WebMouseEvent::Button mouseButton = static_cast<WebMouseEvent::Button>(opaqueMouseButton);
RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
- if (!m_policyClient.decidePolicyForNavigationAction(this, navigationType, modifiers, mouseButton, url, frame, listener.get()))
+
+ ASSERT(!m_inDecidePolicyForNavigationAction);
+
+ m_inDecidePolicyForNavigationAction = true;
+ m_syncNavigationActionPolicyActionIsValid = false;
+
+ if (!m_policyClient.decidePolicyForNavigationAction(this, frame, navigationType, modifiers, mouseButton, request, listener.get(), userData.get()))
listener->use();
+
+ m_inDecidePolicyForNavigationAction = false;
+
+ // Check if we received a policy decision already. If we did, we can just pass it back.
+ if (m_syncNavigationActionPolicyActionIsValid) {
+ receivedPolicyAction = true;
+ policyAction = m_syncNavigationActionPolicyAction;
+ }
}
-void WebPageProxy::decidePolicyForNewWindowAction(uint64_t frameID, uint32_t opaqueNavigationType, uint32_t opaqueModifiers, int32_t opaqueMouseButton, const String& url, uint64_t listenerID)
+void WebPageProxy::decidePolicyForNewWindowAction(uint64_t frameID, uint32_t opaqueNavigationType, uint32_t opaqueModifiers, int32_t opaqueMouseButton, const ResourceRequest& request, const String& frameName, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
{
+ RefPtr<APIObject> userData;
+ WebContextUserMessageDecoder messageDecoder(userData, context());
+ if (!arguments->decode(messageDecoder))
+ return;
+
WebFrameProxy* frame = process()->webFrame(frameID);
MESSAGE_CHECK(frame);
@@ -1409,12 +1599,17 @@ void WebPageProxy::decidePolicyForNewWindowAction(uint64_t frameID, uint32_t opa
WebMouseEvent::Button mouseButton = static_cast<WebMouseEvent::Button>(opaqueMouseButton);
RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
- if (!m_policyClient.decidePolicyForNewWindowAction(this, navigationType, modifiers, mouseButton, url, frame, listener.get()))
+ if (!m_policyClient.decidePolicyForNewWindowAction(this, frame, navigationType, modifiers, mouseButton, request, frameName, listener.get(), userData.get()))
listener->use();
}
-void WebPageProxy::decidePolicyForMIMEType(uint64_t frameID, const String& MIMEType, const String& url, uint64_t listenerID, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID)
+void WebPageProxy::decidePolicyForMIMEType(uint64_t frameID, const String& MIMEType, const ResourceRequest& request, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID)
{
+ RefPtr<APIObject> userData;
+ WebContextUserMessageDecoder messageDecoder(userData, context());
+ if (!arguments->decode(messageDecoder))
+ return;
+
WebFrameProxy* frame = process()->webFrame(frameID);
MESSAGE_CHECK(frame);
@@ -1425,7 +1620,7 @@ void WebPageProxy::decidePolicyForMIMEType(uint64_t frameID, const String& MIMET
m_inDecidePolicyForMIMEType = true;
m_syncMimeTypePolicyActionIsValid = false;
- if (!m_policyClient.decidePolicyForMIMEType(this, MIMEType, url, frame, listener.get()))
+ if (!m_policyClient.decidePolicyForMIMEType(this, frame, MIMEType, request, listener.get(), 0 /*userData*/))
listener->use();
m_inDecidePolicyForMIMEType = false;
@@ -1460,12 +1655,12 @@ void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, cons
// ResourceLoad Client
-void WebPageProxy::didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request)
+void WebPageProxy::didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, bool pageIsProvisionallyLoading)
{
WebFrameProxy* frame = process()->webFrame(frameID);
MESSAGE_CHECK(frame);
- m_resourceLoadClient.didInitiateLoadForResource(this, frame, resourceIdentifier, request);
+ m_resourceLoadClient.didInitiateLoadForResource(this, frame, resourceIdentifier, request, pageIsProvisionallyLoading);
}
void WebPageProxy::didSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, const ResourceResponse& redirectResponse)
@@ -1674,10 +1869,15 @@ void WebPageProxy::runOpenPanel(uint64_t frameID, const WebOpenPanelParameters::
void WebPageProxy::printFrame(uint64_t frameID)
{
+ ASSERT(!m_isPerformingDOMPrintOperation);
+ m_isPerformingDOMPrintOperation = true;
+
WebFrameProxy* frame = process()->webFrame(frameID);
MESSAGE_CHECK(frame);
m_uiClient.printFrame(this, frame);
+
+ m_isPerformingDOMPrintOperation = false;
}
#if PLATFORM(QT)
@@ -1798,9 +1998,9 @@ void WebPageProxy::didCountStringMatches(const String& string, uint32_t matchCou
m_findClient.didCountStringMatches(this, string, matchCount);
}
-void WebPageProxy::setFindIndicator(const FloatRect& selectionRect, const Vector<FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle, bool fadeOut)
+void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle, bool fadeOut)
{
- RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRect, textRects, contentImageHandle);
+ RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageHandle);
m_pageClient->setFindIndicator(findIndicator.release(), fadeOut);
}
@@ -1824,20 +2024,26 @@ void WebPageProxy::setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index
process()->send(Messages::WebPage::SetTextForActivePopupMenu(index), m_pageID);
}
-void WebPageProxy::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData& data)
+void WebPageProxy::showPopupMenu(const IntRect& rect, uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData& data)
{
- if (m_activePopupMenu)
+ if (m_activePopupMenu) {
m_activePopupMenu->hidePopupMenu();
- else
- m_activePopupMenu = m_pageClient->createPopupMenuProxy(this);
+ m_activePopupMenu->invalidate();
+ m_activePopupMenu = 0;
+ }
+
+ m_activePopupMenu = m_pageClient->createPopupMenuProxy(this);
#if PLATFORM(WIN)
// On Windows, we're about to run our own message pump in showPopupMenu(), so turn off the responsiveness timer.
process()->responsivenessTimer()->stop();
#endif
- m_activePopupMenu->showPopupMenu(rect, items, data, selectedIndex);
- m_activePopupMenu = 0;
+ RefPtr<WebPopupMenuProxy> protectedActivePopupMenu = m_activePopupMenu;
+
+ protectedActivePopupMenu->showPopupMenu(rect, static_cast<TextDirection>(textDirection), items, data, selectedIndex);
+ protectedActivePopupMenu->invalidate();
+ protectedActivePopupMenu = 0;
}
void WebPageProxy::hidePopupMenu()
@@ -1846,6 +2052,7 @@ void WebPageProxy::hidePopupMenu()
return;
m_activePopupMenu->hidePopupMenu();
+ m_activePopupMenu->invalidate();
m_activePopupMenu = 0;
}
@@ -1929,7 +2136,16 @@ void WebPageProxy::didChooseFilesForOpenPanel(const Vector<String>& fileURLs)
if (!isValid())
return;
- // FIXME: This also needs to send a sandbox extension for these paths.
+#if ENABLE(WEB_PROCESS_SANDBOX)
+ // FIXME: The sandbox extensions should be sent with the DidChooseFilesForOpenPanel message. This
+ // is gated on a way of passing SandboxExtension::Handles in a Vector.
+ for (size_t i = 0; i < fileURLs.size(); ++i) {
+ SandboxExtension::Handle sandboxExtensionHandle;
+ SandboxExtension::createHandle(fileURLs[i], SandboxExtension::ReadOnly, sandboxExtensionHandle);
+ process()->send(Messages::WebPage::ExtendSandboxForFileFromOpenPanel(sandboxExtensionHandle), m_pageID);
+ }
+#endif
+
process()->send(Messages::WebPage::DidChooseFilesForOpenPanel(fileURLs), m_pageID);
m_openPanelResultListener->invalidate();
@@ -2096,6 +2312,10 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
case WebEvent::KeyUp:
case WebEvent::RawKeyDown:
case WebEvent::Char:
+#if ENABLE(GESTURE_EVENTS)
+ case WebEvent::GestureScrollBegin:
+ case WebEvent::GestureScrollEnd:
+#endif
process()->responsivenessTimer()->stop();
break;
}
@@ -2110,6 +2330,10 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
break;
case WebEvent::MouseDown:
case WebEvent::MouseUp:
+#if ENABLE(GESTURE_EVENTS)
+ case WebEvent::GestureScrollBegin:
+ case WebEvent::GestureScrollEnd:
+#endif
break;
case WebEvent::Wheel: {
@@ -2130,16 +2354,28 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
m_keyEventQueue.removeFirst();
+ m_pageClient->doneWithKeyEvent(event, handled);
+
if (handled)
break;
- m_pageClient->didNotHandleKeyEvent(event);
m_uiClient.didNotHandleKeyEvent(this, event);
break;
}
}
}
+void WebPageProxy::voidCallback(uint64_t callbackID)
+{
+ RefPtr<VoidCallback> callback = m_voidCallbacks.take(callbackID);
+ if (!callback) {
+ // FIXME: Log error or assert.
+ return;
+ }
+
+ callback->performCallback();
+}
+
void WebPageProxy::dataCallback(const CoreIPC::DataReference& dataReference, uint64_t callbackID)
{
RefPtr<DataCallback> callback = m_dataCallbacks.take(callbackID);
@@ -2162,13 +2398,30 @@ void WebPageProxy::stringCallback(const String& resultString, uint64_t callbackI
callback->performCallbackWithReturnValue(resultString.impl());
}
+void WebPageProxy::computedPagesCallback(const Vector<WebCore::IntRect>& pageRects, double totalScaleFactorForPrinting, uint64_t callbackID)
+{
+ RefPtr<ComputedPagesCallback> callback = m_computedPagesCallbacks.take(callbackID);
+ if (!callback) {
+ // FIXME: Log error or assert.
+ return;
+ }
+
+ callback->performCallbackWithReturnValue(pageRects, totalScaleFactorForPrinting);
+}
+
#if PLATFORM(MAC)
-void WebPageProxy::sendAccessibilityPresenterToken(const CoreIPC::DataReference& token)
+
+void WebPageProxy::registerWebProcessAccessibilityToken(const CoreIPC::DataReference& data)
+{
+ m_pageClient->accessibilityWebProcessTokenReceived(data);
+}
+
+void WebPageProxy::registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elementToken, const CoreIPC::DataReference& windowToken)
{
if (!isValid())
return;
- process()->send(Messages::WebPage::SendAccessibilityPresenterToken(token), m_pageID);
+ process()->send(Messages::WebPage::RegisterUIProcessAccessibilityTokens(elementToken, windowToken), m_pageID);
}
#endif
@@ -2249,8 +2502,13 @@ void WebPageProxy::processDidCrash()
m_toolTip = String();
+ m_mainFrameHasHorizontalScrollbar = false;
+ m_mainFrameHasVerticalScrollbar = false;
+
+ invalidateCallbackMap(m_voidCallbacks);
invalidateCallbackMap(m_dataCallbacks);
invalidateCallbackMap(m_stringCallbacks);
+ invalidateCallbackMap(m_computedPagesCallbacks);
Vector<WebEditCommandProxy*> editCommandVector;
copyToVector(m_editCommandSet, editCommandVector);
@@ -2302,6 +2560,15 @@ WebPageCreationParameters WebPageProxy::creationParameters() const
}
#if USE(ACCELERATED_COMPOSITING)
+void WebPageProxy::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
+{
+ m_pageClient->enterAcceleratedCompositingMode(layerTreeContext);
+}
+
+void WebPageProxy::exitAcceleratedCompositingMode()
+{
+ m_pageClient->exitAcceleratedCompositingMode();
+}
void WebPageProxy::didEnterAcceleratedCompositing()
{
@@ -2372,16 +2639,29 @@ float WebPageProxy::footerHeight(WebFrameProxy* frame)
return m_uiClient.footerHeight(this, frame);
}
-void WebPageProxy::drawHeader(WebFrameProxy* frame, const WebCore::FloatRect& rect)
+void WebPageProxy::drawHeader(WebFrameProxy* frame, const FloatRect& rect)
{
m_uiClient.drawHeader(this, frame, rect);
}
-void WebPageProxy::drawFooter(WebFrameProxy* frame, const WebCore::FloatRect& rect)
+void WebPageProxy::drawFooter(WebFrameProxy* frame, const FloatRect& rect)
{
m_uiClient.drawFooter(this, frame, rect);
}
+void WebPageProxy::didCompleteRubberBandForMainFrame(const IntSize& initialOverhang)
+{
+ m_uiClient.didCompleteRubberBandForMainFrame(this, initialOverhang);
+}
+
+void WebPageProxy::didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar)
+{
+ m_mainFrameHasHorizontalScrollbar = hasHorizontalScrollbar;
+ m_mainFrameHasVerticalScrollbar = hasVerticalScrollbar;
+
+ m_pageClient->didChangeScrollbarsForMainFrame();
+}
+
void WebPageProxy::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference& dataReference)
{
m_pageClient->didFinishLoadingDataForCustomRepresentation(dataReference);
@@ -2392,6 +2672,11 @@ void WebPageProxy::setComplexTextInputEnabled(uint64_t pluginComplexTextInputIde
{
m_pageClient->setComplexTextInputEnabled(pluginComplexTextInputIdentifier, complexTextInputEnabled);
}
+
+void WebPageProxy::setAutodisplay(bool newState)
+{
+ m_pageClient->setAutodisplay(newState);
+}
#endif
void WebPageProxy::backForwardRemovedItem(uint64_t itemID)
@@ -2405,7 +2690,7 @@ void WebPageProxy::beginPrinting(WebFrameProxy* frame, const PrintInfo& printInf
return;
m_isInPrintingMode = true;
- process()->send(Messages::WebPage::BeginPrinting(frame->frameID(), printInfo), m_pageID);
+ process()->send(Messages::WebPage::BeginPrinting(frame->frameID(), printInfo), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
}
void WebPageProxy::endPrinting()
@@ -2414,20 +2699,30 @@ void WebPageProxy::endPrinting()
return;
m_isInPrintingMode = false;
- process()->send(Messages::WebPage::EndPrinting(), m_pageID);
+ process()->send(Messages::WebPage::EndPrinting(), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
}
-void WebPageProxy::computePagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, Vector<WebCore::IntRect>& resultPageRects, double& resultTotalScaleFactorForPrinting)
+void WebPageProxy::computePagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, PassRefPtr<ComputedPagesCallback> callback)
{
- // Layout for printing can take a long time, but we need to have the answer.
- process()->sendSync(Messages::WebPage::ComputePagesForPrinting(frame->frameID(), printInfo), Messages::WebPage::ComputePagesForPrinting::Reply(resultPageRects, resultTotalScaleFactorForPrinting), m_pageID);
+ uint64_t callbackID = callback->callbackID();
+ m_computedPagesCallbacks.set(callbackID, callback.get());
+ m_isInPrintingMode = true;
+ process()->send(Messages::WebPage::ComputePagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
}
#if PLATFORM(MAC)
-void WebPageProxy::drawRectToPDF(WebFrameProxy* frame, const IntRect& rect, Vector<uint8_t>& pdfData)
+void WebPageProxy::drawRectToPDF(WebFrameProxy* frame, const IntRect& rect, PassRefPtr<DataCallback> callback)
{
- // Printing can take a long time, but we need to have the answer.
- process()->sendSync(Messages::WebPage::DrawRectToPDF(frame->frameID(), rect), Messages::WebPage::DrawRectToPDF::Reply(pdfData), m_pageID);
+ uint64_t callbackID = callback->callbackID();
+ m_dataCallbacks.set(callbackID, callback.get());
+ process()->send(Messages::WebPage::DrawRectToPDF(frame->frameID(), rect, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
+}
+
+void WebPageProxy::drawPagesToPDF(WebFrameProxy* frame, uint32_t first, uint32_t count, PassRefPtr<DataCallback> callback)
+{
+ uint64_t callbackID = callback->callbackID();
+ m_dataCallbacks.set(callbackID, callback.get());
+ process()->send(Messages::WebPage::DrawPagesToPDF(frame->frameID(), first, count, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
}
#endif
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h
index dc43e19..46aa240 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.h
+++ b/Source/WebKit2/UIProcess/WebPageProxy.h
@@ -31,6 +31,7 @@
#include "DragControllerAction.h"
#include "DrawingAreaProxy.h"
#include "GeolocationPermissionRequestManagerProxy.h"
+#include "SandboxExtension.h"
#include "SelectionState.h"
#include "SharedMemory.h"
#include "WKBase.h"
@@ -81,13 +82,11 @@ namespace WebCore {
namespace WebKit {
-class ContextMenuState;
class DrawingAreaProxy;
class NativeWebKeyboardEvent;
class PageClient;
class PlatformCertificateInfo;
class StringPairVector;
-class WebOpenPanelResultListenerProxy;
class WebBackForwardList;
class WebBackForwardListItem;
class WebContextMenuProxy;
@@ -95,16 +94,22 @@ class WebData;
class WebEditCommandProxy;
class WebKeyboardEvent;
class WebMouseEvent;
+class WebOpenPanelResultListenerProxy;
class WebPageGroup;
class WebPopupMenuProxy;
class WebProcessProxy;
class WebURLRequest;
class WebWheelEvent;
+struct ContextMenuState;
struct PlatformPopupMenuData;
struct PrintInfo;
struct WebPageCreationParameters;
struct WebPopupItem;
+#if ENABLE(GESTURE_EVENTS)
+class WebGestureEvent;
+#endif
+
typedef GenericCallback<WKStringRef, StringImpl*> StringCallback;
class WebPageProxy : public APIObject, public WebPopupMenuProxy::Client {
@@ -158,7 +163,7 @@ public:
bool canGoBack() const;
void goToBackForwardItem(WebBackForwardListItem*);
- void didChangeBackForwardList();
+ void didChangeBackForwardList(WebBackForwardListItem* addedItem, Vector<RefPtr<APIObject> >* removedItems);
bool canShowMIMEType(const String& mimeType) const;
@@ -168,6 +173,9 @@ public:
bool drawsTransparentBackground() const { return m_drawsTransparentBackground; }
void setDrawsTransparentBackground(bool);
+ void viewWillStartLiveResize();
+ void viewWillEndLiveResize();
+
void setInitialFocus(bool);
void setWindowResizerSize(const WebCore::IntSize&);
@@ -215,6 +223,9 @@ public:
void handleMouseEvent(const WebMouseEvent&);
void handleWheelEvent(const WebWheelEvent&);
void handleKeyboardEvent(const NativeWebKeyboardEvent&);
+#if ENABLE(GESTURE_EVENTS)
+ void handleGestureEvent(const WebGestureEvent&);
+#endif
#if ENABLE(TOUCH_EVENTS)
void handleTouchEvent(const WebTouchEvent&);
#endif
@@ -233,7 +244,7 @@ public:
void setCustomTextEncodingName(const String&);
String customTextEncodingName() const { return m_customTextEncodingName; }
- double estimatedProgress() const { return m_estimatedProgress; }
+ double estimatedProgress() const;
void terminateProcess();
@@ -256,10 +267,18 @@ public:
bool useFixedLayout() const { return m_useFixedLayout; };
const WebCore::IntSize& fixedLayoutSize() const { return m_fixedLayoutSize; };
+ bool hasHorizontalScrollbar() const { return m_mainFrameHasHorizontalScrollbar; }
+ bool hasVerticalScrollbar() const { return m_mainFrameHasVerticalScrollbar; }
+
#if PLATFORM(MAC)
- void sendAccessibilityPresenterToken(const CoreIPC::DataReference&);
+ // Called by the web process through a message.
+ void registerWebProcessAccessibilityToken(const CoreIPC::DataReference&);
+ // Called by the UI process when it is ready to send its tokens to the web process.
+ void registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elemenToken, const CoreIPC::DataReference& windowToken);
#endif
+ void viewScaleFactorDidChange(double);
+
// Find.
void findString(const String&, FindOptions, unsigned maxMatchCount);
void hideFindUI();
@@ -273,23 +292,31 @@ public:
void getSourceForFrame(WebFrameProxy*, PassRefPtr<StringCallback>);
void getWebArchiveOfFrame(WebFrameProxy*, PassRefPtr<DataCallback>);
void runJavaScriptInMainFrame(const String&, PassRefPtr<StringCallback>);
-
+ void forceRepaint(PassRefPtr<VoidCallback>);
+
float headerHeight(WebFrameProxy*);
float footerHeight(WebFrameProxy*);
void drawHeader(WebFrameProxy*, const WebCore::FloatRect&);
void drawFooter(WebFrameProxy*, const WebCore::FloatRect&);
+#if PLATFORM(MAC)
+ void setAutodisplay(bool);
+#endif
+
void receivedPolicyDecision(WebCore::PolicyAction, WebFrameProxy*, uint64_t listenerID);
void backForwardRemovedItem(uint64_t itemID);
// Drag and drop support.
- void performDragControllerAction(DragControllerAction, WebCore::DragData*, const String&);
+ void performDragControllerAction(DragControllerAction, WebCore::DragData*, const String& = String());
void didPerformDragControllerAction(uint64_t resultOperation);
void dragEnded(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t operation);
#if PLATFORM(MAC)
void setDragImage(const WebCore::IntPoint& clientPosition, const WebCore::IntSize& imageSize, const SharedMemory::Handle& dragImageHandle, bool isLinkDrag);
#endif
+#if PLATFORM(WIN)
+ void startDragDrop(const WebCore::IntPoint& imagePoint, const WebCore::IntPoint& dragPoint, uint64_t okEffect, const HashMap<UINT, Vector<String> >& dataMap, const WebCore::IntSize& dragImageSize, const SharedMemory::Handle& dragImageHandle, bool isLinkDrag);
+#endif
void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
@@ -298,6 +325,11 @@ public:
void processDidCrash();
#if USE(ACCELERATED_COMPOSITING)
+ virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
+ virtual void exitAcceleratedCompositingMode();
+#endif
+
+#if USE(ACCELERATED_COMPOSITING)
void didEnterAcceleratedCompositing();
void didLeaveAcceleratedCompositing();
#endif
@@ -356,11 +388,14 @@ public:
void beginPrinting(WebFrameProxy*, const PrintInfo&);
void endPrinting();
- void computePagesForPrinting(WebFrameProxy*, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects, double& resultTotalScaleFactorForPrinting);
+ void computePagesForPrinting(WebFrameProxy*, const PrintInfo&, PassRefPtr<ComputedPagesCallback>);
#if PLATFORM(MAC)
- void drawRectToPDF(WebFrameProxy*, const WebCore::IntRect&, Vector<uint8_t>& pdfData);
+ void drawRectToPDF(WebFrameProxy*, const WebCore::IntRect&, PassRefPtr<DataCallback>);
+ void drawPagesToPDF(WebFrameProxy*, uint32_t first, uint32_t count, PassRefPtr<DataCallback>);
#endif
+ const String& pendingAPIRequestURL() const { return m_pendingAPIRequestURL; }
+
private:
WebPageProxy(PageClient*, WebContext*, WebPageGroup*, uint64_t pageID);
@@ -397,16 +432,15 @@ private:
void didStartProgress();
void didChangeProgress(double);
void didFinishProgress();
- void didReceiveAccessibilityPageToken(const CoreIPC::DataReference&);
- void decidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const String& url, uint64_t listenerID);
- void decidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const String& url, uint64_t listenerID);
- void decidePolicyForMIMEType(uint64_t frameID, const String& MIMEType, const String& url, uint64_t listenerID, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID);
+ void decidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::ArgumentDecoder*, bool& receivedPolicyAction, uint64_t& policyAction);
+ void decidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const WebCore::ResourceRequest&, const String& frameName, uint64_t listenerID, CoreIPC::ArgumentDecoder*);
+ void decidePolicyForMIMEType(uint64_t frameID, const String& MIMEType, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID);
void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder*);
// Resource load client
- void didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceRequest&);
+ void didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceRequest&, bool pageIsProvisionallyLoading);
void didSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse);
void didReceiveResponseForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceResponse&);
void didReceiveContentLengthForResource(uint64_t frameID, uint64_t resourceIdentifier, uint64_t contentLength);
@@ -442,6 +476,8 @@ private:
void exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentUsage, uint64_t expectedUsage, uint64_t& newQuota);
void requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier);
void runModal() { m_uiClient.runModal(this); }
+ void didCompleteRubberBandForMainFrame(const WebCore::IntSize&);
+ void didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar);
void reattachToWebProcess();
void reattachToWebProcessWithItem(WebBackForwardListItem*);
@@ -477,12 +513,12 @@ private:
// Find.
void didCountStringMatches(const String&, uint32_t matchCount);
- void setFindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle, bool fadeOut);
+ void setFindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle, bool fadeOut);
void didFindString(const String&, uint32_t matchCount);
void didFailToFindString(const String&);
// Popup Menu.
- void showPopupMenu(const WebCore::IntRect& rect, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData&);
+ void showPopupMenu(const WebCore::IntRect& rect, uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData&);
void hidePopupMenu();
// Context Menu.
@@ -510,8 +546,10 @@ private:
void didReceiveEvent(uint32_t opaqueType, bool handled);
+ void voidCallback(uint64_t);
void dataCallback(const CoreIPC::DataReference&, uint64_t);
void stringCallback(const String&, uint64_t);
+ void computedPagesCallback(const Vector<WebCore::IntRect>&, double totalScaleFactorForPrinting, uint64_t);
void focusedFrameChanged(uint64_t frameID);
void frameSetLargestFrameChanged(uint64_t frameID);
@@ -531,6 +569,11 @@ private:
static String standardUserAgent(const String& applicationName = String());
+ void clearPendingAPIRequestURL() { m_pendingAPIRequestURL = String(); }
+ void setPendingAPIRequestURL(const String& pendingAPIRequestURL) { m_pendingAPIRequestURL = pendingAPIRequestURL; }
+
+ void initializeSandboxExtensionHandle(const WebCore::KURL&, SandboxExtension::Handle&);
+
PageClient* m_pageClient;
WebLoaderClient m_loaderClient;
WebPolicyClient m_policyClient;
@@ -556,8 +599,10 @@ private:
RefPtr<WebInspectorProxy> m_inspector;
#endif
+ HashMap<uint64_t, RefPtr<VoidCallback> > m_voidCallbacks;
HashMap<uint64_t, RefPtr<DataCallback> > m_dataCallbacks;
HashMap<uint64_t, RefPtr<StringCallback> > m_stringCallbacks;
+ HashMap<uint64_t, RefPtr<ComputedPagesCallback> > m_computedPagesCallbacks;
HashSet<WebEditCommandProxy*> m_editCommandSet;
@@ -603,12 +648,17 @@ private:
bool m_isClosed;
bool m_isInPrintingMode;
+ bool m_isPerformingDOMPrintOperation;
bool m_inDecidePolicyForMIMEType;
bool m_syncMimeTypePolicyActionIsValid;
WebCore::PolicyAction m_syncMimeTypePolicyAction;
uint64_t m_syncMimeTypePolicyDownloadID;
+ bool m_inDecidePolicyForNavigationAction;
+ bool m_syncNavigationActionPolicyActionIsValid;
+ WebCore::PolicyAction m_syncNavigationActionPolicyAction;
+
Deque<NativeWebKeyboardEvent> m_keyEventQueue;
bool m_processingWheelEvent;
OwnPtr<WebWheelEvent> m_nextWheelEvent;
@@ -628,6 +678,11 @@ private:
bool m_mainFrameHasCustomRepresentation;
WebCore::DragOperation m_currentDragOperation;
+
+ String m_pendingAPIRequestURL;
+
+ bool m_mainFrameHasHorizontalScrollbar;
+ bool m_mainFrameHasVerticalScrollbar;
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in
index 6456851..e566d02 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -55,6 +55,8 @@ messages -> WebPageProxy {
RunOpenPanel(uint64_t frameID, WebKit::WebOpenPanelParameters::Data parameters)
PrintFrame(uint64_t frameID) -> ()
RunModal()
+ DidCompleteRubberBandForMainFrame(WebCore::IntSize initialOverhang)
+ DidChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar)
#if ENABLE(TILED_BACKING_STORE)
PageDidRequestScroll(WebCore::IntSize delta)
@@ -65,9 +67,9 @@ messages -> WebPageProxy {
#endif
# Policy messages
- DecidePolicyForMIMEType(uint64_t frameID, WTF::String MIMEType, WTF::String url, uint64_t listenerID) -> (bool receivedPolicyAction, uint64_t policyAction, uint64_t downloadID)
- DecidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WTF::String url, uint64_t listenerID)
- DecidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WTF::String url, uint64_t listenerID)
+ DecidePolicyForMIMEType(uint64_t frameID, WTF::String MIMEType, WebCore::ResourceRequest request, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) -> (bool receivedPolicyAction, uint64_t policyAction, uint64_t downloadID)
+ DecidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WebCore::ResourceRequest request, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) -> (bool receivedPolicyAction, uint64_t policyAction)
+ DecidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WebCore::ResourceRequest request, WTF::String frameName, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData)
# Progress messages
DidChangeProgress(double value)
@@ -99,7 +101,7 @@ messages -> WebPageProxy {
FrameDidBecomeFrameSet(uint64_t frameID, bool value)
# Resource load messages
- DidInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, WebCore::ResourceRequest request)
+ DidInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, WebCore::ResourceRequest request, bool pageIsProvisionallyLoading)
DidSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, WebCore::ResourceRequest request, WebCore::ResourceResponse redirectResponse)
DidReceiveResponseForResource(uint64_t frameID, uint64_t resourceIdentifier, WebCore::ResourceResponse response)
DidReceiveContentLengthForResource(uint64_t frameID, uint64_t resourceIdentifier, uint64_t contentLength)
@@ -113,14 +115,20 @@ messages -> WebPageProxy {
WillSubmitForm(uint64_t frameID, uint64_t sourceFrameID, WebKit::StringPairVector textFieldValues, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData)
# Callback messages
+ VoidCallback(uint64_t callbackID)
DataCallback(CoreIPC::DataReference resultData, uint64_t callbackID)
StringCallback(WTF::String resultString, uint64_t callbackID)
+ ComputedPagesCallback(Vector<WebCore::IntRect> pageRects, double totalScaleFactorForPrinting, uint64_t callbackID)
- DidReceiveAccessibilityPageToken(CoreIPC::DataReference data)
+
+ ViewScaleFactorDidChange(double scaleFactor)
#if PLATFORM(MAC)
# Keyboard support messages
InterpretKeyEvent(uint32_t type) -> (Vector<WebCore::KeypressCommand> commandName, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline> underlines)
+
+ # Remote accessibility messages
+ RegisterWebProcessAccessibilityToken(CoreIPC::DataReference data)
#endif
# BackForward messages
@@ -149,7 +157,7 @@ messages -> WebPageProxy {
DidFailToFindString(WTF::String string)
# PopupMenu messages
- ShowPopupMenu(WebCore::IntRect rect, Vector<WebKit::WebPopupItem> items, int32_t selectedIndex, WebKit::PlatformPopupMenuData data)
+ ShowPopupMenu(WebCore::IntRect rect, uint64_t textDirection, Vector<WebKit::WebPopupItem> items, int32_t selectedIndex, WebKit::PlatformPopupMenuData data)
HidePopupMenu()
# ContextMenu messages
@@ -188,10 +196,13 @@ messages -> WebPageProxy {
GetGuessesForWord(WTF::String word, WTF::String context) -> (Vector<WTF::String> guesses)
LearnWord(WTF::String word);
IgnoreWord(WTF::String word);
-
+
# Drag and drop messages
DidPerformDragControllerAction(uint64_t resultOperation)
#if PLATFORM(MAC)
SetDragImage(WebCore::IntPoint clientPosition, WebCore::IntSize imageSize, WebKit::SharedMemory::Handle dragImage, bool linkDrag)
#endif
+#if PLATFORM(WIN)
+ StartDragDrop(WebCore::IntPoint imagePoint, WebCore::IntPoint dragPoint, uint64_t okEffect, HashMap<UINT,Vector<String> > dataMap, WebCore::IntSize dragImageSize, WebKit::SharedMemory::Handle dragImage, bool linkDrag)
+#endif
}
diff --git a/Source/WebKit2/UIProcess/WebPolicyClient.cpp b/Source/WebKit2/UIProcess/WebPolicyClient.cpp
index e7a8239..6296664 100644
--- a/Source/WebKit2/UIProcess/WebPolicyClient.cpp
+++ b/Source/WebKit2/UIProcess/WebPolicyClient.cpp
@@ -23,39 +23,46 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPolicyClient.h"
#include "WKAPICast.h"
-#include <wtf/text/WTFString.h>
+#include "WebURLRequest.h"
using namespace WebCore;
namespace WebKit {
-bool WebPolicyClient::decidePolicyForNavigationAction(WebPageProxy* page, NavigationType type, WebEvent::Modifiers modifiers, WebMouseEvent::Button mouseButton, const String& url, WebFrameProxy* frame, WebFramePolicyListenerProxy* listener)
+bool WebPolicyClient::decidePolicyForNavigationAction(WebPageProxy* page, WebFrameProxy* frame, NavigationType type, WebEvent::Modifiers modifiers, WebMouseEvent::Button mouseButton, const ResourceRequest& resourceRequest, WebFramePolicyListenerProxy* listener, APIObject* userData)
{
if (!m_client.decidePolicyForNavigationAction)
return false;
- m_client.decidePolicyForNavigationAction(toAPI(page), toAPI(type), toAPI(modifiers), toAPI(mouseButton), toURLRef(url.impl()), toAPI(frame), toAPI(listener), m_client.clientInfo);
+ RefPtr<WebURLRequest> request = WebURLRequest::create(resourceRequest);
+
+ m_client.decidePolicyForNavigationAction(toAPI(page), toAPI(frame), toAPI(type), toAPI(modifiers), toAPI(mouseButton), toAPI(request.get()), toAPI(listener), toAPI(userData), m_client.clientInfo);
return true;
}
-bool WebPolicyClient::decidePolicyForNewWindowAction(WebPageProxy* page, NavigationType type, WebEvent::Modifiers modifiers, WebMouseEvent::Button mouseButton, const String& url, WebFrameProxy* frame, WebFramePolicyListenerProxy* listener)
+bool WebPolicyClient::decidePolicyForNewWindowAction(WebPageProxy* page, WebFrameProxy* frame, NavigationType type, WebEvent::Modifiers modifiers, WebMouseEvent::Button mouseButton, const ResourceRequest& resourceRequest, const String& frameName, WebFramePolicyListenerProxy* listener, APIObject* userData)
{
if (!m_client.decidePolicyForNewWindowAction)
return false;
- m_client.decidePolicyForNewWindowAction(toAPI(page), toAPI(type), toAPI(modifiers), toAPI(mouseButton), toURLRef(url.impl()), toAPI(frame), toAPI(listener), m_client.clientInfo);
+ RefPtr<WebURLRequest> request = WebURLRequest::create(resourceRequest);
+
+ m_client.decidePolicyForNewWindowAction(toAPI(page), toAPI(frame), toAPI(type), toAPI(modifiers), toAPI(mouseButton), toAPI(request.get()), toAPI(frameName.impl()), toAPI(listener), toAPI(userData), m_client.clientInfo);
return true;
}
-bool WebPolicyClient::decidePolicyForMIMEType(WebPageProxy* page, const String& MIMEType, const String& url, WebFrameProxy* frame, WebFramePolicyListenerProxy* listener)
+bool WebPolicyClient::decidePolicyForMIMEType(WebPageProxy* page, WebFrameProxy* frame, const String& MIMEType, const ResourceRequest& resourceRequest, WebFramePolicyListenerProxy* listener, APIObject* userData)
{
if (!m_client.decidePolicyForMIMEType)
return false;
- m_client.decidePolicyForMIMEType(toAPI(page), toAPI(MIMEType.impl()), toURLRef(url.impl()), toAPI(frame), toAPI(listener), m_client.clientInfo);
+ RefPtr<WebURLRequest> request = WebURLRequest::create(resourceRequest);
+
+ m_client.decidePolicyForMIMEType(toAPI(page), toAPI(frame), toAPI(MIMEType.impl()), toAPI(request.get()), toAPI(listener), toAPI(userData), m_client.clientInfo);
return true;
}
diff --git a/Source/WebKit2/UIProcess/WebPolicyClient.h b/Source/WebKit2/UIProcess/WebPolicyClient.h
index 797bc37..c624c58 100644
--- a/Source/WebKit2/UIProcess/WebPolicyClient.h
+++ b/Source/WebKit2/UIProcess/WebPolicyClient.h
@@ -27,11 +27,16 @@
#define WebPolicyClient_h
#include "APIClient.h"
+#include "APIObject.h"
#include "WKPage.h"
#include "WebEvent.h"
#include <WebCore/FrameLoaderTypes.h>
#include <wtf/Forward.h>
+namespace WebCore {
+ class ResourceRequest;
+}
+
namespace WebKit {
class WebPageProxy;
@@ -40,9 +45,9 @@ class WebFramePolicyListenerProxy;
class WebPolicyClient : public APIClient<WKPagePolicyClient> {
public:
- bool decidePolicyForNavigationAction(WebPageProxy*, WebCore::NavigationType, WebEvent::Modifiers, WebMouseEvent::Button, const String& url, WebFrameProxy*, WebFramePolicyListenerProxy*);
- bool decidePolicyForNewWindowAction(WebPageProxy*, WebCore::NavigationType, WebEvent::Modifiers, WebMouseEvent::Button, const String& url, WebFrameProxy*, WebFramePolicyListenerProxy*);
- bool decidePolicyForMIMEType(WebPageProxy*, const String&, const String& url, WebFrameProxy*, WebFramePolicyListenerProxy*);
+ bool decidePolicyForNavigationAction(WebPageProxy*, WebFrameProxy*, WebCore::NavigationType, WebEvent::Modifiers, WebMouseEvent::Button, const WebCore::ResourceRequest&, WebFramePolicyListenerProxy*, APIObject* userData);
+ bool decidePolicyForNewWindowAction(WebPageProxy*, WebFrameProxy*, WebCore::NavigationType, WebEvent::Modifiers, WebMouseEvent::Button, const WebCore::ResourceRequest&, const String& frameName, WebFramePolicyListenerProxy*, APIObject* userData);
+ bool decidePolicyForMIMEType(WebPageProxy*, WebFrameProxy*, const String& MIMEType, const WebCore::ResourceRequest&, WebFramePolicyListenerProxy*, APIObject* userData);
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebPopupMenuProxy.h b/Source/WebKit2/UIProcess/WebPopupMenuProxy.h
index fd84928..78dad64 100644
--- a/Source/WebKit2/UIProcess/WebPopupMenuProxy.h
+++ b/Source/WebKit2/UIProcess/WebPopupMenuProxy.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,6 +26,7 @@
#ifndef WebPopupMenuProxy_h
#define WebPopupMenuProxy_h
+#include <WebCore/TextDirection.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
@@ -56,9 +57,11 @@ public:
{
}
- virtual void showPopupMenu(const WebCore::IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) = 0;
+ virtual void showPopupMenu(const WebCore::IntRect& rect, WebCore::TextDirection, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) = 0;
virtual void hidePopupMenu() = 0;
+ void invalidate() { m_client = 0; }
+
protected:
WebPopupMenuProxy(Client* client)
: m_client(client)
diff --git a/Source/WebKit2/UIProcess/WebPreferences.cpp b/Source/WebKit2/UIProcess/WebPreferences.cpp
index e33ebb2..efda4cd 100644
--- a/Source/WebKit2/UIProcess/WebPreferences.cpp
+++ b/Source/WebKit2/UIProcess/WebPreferences.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPreferences.h"
#include "WebPageGroup.h"
diff --git a/Source/WebKit2/UIProcess/WebProcessManager.cpp b/Source/WebKit2/UIProcess/WebProcessManager.cpp
index 94556f8..80e3c2d 100644
--- a/Source/WebKit2/UIProcess/WebProcessManager.cpp
+++ b/Source/WebKit2/UIProcess/WebProcessManager.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebProcessManager.h"
#include "WebContext.h"
diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp
index c7e9382..67dc46b 100644
--- a/Source/WebKit2/UIProcess/WebProcessProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebProcessProxy.h"
#include "DataReference.h"
@@ -43,6 +44,7 @@
#include <wtf/text/WTFString.h>
using namespace WebCore;
+using namespace std;
namespace WebKit {
@@ -76,7 +78,7 @@ WebProcessProxy::~WebProcessProxy()
m_connection->invalidate();
for (size_t i = 0; i < m_pendingMessages.size(); ++i)
- m_pendingMessages[i].releaseArguments();
+ m_pendingMessages[i].first.releaseArguments();
if (m_processLauncher) {
m_processLauncher->invalidate();
@@ -99,20 +101,22 @@ void WebProcessProxy::connect()
ProcessLauncher::LaunchOptions launchOptions;
launchOptions.processType = ProcessLauncher::WebProcess;
+
#if PLATFORM(MAC)
// We want the web process to match the architecture of the UI process.
launchOptions.architecture = ProcessLauncher::LaunchOptions::MatchCurrentArchitecture;
+ launchOptions.executableHeap = false;
#endif
m_processLauncher = ProcessLauncher::create(this, launchOptions);
}
}
-bool WebProcessProxy::sendMessage(CoreIPC::MessageID messageID, PassOwnPtr<CoreIPC::ArgumentEncoder> arguments)
+bool WebProcessProxy::sendMessage(CoreIPC::MessageID messageID, PassOwnPtr<CoreIPC::ArgumentEncoder> arguments, unsigned messageSendFlags)
{
// If we're waiting for the web process to launch, we need to stash away the messages so we can send them once we have
// a CoreIPC connection.
if (isLaunching()) {
- m_pendingMessages.append(CoreIPC::Connection::OutgoingMessage(messageID, arguments));
+ m_pendingMessages.append(make_pair(CoreIPC::Connection::OutgoingMessage(messageID, arguments), messageSendFlags));
return true;
}
@@ -120,7 +124,7 @@ bool WebProcessProxy::sendMessage(CoreIPC::MessageID messageID, PassOwnPtr<CoreI
if (!m_connection)
return false;
- return m_connection->sendMessage(messageID, arguments);
+ return m_connection->sendMessage(messageID, arguments, messageSendFlags);
}
bool WebProcessProxy::isLaunching() const
@@ -344,13 +348,16 @@ void WebProcessProxy::didFinishLaunching(CoreIPC::Connection::Identifier connect
m_connection = CoreIPC::Connection::createServerConnection(connectionIdentifier, this, RunLoop::main());
#if PLATFORM(MAC)
m_connection->setShouldCloseConnectionOnMachExceptions();
+#elif PLATFORM(QT)
+ m_connection->setShouldCloseConnectionOnProcessTermination(processIdentifier());
#endif
-
+
m_connection->open();
for (size_t i = 0; i < m_pendingMessages.size(); ++i) {
- CoreIPC::Connection::OutgoingMessage& outgoingMessage = m_pendingMessages[i];
- m_connection->sendMessage(outgoingMessage.messageID(), adoptPtr(outgoingMessage.arguments()));
+ CoreIPC::Connection::OutgoingMessage& outgoingMessage = m_pendingMessages[i].first;
+ unsigned messageSendFlags = m_pendingMessages[i].second;
+ m_connection->sendMessage(outgoingMessage.messageID(), adoptPtr(outgoingMessage.arguments()), messageSendFlags);
}
m_pendingMessages.clear();
diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.h b/Source/WebKit2/UIProcess/WebProcessProxy.h
index 531d7fe..e4221fe 100644
--- a/Source/WebKit2/UIProcess/WebProcessProxy.h
+++ b/Source/WebKit2/UIProcess/WebProcessProxy.h
@@ -63,8 +63,7 @@ public:
void terminate();
- template<typename E, typename T> bool send(E messageID, uint64_t destinationID, const T& arguments);
- template<typename T> bool send(const T& message, uint64_t destinationID);
+ template<typename T> bool send(const T& message, uint64_t destinationID, unsigned messageSendFlags = 0);
template<typename U> bool sendSync(const U& message, const typename U::Reply& reply, uint64_t destinationID, double timeout = 1);
CoreIPC::Connection* connection() const
@@ -105,13 +104,16 @@ public:
void updateTextCheckerState();
void registerNewWebBackForwardListItem(WebBackForwardListItem*);
-
+
+ // FIXME: This variant of send is deprecated. All clients should move to an overload that take a message type.
+ template<typename E, typename T> bool deprecatedSend(E messageID, uint64_t destinationID, const T& arguments);
+
private:
explicit WebProcessProxy(WebContext*);
void connect();
- bool sendMessage(CoreIPC::MessageID, PassOwnPtr<CoreIPC::ArgumentEncoder>);
+ bool sendMessage(CoreIPC::MessageID, PassOwnPtr<CoreIPC::ArgumentEncoder>, unsigned messageSendFlags);
void addBackForwardItem(uint64_t itemID, const String& originalURLString, const String& urlString, const String& title, const CoreIPC::DataReference& backForwardData);
@@ -143,7 +145,7 @@ private:
ResponsivenessTimer m_responsivenessTimer;
RefPtr<CoreIPC::Connection> m_connection;
- Vector<CoreIPC::Connection::OutgoingMessage> m_pendingMessages;
+ Vector<std::pair<CoreIPC::Connection::OutgoingMessage, unsigned> > m_pendingMessages;
RefPtr<ProcessLauncher> m_processLauncher;
RefPtr<ThreadLauncher> m_threadLauncher;
@@ -155,21 +157,21 @@ private:
};
template<typename E, typename T>
-bool WebProcessProxy::send(E messageID, uint64_t destinationID, const T& arguments)
+bool WebProcessProxy::deprecatedSend(E messageID, uint64_t destinationID, const T& arguments)
{
OwnPtr<CoreIPC::ArgumentEncoder> argumentEncoder = CoreIPC::ArgumentEncoder::create(destinationID);
argumentEncoder->encode(arguments);
- return sendMessage(CoreIPC::MessageID(messageID), argumentEncoder.release());
+ return sendMessage(CoreIPC::MessageID(messageID), argumentEncoder.release(), 0);
}
template<typename T>
-bool WebProcessProxy::send(const T& message, uint64_t destinationID)
+bool WebProcessProxy::send(const T& message, uint64_t destinationID, unsigned messageSendFlags)
{
OwnPtr<CoreIPC::ArgumentEncoder> argumentEncoder = CoreIPC::ArgumentEncoder::create(destinationID);
argumentEncoder->encode(message);
- return sendMessage(CoreIPC::MessageID(T::messageID), argumentEncoder.release());
+ return sendMessage(CoreIPC::MessageID(T::messageID), argumentEncoder.release(), messageSendFlags);
}
template<typename U>
diff --git a/Source/WebKit2/UIProcess/WebResourceLoadClient.cpp b/Source/WebKit2/UIProcess/WebResourceLoadClient.cpp
index 675890f..f6dbe59 100644
--- a/Source/WebKit2/UIProcess/WebResourceLoadClient.cpp
+++ b/Source/WebKit2/UIProcess/WebResourceLoadClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebResourceLoadClient.h"
#include "WKAPICast.h"
@@ -33,13 +34,13 @@ using namespace WebCore;
namespace WebKit {
-void WebResourceLoadClient::didInitiateLoadForResource(WebPageProxy* page, WebFrameProxy* frame, uint64_t resourceIdentifier, const ResourceRequest& resourceRequest)
+void WebResourceLoadClient::didInitiateLoadForResource(WebPageProxy* page, WebFrameProxy* frame, uint64_t resourceIdentifier, const ResourceRequest& resourceRequest, bool pageIsProvisionallyLoading)
{
if (!m_client.didInitiateLoadForResource)
return;
RefPtr<WebURLRequest> request = WebURLRequest::create(resourceRequest);
- return m_client.didInitiateLoadForResource(toAPI(page), toAPI(frame), resourceIdentifier, toAPI(request.get()), m_client.clientInfo);
+ return m_client.didInitiateLoadForResource(toAPI(page), toAPI(frame), resourceIdentifier, toAPI(request.get()), pageIsProvisionallyLoading, m_client.clientInfo);
}
void WebResourceLoadClient::didSendRequestForResource(WebPageProxy* page, WebFrameProxy* frame, uint64_t resourceIdentifier, const ResourceRequest& resourceRequest, const ResourceResponse& redirectResourceResponse)
diff --git a/Source/WebKit2/UIProcess/WebResourceLoadClient.h b/Source/WebKit2/UIProcess/WebResourceLoadClient.h
index e2e322f..9648379 100644
--- a/Source/WebKit2/UIProcess/WebResourceLoadClient.h
+++ b/Source/WebKit2/UIProcess/WebResourceLoadClient.h
@@ -43,7 +43,7 @@ class WebPageProxy;
class WebResourceLoadClient : public APIClient<WKPageResourceLoadClient> {
public:
- void didInitiateLoadForResource(WebPageProxy*, WebFrameProxy*, uint64_t resourceIdentifier, const WebCore::ResourceRequest&);
+ void didInitiateLoadForResource(WebPageProxy*, WebFrameProxy*, uint64_t resourceIdentifier, const WebCore::ResourceRequest&, bool pageIsProvisionallyLoading);
void didSendRequestForResource(WebPageProxy*, WebFrameProxy*, uint64_t resourceIdentifier, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
void didReceiveResponseForResource(WebPageProxy*, WebFrameProxy*, uint64_t resourceIdentifier, const WebCore::ResourceResponse&);
void didReceiveContentLengthForResource(WebPageProxy*, WebFrameProxy*, uint64_t resourceIdentifier, uint64_t contentLength);
diff --git a/Source/WebKit2/UIProcess/WebUIClient.cpp b/Source/WebKit2/UIProcess/WebUIClient.cpp
index 9f2c7ab..076b331 100644
--- a/Source/WebKit2/UIProcess/WebUIClient.cpp
+++ b/Source/WebKit2/UIProcess/WebUIClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebUIClient.h"
#include "ImmutableDictionary.h"
@@ -326,4 +327,12 @@ void WebUIClient::runModal(WebPageProxy* page)
m_client.runModal(toAPI(page), m_client.clientInfo);
}
+void WebUIClient::didCompleteRubberBandForMainFrame(WebPageProxy* page, const IntSize& initialOverhang)
+{
+ if (!m_client.runModal)
+ return;
+
+ m_client.didCompleteRubberBandForMainFrame(toAPI(page), toAPI(initialOverhang), m_client.clientInfo);
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebUIClient.h b/Source/WebKit2/UIProcess/WebUIClient.h
index b873a8d..d8e0bff 100644
--- a/Source/WebKit2/UIProcess/WebUIClient.h
+++ b/Source/WebKit2/UIProcess/WebUIClient.h
@@ -96,6 +96,8 @@ public:
bool canRunModal() const;
void runModal(WebPageProxy*);
+
+ void didCompleteRubberBandForMainFrame(WebPageProxy*, const WebCore::IntSize&);
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp b/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp
index 3f03980..718e3b8 100644
--- a/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp
+++ b/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebBackForwardList.h"
#include "Logging.h"
#include <wtf/RetainPtr.h>
@@ -51,6 +52,8 @@ DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntryDataKey, (CFSTR("SessionHis
CFDictionaryRef WebBackForwardList::createCFDictionaryRepresentation(WebPageProxy::WebPageProxySessionStateFilterCallback filter, void* context) const
{
+ ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size());
+
RetainPtr<CFNumberRef> currentIndex(AdoptCF, CFNumberCreate(0, kCFNumberIntType, &m_current));
RetainPtr<CFMutableArrayRef> entries(AdoptCF, CFArrayCreateMutable(0, m_entries.size(), &kCFTypeArrayCallBacks));
@@ -61,7 +64,7 @@ CFDictionaryRef WebBackForwardList::createCFDictionaryRepresentation(WebPageProx
for (size_t i = 0; i < m_entries.size(); ++i) {
RefPtr<WebURL> webURL = WebURL::create(m_entries[i]->url());
- if (!filter(toAPI(m_page), WKPageGetSessionHistoryURLValueType(), toURLRef(m_entries[i]->originalURL().impl()), context))
+ if (filter && !filter(toAPI(m_page), WKPageGetSessionHistoryURLValueType(), toURLRef(m_entries[i]->originalURL().impl()), context))
continue;
RetainPtr<CFStringRef> url(AdoptCF, m_entries[i]->url().createCFString());
@@ -100,6 +103,16 @@ bool WebBackForwardList::restoreFromCFDictionaryRepresentation(CFDictionaryRef d
}
CFIndex size = CFArrayGetCount(cfEntries);
+ if (currentIndex != static_cast<CFIndex>(NoCurrentItemIndex) && currentIndex >= size) {
+ LOG(SessionState, "WebBackForwardList dictionary representation contains an invalid current index (%ld) for the number of entries (%ld)", currentIndex, size);
+ return false;
+ }
+
+ if (currentIndex == static_cast<CFIndex>(NoCurrentItemIndex) && size) {
+ LOG(SessionState, "WebBackForwardList dictionary representation says there is no current item index, but there is a list of %ld entries - this is bogus", size);
+ return false;
+ }
+
BackForwardListItemVector newEntries;
newEntries.reserveCapacity(size);
for (CFIndex i = 0; i < size; ++i) {
@@ -138,6 +151,7 @@ bool WebBackForwardList::restoreFromCFDictionaryRepresentation(CFDictionaryRef d
m_current = currentIndex;
m_entries = newEntries;
+
return true;
}
diff --git a/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp b/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
index c1b7971..2065799 100644
--- a/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
+++ b/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPageProxy.h"
#include "DataReference.h"
@@ -132,7 +133,11 @@ void WebPageProxy::restoreFromSessionStateData(WebData* webData)
for (size_t i = 0; i < size; ++i)
process()->registerNewWebBackForwardListItem(entries[i].get());
- process()->send(Messages::WebPage::RestoreSessionAndNavigateToCurrentItem(SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex())), m_pageID);
+ SandboxExtension::Handle sandboxExtensionHandle;
+ if (WebBackForwardListItem* item = m_backForwardList->currentItem())
+ initializeSandboxExtensionHandle(KURL(KURL(), item->url()), sandboxExtensionHandle);
+
+ process()->send(Messages::WebPage::RestoreSessionAndNavigateToCurrentItem(SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex()), sandboxExtensionHandle), m_pageID);
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/cf/WebPreferencesCF.cpp b/Source/WebKit2/UIProcess/cf/WebPreferencesCF.cpp
index 7b89d04..1b7c2dc 100644
--- a/Source/WebKit2/UIProcess/cf/WebPreferencesCF.cpp
+++ b/Source/WebKit2/UIProcess/cf/WebPreferencesCF.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPreferences.h"
#if !PLATFORM(MAC)
diff --git a/Source/WebKit2/UIProcess/gtk/ChunkedUpdateDrawingAreaProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/ChunkedUpdateDrawingAreaProxyGtk.cpp
new file mode 100644
index 0000000..a5c708f
--- /dev/null
+++ b/Source/WebKit2/UIProcess/gtk/ChunkedUpdateDrawingAreaProxyGtk.cpp
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ * Copyright (C) 2011 Igalia S.L
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ChunkedUpdateDrawingAreaProxy.h"
+
+#include "RefPtrCairo.h"
+#include "UpdateChunk.h"
+#include "WebProcessProxy.h"
+#include "WebView.h"
+
+#include <gdk/gdk.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebPageProxy* ChunkedUpdateDrawingAreaProxy::page()
+{
+ return m_webView->page();
+}
+
+void ChunkedUpdateDrawingAreaProxy::ensureBackingStore()
+{
+ if (m_backingStoreImage)
+ return;
+
+ m_backingStoreImage = gdk_window_create_similar_surface(gtk_widget_get_window(m_webView->window()),
+ CAIRO_CONTENT_COLOR_ALPHA, size().width(), size().height());
+}
+
+void ChunkedUpdateDrawingAreaProxy::invalidateBackingStore()
+{
+ if (m_backingStoreImage) {
+ cairo_surface_destroy(m_backingStoreImage);
+ m_backingStoreImage = 0;
+ }
+}
+
+bool ChunkedUpdateDrawingAreaProxy::platformPaint(const IntRect& rect, cairo_t* cr)
+{
+ if (!m_backingStoreImage)
+ return false;
+
+ cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
+ cairo_set_source_surface(cr, m_backingStoreImage, 0, 0);
+ cairo_fill(cr);
+
+ return true;
+}
+
+void ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore(UpdateChunk* updateChunk)
+{
+ ensureBackingStore();
+
+ RefPtr<cairo_surface_t> pixmap(updateChunk->createImage());
+ if (cairo_surface_status(pixmap.get()) != CAIRO_STATUS_SUCCESS)
+ return;
+
+ const IntRect& updateChunkRect = updateChunk->rect();
+
+ RefPtr<cairo_t> cr = cairo_create(m_backingStoreImage);
+ cairo_set_source_surface(cr.get(), pixmap.get(), updateChunkRect.x(), updateChunkRect.y());
+ cairo_paint(cr.get());
+
+ gtk_widget_queue_draw_area(m_webView->window(), updateChunkRect.x(), updateChunkRect.y(),
+ updateChunkRect.width(), updateChunkRect.height());
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp b/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp
index 3d7ba2d..711783a 100644
--- a/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp
+++ b/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "TextChecker.h"
#include "NotImplemented.h"
diff --git a/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp
index 86ae636..8d6b515 100644
--- a/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp
+++ b/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebInspectorProxy.h"
#if ENABLE(INSPECTOR)
diff --git a/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp
index 71befa4..a36bd0c 100644
--- a/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp
+++ b/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPageProxy.h"
namespace WebKit {
diff --git a/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp
index 3da7323..f7caee8 100644
--- a/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp
+++ b/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPreferences.h"
#include "NotImplemented.h"
diff --git a/Source/WebKit2/UIProcess/mac/BackingStoreMac.mm b/Source/WebKit2/UIProcess/mac/BackingStoreMac.mm
index eacfefa..0a04eed 100644
--- a/Source/WebKit2/UIProcess/mac/BackingStoreMac.mm
+++ b/Source/WebKit2/UIProcess/mac/BackingStoreMac.mm
@@ -23,13 +23,14 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "BackingStore.h"
-
-#include "CGUtilities.h"
-#include "ShareableBitmap.h"
-#include "UpdateInfo.h"
-#include "WebPageProxy.h"
-#include <WebCore/GraphicsContext.h>
+#import "config.h"
+#import "BackingStore.h"
+
+#import "CGUtilities.h"
+#import "ShareableBitmap.h"
+#import "UpdateInfo.h"
+#import "WebPageProxy.h"
+#import <WebCore/GraphicsContext.h>
using namespace WebCore;
diff --git a/Source/WebKit2/UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm b/Source/WebKit2/UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm
index 909745b..a580a57 100644
--- a/Source/WebKit2/UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm
+++ b/Source/WebKit2/UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm
@@ -23,14 +23,15 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "ChunkedUpdateDrawingAreaProxy.h"
+#import "config.h"
+#import "ChunkedUpdateDrawingAreaProxy.h"
-#include "DrawingAreaMessageKinds.h"
-#include "DrawingAreaProxyMessageKinds.h"
-#include "UpdateChunk.h"
-#include "WKAPICast.h"
-#include "WKView.h"
-#include "WebPageProxy.h"
+#import "DrawingAreaMessageKinds.h"
+#import "DrawingAreaProxyMessageKinds.h"
+#import "UpdateChunk.h"
+#import "WKAPICast.h"
+#import "WKView.h"
+#import "WebPageProxy.h"
using namespace WebCore;
@@ -96,7 +97,7 @@ void ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore(UpdateChunk*
// Flip the destination.
CGContextScaleCTM(m_bitmapContext.get(), 1, -1);
- CGContextTranslateCTM(m_bitmapContext.get(), 0, -(updateChunkRect.y() + updateChunkRect.bottom()));
+ CGContextTranslateCTM(m_bitmapContext.get(), 0, -(updateChunkRect.y() + updateChunkRect.maxY()));
CGContextDrawImage(m_bitmapContext.get(), updateChunkRect, image.get());
diff --git a/Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm b/Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm
index 846eb25..1c3aee3 100644
--- a/Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm
+++ b/Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm
@@ -23,16 +23,17 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "LayerBackedDrawingAreaProxy.h"
+#import "config.h"
+#import "LayerBackedDrawingAreaProxy.h"
-#include "DrawingAreaMessageKinds.h"
-#include "DrawingAreaProxyMessageKinds.h"
-#include <QuartzCore/QuartzCore.h>
-#include "WKAPICast.h"
-#include "WKView.h"
-#include "WKViewInternal.h"
-#include "WebKitSystemInterface.h"
-#include "WebPageProxy.h"
+#import "DrawingAreaMessageKinds.h"
+#import "DrawingAreaProxyMessageKinds.h"
+#import <QuartzCore/QuartzCore.h>
+#import "WKAPICast.h"
+#import "WKView.h"
+#import "WKViewInternal.h"
+#import "WebKitSystemInterface.h"
+#import "WebPageProxy.h"
using namespace WebCore;
@@ -89,4 +90,19 @@ void LayerBackedDrawingAreaProxy::detachCompositingContext()
m_compositingRootLayer = 0;
}
+bool LayerBackedDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext context)
+{
+ WebPageProxy* webPageProxy = page();
+ if (webPageProxy->drawsBackground() && webPageProxy->drawsTransparentBackground()) {
+ CGContextSaveGState(context);
+ CGContextSetBlendMode(context, kCGBlendModeCopy);
+ CGContextSetFillColorWithColor(context, CGColorGetConstantColor(kCGColorClear));
+ CGContextFillRect(context, rect);
+
+ CGContextRestoreGState(context);
+ }
+
+ return true;
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm b/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm
index c89011e..ceb140a 100644
--- a/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm
+++ b/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm
@@ -23,23 +23,24 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "TextChecker.h"
+#import "config.h"
+#import "TextChecker.h"
-#include "TextCheckerState.h"
-#include <wtf/RetainPtr.h>
+#import "TextCheckerState.h"
+#import <wtf/RetainPtr.h>
#ifndef BUILDING_ON_SNOW_LEOPARD
#import <AppKit/NSTextChecker.h>
#endif
-static const NSString * const WebAutomaticSpellingCorrectionEnabled = @"WebAutomaticSpellingCorrectionEnabled";
-static const NSString * const WebContinuousSpellCheckingEnabled = @"WebContinuousSpellCheckingEnabled";
-static const NSString * const WebGrammarCheckingEnabled = @"WebGrammarCheckingEnabled";
-static const NSString * const WebSmartInsertDeleteEnabled = @"WebSmartInsertDeleteEnabled";
-static const NSString * const WebAutomaticQuoteSubstitutionEnabled = @"WebAutomaticQuoteSubstitutionEnabled";
-static const NSString * const WebAutomaticDashSubstitutionEnabled = @"WebAutomaticDashSubstitutionEnabled";
-static const NSString * const WebAutomaticLinkDetectionEnabled = @"WebAutomaticLinkDetectionEnabled";
-static const NSString * const WebAutomaticTextReplacementEnabled = @"WebAutomaticTextReplacementEnabled";
+static NSString* const WebAutomaticSpellingCorrectionEnabled = @"WebAutomaticSpellingCorrectionEnabled";
+static NSString* const WebContinuousSpellCheckingEnabled = @"WebContinuousSpellCheckingEnabled";
+static NSString* const WebGrammarCheckingEnabled = @"WebGrammarCheckingEnabled";
+static NSString* const WebSmartInsertDeleteEnabled = @"WebSmartInsertDeleteEnabled";
+static NSString* const WebAutomaticQuoteSubstitutionEnabled = @"WebAutomaticQuoteSubstitutionEnabled";
+static NSString* const WebAutomaticDashSubstitutionEnabled = @"WebAutomaticDashSubstitutionEnabled";
+static NSString* const WebAutomaticLinkDetectionEnabled = @"WebAutomaticLinkDetectionEnabled";
+static NSString* const WebAutomaticTextReplacementEnabled = @"WebAutomaticTextReplacementEnabled";
using namespace WebCore;
diff --git a/Source/WebKit2/UIProcess/mac/WebContextMac.mm b/Source/WebKit2/UIProcess/mac/WebContextMac.mm
index 4d1679f..9f635c1 100644
--- a/Source/WebKit2/UIProcess/mac/WebContextMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebContextMac.mm
@@ -23,12 +23,13 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "WebContext.h"
+#import "config.h"
+#import "WebContext.h"
-#include "WebKitSystemInterface.h"
-#include "WebProcessCreationParameters.h"
-#include <WebCore/FileSystem.h>
-#include <sys/param.h>
+#import "WebKitSystemInterface.h"
+#import "WebProcessCreationParameters.h"
+#import <WebCore/FileSystem.h>
+#import <sys/param.h>
using namespace WebCore;
@@ -90,5 +91,10 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para
parameters.uiProcessBundleResourcePath = fileSystemRepresentation([[NSBundle mainBundle] resourcePath]);
}
+String WebContext::platformDefaultDatabaseDirectory() const
+{
+ return [@"~/Library/WebKit/Databases" stringByStandardizingPath];
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h b/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h
index ee4fa3d..20ffd0b 100644
--- a/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h
+++ b/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h
@@ -29,13 +29,8 @@
#include "WebContextMenuProxy.h"
#include <wtf/RetainPtr.h>
-#ifdef __OBJC__
-@class NSPopUpButtonCell;
-@class WKView;
-#else
-class NSPopUpButtonCell;
-class WKView;
-#endif
+OBJC_CLASS NSPopUpButtonCell;
+OBJC_CLASS WKView;
namespace WebKit {
diff --git a/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm
index d76b997..67139b3 100644
--- a/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm
@@ -23,14 +23,15 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "WebContextMenuProxyMac.h"
+#import "config.h"
+#import "WebContextMenuProxyMac.h"
-#include "PageClientImpl.h"
-#include "WebContextMenuItemData.h"
-#include "WKView.h"
+#import "PageClientImpl.h"
+#import "WebContextMenuItemData.h"
+#import "WKView.h"
-#include <WebCore/IntRect.h>
-#include <WebKitSystemInterface.h>
+#import <WebCore/IntRect.h>
+#import <WebKitSystemInterface.h>
using namespace WebCore;
diff --git a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
index e129094..37a6f97 100644
--- a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import "config.h"
#import "WebInspectorProxy.h"
#if ENABLE(INSPECTOR)
diff --git a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
index cd3e6f1..e641fe0 100644
--- a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
@@ -23,11 +23,12 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "WebPageProxy.h"
+#import "config.h"
+#import "WebPageProxy.h"
-#include "PageClient.h"
-#include <WebCore/Language.h>
-#include <wtf/text/StringConcatenate.h>
+#import "PageClient.h"
+#import <WebCore/Language.h>
+#import <wtf/text/StringConcatenate.h>
@interface NSApplication (Details)
- (void)speakString:(NSString *)string;
diff --git a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h
index 85339d6..788fd20 100644
--- a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h
+++ b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h
@@ -29,13 +29,8 @@
#include "WebPopupMenuProxy.h"
#include <wtf/RetainPtr.h>
-#ifdef __OBJC__
-@class NSPopUpButtonCell;
-@class WKView;
-#else
-class NSPopUpButtonCell;
-class WKView;
-#endif
+OBJC_CLASS NSPopUpButtonCell;
+OBJC_CLASS WKView;
namespace WebKit {
@@ -49,13 +44,13 @@ public:
}
~WebPopupMenuProxyMac();
- virtual void showPopupMenu(const WebCore::IntRect&, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
+ virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
virtual void hidePopupMenu();
private:
WebPopupMenuProxyMac(WKView*, WebPopupMenuProxy::Client* client);
- void populate(const Vector<WebPopupItem>&);
+ void populate(const Vector<WebPopupItem>&, WebCore::TextDirection);
RetainPtr<NSPopUpButtonCell> m_popup;
WKView* m_webView;
diff --git a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm
index 481e8c5..61713fc 100644
--- a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,13 +23,14 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "WebPopupMenuProxyMac.h"
+#import "config.h"
+#import "WebPopupMenuProxyMac.h"
-#include "PageClientImpl.h"
-#include "PlatformPopupMenuData.h"
-#include "WKView.h"
-#include "WebPopupItem.h"
-#include <WebKitSystemInterface.h>
+#import "PageClientImpl.h"
+#import "PlatformPopupMenuData.h"
+#import "WKView.h"
+#import "WebPopupItem.h"
+#import <WebKitSystemInterface.h>
using namespace WebCore;
@@ -47,7 +48,7 @@ WebPopupMenuProxyMac::~WebPopupMenuProxyMac()
[m_popup.get() setControlView:nil];
}
-void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items)
+void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items, TextDirection menuTextDirection)
{
if (m_popup)
[m_popup.get() removeAllItems];
@@ -63,20 +64,38 @@ void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items)
if (items[i].m_type == WebPopupItem::Seperator)
[[m_popup.get() menu] addItem:[NSMenuItem separatorItem]];
else {
- [m_popup.get() addItemWithTitle:nsStringFromWebCoreString(items[i].m_text)];
- NSMenuItem* menuItem = [m_popup.get() lastItem];
+ [m_popup.get() addItemWithTitle:@""];
+ NSMenuItem *menuItem = [m_popup.get() lastItem];
+
+ RetainPtr<NSMutableParagraphStyle> paragraphStyle(AdoptNS, [[NSParagraphStyle defaultParagraphStyle] mutableCopy]);
+ NSWritingDirection writingDirection = items[i].m_textDirection == LTR ? NSWritingDirectionLeftToRight : NSWritingDirectionRightToLeft;
+ [paragraphStyle.get() setBaseWritingDirection:writingDirection];
+ [paragraphStyle.get() setAlignment:menuTextDirection == LTR ? NSLeftTextAlignment : NSRightTextAlignment];
+ RetainPtr<NSMutableDictionary> attributes(AdoptNS, [[NSMutableDictionary alloc] initWithObjectsAndKeys:
+ paragraphStyle.get(), NSParagraphStyleAttributeName,
+ [m_popup.get() font], NSFontAttributeName,
+ nil]);
+ if (items[i].m_hasTextDirectionOverride) {
+ RetainPtr<NSNumber> writingDirectionValue(AdoptNS, [[NSNumber alloc] initWithInteger:writingDirection + NSTextWritingDirectionOverride]);
+ RetainPtr<NSArray> writingDirectionArray(AdoptNS, [[NSArray alloc] initWithObjects:writingDirectionValue.get(), nil]);
+ [attributes.get() setObject:writingDirectionArray.get() forKey:NSWritingDirectionAttributeName];
+ }
+ RetainPtr<NSAttributedString> string(AdoptNS, [[NSAttributedString alloc] initWithString:nsStringFromWebCoreString(items[i].m_text) attributes:attributes.get()]);
+
+ [menuItem setAttributedTitle:string.get()];
[menuItem setEnabled:items[i].m_isEnabled];
[menuItem setToolTip:nsStringFromWebCoreString(items[i].m_toolTip)];
}
}
}
-void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex)
+void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, TextDirection textDirection, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex)
{
- populate(items);
+ populate(items, textDirection);
[m_popup.get() attachPopUpWithFrame:rect inView:m_webView];
[m_popup.get() selectItemAtIndex:selectedIndex];
+ [m_popup.get() setUserInterfaceLayoutDirection:textDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft];
NSMenu* menu = [m_popup.get() menu];
@@ -97,7 +116,8 @@ void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, const Vector<WebPo
[m_popup.get() dismissPopUp];
[dummyView.get() removeFromSuperview];
- m_client->valueChangedForPopupMenu(this, [m_popup.get() indexOfSelectedItem]);
+ if (m_client)
+ m_client->valueChangedForPopupMenu(this, [m_popup.get() indexOfSelectedItem]);
}
void WebPopupMenuProxyMac::hidePopupMenu()
@@ -105,5 +125,4 @@ void WebPopupMenuProxyMac::hidePopupMenu()
[m_popup.get() dismissPopUp];
}
-
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm b/Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm
index b954bd2..f2f41d3 100644
--- a/Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm
@@ -23,10 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "WebPreferences.h"
+#import "config.h"
+#import "WebPreferences.h"
-#include "PageClientImpl.h"
-#include <wtf/text/StringConcatenate.h>
+#import "PageClientImpl.h"
+#import <wtf/text/StringConcatenate.h>
namespace WebKit {
diff --git a/Source/WebKit2/UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp b/Source/WebKit2/UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp
index 06ce7c6..c323fef 100644
--- a/Source/WebKit2/UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ChunkedUpdateDrawingAreaProxy.h"
#include "DrawingAreaMessageKinds.h"
@@ -73,7 +74,7 @@ void ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore(UpdateChunk*
const IntRect& updateChunkRect = updateChunk->rect();
QPainter painter(&m_backingStoreImage);
- painter.drawImage(updateChunkRect.topLeft(), image);
+ painter.drawImage(updateChunkRect.location(), image);
m_webView->update(QRect(updateChunkRect));
}
diff --git a/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp b/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp
index 9ab6297..2e124d5 100644
--- a/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "TextChecker.h"
#include "NotImplemented.h"
diff --git a/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp b/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp
index 59faa1e..5dda454 100644
--- a/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "TiledDrawingAreaProxy.h"
#if ENABLE(TILED_BACKING_STORE)
diff --git a/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp b/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp
index 2b631ca..11e325f 100644
--- a/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "TiledDrawingAreaTile.h"
#if ENABLE(TILED_BACKING_STORE)
@@ -88,11 +89,11 @@ void TiledDrawingAreaTile::invalidate(const IntRect& dirtyRect)
void TiledDrawingAreaTile::resize(const IntSize& newSize)
{
IntRect oldRect = m_rect;
- m_rect = IntRect(m_rect.topLeft(), newSize);
- if (m_rect.right() > oldRect.right())
- invalidate(IntRect(oldRect.right(), oldRect.y(), m_rect.right() - oldRect.right(), m_rect.height()));
- if (m_rect.bottom() > oldRect.bottom())
- invalidate(IntRect(oldRect.x(), oldRect.bottom(), m_rect.width(), m_rect.bottom() - oldRect.bottom()));
+ m_rect = IntRect(m_rect.location(), newSize);
+ if (m_rect.maxX() > oldRect.maxX())
+ invalidate(IntRect(oldRect.maxX(), oldRect.y(), m_rect.maxX() - oldRect.maxX(), m_rect.height()));
+ if (m_rect.maxY() > oldRect.maxY())
+ invalidate(IntRect(oldRect.x(), oldRect.maxY(), m_rect.width(), m_rect.maxY() - oldRect.maxY()));
}
void TiledDrawingAreaTile::swapBackBufferToFront()
@@ -131,7 +132,7 @@ void TiledDrawingAreaTile::updateFromChunk(UpdateChunk* updateChunk, float)
if (m_backBuffer.isNull())
m_backBuffer = m_buffer.isNull() ? QPixmap(m_proxy->tileSize()) : m_buffer;
QPainter painter(&m_backBuffer);
- IntSize drawPoint = updateChunkRect.topLeft() - m_rect.topLeft();
+ IntSize drawPoint = updateChunkRect.location() - m_rect.location();
painter.drawImage(QPoint(drawPoint.width(), drawPoint.height()), image);
}
m_hasUpdatePending = false;
diff --git a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp
index 566a22e..09638b6 100644
--- a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebContextMenuProxyQt.h"
#include <IntPoint.h>
diff --git a/Source/WebKit2/UIProcess/qt/WebContextQt.cpp b/Source/WebKit2/UIProcess/qt/WebContextQt.cpp
index 5b2cd88..c1301d5 100644
--- a/Source/WebKit2/UIProcess/qt/WebContextQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/WebContextQt.cpp
@@ -24,10 +24,12 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebContext.h"
#include "ApplicationCacheStorage.h"
#include "WebProcessCreationParameters.h"
+#include <QProcess>
namespace WebKit {
@@ -42,6 +44,13 @@ String WebContext::applicationCacheDirectory()
void WebContext::platformInitializeWebProcess(WebProcessCreationParameters&)
{
+ qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
+}
+
+String WebContext::platformDefaultDatabaseDirectory() const
+{
+ // FIXME: Implement.
+ return "";
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp
index c04bd99..fe0dac5 100644
--- a/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebInspectorProxy.h"
#if ENABLE(INSPECTOR)
diff --git a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp
index baf765a..1fa90bb 100644
--- a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPageProxy.h"
namespace WebKit {
diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp
index 5e13499..a79cc3c 100644
--- a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPopupMenuProxyQt.h"
#include "PlatformPopupMenuData.h"
@@ -41,7 +42,7 @@ WebPopupMenuProxyQt::~WebPopupMenuProxyQt()
{
}
-void WebPopupMenuProxyQt::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex)
+void WebPopupMenuProxyQt::showPopupMenu(const IntRect& rect, WebCore::TextDirection, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex)
{
}
diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h
index e6c7a1e..f41432c 100644
--- a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h
+++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h
@@ -38,7 +38,7 @@ public:
}
~WebPopupMenuProxyQt();
- virtual void showPopupMenu(const WebCore::IntRect&, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
+ virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
virtual void hidePopupMenu();
private:
diff --git a/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp b/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp
index 173cfd5..fae4a2d 100644
--- a/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPreferences.h"
namespace WebKit {
diff --git a/Source/WebKit2/UIProcess/win/BackingStoreWin.cpp b/Source/WebKit2/UIProcess/win/BackingStoreWin.cpp
new file mode 100644
index 0000000..801376f
--- /dev/null
+++ b/Source/WebKit2/UIProcess/win/BackingStoreWin.cpp
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "BackingStore.h"
+
+#include "ShareableBitmap.h"
+#include "UpdateInfo.h"
+#include <WebCore/BitmapInfo.h>
+#include <WebCore/GraphicsContext.h>
+#include <WebCore/IntRect.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+class BitmapDC {
+ WTF_MAKE_NONCOPYABLE(BitmapDC);
+
+public:
+ BitmapDC(HBITMAP, HDC destinationDC);
+ ~BitmapDC();
+
+ operator HDC() const { return m_dc.get(); }
+
+private:
+ OwnPtr<HDC> m_dc;
+ HBITMAP m_originalBitmap;
+};
+
+BitmapDC::BitmapDC(HBITMAP bitmap, HDC destinationDC)
+ : m_dc(adoptPtr(::CreateCompatibleDC(destinationDC)))
+ , m_originalBitmap(static_cast<HBITMAP>(::SelectObject(m_dc.get(), bitmap)))
+{
+}
+
+BitmapDC::~BitmapDC()
+{
+ ::SelectObject(m_dc.get(), m_originalBitmap);
+}
+
+void BackingStore::paint(HDC dc, const IntRect& rect)
+{
+ ASSERT(m_bitmap);
+ ::BitBlt(dc, rect.x(), rect.y(), rect.width(), rect.height(), BitmapDC(m_bitmap.get(), dc), rect.x(), rect.y(), SRCCOPY);
+}
+
+static PassOwnPtr<HBITMAP> createBitmap(const IntSize& size)
+{
+ // FIXME: Maybe it would be better for performance to create a device-dependent bitmap here?
+ BitmapInfo info = BitmapInfo::createBottomUp(size);
+ void* bits;
+ return adoptPtr(::CreateDIBSection(0, &info, DIB_RGB_COLORS, &bits, 0, 0));
+}
+
+void BackingStore::incorporateUpdate(ShareableBitmap* bitmap, const UpdateInfo& updateInfo)
+{
+ if (!m_bitmap)
+ m_bitmap = createBitmap(m_size);
+
+ scroll(updateInfo.scrollRect, updateInfo.scrollOffset);
+
+ IntPoint updateRectLocation = updateInfo.updateRectBounds.location();
+
+ BitmapDC dc(m_bitmap.get(), 0);
+ GraphicsContext graphicsContext(dc);
+
+ // Paint all update rects.
+ for (size_t i = 0; i < updateInfo.updateRects.size(); ++i) {
+ IntRect updateRect = updateInfo.updateRects[i];
+ IntRect srcRect = updateRect;
+ srcRect.move(-updateRectLocation.x(), -updateRectLocation.y());
+
+ bitmap->paint(graphicsContext, updateRect.location(), srcRect);
+ }
+}
+
+void BackingStore::scroll(const IntRect& scrollRect, const IntSize& scrollOffset)
+{
+ if (scrollOffset.isZero())
+ return;
+
+ RECT winScrollRect = scrollRect;
+ ::ScrollDC(BitmapDC(m_bitmap.get(), 0), scrollOffset.width(), scrollOffset.height(), &winScrollRect, &winScrollRect, 0, 0);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/win/ChunkedUpdateDrawingAreaProxyWin.cpp b/Source/WebKit2/UIProcess/win/ChunkedUpdateDrawingAreaProxyWin.cpp
index 6a1ee36..e7ce37a 100644
--- a/Source/WebKit2/UIProcess/win/ChunkedUpdateDrawingAreaProxyWin.cpp
+++ b/Source/WebKit2/UIProcess/win/ChunkedUpdateDrawingAreaProxyWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ChunkedUpdateDrawingAreaProxy.h"
#include "UpdateChunk.h"
diff --git a/Source/WebKit2/UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp b/Source/WebKit2/UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp
index 8259272..58dc3b0 100644
--- a/Source/WebKit2/UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp
+++ b/Source/WebKit2/UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp
@@ -23,10 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if USE(ACCELERATED_COMPOSITING)
-
+#include "config.h"
#include "LayerBackedDrawingAreaProxy.h"
+#if USE(ACCELERATED_COMPOSITING)
+
#include "DrawingAreaMessageKinds.h"
#include "DrawingAreaProxyMessageKinds.h"
#include "WebView.h"
diff --git a/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp b/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp
index 3c4b1eb..a16f169 100644
--- a/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp
+++ b/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp
@@ -23,8 +23,10 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "TextChecker.h"
+#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
#include "NotImplemented.h"
#include "TextCheckerState.h"
diff --git a/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp
index 090598f..f8f3a24 100644
--- a/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp
+++ b/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebContextMenuProxyWin.h"
#include "NotImplemented.h"
diff --git a/Source/WebKit2/UIProcess/win/WebContextWin.cpp b/Source/WebKit2/UIProcess/win/WebContextWin.cpp
index 83b586d..210d6cc 100644
--- a/Source/WebKit2/UIProcess/win/WebContextWin.cpp
+++ b/Source/WebKit2/UIProcess/win/WebContextWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebContext.h"
#include "WebProcessCreationParameters.h"
@@ -52,5 +53,10 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para
parameters.shouldPaintNativeControls = m_shouldPaintNativeControls;
}
+String WebContext::platformDefaultDatabaseDirectory() const
+{
+ return WebCore::pathByAppendingComponent(WebCore::localUserSpecificStorageDirectory(), "Databases");
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp
index 7637429..35d73ac 100644
--- a/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp
+++ b/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebInspectorProxy.h"
#if ENABLE(INSPECTOR)
@@ -171,10 +172,13 @@ void WebInspectorProxy::platformOpen()
void WebInspectorProxy::platformClose()
{
- ASSERT(m_inspectorWindow);
- ASSERT(m_inspectorView);
+ ASSERT(!m_isVisible || m_inspectorWindow);
+ ASSERT(!m_isVisible || m_inspectorView);
- ::DestroyWindow(m_inspectorWindow);
+ if (m_inspectorWindow) {
+ ASSERT(::IsWindow(m_inspectorWindow));
+ ::DestroyWindow(m_inspectorWindow);
+ }
m_inspectorWindow = 0;
m_inspectorView = 0;
diff --git a/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp
index 6b0efd1..f70363c 100644
--- a/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp
+++ b/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPageProxy.h"
#include <tchar.h>
diff --git a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp
index 40e3556..4039c49 100644
--- a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp
+++ b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp
@@ -26,6 +26,7 @@
// NOTE: This implementation is very similar to the implementation of popups in WebCore::PopupMenuWin.
// We should try and factor out the common bits and share them.
+#include "config.h"
#include "WebPopupMenuProxyWin.h"
#include "WebView.h"
@@ -187,7 +188,7 @@ WebPopupMenuProxyWin::~WebPopupMenuProxyWin()
m_scrollbar->setParent(0);
}
-void WebPopupMenuProxyWin::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t selectedIndex)
+void WebPopupMenuProxyWin::showPopupMenu(const IntRect& rect, TextDirection, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t selectedIndex)
{
m_items = items;
m_data = data;
@@ -323,7 +324,8 @@ void WebPopupMenuProxyWin::showPopupMenu(const IntRect& rect, const Vector<WebPo
m_showPopup = false;
::ShowWindow(m_popup, SW_HIDE);
- m_client->valueChangedForPopupMenu(this, m_newSelectedIndex);
+ if (m_client)
+ m_client->valueChangedForPopupMenu(this, m_newSelectedIndex);
}
void WebPopupMenuProxyWin::hidePopupMenu()
@@ -372,7 +374,7 @@ void WebPopupMenuProxyWin::calculatePositionAndSize(const IntRect& rect)
// Always left-align items in the popup. This matches popup menus on the mac.
int popupX = rectInScreenCoords.x() + m_data.m_clientInsetLeft;
- IntRect popupRect(popupX, rectInScreenCoords.bottom(), popupWidth, popupHeight);
+ IntRect popupRect(popupX, rectInScreenCoords.maxY(), popupWidth, popupHeight);
// The popup needs to stay within the bounds of the screen and not overlap any toolbars
HMONITOR monitor = ::MonitorFromWindow(m_webView->window(), MONITOR_DEFAULTTOPRIMARY);
@@ -382,7 +384,7 @@ void WebPopupMenuProxyWin::calculatePositionAndSize(const IntRect& rect)
FloatRect screen = monitorInfo.rcWork;
// Check that we don't go off the screen vertically
- if (popupRect.bottom() > screen.height()) {
+ if (popupRect.maxY() > screen.height()) {
// The popup will go off the screen, so try placing it above the client
if (rectInScreenCoords.y() - popupRect.height() < 0) {
// The popup won't fit above, either, so place it whereever's bigger and resize it to fit
@@ -848,8 +850,10 @@ bool WebPopupMenuProxyWin::setFocusedIndex(int i, bool hotTracking)
m_focusedIndex = i;
- if (!hotTracking)
- m_client->setTextFromItemForPopupMenu(this, i);
+ if (!hotTracking) {
+ if (m_client)
+ m_client->setTextFromItemForPopupMenu(this, i);
+ }
if (!scrollToRevealSelection())
::UpdateWindow(m_popup);
diff --git a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h
index d1dc466..2d09bb9 100644
--- a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h
+++ b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h
@@ -48,7 +48,7 @@ public:
}
~WebPopupMenuProxyWin();
- virtual void showPopupMenu(const WebCore::IntRect&, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
+ virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
virtual void hidePopupMenu();
void hide() { hidePopupMenu(); }
diff --git a/Source/WebKit2/UIProcess/win/WebView.cpp b/Source/WebKit2/UIProcess/win/WebView.cpp
index 4516f54..eea43c5 100644
--- a/Source/WebKit2/UIProcess/win/WebView.cpp
+++ b/Source/WebKit2/UIProcess/win/WebView.cpp
@@ -23,14 +23,18 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebView.h"
#include "ChunkedUpdateDrawingAreaProxy.h"
+#include "DrawingAreaProxyImpl.h"
#include "FindIndicator.h"
#include "LayerBackedDrawingAreaProxy.h"
#include "Logging.h"
-#include "RunLoop.h"
#include "NativeWebKeyboardEvent.h"
+#include "Region.h"
+#include "RunLoop.h"
+#include "WKAPICast.h"
#include "WebContext.h"
#include "WebContextMenuProxyWin.h"
#include "WebEditCommandProxy.h"
@@ -38,8 +42,10 @@
#include "WebPageProxy.h"
#include "WebPopupMenuProxyWin.h"
#include <Commctrl.h>
+#include <WebCore/BitmapInfo.h>
#include <WebCore/Cursor.h>
#include <WebCore/FloatRect.h>
+#include <WebCore/GraphicsContextCG.h>
#include <WebCore/IntRect.h>
#include <WebCore/SoftLinking.h>
#include <WebCore/WebCoreInstanceHandle.h>
@@ -47,17 +53,17 @@
#include <wtf/text/WTFString.h>
namespace Ime {
- // We need these functions in a separate namespace, because in the global namespace they conflict
- // with the definitions in imm.h only by the type modifier (the macro defines them as static) and
- // imm.h is included by windows.h
- SOFT_LINK_LIBRARY(IMM32)
- SOFT_LINK(IMM32, ImmGetContext, HIMC, WINAPI, (HWND hwnd), (hwnd))
- SOFT_LINK(IMM32, ImmReleaseContext, BOOL, WINAPI, (HWND hWnd, HIMC hIMC), (hWnd, hIMC))
- SOFT_LINK(IMM32, ImmGetCompositionStringW, LONG, WINAPI, (HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen), (hIMC, dwIndex, lpBuf, dwBufLen))
- SOFT_LINK(IMM32, ImmSetCandidateWindow, BOOL, WINAPI, (HIMC hIMC, LPCANDIDATEFORM lpCandidate), (hIMC, lpCandidate))
- SOFT_LINK(IMM32, ImmSetOpenStatus, BOOL, WINAPI, (HIMC hIMC, BOOL fOpen), (hIMC, fOpen))
- SOFT_LINK(IMM32, ImmNotifyIME, BOOL, WINAPI, (HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue), (hIMC, dwAction, dwIndex, dwValue))
- SOFT_LINK(IMM32, ImmAssociateContextEx, BOOL, WINAPI, (HWND hWnd, HIMC hIMC, DWORD dwFlags), (hWnd, hIMC, dwFlags))
+// We need these functions in a separate namespace, because in the global namespace they conflict
+// with the definitions in imm.h only by the type modifier (the macro defines them as static) and
+// imm.h is included by windows.h
+SOFT_LINK_LIBRARY(IMM32)
+SOFT_LINK(IMM32, ImmGetContext, HIMC, WINAPI, (HWND hwnd), (hwnd))
+SOFT_LINK(IMM32, ImmReleaseContext, BOOL, WINAPI, (HWND hWnd, HIMC hIMC), (hWnd, hIMC))
+SOFT_LINK(IMM32, ImmGetCompositionStringW, LONG, WINAPI, (HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen), (hIMC, dwIndex, lpBuf, dwBufLen))
+SOFT_LINK(IMM32, ImmSetCandidateWindow, BOOL, WINAPI, (HIMC hIMC, LPCANDIDATEFORM lpCandidate), (hIMC, lpCandidate))
+SOFT_LINK(IMM32, ImmSetOpenStatus, BOOL, WINAPI, (HIMC hIMC, BOOL fOpen), (hIMC, fOpen))
+SOFT_LINK(IMM32, ImmNotifyIME, BOOL, WINAPI, (HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue), (hIMC, dwAction, dwIndex, dwValue))
+SOFT_LINK(IMM32, ImmAssociateContextEx, BOOL, WINAPI, (HWND hWnd, HIMC hIMC, DWORD dwFlags), (hWnd, hIMC, dwFlags))
};
using namespace WebCore;
@@ -76,6 +82,13 @@ enum {
UpdateActiveStateTimer = 1,
};
+static bool useNewDrawingArea()
+{
+ // FIXME: Remove this function and the old drawing area code once we aren't interested in
+ // testing the old drawing area anymore.
+ return true;
+}
+
LRESULT CALLBACK WebView::WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
LONG_PTR longPtr = ::GetWindowLongPtr(hWnd, 0);
@@ -100,93 +113,93 @@ LRESULT WebView::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
bool handled = true;
switch (message) {
- case WM_CLOSE:
- m_page->tryClose();
- break;
- case WM_DESTROY:
- m_isBeingDestroyed = true;
- close();
- break;
- case WM_ERASEBKGND:
- lResult = 1;
- break;
- case WM_PAINT:
- lResult = onPaintEvent(hWnd, message, wParam, lParam, handled);
- break;
- case WM_PRINTCLIENT:
- lResult = onPrintClientEvent(hWnd, message, wParam, lParam, handled);
- break;
- case WM_MOUSEACTIVATE:
- setWasActivatedByMouseEvent(true);
- handled = false;
- break;
- case WM_MOUSEMOVE:
- case WM_LBUTTONDOWN:
- case WM_MBUTTONDOWN:
- case WM_RBUTTONDOWN:
- case WM_LBUTTONDBLCLK:
- case WM_MBUTTONDBLCLK:
- case WM_RBUTTONDBLCLK:
- case WM_LBUTTONUP:
- case WM_MBUTTONUP:
- case WM_RBUTTONUP:
- case WM_MOUSELEAVE:
- lResult = onMouseEvent(hWnd, message, wParam, lParam, handled);
- break;
- case WM_MOUSEWHEEL:
- case WM_VISTA_MOUSEHWHEEL:
- lResult = onWheelEvent(hWnd, message, wParam, lParam, handled);
- break;
- case WM_SYSKEYDOWN:
- case WM_KEYDOWN:
- case WM_SYSCHAR:
- case WM_CHAR:
- case WM_SYSKEYUP:
- case WM_KEYUP:
- lResult = onKeyEvent(hWnd, message, wParam, lParam, handled);
- break;
- case WM_SIZE:
- lResult = onSizeEvent(hWnd, message, wParam, lParam, handled);
- break;
- case WM_WINDOWPOSCHANGED:
- lResult = onWindowPositionChangedEvent(hWnd, message, wParam, lParam, handled);
- break;
- case WM_SETFOCUS:
- lResult = onSetFocusEvent(hWnd, message, wParam, lParam, handled);
- break;
- case WM_KILLFOCUS:
- lResult = onKillFocusEvent(hWnd, message, wParam, lParam, handled);
- break;
- case WM_TIMER:
- lResult = onTimerEvent(hWnd, message, wParam, lParam, handled);
- break;
- case WM_SHOWWINDOW:
- lResult = onShowWindowEvent(hWnd, message, wParam, lParam, handled);
- break;
- case WM_SETCURSOR:
- lResult = onSetCursor(hWnd, message, wParam, lParam, handled);
- break;
- case WM_IME_STARTCOMPOSITION:
- handled = onIMEStartComposition();
- break;
- case WM_IME_REQUEST:
- lResult = onIMERequest(wParam, lParam);
- break;
- case WM_IME_COMPOSITION:
- handled = onIMEComposition(lParam);
- break;
- case WM_IME_ENDCOMPOSITION:
- handled = onIMEEndComposition();
- break;
- case WM_IME_SELECT:
- handled = onIMESelect(wParam, lParam);
- break;
- case WM_IME_SETCONTEXT:
- handled = onIMESetContext(wParam, lParam);
- break;
- default:
- handled = false;
- break;
+ case WM_CLOSE:
+ m_page->tryClose();
+ break;
+ case WM_DESTROY:
+ m_isBeingDestroyed = true;
+ close();
+ break;
+ case WM_ERASEBKGND:
+ lResult = 1;
+ break;
+ case WM_PAINT:
+ lResult = onPaintEvent(hWnd, message, wParam, lParam, handled);
+ break;
+ case WM_PRINTCLIENT:
+ lResult = onPrintClientEvent(hWnd, message, wParam, lParam, handled);
+ break;
+ case WM_MOUSEACTIVATE:
+ setWasActivatedByMouseEvent(true);
+ handled = false;
+ break;
+ case WM_MOUSEMOVE:
+ case WM_LBUTTONDOWN:
+ case WM_MBUTTONDOWN:
+ case WM_RBUTTONDOWN:
+ case WM_LBUTTONDBLCLK:
+ case WM_MBUTTONDBLCLK:
+ case WM_RBUTTONDBLCLK:
+ case WM_LBUTTONUP:
+ case WM_MBUTTONUP:
+ case WM_RBUTTONUP:
+ case WM_MOUSELEAVE:
+ lResult = onMouseEvent(hWnd, message, wParam, lParam, handled);
+ break;
+ case WM_MOUSEWHEEL:
+ case WM_VISTA_MOUSEHWHEEL:
+ lResult = onWheelEvent(hWnd, message, wParam, lParam, handled);
+ break;
+ case WM_SYSKEYDOWN:
+ case WM_KEYDOWN:
+ case WM_SYSCHAR:
+ case WM_CHAR:
+ case WM_SYSKEYUP:
+ case WM_KEYUP:
+ lResult = onKeyEvent(hWnd, message, wParam, lParam, handled);
+ break;
+ case WM_SIZE:
+ lResult = onSizeEvent(hWnd, message, wParam, lParam, handled);
+ break;
+ case WM_WINDOWPOSCHANGED:
+ lResult = onWindowPositionChangedEvent(hWnd, message, wParam, lParam, handled);
+ break;
+ case WM_SETFOCUS:
+ lResult = onSetFocusEvent(hWnd, message, wParam, lParam, handled);
+ break;
+ case WM_KILLFOCUS:
+ lResult = onKillFocusEvent(hWnd, message, wParam, lParam, handled);
+ break;
+ case WM_TIMER:
+ lResult = onTimerEvent(hWnd, message, wParam, lParam, handled);
+ break;
+ case WM_SHOWWINDOW:
+ lResult = onShowWindowEvent(hWnd, message, wParam, lParam, handled);
+ break;
+ case WM_SETCURSOR:
+ lResult = onSetCursor(hWnd, message, wParam, lParam, handled);
+ break;
+ case WM_IME_STARTCOMPOSITION:
+ handled = onIMEStartComposition();
+ break;
+ case WM_IME_REQUEST:
+ lResult = onIMERequest(wParam, lParam);
+ break;
+ case WM_IME_COMPOSITION:
+ handled = onIMEComposition(lParam);
+ break;
+ case WM_IME_ENDCOMPOSITION:
+ handled = onIMEEndComposition();
+ break;
+ case WM_IME_SELECT:
+ handled = onIMESelect(wParam, lParam);
+ break;
+ case WM_IME_SETCONTEXT:
+ handled = onIMESetContext(wParam, lParam);
+ break;
+ default:
+ handled = false;
+ break;
}
if (!handled)
@@ -232,18 +245,23 @@ WebView::WebView(RECT rect, WebContext* context, WebPageGroup* pageGroup, HWND p
, m_wasActivatedByMouseEvent(false)
, m_isBeingDestroyed(false)
, m_inIMEComposition(0)
+ , m_findIndicatorCallback(0)
+ , m_findIndicatorCallbackContext(0)
{
registerWebViewWindowClass();
- m_page = context->createWebPage(this, pageGroup);
-
- m_window = ::CreateWindowEx(0, kWebKit2WebViewWindowClassName, 0, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
+ m_window = ::CreateWindowExW(0, kWebKit2WebViewWindowClassName, 0, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE,
rect.top, rect.left, rect.right - rect.left, rect.bottom - rect.top, parentWindow ? parentWindow : HWND_MESSAGE, 0, instanceHandle(), this);
ASSERT(::IsWindow(m_window));
+ // We only check our window style, and not ::IsWindowVisible, because m_isVisible only tracks
+ // this window's visibility status, while ::IsWindowVisible takes our ancestors' visibility
+ // status into account. <http://webkit.org/b/54104>
+ ASSERT(m_isVisible == static_cast<bool>(::GetWindowLong(m_window, GWL_STYLE) & WS_VISIBLE));
+ m_page = context->createWebPage(this, pageGroup);
m_page->initializeWebPage();
- ::ShowWindow(m_window, SW_SHOW);
+ CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER, IID_IDropTargetHelper, (void**)&m_dropTargetHelper);
// FIXME: Initializing the tooltip window here matches WebKit win, but seems like something
// we could do on demand to save resources.
@@ -260,6 +278,11 @@ WebView::~WebView()
::DestroyWindow(m_toolTipWindow);
}
+void WebView::initialize()
+{
+ ::RegisterDragDrop(m_window, this);
+}
+
void WebView::setParentWindow(HWND parentWindow)
{
if (m_window) {
@@ -325,29 +348,29 @@ LRESULT WebView::onMouseEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
setWasActivatedByMouseEvent(false);
switch (message) {
- case WM_LBUTTONDOWN:
- case WM_MBUTTONDOWN:
- case WM_RBUTTONDOWN:
- ::SetFocus(m_window);
- ::SetCapture(m_window);
- break;
- case WM_LBUTTONUP:
- case WM_MBUTTONUP:
- case WM_RBUTTONUP:
- ::ReleaseCapture();
- break;
- case WM_MOUSEMOVE:
- startTrackingMouseLeave();
- break;
- case WM_MOUSELEAVE:
- stopTrackingMouseLeave();
- break;
- case WM_LBUTTONDBLCLK:
- case WM_MBUTTONDBLCLK:
- case WM_RBUTTONDBLCLK:
- break;
- default:
- ASSERT_NOT_REACHED();
+ case WM_LBUTTONDOWN:
+ case WM_MBUTTONDOWN:
+ case WM_RBUTTONDOWN:
+ ::SetFocus(m_window);
+ ::SetCapture(m_window);
+ break;
+ case WM_LBUTTONUP:
+ case WM_MBUTTONUP:
+ case WM_RBUTTONUP:
+ ::ReleaseCapture();
+ break;
+ case WM_MOUSEMOVE:
+ startTrackingMouseLeave();
+ break;
+ case WM_MOUSELEAVE:
+ stopTrackingMouseLeave();
+ break;
+ case WM_LBUTTONDBLCLK:
+ case WM_MBUTTONDBLCLK:
+ case WM_RBUTTONDBLCLK:
+ break;
+ default:
+ ASSERT_NOT_REACHED();
}
m_page->handleMouseEvent(mouseEvent);
@@ -382,19 +405,45 @@ LRESULT WebView::onKeyEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
return 0;
}
+static void drawPageBackground(HDC dc, const RECT& rect)
+{
+ // Mac checks WebPageProxy::drawsBackground and
+ // WebPageProxy::drawsTransparentBackground here, but those are always false on
+ // Windows currently (see <http://webkit.org/b/52009>).
+ ::FillRect(dc, &rect, reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1));
+}
+
+void WebView::paint(HDC hdc, const IntRect& dirtyRect)
+{
+ if (useNewDrawingArea()) {
+ if (DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(m_page->drawingArea())) {
+ // FIXME: We should port WebKit1's rect coalescing logic here.
+ Region unpaintedRegion;
+ drawingArea->paint(hdc, dirtyRect, unpaintedRegion);
+
+ Vector<IntRect> unpaintedRects = unpaintedRegion.rects();
+ for (size_t i = 0; i < unpaintedRects.size(); ++i) {
+ RECT winRect = unpaintedRects[i];
+ drawPageBackground(hdc, unpaintedRects[i]);
+ }
+ } else
+ drawPageBackground(hdc, dirtyRect);
+
+ m_page->didDraw();
+ } else {
+ if (m_page->isValid() && m_page->drawingArea() && m_page->drawingArea()->paint(dirtyRect, hdc))
+ m_page->didDraw();
+ else
+ drawPageBackground(hdc, dirtyRect);
+ }
+}
+
LRESULT WebView::onPaintEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled)
{
PAINTSTRUCT paintStruct;
HDC hdc = ::BeginPaint(m_window, &paintStruct);
- if (m_page->isValid() && m_page->drawingArea() && m_page->drawingArea()->paint(IntRect(paintStruct.rcPaint), hdc))
- m_page->didDraw();
- else {
- // Mac checks WebPageProxy::drawsBackground and
- // WebPageProxy::drawsTransparentBackground here, but those are always false on Windows
- // currently (see <http://webkit.org/b/52009>).
- ::FillRect(hdc, &paintStruct.rcPaint, reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1));
- }
+ paint(hdc, paintStruct.rcPaint);
::EndPaint(m_window, &paintStruct);
@@ -407,9 +456,8 @@ LRESULT WebView::onPrintClientEvent(HWND hWnd, UINT, WPARAM wParam, LPARAM, bool
HDC hdc = reinterpret_cast<HDC>(wParam);
RECT winRect;
::GetClientRect(hWnd, &winRect);
- IntRect rect = winRect;
- m_page->drawingArea()->paint(rect, hdc);
+ paint(hdc, winRect);
handled = true;
return 0;
@@ -420,8 +468,8 @@ LRESULT WebView::onSizeEvent(HWND, UINT, WPARAM, LPARAM lParam, bool& handled)
int width = LOWORD(lParam);
int height = HIWORD(lParam);
- if (m_page->drawingArea())
- m_page->drawingArea()->setSize(IntSize(width, height));
+ if (m_page && m_page->drawingArea())
+ m_page->drawingArea()->setSize(IntSize(width, height), IntSize());
handled = true;
return 0;
@@ -453,10 +501,10 @@ LRESULT WebView::onKillFocusEvent(HWND, UINT, WPARAM, LPARAM lParam, bool& handl
LRESULT WebView::onTimerEvent(HWND hWnd, UINT, WPARAM wParam, LPARAM, bool& handled)
{
switch (wParam) {
- case UpdateActiveStateTimer:
- ::KillTimer(hWnd, UpdateActiveStateTimer);
- updateActiveState();
- break;
+ case UpdateActiveStateTimer:
+ ::KillTimer(hWnd, UpdateActiveStateTimer);
+ updateActiveState();
+ break;
}
handled = true;
@@ -466,14 +514,15 @@ LRESULT WebView::onTimerEvent(HWND hWnd, UINT, WPARAM wParam, LPARAM, bool& hand
LRESULT WebView::onShowWindowEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled)
{
// lParam is 0 when the message is sent because of a ShowWindow call.
- // FIXME: Is WM_SHOWWINDOW sent when ShowWindow is called on an ancestor of our window?
+ // FIXME: Since we don't get notified when an ancestor window is hidden or shown, we will keep
+ // painting even when we have a hidden ancestor. <http://webkit.org/b/54104>
if (!lParam) {
m_isVisible = wParam;
- m_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
-
- handled = true;
+ if (m_page)
+ m_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
}
+ handled = false;
return 0;
}
@@ -569,6 +618,7 @@ void WebView::stopTrackingMouseLeave()
void WebView::close()
{
+ ::RevokeDragDrop(m_window);
setParentWindow(0);
m_page->close();
}
@@ -577,6 +627,9 @@ void WebView::close()
PassOwnPtr<DrawingAreaProxy> WebView::createDrawingAreaProxy()
{
+ if (useNewDrawingArea())
+ return DrawingAreaProxyImpl::create(m_page.get());
+
return ChunkedUpdateDrawingAreaProxy::create(this, m_page.get());
}
@@ -626,6 +679,10 @@ bool WebView::isViewInWindow()
return m_isInWindow;
}
+void WebView::pageClosed()
+{
+}
+
void WebView::processDidCrash()
{
updateNativeCursor();
@@ -740,11 +797,11 @@ void WebView::prepareCandidateWindow(HIMC hInputContext)
form.dwIndex = 0;
form.dwStyle = CFS_EXCLUDE;
form.ptCurrentPos.x = caret.x();
- form.ptCurrentPos.y = caret.bottom();
+ form.ptCurrentPos.y = caret.maxY();
form.rcArea.top = caret.y();
- form.rcArea.bottom = caret.bottom();
+ form.rcArea.bottom = caret.maxY();
form.rcArea.left = caret.x();
- form.rcArea.right = caret.right();
+ form.rcArea.right = caret.maxX();
Ime::ImmSetCandidateWindow(hInputContext, &form);
}
@@ -962,11 +1019,11 @@ LRESULT WebView::onIMERequest(WPARAM request, LPARAM data)
return 0;
switch (request) {
- case IMR_RECONVERTSTRING:
- return onIMERequestReconvertString(reinterpret_cast<RECONVERTSTRING*>(data));
+ case IMR_RECONVERTSTRING:
+ return onIMERequestReconvertString(reinterpret_cast<RECONVERTSTRING*>(data));
- case IMR_QUERYCHARPOSITION:
- return onIMERequestCharPosition(reinterpret_cast<IMECHARPOSITION*>(data));
+ case IMR_QUERYCHARPOSITION:
+ return onIMERequestCharPosition(reinterpret_cast<IMECHARPOSITION*>(data));
}
return 0;
}
@@ -985,11 +1042,12 @@ bool WebView::onIMESetContext(WPARAM wparam, LPARAM)
return false;
}
-void WebView::didNotHandleKeyEvent(const NativeWebKeyboardEvent& event)
+void WebView::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool wasEventHandled)
{
// Calling ::DefWindowProcW will ensure that pressing the Alt key will generate a WM_SYSCOMMAND
// event, e.g. See <http://webkit.org/b/47671>.
- ::DefWindowProcW(event.nativeEvent()->hwnd, event.nativeEvent()->message, event.nativeEvent()->wParam, event.nativeEvent()->lParam);
+ if (!wasEventHandled)
+ ::DefWindowProcW(event.nativeEvent()->hwnd, event.nativeEvent()->message, event.nativeEvent()->wParam, event.nativeEvent()->lParam);
}
PassRefPtr<WebPopupMenuProxy> WebView::createPopupMenuProxy(WebPageProxy* page)
@@ -1002,9 +1060,54 @@ PassRefPtr<WebContextMenuProxy> WebView::createContextMenuProxy(WebPageProxy* pa
return WebContextMenuProxyWin::create(m_window, page);
}
-void WebView::setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut)
+void WebView::setFindIndicator(PassRefPtr<FindIndicator> prpFindIndicator, bool fadeOut)
{
- // FIXME: Implement.
+ if (!m_findIndicatorCallback)
+ return;
+
+ HBITMAP hbmp = 0;
+ IntRect selectionRect;
+
+ if (RefPtr<FindIndicator> findIndicator = prpFindIndicator) {
+ if (ShareableBitmap* contentImage = findIndicator->contentImage()) {
+ // Render the contentImage to an HBITMAP.
+ void* bits;
+ HDC hdc = ::CreateCompatibleDC(0);
+ int width = contentImage->bounds().width();
+ int height = contentImage->bounds().height();
+ BitmapInfo bitmapInfo = BitmapInfo::create(contentImage->size());
+
+ hbmp = CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, static_cast<void**>(&bits), 0, 0);
+ HBITMAP hbmpOld = static_cast<HBITMAP>(SelectObject(hdc, hbmp));
+ RetainPtr<CGContextRef> context(AdoptCF, CGBitmapContextCreate(bits, width, height,
+ 8, width * sizeof(RGBQUAD), deviceRGBColorSpaceRef(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
+
+ GraphicsContext graphicsContext(context.get());
+ contentImage->paint(graphicsContext, IntPoint(), contentImage->bounds());
+
+ ::SelectObject(hdc, hbmpOld);
+ ::DeleteDC(hdc);
+ }
+
+ selectionRect = IntRect(findIndicator->selectionRectInWindowCoordinates());
+ }
+
+ // The callback is responsible for calling ::DeleteObject(hbmp).
+ (*m_findIndicatorCallback)(toAPI(this), hbmp, selectionRect, fadeOut, m_findIndicatorCallbackContext);
+}
+
+void WebView::setFindIndicatorCallback(WKViewFindIndicatorCallback callback, void* context)
+{
+ m_findIndicatorCallback = callback;
+ m_findIndicatorCallbackContext = context;
+}
+
+WKViewFindIndicatorCallback WebView::getFindIndicatorCallback(void** context)
+{
+ if (context)
+ *context = m_findIndicatorCallbackContext;
+
+ return m_findIndicatorCallback;
}
void WebView::didCommitLoadForMainFrame(bool useCustomRepresentation)
@@ -1024,6 +1127,10 @@ void WebView::setCustomRepresentationZoomFactor(double)
{
}
+void WebView::didChangeScrollbarsForMainFrame() const
+{
+}
+
void WebView::setIsInWindow(bool isInWindow)
{
m_isInWindow = isInWindow;
@@ -1032,36 +1139,55 @@ void WebView::setIsInWindow(bool isInWindow)
#if USE(ACCELERATED_COMPOSITING)
+void WebView::enterAcceleratedCompositingMode(const LayerTreeContext&)
+{
+ ASSERT(useNewDrawingArea());
+ // FIXME: Implement.
+ ASSERT_NOT_REACHED();
+}
+
+void WebView::exitAcceleratedCompositingMode()
+{
+ ASSERT(useNewDrawingArea());
+ // FIXME: Implement.
+ ASSERT_NOT_REACHED();
+}
+
void WebView::pageDidEnterAcceleratedCompositing()
{
+ ASSERT(!useNewDrawingArea());
switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::LayerBacked);
}
void WebView::pageDidLeaveAcceleratedCompositing()
{
+ ASSERT(!useNewDrawingArea());
switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::ChunkedUpdate);
}
void WebView::switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::Type type)
{
+ ASSERT(!useNewDrawingArea());
+
DrawingAreaInfo::Type existingDrawingAreaType = m_page->drawingArea() ? m_page->drawingArea()->info().type : DrawingAreaInfo::None;
if (existingDrawingAreaType == type)
return;
OwnPtr<DrawingAreaProxy> newDrawingArea;
switch (type) {
- case DrawingAreaInfo::None:
- break;
- case DrawingAreaInfo::ChunkedUpdate:
- newDrawingArea = ChunkedUpdateDrawingAreaProxy::create(this, m_page.get());
- break;
- case DrawingAreaInfo::LayerBacked:
- newDrawingArea = LayerBackedDrawingAreaProxy::create(this, m_page.get());
- break;
+ case DrawingAreaInfo::Impl:
+ case DrawingAreaInfo::None:
+ break;
+ case DrawingAreaInfo::ChunkedUpdate:
+ newDrawingArea = ChunkedUpdateDrawingAreaProxy::create(this, m_page.get());
+ break;
+ case DrawingAreaInfo::LayerBacked:
+ newDrawingArea = LayerBackedDrawingAreaProxy::create(this, m_page.get());
+ break;
}
if (m_page->drawingArea())
- newDrawingArea->setSize(m_page->drawingArea()->size());
+ newDrawingArea->setSize(m_page->drawingArea()->size(), IntSize());
m_page->drawingArea()->detachCompositingContext();
m_page->setDrawingArea(newDrawingArea.release());
@@ -1079,13 +1205,140 @@ HWND WebView::nativeWindow()
void WebView::windowReceivedMessage(HWND, UINT message, WPARAM wParam, LPARAM)
{
switch (message) {
- case WM_NCACTIVATE:
- updateActiveStateSoon();
- break;
- case WM_SETTINGCHANGE:
- // systemParameterChanged(wParam);
- break;
+ case WM_NCACTIVATE:
+ updateActiveStateSoon();
+ break;
+ case WM_SETTINGCHANGE:
+ // systemParameterChanged(wParam);
+ break;
}
}
+HRESULT STDMETHODCALLTYPE WebView::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IUnknown*>(this);
+ else if (IsEqualGUID(riid, IID_IDropTarget))
+ *ppvObject = static_cast<IDropTarget*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebView::AddRef(void)
+{
+ ref();
+ return refCount();
+}
+
+ULONG STDMETHODCALLTYPE WebView::Release(void)
+{
+ deref();
+ return refCount();
+}
+
+static DWORD dragOperationToDragCursor(DragOperation op)
+{
+ DWORD res = DROPEFFECT_NONE;
+ if (op & DragOperationCopy)
+ res = DROPEFFECT_COPY;
+ else if (op & DragOperationLink)
+ res = DROPEFFECT_LINK;
+ else if (op & DragOperationMove)
+ res = DROPEFFECT_MOVE;
+ else if (op & DragOperationGeneric)
+ res = DROPEFFECT_MOVE; // This appears to be the Firefox behaviour
+ return res;
+}
+
+WebCore::DragOperation WebView::keyStateToDragOperation(DWORD grfKeyState) const
+{
+ if (!m_page)
+ return DragOperationNone;
+
+ // Conforms to Microsoft's key combinations as documented for
+ // IDropTarget::DragOver. Note, grfKeyState is the current
+ // state of the keyboard modifier keys on the keyboard. See:
+ // <http://msdn.microsoft.com/en-us/library/ms680129(VS.85).aspx>.
+ DragOperation operation = m_page->dragOperation();
+
+ if ((grfKeyState & (MK_CONTROL | MK_SHIFT)) == (MK_CONTROL | MK_SHIFT))
+ operation = DragOperationLink;
+ else if ((grfKeyState & MK_CONTROL) == MK_CONTROL)
+ operation = DragOperationCopy;
+ else if ((grfKeyState & MK_SHIFT) == MK_SHIFT)
+ operation = DragOperationGeneric;
+
+ return operation;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::DragEnter(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect)
+{
+ m_dragData = 0;
+ m_page->resetDragOperation();
+
+ if (m_dropTargetHelper)
+ m_dropTargetHelper->DragEnter(m_window, pDataObject, (POINT*)&pt, *pdwEffect);
+
+ POINTL localpt = pt;
+ ::ScreenToClient(m_window, (LPPOINT)&localpt);
+ DragData data(pDataObject, IntPoint(localpt.x, localpt.y), IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
+ m_page->performDragControllerAction(DragControllerActionEntered, &data);
+ *pdwEffect = dragOperationToDragCursor(m_page->dragOperation());
+
+ m_lastDropEffect = *pdwEffect;
+ m_dragData = pDataObject;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::DragOver(DWORD grfKeyState, POINTL pt, DWORD* pdwEffect)
+{
+ if (m_dropTargetHelper)
+ m_dropTargetHelper->DragOver((POINT*)&pt, *pdwEffect);
+
+ if (m_dragData) {
+ POINTL localpt = pt;
+ ::ScreenToClient(m_window, (LPPOINT)&localpt);
+ DragData data(m_dragData.get(), IntPoint(localpt.x, localpt.y), IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
+ m_page->performDragControllerAction(DragControllerActionUpdated, &data);
+ *pdwEffect = dragOperationToDragCursor(m_page->dragOperation());
+ } else
+ *pdwEffect = DROPEFFECT_NONE;
+
+ m_lastDropEffect = *pdwEffect;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::DragLeave()
+{
+ if (m_dropTargetHelper)
+ m_dropTargetHelper->DragLeave();
+
+ if (m_dragData) {
+ DragData data(m_dragData.get(), IntPoint(), IntPoint(), DragOperationNone);
+ m_page->performDragControllerAction(DragControllerActionExited, &data);
+ m_dragData = 0;
+ m_page->resetDragOperation();
+ }
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::Drop(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect)
+{
+ if (m_dropTargetHelper)
+ m_dropTargetHelper->Drop(pDataObject, (POINT*)&pt, *pdwEffect);
+
+ m_dragData = 0;
+ *pdwEffect = m_lastDropEffect;
+ POINTL localpt = pt;
+ ::ScreenToClient(m_window, (LPPOINT)&localpt);
+ DragData data(pDataObject, IntPoint(localpt.x, localpt.y), IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
+ m_page->performDragControllerAction(DragControllerActionPerformDrag, &data);
+ return S_OK;
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/win/WebView.h b/Source/WebKit2/UIProcess/win/WebView.h
index dfb5ed1..297b6ad 100644
--- a/Source/WebKit2/UIProcess/win/WebView.h
+++ b/Source/WebKit2/UIProcess/win/WebView.h
@@ -28,21 +28,30 @@
#include "APIObject.h"
#include "PageClient.h"
+#include "WKView.h"
#include "WebPageProxy.h"
+#include <ShlObj.h>
+#include <WebCore/COMPtr.h>
+#include <WebCore/DragActions.h>
+#include <WebCore/DragData.h>
#include <WebCore/WindowMessageListener.h>
#include <wtf/Forward.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
+interface IDropTargetHelper;
+
namespace WebKit {
class DrawingAreaProxy;
-class WebView : public APIObject, public PageClient, WebCore::WindowMessageListener {
+class WebView : public APIObject, public PageClient, WebCore::WindowMessageListener, public IDropTarget {
public:
static PassRefPtr<WebView> create(RECT rect, WebContext* context, WebPageGroup* pageGroup, HWND parentWindow)
{
- return adoptRef(new WebView(rect, context, pageGroup, parentWindow));
+ RefPtr<WebView> webView = adoptRef(new WebView(rect, context, pageGroup, parentWindow));
+ webView->initialize();
+ return webView;
}
~WebView();
@@ -50,8 +59,22 @@ public:
void setParentWindow(HWND);
void windowAncestryDidChange();
void setIsInWindow(bool);
- void setOverrideCursor(HCURSOR overrideCursor);
+ void setOverrideCursor(HCURSOR);
void setInitialFocus(bool forward);
+ void setFindIndicatorCallback(WKViewFindIndicatorCallback, void*);
+ WKViewFindIndicatorCallback getFindIndicatorCallback(void**);
+ void initialize();
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IDropTarget
+ virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
+ virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
+ virtual HRESULT STDMETHODCALLTYPE DragLeave();
+ virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
WebPageProxy* page() const { return m_page.get(); }
@@ -64,7 +87,6 @@ private:
static LRESULT CALLBACK WebViewWndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
- void setWasActivatedByMouseEvent(bool flag) { m_wasActivatedByMouseEvent = flag; }
LRESULT onMouseEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
LRESULT onWheelEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
LRESULT onKeyEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
@@ -77,6 +99,9 @@ private:
LRESULT onTimerEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
LRESULT onShowWindowEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
LRESULT onSetCursor(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
+
+ void paint(HDC, const WebCore::IntRect& dirtyRect);
+ void setWasActivatedByMouseEvent(bool flag) { m_wasActivatedByMouseEvent = flag; }
bool onIMEStartComposition();
bool onIMEComposition(LPARAM);
bool onIMEEndComposition();
@@ -116,6 +141,7 @@ private:
virtual bool isViewInWindow();
virtual void processDidCrash();
virtual void didRelaunchProcess();
+ virtual void pageClosed();
virtual void takeFocus(bool direction);
virtual void toolTipChanged(const WTF::String&, const WTF::String&);
virtual void setCursor(const WebCore::Cursor&);
@@ -125,13 +151,16 @@ private:
virtual void setEditCommandState(const WTF::String&, bool, int);
virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
- virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&);
+ virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled);
virtual void compositionSelectionChanged(bool);
virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*);
virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut);
#if USE(ACCELERATED_COMPOSITING)
+ virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
+ virtual void exitAcceleratedCompositingMode();
+
virtual void pageDidEnterAcceleratedCompositing();
virtual void pageDidLeaveAcceleratedCompositing();
void switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::Type);
@@ -141,6 +170,8 @@ private:
void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&);
virtual double customRepresentationZoomFactor();
virtual void setCustomRepresentationZoomFactor(double);
+ WebCore::DragOperation keyStateToDragOperation(DWORD grfKeyState) const;
+ virtual void didChangeScrollbarsForMainFrame() const;
virtual HWND nativeWindow();
@@ -164,6 +195,17 @@ private:
RefPtr<WebPageProxy> m_page;
unsigned m_inIMEComposition;
+
+ WKViewFindIndicatorCallback m_findIndicatorCallback;
+ void* m_findIndicatorCallbackContext;
+
+ COMPtr<IDataObject> m_dragData;
+ COMPtr<IDropTargetHelper> m_dropTargetHelper;
+ // FIXME: This variable is part of a workaround. The drop effect (pdwEffect) passed to Drop is incorrect.
+ // We set this variable in DragEnter and DragOver so that it can be used in Drop to set the correct drop effect.
+ // Thus, on return from DoDragDrop we have the correct pdwEffect for the drag-and-drop operation.
+ // (see https://bugs.webkit.org/show_bug.cgi?id=29264)
+ DWORD m_lastDropEffect;
};
} // namespace WebKit