summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/UIProcess
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-25 19:08:45 +0100
committerSteve Block <steveblock@google.com>2011-06-08 13:51:31 +0100
commit2bde8e466a4451c7319e3a072d118917957d6554 (patch)
tree28f4a1b869a513e565c7760d0e6a06e7cf1fe95a /Source/WebKit2/UIProcess
parent6939c99b71d9372d14a0c74a772108052e8c48c8 (diff)
downloadexternal_webkit-2bde8e466a4451c7319e3a072d118917957d6554.zip
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.gz
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.bz2
Merge WebKit at r82507: Initial merge by git
Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e
Diffstat (limited to 'Source/WebKit2/UIProcess')
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKAPICast.h51
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKContext.cpp24
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKContext.h12
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKContextPrivate.h7
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp10
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKCookieManager.h11
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKIconDatabase.cpp52
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKIconDatabase.h45
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.cpp52
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.h47
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPage.cpp2
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPage.h2
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPreferences.cpp50
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPreferences.h5
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h16
-rw-r--r--Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.cpp41
-rw-r--r--Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.h (renamed from Source/WebKit2/UIProcess/API/C/win/WKBaseWin.h)21
-rw-r--r--Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h2
-rw-r--r--Source/WebKit2/UIProcess/API/C/win/WKContextPrivateWin.h4
-rw-r--r--Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp5
-rw-r--r--Source/WebKit2/UIProcess/API/C/win/WKView.cpp22
-rw-r--r--Source/WebKit2/UIProcess/API/C/win/WKView.h24
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PDFViewController.h6
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PDFViewController.mm46
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PageClientImpl.h18
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm98
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKPrintingView.h3
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm49
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKView.mm248
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKViewInternal.h15
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h2
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwkpage.cpp14
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwkpage_p.h7
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qgraphicswkview/tst_qgraphicswkview.cpp14
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qwkpage/qwkpage.pro1
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qwkpage/tst_qwkpage.cpp59
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/tests.pri2
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/tests.pro2
-rw-r--r--Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp14
-rw-r--r--Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h10
-rw-r--r--Source/WebKit2/UIProcess/BackingStore.cpp3
-rw-r--r--Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp10
-rw-r--r--Source/WebKit2/UIProcess/Downloads/DownloadProxy.h2
-rw-r--r--Source/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in2
-rw-r--r--Source/WebKit2/UIProcess/DrawingAreaProxy.h1
-rw-r--r--Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in3
-rw-r--r--Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp14
-rw-r--r--Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h8
-rw-r--r--Source/WebKit2/UIProcess/FindIndicator.cpp5
-rw-r--r--Source/WebKit2/UIProcess/FindIndicator.h6
-rw-r--r--Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h2
-rw-r--r--Source/WebKit2/UIProcess/Launcher/ThreadLauncher.h2
-rw-r--r--Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm13
-rw-r--r--Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp12
-rw-r--r--Source/WebKit2/UIProcess/PageClient.h15
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp24
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h32
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in5
-rw-r--r--Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp12
-rw-r--r--Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm138
-rw-r--r--Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp34
-rw-r--r--Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp16
-rw-r--r--Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h3
-rw-r--r--Source/WebKit2/UIProcess/WebContext.cpp98
-rw-r--r--Source/WebKit2/UIProcess/WebContext.h32
-rw-r--r--Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp53
-rw-r--r--Source/WebKit2/UIProcess/WebCookieManagerProxy.h13
-rw-r--r--Source/WebKit2/UIProcess/WebCookieManagerProxy.messages.in1
-rw-r--r--Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp27
-rw-r--r--Source/WebKit2/UIProcess/WebDatabaseManagerProxy.h3
-rw-r--r--Source/WebKit2/UIProcess/WebDownloadClient.cpp8
-rw-r--r--Source/WebKit2/UIProcess/WebDownloadClient.h2
-rw-r--r--Source/WebKit2/UIProcess/WebEditCommandProxy.cpp4
-rw-r--r--Source/WebKit2/UIProcess/WebEditCommandProxy.h5
-rw-r--r--Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp113
-rw-r--r--Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h110
-rw-r--r--Source/WebKit2/UIProcess/WebFullScreenManagerProxy.messages.in38
-rw-r--r--Source/WebKit2/UIProcess/WebIconDatabase.cpp255
-rw-r--r--Source/WebKit2/UIProcess/WebIconDatabase.h110
-rw-r--r--Source/WebKit2/UIProcess/WebIconDatabase.messages.in35
-rw-r--r--Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp17
-rw-r--r--Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h3
-rw-r--r--Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.cpp103
-rw-r--r--Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.h83
-rw-r--r--Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.messages.in25
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.cpp356
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.h55
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.messages.in18
-rw-r--r--Source/WebKit2/UIProcess/WebProcessProxy.cpp5
-rw-r--r--Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp16
-rw-r--r--Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.h3
-rw-r--r--Source/WebKit2/UIProcess/WebUIClient.cpp10
-rw-r--r--Source/WebKit2/UIProcess/WebUIClient.h3
-rw-r--r--Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp25
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp15
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebFullScreenManagerProxyGtk.cpp81
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebView.cpp23
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebView.h3
-rw-r--r--Source/WebKit2/UIProcess/mac/CorrectionPanel.h63
-rw-r--r--Source/WebKit2/UIProcess/mac/CorrectionPanel.mm166
-rw-r--r--Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h74
-rw-r--r--Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm608
-rw-r--r--Source/WebKit2/UIProcess/mac/WebContextMac.mm33
-rw-r--r--Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm13
-rw-r--r--Source/WebKit2/UIProcess/mac/WebCookieManagerProxyMac.mm39
-rw-r--r--Source/WebKit2/UIProcess/mac/WebFullScreenManagerProxyMac.mm101
-rw-r--r--Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm4
-rw-r--r--Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm137
-rw-r--r--Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp3
-rw-r--r--Source/WebKit2/UIProcess/qt/WebContextQt.cpp16
-rw-r--r--Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp3
-rw-r--r--Source/WebKit2/UIProcess/win/WebContextWin.cpp21
-rw-r--r--Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp31
-rw-r--r--Source/WebKit2/UIProcess/win/WebUndoClient.cpp53
-rwxr-xr-xSource/WebKit2/UIProcess/win/WebUndoClient.h46
-rw-r--r--Source/WebKit2/UIProcess/win/WebView.cpp159
-rw-r--r--Source/WebKit2/UIProcess/win/WebView.h17
117 files changed, 4270 insertions, 543 deletions
diff --git a/Source/WebKit2/UIProcess/API/C/WKAPICast.h b/Source/WebKit2/UIProcess/API/C/WKAPICast.h
index a2983e9..a440c6f 100644
--- a/Source/WebKit2/UIProcess/API/C/WKAPICast.h
+++ b/Source/WebKit2/UIProcess/API/C/WKAPICast.h
@@ -29,12 +29,16 @@
#include "CacheModel.h"
#include "FontSmoothingLevel.h"
+#include "HTTPCookieAcceptPolicy.h"
+#include "ResourceCachesToClear.h"
#include "WKContext.h"
+#include "WKCookieManager.h"
#include "WKCredentialTypes.h"
#include "WKPage.h"
#include "WKPreferencesPrivate.h"
#include "WKProtectionSpaceTypes.h"
#include "WKSharedAPICast.h"
+#include <WebCore/CookieJar.h>
#include <WebCore/Credential.h>
#include <WebCore/FrameLoaderTypes.h>
#include <WebCore/ProtectionSpace.h>
@@ -58,8 +62,10 @@ class WebFramePolicyListenerProxy;
class WebFrameProxy;
class WebGeolocationManagerProxy;
class WebGeolocationPosition;
+class WebIconDatabase;
class WebInspectorProxy;
class WebKeyValueStorageManagerProxy;
+class WebMediaCacheManagerProxy;
class WebNavigationData;
class WebOpenPanelParameters;
class WebOpenPanelResultListenerProxy;
@@ -86,7 +92,9 @@ WK_ADD_API_MAPPING(WKFrameRef, WebFrameProxy)
WK_ADD_API_MAPPING(WKGeolocationManagerRef, WebGeolocationManagerProxy)
WK_ADD_API_MAPPING(WKGeolocationPermissionRequestRef, GeolocationPermissionRequestProxy)
WK_ADD_API_MAPPING(WKGeolocationPositionRef, WebGeolocationPosition)
+WK_ADD_API_MAPPING(WKIconDatabaseRef, WebIconDatabase)
WK_ADD_API_MAPPING(WKKeyValueStorageManagerRef, WebKeyValueStorageManagerProxy)
+WK_ADD_API_MAPPING(WKMediaCacheManagerRef, WebMediaCacheManagerProxy)
WK_ADD_API_MAPPING(WKNavigationDataRef, WebNavigationData)
WK_ADD_API_MAPPING(WKOpenPanelParametersRef, WebOpenPanelParameters)
WK_ADD_API_MAPPING(WKOpenPanelResultListenerRef, WebOpenPanelResultListenerProxy)
@@ -235,6 +243,49 @@ inline WebCore::CredentialPersistence toCredentialPersistence(WKCredentialPersis
}
}
+inline ResourceCachesToClear toResourceCachesToClear(WKResourceCachesToClear wkResourceCachesToClear)
+{
+ switch (wkResourceCachesToClear) {
+ case kWKAllResourceCaches:
+ return AllResourceCaches;
+ case kWKInMemoryResourceCachesOnly:
+ return InMemoryResourceCachesOnly;
+ }
+
+ ASSERT_NOT_REACHED();
+ return AllResourceCaches;
+}
+
+inline HTTPCookieAcceptPolicy toHTTPCookieAcceptPolicy(WKHTTPCookieAcceptPolicy policy)
+{
+ switch (policy) {
+ case kWKHTTPCookieAcceptPolicyAlways:
+ return HTTPCookieAcceptPolicyAlways;
+ case kWKHTTPCookieAcceptPolicyNever:
+ return HTTPCookieAcceptPolicyNever;
+ case kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
+ return HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
+ }
+
+ ASSERT_NOT_REACHED();
+ return HTTPCookieAcceptPolicyAlways;
+}
+
+inline WKHTTPCookieAcceptPolicy toAPI(HTTPCookieAcceptPolicy policy)
+{
+ switch (policy) {
+ case HTTPCookieAcceptPolicyAlways:
+ return kWKHTTPCookieAcceptPolicyAlways;
+ case HTTPCookieAcceptPolicyNever:
+ return kWKHTTPCookieAcceptPolicyNever;
+ case HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
+ return kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
+ }
+
+ ASSERT_NOT_REACHED();
+ return kWKHTTPCookieAcceptPolicyAlways;
+}
+
} // namespace WebKit
#if defined(WIN32) || defined(_WIN32)
diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.cpp b/Source/WebKit2/UIProcess/API/C/WKContext.cpp
index 6e4e5e0..bf196b7 100644
--- a/Source/WebKit2/UIProcess/API/C/WKContext.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKContext.cpp
@@ -148,9 +148,9 @@ void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef contextRef,
toImpl(contextRef)->setDomainRelaxationForbiddenForURLScheme(toImpl(urlScheme)->string());
}
-void WKContextClearResourceCaches(WKContextRef contextRef)
+void WKContextClearResourceCaches(WKContextRef contextRef, WKResourceCachesToClear cachesToClear)
{
- toImpl(contextRef)->clearResourceCaches();
+ toImpl(contextRef)->clearResourceCaches(toResourceCachesToClear(cachesToClear));
}
void WKContextClearApplicationCache(WKContextRef contextRef)
@@ -178,11 +178,21 @@ WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef contextRef)
return toAPI(toImpl(contextRef)->geolocationManagerProxy());
}
+WKIconDatabaseRef WKContextGetIconDatabase(WKContextRef contextRef)
+{
+ return toAPI(toImpl(contextRef)->iconDatabase());
+}
+
WKKeyValueStorageManagerRef WKContextGetKeyValueStorageManager(WKContextRef contextRef)
{
return toAPI(toImpl(contextRef)->keyValueStorageManagerProxy());
}
+WKMediaCacheManagerRef WKContextGetMediaCacheManager(WKContextRef contextRef)
+{
+ return toAPI(toImpl(contextRef)->mediaCacheManagerProxy());
+}
+
WKPluginSiteDataManagerRef WKContextGetPluginSiteDataManager(WKContextRef contextRef)
{
return toAPI(toImpl(contextRef)->pluginSiteDataManager());
@@ -203,7 +213,17 @@ void WKContextStopMemorySampler(WKContextRef contextRef)
toImpl(contextRef)->stopMemorySampler();
}
+void WKContextSetIconDatabasePath(WKContextRef contextRef, WKStringRef iconDatabasePath)
+{
+ toImpl(contextRef)->setIconDatabasePath(toImpl(iconDatabasePath)->string());
+}
+
void WKContextSetDatabaseDirectory(WKContextRef contextRef, WKStringRef databaseDirectory)
{
toImpl(contextRef)->setDatabaseDirectory(toImpl(databaseDirectory)->string());
}
+
+void WKContextSetLocalStorageDirectory(WKContextRef contextRef, WKStringRef localStorageDirectory)
+{
+ toImpl(contextRef)->setLocalStorageDirectory(toImpl(localStorageDirectory)->string());
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.h b/Source/WebKit2/UIProcess/API/C/WKContext.h
index f8e7cee..606574f 100644
--- a/Source/WebKit2/UIProcess/API/C/WKContext.h
+++ b/Source/WebKit2/UIProcess/API/C/WKContext.h
@@ -39,6 +39,12 @@ enum {
};
typedef uint32_t WKCacheModel;
+enum {
+ kWKAllResourceCaches = 0,
+ kWKInMemoryResourceCachesOnly = 1
+};
+typedef uint32_t WKResourceCachesToClear;
+
// Injected Bundle Client
typedef void (*WKContextDidReceiveMessageFromInjectedBundleCallback)(WKContextRef page, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo);
typedef void (*WKContextDidReceiveSynchronousMessageFromInjectedBundleCallback)(WKContextRef page, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData, const void *clientInfo);
@@ -71,6 +77,7 @@ typedef struct WKContextHistoryClient WKContextHistoryClient;
// Download Client
typedef void (*WKContextDownloadDidStartCallback)(WKContextRef context, WKDownloadRef download, const void *clientInfo);
+typedef void (*WKContextDownloadDidReceiveAuthenticationChallengeCallback)(WKContextRef context, WKDownloadRef download, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo);
typedef void (*WKContextDownloadDidReceiveResponseCallback)(WKContextRef context, WKDownloadRef download, WKURLResponseRef response, const void *clientInfo);
typedef void (*WKContextDownloadDidReceiveDataCallback)(WKContextRef context, WKDownloadRef download, uint64_t length, const void *clientInfo);
typedef bool (*WKContextDownloadShouldDecodeSourceDataOfMIMETypeCallback)(WKContextRef context, WKDownloadRef download, WKStringRef mimeType, const void *clientInfo);
@@ -85,6 +92,7 @@ struct WKContextDownloadClient {
int version;
const void * clientInfo;
WKContextDownloadDidStartCallback didStart;
+ WKContextDownloadDidReceiveAuthenticationChallengeCallback didReceiveAuthenticationChallenge;
WKContextDownloadDidReceiveResponseCallback didReceiveResponse;
WKContextDownloadDidReceiveDataCallback didReceiveData;
WKContextDownloadShouldDecodeSourceDataOfMIMETypeCallback shouldDecodeSourceDataOfMIMEType;
@@ -117,7 +125,7 @@ WK_EXPORT void WKContextAddVisitedLink(WKContextRef context, WKStringRef visited
WK_EXPORT void WKContextSetCacheModel(WKContextRef context, WKCacheModel cacheModel);
WK_EXPORT WKCacheModel WKContextGetCacheModel(WKContextRef context);
-WK_EXPORT void WKContextClearResourceCaches(WKContextRef context);
+WK_EXPORT void WKContextClearResourceCaches(WKContextRef context, WKResourceCachesToClear cachesToClear);
WK_EXPORT void WKContextClearApplicationCache(WKContextRef context);
WK_EXPORT void WKContextStartMemorySampler(WKContextRef context, WKDoubleRef interval);
@@ -127,7 +135,9 @@ WK_EXPORT WKApplicationCacheManagerRef WKContextGetApplicationCacheManager(WKCon
WK_EXPORT WKCookieManagerRef WKContextGetCookieManager(WKContextRef context);
WK_EXPORT WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef context);
WK_EXPORT WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef context);
+WK_EXPORT WKIconDatabaseRef WKContextGetIconDatabase(WKContextRef context);
WK_EXPORT WKKeyValueStorageManagerRef WKContextGetKeyValueStorageManager(WKContextRef context);
+WK_EXPORT WKMediaCacheManagerRef WKContextGetMediaCacheManager(WKContextRef context);
WK_EXPORT WKPluginSiteDataManagerRef WKContextGetPluginSiteDataManager(WKContextRef context);
WK_EXPORT WKResourceCacheManagerRef WKContextGetResourceCacheManager(WKContextRef context);
diff --git a/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h
index bcd24a5..5fd7dd3 100644
--- a/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h
+++ b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h
@@ -54,9 +54,12 @@ 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 WKContextSetIconDatabasePath(WKContextRef context, WKStringRef iconDatabasePath);
+
+// FIXME: These functions are only effective if called before the Web process is launched. But
+// we should really change these settings to be on WebPreferences and changeable at runtime.
WK_EXPORT void WKContextSetDatabaseDirectory(WKContextRef context, WKStringRef databaseDirectory);
+WK_EXPORT void WKContextSetLocalStorageDirectory(WKContextRef context, WKStringRef localStorageDirectory);
#ifdef __cplusplus
}
diff --git a/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp b/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp
index 83578f7..50e2732 100644
--- a/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp
@@ -58,6 +58,16 @@ void WKCookieManagerDeleteAllCookies(WKCookieManagerRef cookieManagerRef)
toImpl(cookieManagerRef)->deleteAllCookies();
}
+void WKCookieManagerSetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, WKHTTPCookieAcceptPolicy policy)
+{
+ toImpl(cookieManager)->setHTTPCookieAcceptPolicy(toHTTPCookieAcceptPolicy(policy));
+}
+
+void WKCookieManagerGetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, void* context, WKCookieManagerGetHTTPCookieAcceptPolicyFunction callback)
+{
+ toImpl(cookieManager)->getHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicyCallback::create(context, callback));
+}
+
void WKCookieManagerStartObservingCookieChanges(WKCookieManagerRef cookieManager)
{
toImpl(cookieManager)->startObservingCookieChanges();
diff --git a/Source/WebKit2/UIProcess/API/C/WKCookieManager.h b/Source/WebKit2/UIProcess/API/C/WKCookieManager.h
index 75d8ef5..4da60f4 100644
--- a/Source/WebKit2/UIProcess/API/C/WKCookieManager.h
+++ b/Source/WebKit2/UIProcess/API/C/WKCookieManager.h
@@ -32,6 +32,13 @@
extern "C" {
#endif
+enum {
+ kWKHTTPCookieAcceptPolicyAlways = 0,
+ kWKHTTPCookieAcceptPolicyNever = 1,
+ kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain = 2
+};
+typedef uint32_t WKHTTPCookieAcceptPolicy;
+
// Cookie Manager Client
typedef void (*WKCookieManagerCookiesDidChangeCallback)(WKCookieManagerRef cookieManager, const void *clientInfo);
@@ -52,6 +59,10 @@ WK_EXPORT void WKCookieManagerGetHostnamesWithCookies(WKCookieManagerRef cookieM
WK_EXPORT void WKCookieManagerDeleteCookiesForHostname(WKCookieManagerRef cookieManager, WKStringRef hostname);
WK_EXPORT void WKCookieManagerDeleteAllCookies(WKCookieManagerRef cookieManager);
+WK_EXPORT void WKCookieManagerSetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, WKHTTPCookieAcceptPolicy policy);
+typedef void (*WKCookieManagerGetHTTPCookieAcceptPolicyFunction)(WKHTTPCookieAcceptPolicy, WKErrorRef, void*);
+WK_EXPORT void WKCookieManagerGetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, void* context, WKCookieManagerGetHTTPCookieAcceptPolicyFunction callback);
+
WK_EXPORT void WKCookieManagerStartObservingCookieChanges(WKCookieManagerRef cookieManager);
WK_EXPORT void WKCookieManagerStopObservingCookieChanges(WKCookieManagerRef cookieManager);
diff --git a/Source/WebKit2/UIProcess/API/C/WKIconDatabase.cpp b/Source/WebKit2/UIProcess/API/C/WKIconDatabase.cpp
new file mode 100644
index 0000000..c8e87a0
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKIconDatabase.cpp
@@ -0,0 +1,52 @@
+/*
+ * 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 "WKIconDatabase.h"
+
+#include "WKAPICast.h"
+#include "WebIconDatabase.h"
+
+using namespace WebKit;
+
+WKTypeID WKIconDatabaseGetTypeID()
+{
+ return toAPI(WebIconDatabase::APIType);
+}
+
+void WKIconDatabaseRetainIconForURL(WKIconDatabaseRef iconDatabaseRef, WKURLRef pageURLRef)
+{
+ toImpl(iconDatabaseRef)->retainIconForPageURL(toWTFString(pageURLRef));
+}
+
+void WKIconDatabaseReleaseIconForURL(WKIconDatabaseRef iconDatabaseRef, WKURLRef pageURLRef)
+{
+ toImpl(iconDatabaseRef)->releaseIconForPageURL(toWTFString(pageURLRef));
+}
+
+void WKIconDatabaseEnableDatabaseCleanup(WKIconDatabaseRef iconDatabaseRef)
+{
+ toImpl(iconDatabaseRef)->enableDatabaseCleanup();
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h b/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h
new file mode 100644
index 0000000..1ea1860
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+#ifndef WKIconDatabase_h
+#define WKIconDatabase_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKIconDatabaseGetTypeID();
+
+WK_EXPORT void WKIconDatabaseRetainIconForURL(WKIconDatabaseRef iconDatabase, WKURLRef pageURL);
+WK_EXPORT void WKIconDatabaseReleaseIconForURL(WKIconDatabaseRef iconDatabase, WKURLRef pageURL);
+WK_EXPORT void WKIconDatabaseEnableDatabaseCleanup(WKIconDatabaseRef iconDatabase);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKIconDatabase_h */
diff --git a/Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.cpp b/Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.cpp
new file mode 100644
index 0000000..6e2ecce
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.cpp
@@ -0,0 +1,52 @@
+/*
+ * 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 "WKMediaCacheManager.h"
+
+#include "WKAPICast.h"
+#include "WebMediaCacheManagerProxy.h"
+
+using namespace WebKit;
+
+WKTypeID WKMediaCacheManagerGetTypeID()
+{
+ return toAPI(WebMediaCacheManagerProxy::APIType);
+}
+
+void WKMediaCacheManagerGetHostnamesWithMediaCache(WKMediaCacheManagerRef mediaCacheManagerRef, void* context, WKMediaCacheManagerGetHostnamesWithMediaCacheFunction callback)
+{
+ toImpl(mediaCacheManagerRef)->getHostnamesWithMediaCache(ArrayCallback::create(context, callback));
+}
+
+void WKMediaCacheManagerClearCacheForHostname(WKMediaCacheManagerRef mediaCacheManagerRef, WKStringRef hostname)
+{
+ toImpl(mediaCacheManagerRef)->clearCacheForHostname(toWTFString(hostname));
+}
+
+void WKMediaCacheManagerClearCacheForAllHostnames(WKMediaCacheManagerRef mediaCacheManagerRef)
+{
+ toImpl(mediaCacheManagerRef)->clearCacheForAllHostnames();
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.h b/Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.h
new file mode 100644
index 0000000..eee1b92
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.h
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+#ifndef WKMediaCacheManager_h
+#define WKMediaCacheManager_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKMediaCacheManagerGetTypeID();
+
+typedef void (*WKMediaCacheManagerGetHostnamesWithMediaCacheFunction)(WKArrayRef, WKErrorRef, void*);
+WK_EXPORT void WKMediaCacheManagerGetHostnamesWithMediaCache(WKMediaCacheManagerRef mediaCacheManager, void* context, WKMediaCacheManagerGetHostnamesWithMediaCacheFunction function);
+
+WK_EXPORT void WKMediaCacheManagerClearCacheForHostname(WKMediaCacheManagerRef mediaCacheManager, WKStringRef hostname);
+WK_EXPORT void WKMediaCacheManagerClearCacheForAllHostnames(WKMediaCacheManagerRef mediaCacheManager);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKMediaCacheManager_h
diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.cpp b/Source/WebKit2/UIProcess/API/C/WKPage.cpp
index c4e8eae..7061e39 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPage.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKPage.cpp
@@ -56,7 +56,7 @@ WKPageGroupRef WKPageGetPageGroup(WKPageRef pageRef)
void WKPageLoadURL(WKPageRef pageRef, WKURLRef URLRef)
{
- toImpl(pageRef)->loadURL(toImpl(URLRef)->string());
+ toImpl(pageRef)->loadURL(toWTFString(URLRef));
}
void WKPageLoadURLRequest(WKPageRef pageRef, WKURLRequestRef urlRequestRef)
diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.h b/Source/WebKit2/UIProcess/API/C/WKPage.h
index 655e999..03f49f7 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPage.h
+++ b/Source/WebKit2/UIProcess/API/C/WKPage.h
@@ -173,6 +173,7 @@ typedef void (*WKPageDrawHeaderCallback)(WKPageRef page, WKFrameRef frame, WKRec
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);
+typedef void (*WKPageSaveDataToFileInDownloadsFolderCallback)(WKPageRef page, WKStringRef suggestedFilename, WKStringRef mimeType, WKURLRef originatingURL, WKDataRef data, const void* clientInfo);
struct WKPageUIClient {
int version;
@@ -210,6 +211,7 @@ struct WKPageUIClient {
WKPagePrintFrameCallback printFrame;
WKPageCallback runModal;
WKPageDidCompleteRubberBandForMainFrameCallback didCompleteRubberBandForMainFrame;
+ WKPageSaveDataToFileInDownloadsFolderCallback saveDataToFileInDownloadsFolder;
};
typedef struct WKPageUIClient WKPageUIClient;
diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
index 7ba9ba0..0122531 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
@@ -311,6 +311,16 @@ bool WKPreferencesGetAcceleratedDrawingEnabled(WKPreferencesRef preferencesRef)
return toImpl(preferencesRef)->acceleratedDrawingEnabled();
}
+void WKPreferencesSetCanvasUsesAcceleratedDrawing(WKPreferencesRef preferencesRef, bool flag)
+{
+ toImpl(preferencesRef)->setCanvasUsesAcceleratedDrawing(flag);
+}
+
+bool WKPreferencesGetCanvasUsesAcceleratedDrawing(WKPreferencesRef preferencesRef)
+{
+ return toImpl(preferencesRef)->canvasUsesAcceleratedDrawing();
+}
+
void WKPreferencesSetAcceleratedCompositingEnabled(WKPreferencesRef preferencesRef, bool flag)
{
toImpl(preferencesRef)->setAcceleratedCompositingEnabled(flag);
@@ -480,3 +490,43 @@ bool WKPreferencesGetJavaScriptCanAccessClipboard(WKPreferencesRef preferencesRe
{
return toImpl(preferencesRef)->javaScriptCanAccessClipboard();
}
+
+void WKPreferencesSetFullScreenEnabled(WKPreferencesRef preferencesRef, bool enabled)
+{
+ toImpl(preferencesRef)->setFullScreenEnabled(enabled);
+}
+
+bool WKPreferencesGetFullScreenEnabled(WKPreferencesRef preferencesRef)
+{
+ return toImpl(preferencesRef)->fullScreenEnabled();
+}
+
+void WKPreferencesSetWebSecurityEnabled(WKPreferencesRef preferencesRef, bool enabled)
+{
+ toImpl(preferencesRef)->setWebSecurityEnabled(enabled);
+}
+
+bool WKPreferencesGetWebSecurityEnabled(WKPreferencesRef preferencesRef)
+{
+ return toImpl(preferencesRef)->webSecurityEnabled();
+}
+
+void WKPreferencesSetUniversalAccessFromFileURLsAllowed(WKPreferencesRef preferencesRef, bool allowed)
+{
+ toImpl(preferencesRef)->setAllowUniversalAccessFromFileURLs(allowed);
+}
+
+bool WKPreferencesGetUniversalAccessFromFileURLsAllowed(WKPreferencesRef preferencesRef)
+{
+ return toImpl(preferencesRef)->allowUniversalAccessFromFileURLs();
+}
+
+void WKPreferencesSetFileAccessFromFileURLsAllowed(WKPreferencesRef preferencesRef, bool allowed)
+{
+ toImpl(preferencesRef)->setAllowFileAccessFromFileURLs(allowed);
+}
+
+bool WKPreferencesGetFileAccessFromFileURLsAllowed(WKPreferencesRef preferencesRef)
+{
+ return toImpl(preferencesRef)->allowFileAccessFromFileURLs();
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.h b/Source/WebKit2/UIProcess/API/C/WKPreferences.h
index 5c6c478..f2486bf 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPreferences.h
+++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.h
@@ -150,6 +150,11 @@ WK_EXPORT bool WKPreferencesGetShouldPrintBackgrounds(WKPreferencesRef preferenc
WK_EXPORT void WKPreferencesSetJavaScriptCanAccessClipboard(WKPreferencesRef preferencesRef, bool enabled);
WK_EXPORT bool WKPreferencesGetJavaScriptCanAccessClipboard(WKPreferencesRef preferencesRef);
+// Defaults to false
+WK_EXPORT void WKPreferencesSetFullScreenEnabled(WKPreferencesRef preferencesRef, bool enabled);
+WK_EXPORT bool WKPreferencesGetFullScreenEnabled(WKPreferencesRef preferencesRef);
+
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
index 426119b..ddf1b9a 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
+++ b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
@@ -52,6 +52,10 @@ WK_EXPORT void WKPreferencesSetAcceleratedDrawingEnabled(WKPreferencesRef, bool)
WK_EXPORT bool WKPreferencesGetAcceleratedDrawingEnabled(WKPreferencesRef);
// Defaults to true.
+WK_EXPORT void WKPreferencesSetCanvasUsesAcceleratedDrawing(WKPreferencesRef, bool);
+WK_EXPORT bool WKPreferencesGetCanvasUsesAcceleratedDrawing(WKPreferencesRef);
+
+// Defaults to true.
WK_EXPORT void WKPreferencesSetAcceleratedCompositingEnabled(WKPreferencesRef, bool);
WK_EXPORT bool WKPreferencesGetAcceleratedCompositingEnabled(WKPreferencesRef);
@@ -99,6 +103,18 @@ WK_EXPORT bool WKPreferencesGetPaginateDuringLayoutEnabled(WKPreferencesRef pref
WK_EXPORT void WKPreferencesSetDOMPasteAllowed(WKPreferencesRef preferences, bool enabled);
WK_EXPORT bool WKPreferencesGetDOMPasteAllowed(WKPreferencesRef preferences);
+// Defaults to true.
+WK_EXPORT void WKPreferencesSetWebSecurityEnabled(WKPreferencesRef preferences, bool enabled);
+WK_EXPORT bool WKPreferencesGetWebSecurityEnabled(WKPreferencesRef preferences);
+
+// Defaults to false.
+WK_EXPORT void WKPreferencesSetUniversalAccessFromFileURLsAllowed(WKPreferencesRef preferences, bool allowed);
+WK_EXPORT bool WKPreferencesGetUniversalAccessFromFileURLsAllowed(WKPreferencesRef preferences);
+
+// Defaults to false.
+WK_EXPORT void WKPreferencesSetFileAccessFromFileURLsAllowed(WKPreferencesRef preferences, bool allowed);
+WK_EXPORT bool WKPreferencesGetFileAccessFromFileURLsAllowed(WKPreferencesRef preferences);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.cpp b/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.cpp
new file mode 100644
index 0000000..5e50dd8
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.cpp
@@ -0,0 +1,41 @@
+/*
+ * 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 MERCHANTAwBILITY 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 "WKIconDatabaseCG.h"
+
+#include "WebIconDatabase.h"
+#include "WKAPICast.h"
+#include "WKSharedAPICast.h"
+#include <WebCore/Image.h>
+
+using namespace WebKit;
+using namespace WebCore;
+
+CGImageRef WKIconDatabaseGetCGImageForURL(WKIconDatabaseRef iconDatabaseRef, WKURLRef urlRef)
+{
+ Image* image = toImpl(iconDatabaseRef)->imageForPageURL(toWTFString(urlRef));
+ return image ? image->getCGImageRef() : 0;
+}
diff --git a/Source/WebKit2/UIProcess/API/C/win/WKBaseWin.h b/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.h
index e2ee9a7..48cf5bf 100644
--- a/Source/WebKit2/UIProcess/API/C/win/WKBaseWin.h
+++ b/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * 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
@@ -23,13 +23,20 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WKBaseWin_h
-#define WKBaseWin_h
+#ifndef WKIconDatabaseCG_h
+#define WKIconDatabaseCG_h
-#ifndef WKBase_h
-#error "Please #include \"WKBase.h\" instead of this file directly."
+#include <CoreGraphics/CGImage.h>
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
#endif
-typedef const struct OpaqueWKView* WKViewRef;
+WK_EXPORT CGImageRef WKIconDatabaseGetCGImageForURL(WKIconDatabaseRef iconDatabase, WKURLRef urlString);
+
+#ifdef __cplusplus
+}
+#endif
-#endif /* WKBaseWin_h */
+#endif /* WKIconDatabaseCG_h */
diff --git a/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h b/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h
index 6acb1a6..09cf06f 100644
--- a/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h
+++ b/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h
@@ -33,8 +33,10 @@
namespace WebKit {
class WebView;
+class WebEditCommandProxy;
WK_ADD_API_MAPPING(WKViewRef, WebView)
+WK_ADD_API_MAPPING(WKEditCommandRef, WebEditCommandProxy)
}
diff --git a/Source/WebKit2/UIProcess/API/C/win/WKContextPrivateWin.h b/Source/WebKit2/UIProcess/API/C/win/WKContextPrivateWin.h
index c8a9c34..0d49ac9 100644
--- a/Source/WebKit2/UIProcess/API/C/win/WKContextPrivateWin.h
+++ b/Source/WebKit2/UIProcess/API/C/win/WKContextPrivateWin.h
@@ -28,6 +28,7 @@
#include <WebKit2/WKBase.h>
#include <WebKit2/WKContext.h>
+#include <WebKit2/WKCookieManager.h>
#ifndef __cplusplus
#include <stdbool.h>
@@ -40,6 +41,9 @@ extern "C" {
// Defaults to true.
WK_EXPORT void WKContextSetShouldPaintNativeControls(WKContextRef, bool);
+// Defaults to WKHTTPCookieAcceptPolicyAlways.
+WK_EXPORT void WKContextSetInitialHTTPCookieAcceptPolicy(WKContextRef, WKHTTPCookieAcceptPolicy);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp b/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp
index 110951f..4971540 100644
--- a/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp
+++ b/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp
@@ -36,3 +36,8 @@ void WKContextSetShouldPaintNativeControls(WKContextRef contextRef, bool b)
{
toImpl(contextRef)->setShouldPaintNativeControls(b);
}
+
+void WKContextSetInitialHTTPCookieAcceptPolicy(WKContextRef contextRef, WKHTTPCookieAcceptPolicy policy)
+{
+ toImpl(contextRef)->setInitialHTTPCookieAcceptPolicy(toHTTPCookieAcceptPolicy(policy));
+}
diff --git a/Source/WebKit2/UIProcess/API/C/win/WKView.cpp b/Source/WebKit2/UIProcess/API/C/win/WKView.cpp
index 62603fe..05ae0d7 100644
--- a/Source/WebKit2/UIProcess/API/C/win/WKView.cpp
+++ b/Source/WebKit2/UIProcess/API/C/win/WKView.cpp
@@ -72,6 +72,11 @@ void WKViewSetInitialFocus(WKViewRef viewRef, bool forward)
toImpl(viewRef)->setInitialFocus(forward);
}
+void WKViewSetScrollOffsetOnNextResize(WKViewRef viewRef, WKSize scrollOffset)
+{
+ toImpl(viewRef)->setScrollOffsetOnNextResize(toIntSize(scrollOffset));
+}
+
void WKViewSetFindIndicatorCallback(WKViewRef viewRef, WKViewFindIndicatorCallback callback, void* context)
{
toImpl(viewRef)->setFindIndicatorCallback(callback, context);
@@ -81,3 +86,20 @@ WKViewFindIndicatorCallback WKViewGetFindIndicatorCallback(WKViewRef viewRef, vo
{
return toImpl(viewRef)->getFindIndicatorCallback(context);
}
+
+void WKViewSetViewUndoClient(WKViewRef viewRef, const WKViewUndoClient* wkClient)
+{
+ if (wkClient && wkClient->version)
+ return;
+ toImpl(viewRef)->initializeUndoClient(wkClient);
+}
+
+void WKViewReapplyEditCommand(WKViewRef viewRef, WKEditCommandRef command)
+{
+ toImpl(viewRef)->reapplyEditCommand(toImpl(command));
+}
+
+void WKViewUnapplyEditCommand(WKViewRef viewRef, WKEditCommandRef command)
+{
+ toImpl(viewRef)->unapplyEditCommand(toImpl(command));
+}
diff --git a/Source/WebKit2/UIProcess/API/C/win/WKView.h b/Source/WebKit2/UIProcess/API/C/win/WKView.h
index 213897e..c8ac44c 100644
--- a/Source/WebKit2/UIProcess/API/C/win/WKView.h
+++ b/Source/WebKit2/UIProcess/API/C/win/WKView.h
@@ -27,12 +27,31 @@
#define WKView_h
#include <WebKit2/WKBase.h>
+#include <WebKit2/WKGeometry.h>
#include <windows.h>
#ifdef __cplusplus
extern "C" {
#endif
+// Undo Client.
+enum {
+ kWKViewUndo = 0,
+ kWKViewRedo = 1
+};
+typedef uint32_t WKViewUndoType;
+
+typedef void (*WKViewRegisterEditCommandCallback)(WKViewRef, WKEditCommandRef, WKViewUndoType undoOrRedo, const void *clientInfo);
+typedef void (*WKViewClearAllEditCommandsCallback)(WKViewRef, const void *clientInfo);
+
+struct WKViewUndoClient {
+ int version;
+ const void * clientInfo;
+ WKViewRegisterEditCommandCallback registerEditCommand;
+ WKViewClearAllEditCommandsCallback clearAllEditCommands;
+};
+typedef struct WKViewUndoClient WKViewUndoClient;
+
WK_EXPORT WKTypeID WKViewGetTypeID();
WK_EXPORT WKViewRef WKViewCreate(RECT rect, WKContextRef context, WKPageGroupRef pageGroup, HWND parentWindow);
@@ -41,10 +60,15 @@ WK_EXPORT HWND WKViewGetWindow(WKViewRef view);
WK_EXPORT WKPageRef WKViewGetPage(WKViewRef view);
+WK_EXPORT void WKViewSetViewUndoClient(WKViewRef view, const WKViewUndoClient* client);
+WK_EXPORT void WKViewReapplyEditCommand(WKViewRef view, WKEditCommandRef command);
+WK_EXPORT void WKViewUnapplyEditCommand(WKViewRef view, WKEditCommandRef command);
+
WK_EXPORT void WKViewSetParentWindow(WKViewRef view, HWND parentWindow);
WK_EXPORT void WKViewWindowAncestryDidChange(WKViewRef view);
WK_EXPORT void WKViewSetIsInWindow(WKViewRef view, bool isInWindow);
WK_EXPORT void WKViewSetInitialFocus(WKViewRef view, bool forward);
+WK_EXPORT void WKViewSetScrollOffsetOnNextResize(WKViewRef view, WKSize scrollOffset);
typedef void (*WKViewFindIndicatorCallback)(WKViewRef, HBITMAP selectionBitmap, RECT selectionRectInWindowCoordinates, bool fadeout, void*);
WK_EXPORT void WKViewSetFindIndicatorCallback(WKViewRef view, WKViewFindIndicatorCallback callback, void* context);
diff --git a/Source/WebKit2/UIProcess/API/mac/PDFViewController.h b/Source/WebKit2/UIProcess/API/mac/PDFViewController.h
index d22d8b5..dc30f56 100644
--- a/Source/WebKit2/UIProcess/API/mac/PDFViewController.h
+++ b/Source/WebKit2/UIProcess/API/mac/PDFViewController.h
@@ -41,6 +41,8 @@ namespace CoreIPC {
namespace WebKit {
+class WebPageProxy;
+
class PDFViewController {
WTF_MAKE_NONCOPYABLE(PDFViewController);
@@ -49,6 +51,9 @@ public:
~PDFViewController();
WKView* wkView() const { return m_wkView; }
+ WebPageProxy* page() const;
+ NSView* pdfView() const;
+
void setPDFDocumentData(const String& mimeType, const String& suggestedFilename, const CoreIPC::DataReference&);
double zoomFactor() const;
@@ -58,6 +63,7 @@ public:
NSPrintOperation *makePrintOperation(NSPrintInfo *);
void openPDFInFinder();
+ void savePDFToDownloadsFolder();
private:
explicit PDFViewController(WKView *wkView);
diff --git a/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm b/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm
index 5d9b860..5c64000 100644
--- a/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm
+++ b/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm
@@ -29,6 +29,7 @@
#import "DataReference.h"
#import "WKAPICast.h"
#import "WKView.h"
+#import "WebData.h"
#import "WebPageGroup.h"
#import "WebPageProxy.h"
#import "WebPreferences.h"
@@ -116,7 +117,7 @@ extern "C" NSString *_NSPathForSystemFramework(NSString *framework);
if (!_pdfViewController)
return;
- WebPreferences *preferences = toImpl([_pdfViewController->wkView() pageRef])->pageGroup()->preferences();
+ WebPreferences *preferences = _pdfViewController->page()->pageGroup()->preferences();
CGFloat scaleFactor = preferences->pdfScaleFactor();
if (!scaleFactor)
@@ -135,7 +136,7 @@ extern "C" NSString *_NSPathForSystemFramework(NSString *framework);
if (!_pdfViewController)
return;
- WebPreferences* preferences = toImpl([_pdfViewController->wkView() pageRef])->pageGroup()->preferences();
+ WebPreferences* preferences = _pdfViewController->page()->pageGroup()->preferences();
CGFloat scaleFactor = [_pdfView autoScales] ? 0 : [_pdfView scaleFactor];
preferences->setPDFScaleFactor(scaleFactor);
@@ -187,6 +188,11 @@ extern "C" NSString *_NSPathForSystemFramework(NSString *framework);
_pdfViewController->openPDFInFinder();
}
+- (void)PDFViewSavePDFToDownloadFolder:(PDFView *)sender
+{
+ _pdfViewController->savePDFToDownloadsFolder();
+}
+
@end
namespace WebKit {
@@ -212,6 +218,16 @@ PDFViewController::~PDFViewController()
m_wkPDFView = nullptr;
}
+WebPageProxy* PDFViewController::page() const
+{
+ return toImpl([m_wkView pageRef]);
+}
+
+NSView* PDFViewController::pdfView() const
+{
+ return m_wkPDFView.get();
+}
+
static RetainPtr<CFDataRef> convertPostScriptDataSourceToPDF(const CoreIPC::DataReference& dataReference)
{
// Convert PostScript to PDF using Quartz 2D API
@@ -330,6 +346,32 @@ void PDFViewController::openPDFInFinder()
[[NSWorkspace sharedWorkspace] openFile:path];
}
+static void releaseCFData(unsigned char*, const void* data)
+{
+ ASSERT(CFGetTypeID(data) == CFDataGetTypeID());
+
+ // Balanced by CFRetain in savePDFToDownloadsFolder.
+ CFRelease(data);
+}
+
+void PDFViewController::savePDFToDownloadsFolder()
+{
+ // We don't want to write the file until we have a document to write. (see 5267607).
+ if (![m_pdfView document]) {
+ NSBeep();
+ return;
+ }
+
+ ASSERT(m_pdfData);
+
+ // Balanced by CFRelease in releaseCFData.
+ CFRetain(m_pdfData.get());
+
+ RefPtr<WebData> data = WebData::createWithoutCopying(CFDataGetBytePtr(m_pdfData.get()), CFDataGetLength(m_pdfData.get()), releaseCFData, m_pdfData.get());
+
+ page()->saveDataToFileInDownloadsFolder(m_suggestedFilename.get(), page()->mainFrame()->mimeType(), page()->mainFrame()->url(), data.get());
+}
+
static NSString *temporaryPDFDirectoryPath()
{
static NSString *temporaryPDFDirectoryPath;
diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
index e01cf66..e217fc5 100644
--- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
+++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
@@ -26,6 +26,7 @@
#ifndef PageClientImpl_h
#define PageClientImpl_h
+#include "CorrectionPanel.h"
#include "PageClient.h"
#include <wtf/RetainPtr.h>
@@ -62,6 +63,7 @@ private:
virtual void processDidCrash();
virtual void pageClosed();
virtual void didRelaunchProcess();
+ virtual void setFocus(bool focused);
virtual void takeFocus(bool direction);
virtual void toolTipChanged(const String& oldToolTip, const String& newToolTip);
virtual void setCursor(const WebCore::Cursor&);
@@ -70,11 +72,12 @@ private:
virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
virtual void clearAllEditCommands();
virtual void interceptKeyEvent(const NativeWebKeyboardEvent& event, Vector<WebCore::KeypressCommand>& commandName, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline>& underlines);
- virtual void setDragImage(const WebCore::IntPoint& clientPosition, const WebCore::IntSize& imageSize, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag);
+ virtual void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag);
virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
-
+ virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&);
+
virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled);
virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*);
@@ -87,7 +90,6 @@ private:
virtual void accessibilityWebProcessTokenReceived(const CoreIPC::DataReference&);
virtual void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled);
- virtual void setAutodisplay(bool);
virtual CGContextRef containingWindowGraphicsContext();
@@ -103,8 +105,18 @@ private:
virtual void didPerformDictionaryLookup(const String&, double scaleFactor, const DictionaryPopupInfo&);
+ virtual void showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
+ virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingCorrectionPanel);
+ virtual String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingCorrectionPanel);
+ virtual void recordAutocorrectionResponse(WebCore::EditorClient::AutocorrectionResponseType, const String& replacedString, const String& replacementString);
+
+ virtual float userSpaceScaleFactor() const;
+
WKView* m_wkView;
RetainPtr<WebEditorUndoTargetObjC> m_undoTarget;
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ CorrectionPanel m_correctionPanel;
+#endif
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
index 88bb9a4..7a0d62d 100644
--- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
+++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
@@ -45,6 +45,7 @@
#import <wtf/PassOwnPtr.h>
#import <wtf/text/CString.h>
#import <wtf/text/WTFString.h>
+#import <WebKitSystemInterface.h>
@interface NSApplication (WebNSApplicationDetails)
- (NSCursor *)_cursorRectCursor;
@@ -195,6 +196,15 @@ void PageClientImpl::didRelaunchProcess()
[m_wkView _didRelaunchProcess];
}
+void PageClientImpl::setFocus(bool focused)
+{
+ if (focused)
+ [[m_wkView window] makeFirstResponder:m_wkView];
+ else
+ // takeFocus in this context means take focus away from the WKView.
+ takeFocus(true);
+}
+
void PageClientImpl::takeFocus(bool direction)
{
[m_wkView _takeFocus:direction];
@@ -287,10 +297,11 @@ void PageClientImpl::interceptKeyEvent(const NativeWebKeyboardEvent& event, Vect
[m_wkView _getTextInputState:selectionStart selectionEnd:selectionEnd underlines:underlines];
}
-void PageClientImpl::setDragImage(const IntPoint& clientPosition, const IntSize& imageSize, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag)
+void PageClientImpl::setDragImage(const IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag)
{
- OwnPtr<GraphicsContext> graphicsContext = dragImage->createGraphicsContext();
- RetainPtr<NSImage> dragNSImage(AdoptNS, [[NSImage alloc] initWithCGImage:CGBitmapContextCreateImage(graphicsContext->platformContext()) size:imageSize]);
+ RetainPtr<CGImageRef> dragCGImage = dragImage->makeCGImage();
+ RetainPtr<NSImage> dragNSImage(AdoptNS, [[NSImage alloc] initWithCGImage:dragCGImage.get() size:dragImage->size()]);
+
[m_wkView _setDragImage:dragNSImage.get() at:clientPosition linkDrag:isLinkDrag];
}
@@ -303,6 +314,14 @@ FloatRect PageClientImpl::convertToUserSpace(const FloatRect& rect)
{
return [m_wkView _convertToUserSpace:rect];
}
+
+IntRect PageClientImpl::windowToScreen(const IntRect& rect)
+{
+ NSRect tempRect = rect;
+ tempRect = [m_wkView convertRect:tempRect toView:nil];
+ tempRect.origin = [[m_wkView window] convertBaseToScreen:tempRect.origin];
+ return enclosingIntRect(tempRect);
+}
void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool wasEventHandled)
{
@@ -311,10 +330,8 @@ void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool
return;
if (wasEventHandled)
[NSCursor setHiddenUntilMouseMoves:YES];
- else {
- [m_wkView _setEventBeingResent:nativeEvent];
- [[NSApplication sharedApplication] sendEvent:nativeEvent];
- }
+ else
+ [m_wkView _resendKeyDownEvent:nativeEvent];
}
PassRefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy(WebPageProxy* page)
@@ -355,18 +372,6 @@ 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];
-
- // For some reason, painting doesn't happen for a long time without this call, <rdar://problem/8975229>.
- if (newState)
- [m_wkView displayIfNeeded];
-}
-
CGContextRef PageClientImpl::containingWindowGraphicsContext()
{
NSWindow *window = [m_wkView window];
@@ -419,9 +424,64 @@ void PageClientImpl::didPerformDictionaryLookup(const String& text, double scale
NSPoint textBaselineOrigin = dictionaryPopupInfo.origin;
textBaselineOrigin.y += [font ascender];
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ // Convert to screen coordinates.
+ textBaselineOrigin = [m_wkView convertPoint:textBaselineOrigin toView:nil];
+ textBaselineOrigin = [m_wkView.window convertRectToScreen:NSMakeRect(textBaselineOrigin.x, textBaselineOrigin.y, 0, 0)].origin;
+
+ WKShowWordDefinitionWindow(attributedString.get(), textBaselineOrigin, (NSDictionary *)dictionaryPopupInfo.options.get());
+#else
// If the dictionary lookup is being triggered by a hot key, force the overlay style.
NSDictionary *options = (dictionaryPopupInfo.type == DictionaryPopupInfo::HotKey) ? [NSDictionary dictionaryWithObject:NSDefinitionPresentationTypeOverlay forKey:NSDefinitionPresentationTypeKey] : 0;
[m_wkView showDefinitionForAttributedString:attributedString.get() range:NSMakeRange(0, [attributedString.get() length]) options:options baselineOriginProvider:^(NSRange adjustedRange) { return (NSPoint)textBaselineOrigin; }];
+#endif
+}
+
+void PageClientImpl::showCorrectionPanel(CorrectionPanelInfo::PanelType type, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings)
+{
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ if (!isViewVisible() || !isViewInWindow())
+ return;
+ m_correctionPanel.show(m_wkView, type, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings);
+#endif
+}
+
+void PageClientImpl::dismissCorrectionPanel(ReasonForDismissingCorrectionPanel reason)
+{
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ m_correctionPanel.dismiss(reason);
+#endif
+}
+
+String PageClientImpl::dismissCorrectionPanelSoon(WebCore::ReasonForDismissingCorrectionPanel reason)
+{
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ return m_correctionPanel.dismissSoon(reason);
+#else
+ return String();
+#endif
+}
+
+void PageClientImpl::recordAutocorrectionResponse(EditorClient::AutocorrectionResponseType responseType, const String& replacedString, const String& replacementString)
+{
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ NSCorrectionResponse response = responseType == EditorClient::AutocorrectionReverted ? NSCorrectionResponseReverted : NSCorrectionResponseEdited;
+ CorrectionPanel::recordAutocorrectionResponse(m_wkView, response, replacedString, replacementString);
+#endif
+}
+
+float PageClientImpl::userSpaceScaleFactor() const
+{
+ NSWindow *window = [m_wkView window];
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ if (window)
+ return [window backingScaleFactor];
+ return [[NSScreen mainScreen] backingScaleFactor];
+#else
+ if (window)
+ return [window userSpaceScaleFactor];
+ return [[NSScreen mainScreen] userSpaceScaleFactor];
+#endif
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/mac/WKPrintingView.h b/Source/WebKit2/UIProcess/API/mac/WKPrintingView.h
index 3f7a692..87d81f4 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKPrintingView.h
+++ b/Source/WebKit2/UIProcess/API/mac/WKPrintingView.h
@@ -35,6 +35,7 @@ namespace WebKit {
@interface WKPrintingView : NSView {
@public
NSPrintOperation *_printOperation; // WKPrintingView is owned by the operation.
+ RetainPtr<NSView> _wkView;
RefPtr<WebKit::WebFrameProxy> _webFrame;
Vector<WebCore::IntRect> _printingPageRects;
@@ -56,6 +57,6 @@ namespace WebKit {
NSTimer *_autodisplayResumeTimer;
}
-- (id)initWithFrameProxy:(WebKit::WebFrameProxy*)frame;
+- (id)initWithFrameProxy:(WebKit::WebFrameProxy*)frame view:(NSView *)wkView;
@end
diff --git a/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm b/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm
index 28ba153..d5d9de7 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm
+++ b/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm
@@ -43,13 +43,14 @@ static BOOL isForcingPreviewUpdate;
@implementation WKPrintingView
-- (id)initWithFrameProxy:(WebFrameProxy*)frame
+- (id)initWithFrameProxy:(WebKit::WebFrameProxy*)frame view:(NSView *)wkView
{
self = [super init]; // No frame rect to pass to NSView.
if (!self)
return nil;
_webFrame = frame;
+ _wkView = wkView;
return self;
}
@@ -59,6 +60,19 @@ static BOOL isForcingPreviewUpdate;
return YES;
}
+- (void)_setAutodisplay:(BOOL)newState
+{
+ if (!newState && [[_wkView.get() window] isAutodisplay])
+ [_wkView.get() displayIfNeeded];
+
+ [[_wkView.get() window] setAutodisplay:newState];
+
+ // For some reason, painting doesn't happen for a long time without this call, <rdar://problem/8975229>.
+ if (newState)
+ [_wkView.get() displayIfNeeded];
+}
+
+
- (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.
@@ -67,7 +81,7 @@ static BOOL isForcingPreviewUpdate;
[_autodisplayResumeTimer invalidate];
_autodisplayResumeTimer = nil;
} else
- _webFrame->page()->setAutodisplay(false);
+ [self _setAutodisplay:NO];
}
- (void)_delayedResumeAutodisplayTimerFired
@@ -75,7 +89,7 @@ static BOOL isForcingPreviewUpdate;
ASSERT(isMainThread());
_autodisplayResumeTimer = nil;
- _webFrame->page()->setAutodisplay(true);
+ [self _setAutodisplay:YES];
}
- (void)_delayedResumeAutodisplay
@@ -200,11 +214,12 @@ static void pageDidDrawToPDF(WKDataRef dataRef, WKErrorRef, void* untypedContext
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)
+ bool receivedResponseToLatestRequest = view->_latestExpectedPreviewCallback == context->callbackID;
+ if (receivedResponseToLatestRequest) {
+ view->_latestExpectedPreviewCallback = 0;
[view _updatePreview];
+ }
}
}
}
@@ -264,6 +279,12 @@ static void pageDidComputePageRects(const Vector<WebCore::IntRect>& pageRects, d
view->_printingPageRects = pageRects;
view->_totalScaleFactorForPrinting = totalScaleFactorForPrinting;
+ // Sanitize a response coming from the Web process.
+ if (view->_printingPageRects.isEmpty())
+ view->_printingPageRects.append(IntRect(0, 0, 1, 1));
+ if (view->_totalScaleFactorForPrinting <= 0)
+ view->_totalScaleFactorForPrinting = 1;
+
const IntRect& lastPrintingPageRect = view->_printingPageRects[view->_printingPageRects.size() - 1];
NSRect newFrameSize = NSMakeRect(0, 0,
ceil(lastPrintingPageRect.maxX() * view->_totalScaleFactorForPrinting),
@@ -330,6 +351,11 @@ static void prepareDataForPrintingOnSecondaryThread(void* untypedContext)
if (!isMainThread())
_isPrintingFromSecondaryThread = YES;
+ if (!_webFrame->page()) {
+ *range = NSMakeRange(1, NSIntegerMax);
+ return YES;
+ }
+
[self _suspendAutodisplay];
[self _adjustPrintingMarginsForHeaderAndFooter];
@@ -524,11 +550,22 @@ static void prepareDataForPrintingOnSecondaryThread(void* untypedContext)
ASSERT(_printOperation == [NSPrintOperation currentOperation]);
if (![self _hasPageRects]) {
LOG(View, "-[WKPrintingView %p rectForPage:%d] - data is not yet available", self, (int)page);
+ if (!_webFrame->page()) {
+ // We may have not told AppKit how many pages there are, so it will try to print until a null rect is returned.
+ return NSMakeRect(0, 0, 0, 0);
+ }
// We must be still calculating the page range.
ASSERT(_expectedComputedPagesCallback);
return NSMakeRect(0, 0, 1, 1);
}
+ // If Web process crashes while computing page rects, we never tell AppKit how many pages there are.
+ // Returning a null rect prevents selecting non-existent pages in preview dialog.
+ if (static_cast<unsigned>(page) > _printingPageRects.size()) {
+ ASSERT(!_webFrame->page());
+ return NSMakeRect(0, 0, 0, 0);
+ }
+
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());
diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm
index e432549..05693ef 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/Source/WebKit2/UIProcess/API/mac/WKView.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
@@ -42,6 +42,7 @@
#import "TextChecker.h"
#import "TextCheckerState.h"
#import "WKAPICast.h"
+#import "WKFullScreenWindowController.h"
#import "WKPrintingView.h"
#import "WKStringCF.h"
#import "WKTextInputWindowController.h"
@@ -49,6 +50,7 @@
#import "WKViewPrivate.h"
#import "WebContext.h"
#import "WebEventFactory.h"
+#import "WebFullScreenManagerProxy.h"
#import "WebPage.h"
#import "WebPageProxy.h"
#import "WebProcessProxy.h"
@@ -57,6 +59,7 @@
#import <WebCore/ColorMac.h>
#import <WebCore/DragController.h>
#import <WebCore/DragData.h>
+#import <WebCore/LocalizedStrings.h>
#import <WebCore/FloatRect.h>
#import <WebCore/IntRect.h>
#import <WebCore/KeyboardEvent.h>
@@ -66,15 +69,14 @@
#import <wtf/RefPtr.h>
#import <wtf/RetainPtr.h>
-// FIXME (WebKit2) <rdar://problem/8728860> WebKit2 needs to be localized
-#define UI_STRING(__str, __desc) [NSString stringWithUTF8String:__str]
-
-@interface NSApplication (Details)
+@interface NSApplication (WebNSApplicationDetails)
- (void)speakString:(NSString *)string;
+- (void)_setCurrentEvent:(NSEvent *)event;
@end
-@interface NSWindow (Details)
+@interface NSWindow (WebNSWindowDetails)
- (NSRect)_growBoxRect;
+- (id)_growBoxOwner;
- (void)_setShowOpaqueGrowBoxForOwner:(id)owner;
- (BOOL)_updateGrowBoxForWindowFrameChange;
@end
@@ -108,11 +110,6 @@ typedef HashMap<String, ValidationVector> ValidationMap;
RetainPtr<NSView> _layerHostingView;
- // FIXME: Remove _oldLayerHostingView.
-#if USE(ACCELERATED_COMPOSITING)
- NSView *_oldLayerHostingView;
-#endif
-
RetainPtr<id> _remoteAccessibilityChild;
// For asynchronous validation.
@@ -124,7 +121,8 @@ typedef HashMap<String, ValidationVector> ValidationMap;
// We keep here the event when resending it to
// the application to distinguish the case of a new event from one
// that has been already sent to WebCore.
- NSEvent *_keyDownEventBeingResent;
+ RetainPtr<NSEvent> _keyDownEventBeingResent;
+ bool _isInInterpretKeyEvents;
Vector<KeypressCommand> _commandsList;
NSSize _resizeScrollOffset;
@@ -145,6 +143,13 @@ typedef HashMap<String, ValidationVector> ValidationMap;
#if ENABLE(GESTURE_EVENTS)
id _endGestureMonitor;
#endif
+
+#if ENABLE(FULLSCREEN_API)
+ RetainPtr<WKFullScreenWindowController> _fullScreenWindowController;
+#endif
+
+ BOOL _hasSpellCheckerDocumentTag;
+ NSInteger _spellCheckerDocumentTag;
}
@end
@@ -158,12 +163,6 @@ typedef HashMap<String, ValidationVector> ValidationMap;
@implementation WKView
-// FIXME: Remove this once we no longer want to be able to go back to the old drawing area.
-static bool useNewDrawingArea()
-{
- return true;
-}
-
- (id)initWithFrame:(NSRect)frame
{
return [self initWithFrame:frame contextRef:toAPI(WebContext::sharedProcessContext())];
@@ -223,6 +222,9 @@ static bool useNewDrawingArea()
_data->_pageClient = PageClientImpl::create(self);
_data->_page = toImpl(contextRef)->createWebPage(_data->_pageClient.get(), toImpl(pageGroupRef));
_data->_page->initializeWebPage();
+#if ENABLE(FULLSCREEN_API)
+ _data->_page->fullScreenManager()->setWebView(self);
+#endif
_data->_mouseDownEvent = nil;
_data->_ignoringMouseDraggedEvents = NO;
@@ -238,6 +240,7 @@ static bool useNewDrawingArea()
_data->_page->close();
[_data release];
+ _data = nil;
WebContext::statistics().wkViewCount--;
@@ -496,6 +499,8 @@ WEBCORE_COMMAND(yankAndSelect)
#undef WEBCORE_COMMAND
+// This method is needed to support Mac OS X services.
+
- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pasteboard types:(NSArray *)types
{
Vector<String> pasteboardTypes;
@@ -505,6 +510,8 @@ WEBCORE_COMMAND(yankAndSelect)
return _data->_page->writeSelectionToPasteboard([pasteboard name], pasteboardTypes);
}
+// This method is needed to support Mac OS X services.
+
- (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType
{
BOOL isValidSendType = !sendType || ([PasteboardTypes::forSelection() containsObject:sendType] && !_data->_page->selectionState().isNone);
@@ -520,6 +527,13 @@ WEBCORE_COMMAND(yankAndSelect)
return [[self nextResponder] validRequestorForSendType:sendType returnType:returnType];
}
+// This method is needed to support Mac OS X services.
+
+- (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pasteboard
+{
+ return _data->_page->readSelectionFromPasteboard([pasteboard name]);
+}
+
/*
When possible, editing-related methods should be implemented in WebCore with the
@@ -589,12 +603,8 @@ static void validateCommandCallback(WKStringRef commandName, bool isEnabled, int
SEL action = [item action];
if (action == @selector(showGuessPanel:)) {
- if (NSMenuItem *menuItem = ::menuItem(item)) {
- BOOL panelShowing = [[[NSSpellChecker sharedSpellChecker] spellingPanel] isVisible];
- [menuItem setTitle:panelShowing
- ? UI_STRING("Hide Spelling and Grammar", "menu item title")
- : UI_STRING("Show Spelling and Grammar", "menu item title")];
- }
+ if (NSMenuItem *menuItem = ::menuItem(item))
+ [menuItem setTitle:contextMenuItemTagShowSpellingPanel([[[NSSpellChecker sharedSpellChecker] spellingPanel] isVisible])];
return _data->_page->selectionState().isContentEditable;
}
@@ -621,12 +631,8 @@ static void validateCommandCallback(WKStringRef commandName, bool isEnabled, int
}
if (action == @selector(orderFrontSubstitutionsPanel:)) {
- if (NSMenuItem *menuItem = ::menuItem(item)) {
- BOOL panelShowing = [[[NSSpellChecker sharedSpellChecker] substitutionsPanel] isVisible];
- [menuItem setTitle:panelShowing
- ? UI_STRING("Hide Substitutions", "menu item title")
- : UI_STRING("Show Substitutions", "menu item title")];
- }
+ if (NSMenuItem *menuItem = ::menuItem(item))
+ [menuItem setTitle:contextMenuItemTagShowSubstitutions([[[NSSpellChecker sharedSpellChecker] substitutionsPanel] isVisible])];
return _data->_page->selectionState().isContentEditable;
}
@@ -1010,6 +1016,12 @@ static const short kIOHIDEventTypeScroll = 6;
- (void)doCommandBySelector:(SEL)selector
{
+ LOG(TextInput, "doCommandBySelector:\"%s\"", sel_getName(selector));
+
+ if (!_data->_isInInterpretKeyEvents) {
+ [super doCommandBySelector:selector];
+ return;
+ }
if (selector != @selector(noop:))
_data->_commandsList.append(KeypressCommand(commandNameForSelector(selector)));
}
@@ -1034,9 +1046,13 @@ static const short kIOHIDEventTypeScroll = 6;
isFromInputMethod = YES;
} else
text = string;
-
+
String eventText = text;
+ // We'd need a different code path here if we wanted to be able to handle this
+ // outside of interpretKeyEvents.
+ ASSERT(_data->_isInInterpretKeyEvents);
+
if (!isFromInputMethod)
_data->_commandsList.append(KeypressCommand("insertText", text));
else {
@@ -1085,9 +1101,6 @@ static const short kIOHIDEventTypeScroll = 6;
// But don't do it if we have already handled the event.
// Pressing Esc results in a fake event being sent - don't pass it to WebCore.
if (!eventWasSentToWebCore && event == [NSApp currentEvent] && self == [[self window] firstResponder]) {
- [_data->_keyDownEventBeingResent release];
- _data->_keyDownEventBeingResent = nil;
-
_data->_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, self));
return YES;
}
@@ -1102,6 +1115,11 @@ static const short kIOHIDEventTypeScroll = 6;
- (void)keyDown:(NSEvent *)theEvent
{
+ // There's a chance that responding to this event will run a nested event loop, and
+ // fetching a new event might release the old one. Retaining and then autoreleasing
+ // the current event prevents that from causing a problem inside WebKit or AppKit code.
+ [[theEvent retain] autorelease];
+
if (_data->_pluginComplexTextInputIdentifier) {
// Try feeding the keyboard event directly to the plug-in.
NSString *string = nil;
@@ -1120,8 +1138,6 @@ static const short kIOHIDEventTypeScroll = 6;
// there is no range selection).
// If this is the case we should ignore the key down.
if (_data->_keyDownEventBeingResent == theEvent) {
- [_data->_keyDownEventBeingResent release];
- _data->_keyDownEventBeingResent = nil;
[super keyDown:theEvent];
return;
}
@@ -1129,7 +1145,7 @@ static const short kIOHIDEventTypeScroll = 6;
}
- (NSTextInputContext *)inputContext {
- if (_data->_pluginComplexTextInputIdentifier)
+ if (_data->_pluginComplexTextInputIdentifier && !_data->_isInInterpretKeyEvents)
return [[WKTextInputWindowController sharedTextInputWindowController] inputContext];
return [super inputContext];
@@ -1153,7 +1169,11 @@ static const short kIOHIDEventTypeScroll = 6;
- (void)unmarkText
{
LOG(TextInput, "unmarkText");
-
+
+ // We'd need a different code path here if we wanted to be able to handle this
+ // outside of interpretKeyEvents.
+ ASSERT(_data->_isInInterpretKeyEvents);
+
_data->_commandsList.append(KeypressCommand("unmarkText"));
}
@@ -1208,6 +1228,10 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
extractUnderlines(string, _data->_underlines);
}
+ // We'd need a different code path here if we wanted to be able to handle this
+ // outside of interpretKeyEvents.
+ ASSERT(_data->_isInInterpretKeyEvents);
+
_data->_commandsList.append(KeypressCommand("setMarkedText", text));
_data->_selectionStart = newSelRange.location;
_data->_selectionEnd = NSMaxRange(newSelRange);
@@ -1418,10 +1442,15 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
- (void)viewWillMoveToWindow:(NSWindow *)window
{
- if (window != [self window]) {
- [self removeWindowObservers];
- [self addWindowObserversForWindow:window];
- }
+ NSWindow *currentWindow = [self window];
+ if (window == currentWindow)
+ return;
+
+ [self removeWindowObservers];
+ [self addWindowObserversForWindow:window];
+
+ if ([currentWindow _growBoxOwner] == self)
+ [currentWindow _setShowOpaqueGrowBoxForOwner:nil];
}
- (void)viewDidMoveToWindow
@@ -1438,7 +1467,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
// 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]);
+ NSData *remoteWindowToken = WKAXRemoteTokenForElement([self accessibilityAttributeValue:NSAccessibilityWindowAttribute]);
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);
@@ -1454,6 +1483,9 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
_data->_endGestureMonitor = nil;
}
#endif
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ WKHideWordDefinitionWindow();
+#endif
}
}
@@ -1510,37 +1542,25 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
{
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()) {
- 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];
- for (NSInteger i = 0; i < numRectsBeingDrawn; ++i) {
- 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
- drawPageBackground(context, _data->_page.get(), enclosingIntRect(rect));
-
- _data->_page->didDraw();
- return;
- }
+ 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];
+ for (NSInteger i = 0; i < numRectsBeingDrawn; ++i) {
+ 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
+ drawPageBackground(context, _data->_page.get(), enclosingIntRect(rect));
- if (_data->_page->isValid() && _data->_page->drawingArea()) {
- CGContextRef context = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
- _data->_page->drawingArea()->paint(IntRect(rect), context);
- _data->_page->didDraw();
- } else if (_data->_page->drawsBackground()) {
- [_data->_page->drawsTransparentBackground() ? [NSColor clearColor] : [NSColor whiteColor] set];
- NSRectFill(rect);
- }
+ _data->_page->didDraw();
}
- (BOOL)isOpaque
@@ -1567,6 +1587,9 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
- (id)accessibilityFocusedUIElement
{
+ if (_data->_pdfViewController)
+ return NSAccessibilityUnignoredDescendant(_data->_pdfViewController->pdfView());
+
return _data->_remoteAccessibilityChild.get();
}
@@ -1577,15 +1600,25 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
- (id)accessibilityHitTest:(NSPoint)point
{
+ if (_data->_pdfViewController)
+ return [_data->_pdfViewController->pdfView() accessibilityHitTest:point];
+
return _data->_remoteAccessibilityChild.get();
}
- (id)accessibilityAttributeValue:(NSString*)attribute
{
if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) {
- if (!_data->_remoteAccessibilityChild)
+
+ id child = nil;
+ if (_data->_pdfViewController)
+ child = NSAccessibilityUnignoredDescendant(_data->_pdfViewController->pdfView());
+ else if (_data->_remoteAccessibilityChild)
+ child = _data->_remoteAccessibilityChild.get();
+
+ if (!child)
return nil;
- return [NSArray arrayWithObject:_data->_remoteAccessibilityChild.get()];
+ return [NSArray arrayWithObject:child];
}
if ([attribute isEqualToString:NSAccessibilityRoleAttribute])
return NSAccessibilityGroupRole;
@@ -1605,10 +1638,6 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
if (hitView && _data && hitView == _data->_layerHostingView)
hitView = self;
-#if USE(ACCELERATED_COMPOSITING)
- if (hitView && _data && hitView == _data->_oldLayerHostingView)
- hitView = self;
-#endif
return hitView;
}
@@ -1634,7 +1663,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
return 0;
return _data->_pdfViewController->makePrintOperation(printInfo);
} else {
- RetainPtr<WKPrintingView> printingView(AdoptNS, [[WKPrintingView alloc] initWithFrameProxy:toImpl(frameRef)]);
+ RetainPtr<WKPrintingView> printingView(AdoptNS, [[WKPrintingView alloc] initWithFrameProxy:toImpl(frameRef) view:self]);
// NSPrintOperation takes ownership of the view.
NSPrintOperation *printOperation = [NSPrintOperation printOperationWithView:printingView.get()];
[printOperation setCanSpawnSeparateThread:YES];
@@ -1649,10 +1678,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
- (PassOwnPtr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy
{
- if (useNewDrawingArea())
- return DrawingAreaProxyImpl::create(_data->_page.get());
-
- return ChunkedUpdateDrawingAreaProxy::create(self, _data->_page.get());
+ return DrawingAreaProxyImpl::create(_data->_page.get());
}
- (BOOL)_isFocused
@@ -1708,21 +1734,33 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
}
}
-- (void)_setEventBeingResent:(NSEvent *)event
+- (void)_resendKeyDownEvent:(NSEvent *)event
{
- _data->_keyDownEventBeingResent = [event retain];
+ ASSERT(!_data->_keyDownEventBeingResent);
+ _data->_keyDownEventBeingResent = event;
+ [NSApp _setCurrentEvent:event];
+ [NSApp sendEvent:event];
+
+ _data->_keyDownEventBeingResent = nullptr;
}
- (Vector<KeypressCommand>&)_interceptKeyEvent:(NSEvent *)theEvent
{
+ ASSERT(!_data->_isInInterpretKeyEvents);
+
+ _data->_isInInterpretKeyEvents = true;
_data->_commandsList.clear();
- // interpretKeyEvents will trigger one or more calls to doCommandBySelector or setText
+
+ // Calling interpretKeyEvents will trigger one or more calls to doCommandBySelector and insertText
// that will populate the commandsList vector.
[self interpretKeyEvents:[NSArray arrayWithObject:theEvent]];
+
+ _data->_isInInterpretKeyEvents = false;
+
return _data->_commandsList;
}
-- (void)_getTextInputState:(unsigned)start selectionEnd:(unsigned)end underlines:(Vector<WebCore::CompositionUnderline>&)lines
+- (void)_getTextInputState:(unsigned)start selectionEnd:(unsigned)end underlines:(Vector<CompositionUnderline>&)lines
{
start = _data->_selectionStart;
end = _data->_selectionEnd;
@@ -1771,20 +1809,23 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
- (void)removeTrackingRect:(NSTrackingRectTag)tag
{
+ if (!_data)
+ return;
+
if (tag == 0)
return;
- if (_data && (tag == TRACKING_RECT_TAG)) {
+ if (tag == TRACKING_RECT_TAG) {
_data->_trackingRectOwner = nil;
return;
}
- if (_data && (tag == _data->_lastToolTipTag)) {
+ if (tag == _data->_lastToolTipTag) {
[super removeTrackingRect:tag];
_data->_lastToolTipTag = 0;
return;
}
-
+
// If any other tracking rect is being removed, we don't know how it was created
// and it's possible there's a leak involved (see 3500217)
ASSERT_NOT_REACHED();
@@ -2001,6 +2042,17 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
[self _updateGrowBoxForWindowFrameChange];
}
+#if ENABLE(FULLSCREEN_API)
+- (WKFullScreenWindowController*)fullScreenWindowController
+{
+ if (!_data->_fullScreenWindowController) {
+ _data->_fullScreenWindowController.adoptNS([[WKFullScreenWindowController alloc] init]);
+ [_data->_fullScreenWindowController.get() setWebView:self];
+ }
+ return _data->_fullScreenWindowController.get();
+}
+#endif
+
@end
@implementation WKView (Private)
@@ -2033,5 +2085,19 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
_data->_page->performDictionaryLookupAtLocation(FloatPoint(thePoint.x, thePoint.y));
}
+- (NSInteger)spellCheckerDocumentTag
+{
+ if (!_data->_hasSpellCheckerDocumentTag) {
+ _data->_spellCheckerDocumentTag = [NSSpellChecker uniqueSpellDocumentTag];
+ _data->_hasSpellCheckerDocumentTag = YES;
+ }
+ return _data->_spellCheckerDocumentTag;
+}
+
+- (void)handleCorrectionPanelResult:(NSString*)result
+{
+ _data->_page->handleCorrectionPanelResult(result);
+}
+
@end
diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
index 4147658..e4a40f7 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
+++ b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
@@ -27,11 +27,20 @@
#import <WebCore/Editor.h>
#import <WebCore/KeyboardEvent.h>
+namespace CoreIPC {
+ class DataReference;
+}
+
namespace WebKit {
class DrawingAreaProxy;
class FindIndicator;
+ class LayerTreeContext;
}
+#if ENABLE(FULLSCREEN_API)
+@class WKFullScreenWindowController;
+#endif
+
@interface WKView (Internal)
- (PassOwnPtr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy;
- (BOOL)_isFocused;
@@ -44,7 +53,7 @@ namespace WebKit {
- (void)_setUserInterfaceItemState:(NSString *)commandName enabled:(BOOL)isEnabled state:(int)newState;
- (Vector<WebCore::KeypressCommand>&)_interceptKeyEvent:(NSEvent *)theEvent;
- (void)_getTextInputState:(unsigned)start selectionEnd:(unsigned)end underlines:(Vector<WebCore::CompositionUnderline>&)lines;
-- (void)_setEventBeingResent:(NSEvent *)event;
+- (void)_resendKeyDownEvent:(NSEvent *)event;
- (NSRect)_convertToDeviceSpace:(NSRect)rect;
- (NSRect)_convertToUserSpace:(NSRect)rect;
- (void)_setFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut;
@@ -64,4 +73,8 @@ namespace WebKit {
- (void)_setDrawingAreaSize:(NSSize)size;
- (void)_didChangeScrollbarsForMainFrame;
+
+#if ENABLE(FULLSCREEN_API)
+- (WKFullScreenWindowController*)fullScreenWindowController;
+#endif
@end
diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h b/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h
index cece1c7..37c2d8d 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h
+++ b/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h
@@ -35,4 +35,6 @@
- (void)performDictionaryLookupAtCurrentMouseLocation;
+- (NSInteger)spellCheckerDocumentTag;
+- (void)handleCorrectionPanelResult:(NSString*)result;
@end
diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp b/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp
index 05c7b8b..a162918 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp
@@ -194,9 +194,9 @@ void QWKPagePrivate::exitAcceleratedCompositingMode()
// FIXME: Implement.
}
-void QWKPagePrivate::pageDidRequestScroll(const IntSize& delta)
+void QWKPagePrivate::pageDidRequestScroll(const IntPoint& point)
{
- emit q->scrollRequested(delta.width(), delta.height());
+ emit q->scrollRequested(point.x(), point.y());
}
void QWKPagePrivate::didChangeContentsSize(const IntSize& newSize)
@@ -222,6 +222,11 @@ FloatRect QWKPagePrivate::convertToDeviceSpace(const FloatRect& rect)
return rect;
}
+IntRect QWKPagePrivate::windowToScreen(const IntRect& rect)
+{
+ return rect;
+}
+
FloatRect QWKPagePrivate::convertToUserSpace(const FloatRect& rect)
{
return rect;
@@ -482,7 +487,8 @@ QWKPage::QWKPage(QWKContext* context)
0, /* drawFooter */
0, /* printFrame */
0, /* runModal */
- 0 /* didCompleteRubberBandForMainFrame */
+ 0, /* didCompleteRubberBandForMainFrame */
+ 0 /* saveDataToFileInDownloadsFolder */
};
WKPageSetPageUIClient(pageRef(), &uiClient);
}
@@ -561,7 +567,7 @@ QWKPage::ViewportAttributes QWKPage::viewportAttributesForSize(const QSize& avai
result.m_minimumScaleFactor = conf.minimumScale;
result.m_maximumScaleFactor = conf.maximumScale;
result.m_devicePixelRatio = conf.devicePixelRatio;
- result.m_isUserScalable = conf.userScalable;
+ result.m_isUserScalable = static_cast<bool>(conf.userScalable);
return result;
}
diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h b/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h
index 1a626a1..ee1fb0e 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h
@@ -63,7 +63,7 @@ public:
virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
virtual void exitAcceleratedCompositingMode();
#endif // USE(ACCELERATED_COMPOSITING)
- virtual void pageDidRequestScroll(const WebCore::IntSize&);
+ virtual void pageDidRequestScroll(const WebCore::IntPoint&);
virtual void processDidCrash();
virtual void pageClosed() { }
virtual void didRelaunchProcess();
@@ -72,11 +72,14 @@ public:
virtual void setCursor(const WebCore::Cursor&);
virtual void setViewportArguments(const WebCore::ViewportArguments&);
virtual void takeFocus(bool direction);
+ virtual void setFocus(bool focused) { }
virtual void toolTipChanged(const WTF::String&, const WTF::String&);
virtual void registerEditCommand(PassRefPtr<WebKit::WebEditCommandProxy>, WebKit::WebPageProxy::UndoOrRedo);
virtual void clearAllEditCommands();
virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
+ virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&);
+
virtual void doneWithKeyEvent(const WebKit::NativeWebKeyboardEvent&, bool wasEventHandled);
virtual void selectionChanged(bool, bool, bool, bool);
virtual PassRefPtr<WebKit::WebPopupMenuProxy> createPopupMenuProxy(WebKit::WebPageProxy*);
@@ -92,6 +95,8 @@ public:
virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
+ virtual float userSpaceScaleFactor() const { return 1; }
+
void paint(QPainter* painter, QRect);
void keyPressEvent(QKeyEvent*);
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qgraphicswkview/tst_qgraphicswkview.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qgraphicswkview/tst_qgraphicswkview.cpp
index f26c69d..8cb7263 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/qgraphicswkview/tst_qgraphicswkview.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qgraphicswkview/tst_qgraphicswkview.cpp
@@ -35,6 +35,7 @@ private slots:
void init();
void cleanup();
+ void loadEmptyUrl();
void loadEmptyPage();
private:
@@ -83,10 +84,21 @@ void tst_QGraphicsWKView::loadEmptyPage()
{
m_view->show();
- m_view->m_webView-> load(QUrl::fromLocalFile(TESTDIR "/html/basic_page.html"));
+ m_view->m_webView-> load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
QVERIFY(waitForSignal(m_view->m_webView, SIGNAL(loadFinished(bool))));
}
+void tst_QGraphicsWKView::loadEmptyUrl()
+{
+ // That should not crash.
+ m_view->show();
+ m_view->m_webView->load(QUrl());
+ QVERIFY(!waitForSignal(m_view->m_webView->page(), SIGNAL(engineConnectionChanged(bool)), 50));
+
+ m_view->m_webView->load(QUrl(QLatin1String("")));
+ QVERIFY(!waitForSignal(m_view->m_webView->page(), SIGNAL(engineConnectionChanged(bool)), 50));
+}
+
QTEST_MAIN(tst_QGraphicsWKView)
#include "tst_qgraphicswkview.moc"
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qwkpage/qwkpage.pro b/Source/WebKit2/UIProcess/API/qt/tests/qwkpage/qwkpage.pro
new file mode 100644
index 0000000..e99c7f4
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qwkpage/qwkpage.pro
@@ -0,0 +1 @@
+include(../tests.pri)
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qwkpage/tst_qwkpage.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qwkpage/tst_qwkpage.cpp
new file mode 100644
index 0000000..39fcac2
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qwkpage/tst_qwkpage.cpp
@@ -0,0 +1,59 @@
+/*
+ Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <QScopedPointer>
+#include <QtTest/QtTest>
+#include <qwkcontext.h>
+#include <qwkpage.h>
+
+class tst_QWKPage : public QObject {
+ Q_OBJECT
+
+private slots:
+ void init();
+ void cleanup();
+
+ void loadEmptyUrl();
+
+private:
+ QScopedPointer<QWKContext> m_context;
+ QScopedPointer<QWKPage> m_page;
+};
+
+void tst_QWKPage::init()
+{
+ m_context.reset(new QWKContext);
+ m_page.reset(new QWKPage(m_context.data()));
+}
+
+void tst_QWKPage::cleanup()
+{
+ m_page.reset();
+ m_context.reset();
+}
+
+void tst_QWKPage::loadEmptyUrl()
+{
+ m_page->load(QUrl());
+ m_page->load(QUrl(QLatin1String("")));
+}
+
+QTEST_MAIN(tst_QWKPage)
+
+#include "tst_qwkpage.moc"
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri
index 3a2aac1..032acc3 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri
+++ b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri
@@ -13,4 +13,4 @@ include(../../../../../WebKit.pri)
QT += testlib
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
-DEFINES += TESTDIR=\\\"$$PWD\\\"
+!symbian: DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD\\\"
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/tests.pro b/Source/WebKit2/UIProcess/API/qt/tests/tests.pro
index eb85021..f8db5a4 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/tests.pro
+++ b/Source/WebKit2/UIProcess/API/qt/tests/tests.pro
@@ -1,2 +1,2 @@
TEMPLATE = subdirs
-SUBDIRS = qgraphicswkview
+SUBDIRS = qgraphicswkview qwkpage
diff --git a/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp b/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp
index ffe8bac..ecff862 100644
--- a/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp
+++ b/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp
@@ -36,10 +36,10 @@
namespace WebKit {
-AuthenticationChallengeProxy::AuthenticationChallengeProxy(const WebCore::AuthenticationChallenge& authenticationChallenge, uint64_t challengeID, WebPageProxy* page)
+AuthenticationChallengeProxy::AuthenticationChallengeProxy(const WebCore::AuthenticationChallenge& authenticationChallenge, uint64_t challengeID, WebProcessProxy* process)
: m_coreAuthenticationChallenge(authenticationChallenge)
, m_challengeID(challengeID)
- , m_page(page)
+ , m_process(process)
{
ASSERT(m_challengeID);
m_listener = AuthenticationDecisionListener::create(this);
@@ -49,8 +49,8 @@ AuthenticationChallengeProxy::~AuthenticationChallengeProxy()
{
// If an outstanding AuthenticationChallengeProxy is being destroyed even though it hasn't been responded to yet,
// we cancel it here so the WebProcess isn't waiting for an answer forever.
- if (m_challengeID && m_page->process())
- m_page->process()->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), m_page->pageID());
+ if (m_challengeID)
+ m_process->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), 0);
if (m_listener)
m_listener->detachChallenge();
@@ -62,9 +62,9 @@ void AuthenticationChallengeProxy::useCredential(WebCredential* credential)
return;
if (!credential)
- m_page->process()->send(Messages::AuthenticationManager::ContinueWithoutCredentialForChallenge(m_challengeID), m_page->pageID());
+ m_process->send(Messages::AuthenticationManager::ContinueWithoutCredentialForChallenge(m_challengeID), 0);
else
- m_page->process()->send(Messages::AuthenticationManager::UseCredentialForChallenge(m_challengeID, credential->core()), m_page->pageID());
+ m_process->send(Messages::AuthenticationManager::UseCredentialForChallenge(m_challengeID, credential->core()), 0);
m_challengeID = 0;
}
@@ -74,7 +74,7 @@ void AuthenticationChallengeProxy::cancel()
if (!m_challengeID)
return;
- m_page->process()->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), m_page->pageID());
+ m_process->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), 0);
m_challengeID = 0;
}
diff --git a/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h b/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h
index d4e76dd..a429ac5 100644
--- a/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h
+++ b/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h
@@ -40,16 +40,16 @@ namespace WebKit {
class AuthenticationDecisionListener;
class WebCredential;
-class WebPageProxy;
+class WebProcessProxy;
class WebProtectionSpace;
class AuthenticationChallengeProxy : public APIObject {
public:
static const Type APIType = TypeAuthenticationChallenge;
- static PassRefPtr<AuthenticationChallengeProxy> create(const WebCore::AuthenticationChallenge& authenticationChallenge, uint64_t challengeID, WebPageProxy* page)
+ static PassRefPtr<AuthenticationChallengeProxy> create(const WebCore::AuthenticationChallenge& authenticationChallenge, uint64_t challengeID, WebProcessProxy* process)
{
- return adoptRef(new AuthenticationChallengeProxy(authenticationChallenge, challengeID, page));
+ return adoptRef(new AuthenticationChallengeProxy(authenticationChallenge, challengeID, process));
}
~AuthenticationChallengeProxy();
@@ -63,13 +63,13 @@ public:
int previousFailureCount() const { return m_coreAuthenticationChallenge.previousFailureCount(); }
private:
- AuthenticationChallengeProxy(const WebCore::AuthenticationChallenge&, uint64_t challengeID, WebPageProxy* page);
+ AuthenticationChallengeProxy(const WebCore::AuthenticationChallenge&, uint64_t challengeID, WebProcessProxy*);
virtual Type type() const { return APIType; }
WebCore::AuthenticationChallenge m_coreAuthenticationChallenge;
uint64_t m_challengeID;
- RefPtr<WebPageProxy> m_page;
+ RefPtr<WebProcessProxy> m_process;
RefPtr<AuthenticationDecisionListener> m_listener;
mutable RefPtr<WebCredential> m_webCredential;
mutable RefPtr<WebProtectionSpace> m_webProtectionSpace;
diff --git a/Source/WebKit2/UIProcess/BackingStore.cpp b/Source/WebKit2/UIProcess/BackingStore.cpp
index f9a2672..5f024e6 100644
--- a/Source/WebKit2/UIProcess/BackingStore.cpp
+++ b/Source/WebKit2/UIProcess/BackingStore.cpp
@@ -57,9 +57,10 @@ void BackingStore::incorporateUpdate(const UpdateInfo& updateInfo)
{
// ASSERT(m_size == updateInfo.viewSize);
- RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(updateInfo.updateRectBounds.size(), updateInfo.bitmapHandle);
+ RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(updateInfo.bitmapHandle);
if (!bitmap)
return;
+ ASSERT(bitmap->size() == updateInfo.updateRectBounds.size());
incorporateUpdate(bitmap.get(), updateInfo);
}
diff --git a/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
index 55168bc..ad61d33 100644
--- a/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
+++ b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "DownloadProxy.h"
+#include "AuthenticationChallengeProxy.h"
#include "DataReference.h"
#include "WebContext.h"
#include "WebData.h"
@@ -91,6 +92,15 @@ void DownloadProxy::didStart(const ResourceRequest& request)
m_webContext->downloadClient().didStart(m_webContext, this);
}
+void DownloadProxy::didReceiveAuthenticationChallenge(const AuthenticationChallenge& authenticationChallenge, uint64_t challengeID)
+{
+ if (!m_webContext)
+ return;
+
+ RefPtr<AuthenticationChallengeProxy> authenticationChallengeProxy = AuthenticationChallengeProxy::create(authenticationChallenge, challengeID, m_webContext->process());
+ m_webContext->downloadClient().didReceiveAuthenticationChallenge(m_webContext, this, authenticationChallengeProxy.get());
+}
+
void DownloadProxy::didReceiveResponse(const ResourceResponse& response)
{
if (!m_webContext)
diff --git a/Source/WebKit2/UIProcess/Downloads/DownloadProxy.h b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.h
index a155d72..2643173 100644
--- a/Source/WebKit2/UIProcess/Downloads/DownloadProxy.h
+++ b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.h
@@ -34,6 +34,7 @@
#include <wtf/PassRefPtr.h>
namespace WebCore {
+ class AuthenticationChallenge;
class ResourceError;
class ResourceResponse;
}
@@ -69,6 +70,7 @@ private:
// Message handlers.
void didStart(const WebCore::ResourceRequest&);
+ void didReceiveAuthenticationChallenge(const WebCore::AuthenticationChallenge&, uint64_t challengeID);
void didReceiveResponse(const WebCore::ResourceResponse&);
void didReceiveData(uint64_t length);
void shouldDecodeSourceDataOfMIMEType(const String& mimeType, bool& result);
diff --git a/Source/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in
index 999080b..d725599 100644
--- a/Source/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in
+++ b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in
@@ -22,6 +22,8 @@
messages -> DownloadProxy {
DidStart(WebCore::ResourceRequest request)
+ DidReceiveAuthenticationChallenge(WebCore::AuthenticationChallenge challenge, uint64_t challengeID)
+
DidReceiveResponse(WebCore::ResourceResponse response)
DidReceiveData(uint64_t length)
ShouldDecodeSourceDataOfMIMEType(String mimeType) -> (bool result)
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.h b/Source/WebKit2/UIProcess/DrawingAreaProxy.h
index 4222c3b..c72cf03 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxy.h
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.h
@@ -28,6 +28,7 @@
#define DrawingAreaProxy_h
#include "DrawingAreaInfo.h"
+#include <stdint.h>
#include <WebCore/IntSize.h>
#include <wtf/Noncopyable.h>
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in b/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in
index 217feaf..78d5724 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in
@@ -22,9 +22,8 @@
messages -> DrawingAreaProxy {
Update(uint64_t stateID, WebKit::UpdateInfo updateInfo)
- DidUpdateBackingStoreState(uint64_t backingStoreStateID, WebKit::UpdateInfo updateInfo, WebKit::LayerTreeContext context)
-
#if USE(ACCELERATED_COMPOSITING)
+ DidUpdateBackingStoreState(uint64_t backingStoreStateID, WebKit::UpdateInfo updateInfo, WebKit::LayerTreeContext context)
EnterAcceleratedCompositingMode(uint64_t backingStoreStateID, WebKit::LayerTreeContext context)
ExitAcceleratedCompositingMode(uint64_t backingStoreStateID, WebKit::UpdateInfo updateInfo)
#endif
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
index 4cf4d2e..0ee42f4 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
@@ -58,9 +58,11 @@ DrawingAreaProxyImpl::DrawingAreaProxyImpl(WebPageProxy* webPageProxy)
DrawingAreaProxyImpl::~DrawingAreaProxyImpl()
{
+#if USE(ACCELERATED_COMPOSITING)
// Make sure to exit accelerated compositing mode.
if (isInAcceleratedCompositingMode())
exitAcceleratedCompositingMode();
+#endif
}
void DrawingAreaProxyImpl::paint(BackingStore::PlatformGraphicsContext context, const IntRect& rect, Region& unpaintedRegion)
@@ -162,6 +164,7 @@ void DrawingAreaProxyImpl::didUpdateBackingStoreState(uint64_t backingStoreState
if (m_nextBackingStoreStateID != m_currentBackingStoreStateID)
sendUpdateBackingStoreState(RespondImmediately);
+#if USE(ACCELERATED_COMPOSITING)
if (layerTreeContext != m_layerTreeContext) {
if (!m_layerTreeContext.isEmpty()) {
exitAcceleratedCompositingMode();
@@ -178,6 +181,7 @@ void DrawingAreaProxyImpl::didUpdateBackingStoreState(uint64_t backingStoreState
ASSERT(!m_backingStore);
return;
}
+#endif
// FIXME: We could just reuse our existing backing store if it's the same size as
// updateInfo.viewSize.
@@ -191,7 +195,9 @@ void DrawingAreaProxyImpl::enterAcceleratedCompositingMode(uint64_t backingStore
if (backingStoreStateID < m_currentBackingStoreStateID)
return;
+#if USE(ACCELERATED_COMPOSITING)
enterAcceleratedCompositingMode(layerTreeContext);
+#endif
}
void DrawingAreaProxyImpl::exitAcceleratedCompositingMode(uint64_t backingStoreStateID, const UpdateInfo& updateInfo)
@@ -200,7 +206,9 @@ void DrawingAreaProxyImpl::exitAcceleratedCompositingMode(uint64_t backingStoreS
if (backingStoreStateID < m_currentBackingStoreStateID)
return;
+#if USE(ACCELERATED_COMPOSITING)
exitAcceleratedCompositingMode();
+#endif
incorporateUpdate(updateInfo);
}
@@ -252,11 +260,13 @@ void DrawingAreaProxyImpl::sendUpdateBackingStoreState(RespondImmediatelyOrNot r
m_webPageProxy->process()->send(Messages::DrawingArea::UpdateBackingStoreState(m_nextBackingStoreStateID, respondImmediatelyOrNot == RespondImmediately, m_size, m_scrollOffset), m_webPageProxy->pageID());
m_scrollOffset = IntSize();
+#if USE(ACCELERATED_COMPOSITING)
if (m_isWaitingForDidUpdateBackingStoreState && !m_layerTreeContext.isEmpty()) {
// Wait for the DidUpdateBackingStoreState message. Normally we don this in DrawingAreaProxyImpl::paint, but that
// function is never called when in accelerated compositing mode.
waitForAndDispatchDidUpdateBackingStoreState();
}
+#endif
}
void DrawingAreaProxyImpl::waitForAndDispatchDidUpdateBackingStoreState()
@@ -268,6 +278,7 @@ void DrawingAreaProxyImpl::waitForAndDispatchDidUpdateBackingStoreState()
if (m_webPageProxy->process()->isLaunching())
return;
+#if USE(ACCELERATED_COMPOSITING)
// FIXME: waitForAndDispatchImmediately will always return the oldest DidUpdateBackingStoreState message that
// hasn't yet been processed. But it might be better to skip ahead to some other DidUpdateBackingStoreState
// message, if multiple DidUpdateBackingStoreState messages are waiting to be processed. For instance, we could
@@ -276,8 +287,10 @@ void DrawingAreaProxyImpl::waitForAndDispatchDidUpdateBackingStoreState()
// The timeout, in seconds, we use when waiting for a DidUpdateBackingStoreState message when we're asked to paint.
static const double didUpdateBackingStoreStateTimeout = 0.5;
m_webPageProxy->process()->connection()->waitForAndDispatchImmediately<Messages::DrawingAreaProxy::DidUpdateBackingStoreState>(m_webPageProxy->pageID(), didUpdateBackingStoreStateTimeout);
+#endif
}
+#if USE(ACCELERATED_COMPOSITING)
void DrawingAreaProxyImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
{
ASSERT(!isInAcceleratedCompositingMode());
@@ -294,6 +307,7 @@ void DrawingAreaProxyImpl::exitAcceleratedCompositingMode()
m_layerTreeContext = LayerTreeContext();
m_webPageProxy->exitAcceleratedCompositingMode();
}
+#endif
void DrawingAreaProxyImpl::discardBackingStoreSoon()
{
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
index 17c7512..11e430c 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
@@ -68,10 +68,14 @@ private:
void sendUpdateBackingStoreState(RespondImmediatelyOrNot);
void waitForAndDispatchDidUpdateBackingStoreState();
+#if USE(ACCELERATED_COMPOSITING)
void enterAcceleratedCompositingMode(const LayerTreeContext&);
void exitAcceleratedCompositingMode();
bool isInAcceleratedCompositingMode() const { return !m_layerTreeContext.isEmpty(); }
+#else
+ bool isInAcceleratedCompositingMode() const { return false; }
+#endif
void discardBackingStoreSoon();
void discardBackingStore();
@@ -85,9 +89,11 @@ private:
// whenever our state changes in a way that will require a new backing store to be allocated.
uint64_t m_nextBackingStoreStateID;
+#if USE(ACCELERATED_COMPOSITING)
// The current layer tree context.
LayerTreeContext m_layerTreeContext;
-
+#endif
+
// Whether we've sent a UpdateBackingStoreState message and are now waiting for a DidUpdateBackingStoreState message.
// Used to throttle UpdateBackingStoreState messages so we don't send them faster than the Web process can handle.
bool m_isWaitingForDidUpdateBackingStoreState;
diff --git a/Source/WebKit2/UIProcess/FindIndicator.cpp b/Source/WebKit2/UIProcess/FindIndicator.cpp
index d6ac461..d30fb8d 100644
--- a/Source/WebKit2/UIProcess/FindIndicator.cpp
+++ b/Source/WebKit2/UIProcess/FindIndicator.cpp
@@ -77,11 +77,12 @@ static const int gradientLightAlpha = 255;
namespace WebKit {
-PassRefPtr<FindIndicator> FindIndicator::create(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle)
+PassRefPtr<FindIndicator> FindIndicator::create(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, const ShareableBitmap::Handle& contentImageHandle)
{
- RefPtr<ShareableBitmap> contentImage = ShareableBitmap::create(enclosingIntRect(selectionRectInWindowCoordinates).size(), contentImageHandle);
+ RefPtr<ShareableBitmap> contentImage = ShareableBitmap::create(contentImageHandle);
if (!contentImage)
return 0;
+ ASSERT(contentImage->size() == enclosingIntRect(selectionRectInWindowCoordinates).size());
return adoptRef(new FindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImage.release()));
}
diff --git a/Source/WebKit2/UIProcess/FindIndicator.h b/Source/WebKit2/UIProcess/FindIndicator.h
index 69088ce..49d07da 100644
--- a/Source/WebKit2/UIProcess/FindIndicator.h
+++ b/Source/WebKit2/UIProcess/FindIndicator.h
@@ -26,7 +26,7 @@
#ifndef FindIndicator_h
#define FindIndicator_h
-#include "SharedMemory.h"
+#include "ShareableBitmap.h"
#include <WebCore/FloatRect.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
@@ -38,11 +38,9 @@ namespace WebCore {
namespace WebKit {
-class ShareableBitmap;
-
class FindIndicator : public RefCounted<FindIndicator> {
public:
- static PassRefPtr<FindIndicator> create(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle);
+ static PassRefPtr<FindIndicator> create(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, const ShareableBitmap::Handle& contentImageHandle);
~FindIndicator();
WebCore::FloatRect selectionRectInWindowCoordinates() const { return m_selectionRectInWindowCoordinates; }
diff --git a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h
index 8a1cd01..8dbfb11 100644
--- a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h
+++ b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h
@@ -37,7 +37,7 @@ class QLocalSocket;
namespace WebKit {
-class ProcessLauncher : public ThreadSafeShared<ProcessLauncher> {
+class ProcessLauncher : public ThreadSafeRefCounted<ProcessLauncher> {
public:
class Client {
public:
diff --git a/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.h b/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.h
index 9c90fbd..f3a5312 100644
--- a/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.h
+++ b/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.h
@@ -37,7 +37,7 @@ class QLocalSocket;
namespace WebKit {
-class ThreadLauncher : public ThreadSafeShared<ThreadLauncher> {
+class ThreadLauncher : public ThreadSafeRefCounted<ThreadLauncher> {
public:
class Client {
public:
diff --git a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
index af758d9..a1e8f5c 100644
--- a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
+++ b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
@@ -200,8 +200,13 @@ void ProcessLauncher::launchProcess()
NSString *frameworksPath = [[webKit2Bundle bundlePath] stringByDeletingLastPathComponent];
const char* frameworkExecutablePath = [[webKit2Bundle executablePath] fileSystemRepresentation];
- NSString *webProcessAppPath = [webKit2Bundle pathForAuxiliaryExecutable:@"WebProcess.app"];
- NSString *webProcessAppExecutablePath = [[NSBundle bundleWithPath:webProcessAppPath] executablePath];
+ NSString *processPath;
+ if (m_launchOptions.processType == ProcessLauncher::PluginProcess)
+ processPath = [webKit2Bundle pathForAuxiliaryExecutable:@"PluginProcess.app"];
+ else
+ processPath = [webKit2Bundle pathForAuxiliaryExecutable:@"WebProcess.app"];
+
+ NSString *processAppExecutablePath = [[NSBundle bundleWithPath:processPath] executablePath];
RetainPtr<CFStringRef> cfLocalization(AdoptCF, WKCopyCFLocalizationPreferredName(NULL));
CString localization = String(cfLocalization.get()).utf8();
@@ -209,7 +214,7 @@ void ProcessLauncher::launchProcess()
// Make a unique, per pid, per process launcher web process service name.
CString serviceName = String::format("com.apple.WebKit.WebProcess-%d-%p", getpid(), this).utf8();
- const char* args[] = { [webProcessAppExecutablePath fileSystemRepresentation], frameworkExecutablePath, "-type", processTypeAsString(m_launchOptions.processType), "-servicename", serviceName.data(), "-localization", localization.data(), 0 };
+ const char* args[] = { [processAppExecutablePath fileSystemRepresentation], frameworkExecutablePath, "-type", processTypeAsString(m_launchOptions.processType), "-servicename", serviceName.data(), "-localization", localization.data(), 0 };
// Register ourselves.
kern_return_t kr = bootstrap_register2(bootstrap_port, const_cast<char*>(serviceName.data()), listeningPort, 0);
@@ -259,7 +264,7 @@ void ProcessLauncher::launchProcess()
if (m_launchOptions.processType == ProcessLauncher::PluginProcess) {
// We need to insert the plug-in process shim.
- NSString *pluginProcessShimPathNSString = [[webProcessAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"PluginProcessShim.dylib"];
+ NSString *pluginProcessShimPathNSString = [[processAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"PluginProcessShim.dylib"];
const char* pluginProcessShimPath = [pluginProcessShimPathNSString fileSystemRepresentation];
// Make sure that the file exists.
diff --git a/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp b/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp
index 1e7e14a..cae5bdf 100644
--- a/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp
@@ -75,18 +75,22 @@ protected:
void QtWebProcess::setupChildProcess()
{
#if defined Q_OS_LINUX
+#ifndef NDEBUG
+ if (getenv("QT_WEBKIT_KEEP_ALIVE_WEB_PROCESS"))
+ return;
+#endif
prctl(PR_SET_PDEATHSIG, SIGKILL);
#endif
}
void ProcessLauncher::launchProcess()
{
- QString applicationPath = "%1 %2";
+ QString applicationPath = QLatin1String("%1 %2");
- if (QFile::exists(QCoreApplication::applicationDirPath() + "/QtWebProcess")) {
- applicationPath = applicationPath.arg(QCoreApplication::applicationDirPath() + "/QtWebProcess");
+ if (QFile::exists(QCoreApplication::applicationDirPath() + QLatin1String("/QtWebProcess"))) {
+ applicationPath = applicationPath.arg(QCoreApplication::applicationDirPath() + QLatin1String("/QtWebProcess"));
} else {
- applicationPath = applicationPath.arg("QtWebProcess");
+ applicationPath = applicationPath.arg(QLatin1String("QtWebProcess"));
}
int sockets[2];
diff --git a/Source/WebKit2/UIProcess/PageClient.h b/Source/WebKit2/UIProcess/PageClient.h
index 59e02ca..83ce502 100644
--- a/Source/WebKit2/UIProcess/PageClient.h
+++ b/Source/WebKit2/UIProcess/PageClient.h
@@ -81,11 +81,12 @@ public:
virtual void didRelaunchProcess() = 0;
virtual void pageClosed() = 0;
+ virtual void setFocus(bool focused) = 0;
virtual void takeFocus(bool direction) = 0;
virtual void toolTipChanged(const String&, const String&) = 0;
#if ENABLE(TILED_BACKING_STORE)
- virtual void pageDidRequestScroll(const WebCore::IntSize&) = 0;
+ virtual void pageDidRequestScroll(const WebCore::IntPoint&) = 0;
#endif
#if PLATFORM(QT)
virtual void didChangeContentsSize(const WebCore::IntSize&) = 0;
@@ -100,14 +101,15 @@ public:
#if PLATFORM(MAC)
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;
+ virtual void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) = 0;
#endif
#if PLATFORM(WIN)
virtual void compositionSelectionChanged(bool) = 0;
#endif
virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) = 0;
virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) = 0;
-
+ virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) = 0;
+
virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) = 0;
virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) = 0;
@@ -126,9 +128,12 @@ public:
#if PLATFORM(MAC)
virtual void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled) = 0;
- virtual void setAutodisplay(bool) = 0;
virtual CGContextRef containingWindowGraphicsContext() = 0;
virtual void didPerformDictionaryLookup(const String&, double scaleFactor, const DictionaryPopupInfo&) = 0;
+ virtual void showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) = 0;
+ virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingCorrectionPanel) = 0;
+ virtual String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingCorrectionPanel) = 0;
+ virtual void recordAutocorrectionResponse(WebCore::EditorClient::AutocorrectionResponseType, const String& replacedString, const String& replacementString) = 0;
#endif
virtual void didChangeScrollbarsForMainFrame() const = 0;
@@ -140,6 +145,8 @@ public:
virtual void setCustomRepresentationZoomFactor(double) = 0;
virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects) = 0;
+
+ virtual float userSpaceScaleFactor() const = 0;
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
index c63d500..f167747 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
@@ -38,16 +38,6 @@
#include "WebProcessProxy.h"
namespace WebKit {
-
-#if PLATFORM(MAC)
-static bool pluginNeedsExecutableHeap(const PluginInfoStore::Plugin& pluginInfo)
-{
- if (pluginInfo.bundleIdentifier == "com.apple.QuickTime Plugin.plugin")
- return false;
-
- return true;
-}
-#endif
PassOwnPtr<PluginProcessProxy> PluginProcessProxy::create(PluginProcessManager* PluginProcessManager, const PluginInfoStore::Plugin& pluginInfo)
{
@@ -58,12 +48,16 @@ PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManage
: m_pluginProcessManager(PluginProcessManager)
, m_pluginInfo(pluginInfo)
, m_numPendingConnectionRequests(0)
+#if PLATFORM(MAC)
+ , m_modalWindowIsShowing(false)
+ , m_fullscreenWindowIsShowing(false)
+#endif
{
ProcessLauncher::LaunchOptions launchOptions;
launchOptions.processType = ProcessLauncher::PluginProcess;
#if PLATFORM(MAC)
launchOptions.architecture = pluginInfo.pluginArchitecture;
- launchOptions.executableHeap = pluginNeedsExecutableHeap(pluginInfo);
+ launchOptions.executableHeap = PluginProcessProxy::pluginNeedsExecutableHeap(pluginInfo);
#endif
m_processLauncher = ProcessLauncher::create(this, launchOptions);
@@ -153,6 +147,14 @@ void PluginProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, Core
void PluginProcessProxy::didClose(CoreIPC::Connection*)
{
+#if PLATFORM(MAC)
+ if (m_modalWindowIsShowing)
+ endModal();
+
+ if (m_fullscreenWindowIsShowing)
+ exitFullscreen();
+#endif
+
pluginProcessCrashedOrFailedToLaunch();
}
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h
index 2ea2573..e285d64 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h
+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h
@@ -33,6 +33,12 @@
#include "ProcessLauncher.h"
#include <wtf/Deque.h>
+#if PLATFORM(MAC)
+#include <wtf/RetainPtr.h>
+OBJC_CLASS NSObject;
+OBJC_CLASS WKPlaceholderModalWindow;
+#endif
+
// FIXME: This is platform specific.
namespace CoreIPC {
class MachPort;
@@ -47,6 +53,9 @@ struct PluginProcessCreationParameters;
class PluginProcessProxy : CoreIPC::Connection::Client, ProcessLauncher::Client {
public:
+#if PLATFORM(MAC)
+ static bool pluginNeedsExecutableHeap(const PluginInfoStore::Plugin&);
+#endif
static PassOwnPtr<PluginProcessProxy> create(PluginProcessManager*, const PluginInfoStore::Plugin&);
~PluginProcessProxy();
@@ -81,6 +90,22 @@ private:
void didGetSitesWithData(const Vector<String>& sites, uint64_t callbackID);
void didClearSiteData(uint64_t callbackID);
+#if PLATFORM(MAC)
+ bool getPluginProcessSerialNumber(ProcessSerialNumber&);
+ void makePluginProcessTheFrontProcess();
+ void makeUIProcessTheFrontProcess();
+
+ void setFullscreenWindowIsShowing(bool);
+ void enterFullscreen();
+ void exitFullscreen();
+
+ void setModalWindowIsShowing(bool);
+ void beginModal();
+ void endModal();
+
+ void applicationDidBecomeActive();
+#endif
+
void platformInitializePluginProcess(PluginProcessCreationParameters& parameters);
// The plug-in host process manager.
@@ -112,6 +137,13 @@ private:
// If createPluginConnection is called while the process is still launching we'll keep count of it and send a bunch of requests
// when the process finishes launching.
unsigned m_numPendingConnectionRequests;
+
+#if PLATFORM(MAC)
+ RetainPtr<NSObject> m_activationObserver;
+ RetainPtr<WKPlaceholderModalWindow *> m_placeholderWindow;
+ bool m_modalWindowIsShowing;
+ bool m_fullscreenWindowIsShowing;
+#endif
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in
index a504f9a..5fcbe71 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in
+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in
@@ -28,6 +28,11 @@ messages -> PluginProcessProxy {
DidGetSitesWithData(Vector<WTF::String> sites, uint64_t callbackID)
DidClearSiteData(uint64_t callbackID)
+
+#if PLATFORM(MAC)
+ SetModalWindowIsShowing(bool modalWindowIsShowing)
+ SetFullscreenWindowIsShowing(bool fullscreenWindowIsShowing)
+#endif
}
#endif
diff --git a/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp b/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp
index dfa0806..5f56d0b 100644
--- a/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp
@@ -163,11 +163,7 @@ void WebPluginSiteDataManager::getSitesWithData(PassRefPtr<ArrayCallback> prpCal
m_pendingGetSitesWithData.set(callbackID, state);
state->getSitesWithDataForNextPlugin();
#else
- if (!m_webContext->hasValidProcess()) {
- RefPtr<ArrayCallback> callback = m_arrayCallbacks.take(callbackID);
- callback->invalidate();
- return;
- }
+ m_webContext->relaunchProcessIfNecessary();
Vector<String> pluginPaths;
m_webContext->pluginInfoStore()->getPluginPaths(pluginPaths);
@@ -227,11 +223,7 @@ void WebPluginSiteDataManager::clearSiteData(ImmutableArray* sites, uint64_t fla
state->clearSiteDataForNextPlugin();
#else
- if (!m_webContext->hasValidProcess()) {
- RefPtr<VoidCallback> callback = m_voidCallbacks.take(callbackID);
- callback->invalidate();
- return;
- }
+ m_webContext->relaunchProcessIfNecessary();
Vector<String> pluginPaths;
m_webContext->pluginInfoStore()->getPluginPaths(pluginPaths);
m_webContext->ensureWebProcess();
diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
index 2adc473..8375fd2 100644
--- a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
+++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
@@ -31,7 +31,33 @@
#import "PluginProcessCreationParameters.h"
#import "WebKitSystemInterface.h"
+@interface WKPlaceholderModalWindow : NSWindow
+@end
+
+@implementation WKPlaceholderModalWindow
+
+// Prevent NSApp from calling requestUserAttention: when the window is shown
+// modally, even if the app is inactive. See 6823049.
+- (BOOL)_wantsUserAttention
+{
+ return NO;
+}
+
+@end
+
namespace WebKit {
+
+bool PluginProcessProxy::pluginNeedsExecutableHeap(const PluginInfoStore::Plugin& pluginInfo)
+{
+ static bool forceNonexecutableHeapForPlugins = [[NSUserDefaults standardUserDefaults] boolForKey:@"ForceNonexecutableHeapForPlugins"];
+ if (forceNonexecutableHeapForPlugins)
+ return false;
+
+ if (pluginInfo.bundleIdentifier == "com.apple.QuickTime Plugin.plugin")
+ return false;
+
+ return true;
+}
void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationParameters& parameters)
{
@@ -41,7 +67,117 @@ void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationPa
if (renderServerPort != MACH_PORT_NULL)
parameters.acceleratedCompositingPort = CoreIPC::MachPort(renderServerPort, MACH_MSG_TYPE_COPY_SEND);
#endif
-}
+}
+
+bool PluginProcessProxy::getPluginProcessSerialNumber(ProcessSerialNumber& pluginProcessSerialNumber)
+{
+ pid_t pluginProcessPID = m_processLauncher->processIdentifier();
+ return GetProcessForPID(pluginProcessPID, &pluginProcessSerialNumber) == noErr;
+}
+
+void PluginProcessProxy::makePluginProcessTheFrontProcess()
+{
+ ProcessSerialNumber pluginProcessSerialNumber;
+ if (!getPluginProcessSerialNumber(pluginProcessSerialNumber))
+ return;
+
+ SetFrontProcess(&pluginProcessSerialNumber);
+}
+
+void PluginProcessProxy::makeUIProcessTheFrontProcess()
+{
+ ProcessSerialNumber processSerialNumber;
+ GetCurrentProcess(&processSerialNumber);
+ SetFrontProcess(&processSerialNumber);
+}
+
+void PluginProcessProxy::setFullscreenWindowIsShowing(bool fullscreenWindowIsShowing)
+{
+ if (m_fullscreenWindowIsShowing == fullscreenWindowIsShowing)
+ return;
+
+ m_fullscreenWindowIsShowing = fullscreenWindowIsShowing;
+ if (m_fullscreenWindowIsShowing)
+ enterFullscreen();
+ else
+ exitFullscreen();
+}
+
+void PluginProcessProxy::enterFullscreen()
+{
+ [NSMenu setMenuBarVisible:NO];
+
+ makePluginProcessTheFrontProcess();
+}
+
+void PluginProcessProxy::exitFullscreen()
+{
+ [NSMenu setMenuBarVisible:YES];
+
+ // If the plug-in host is the current application then we should bring ourselves to the front when it exits full-screen mode.
+
+ ProcessSerialNumber frontProcessSerialNumber;
+ GetFrontProcess(&frontProcessSerialNumber);
+ Boolean isSameProcess = 0;
+
+ ProcessSerialNumber pluginProcessSerialNumber;
+ if (!getPluginProcessSerialNumber(pluginProcessSerialNumber))
+ return;
+
+ SameProcess(&frontProcessSerialNumber, &pluginProcessSerialNumber, &isSameProcess);
+ if (!isSameProcess)
+ return;
+
+ makeUIProcessTheFrontProcess();
+}
+
+void PluginProcessProxy::setModalWindowIsShowing(bool modalWindowIsShowing)
+{
+ if (modalWindowIsShowing == m_modalWindowIsShowing)
+ return;
+
+ m_modalWindowIsShowing = modalWindowIsShowing;
+
+ if (m_modalWindowIsShowing)
+ beginModal();
+ else
+ endModal();
+}
+
+void PluginProcessProxy::beginModal()
+{
+ ASSERT(!m_placeholderWindow);
+ ASSERT(!m_activationObserver);
+
+ m_placeholderWindow.adoptNS([[WKPlaceholderModalWindow alloc] initWithContentRect:NSMakeRect(0, 0, 1, 1) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
+
+ m_activationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:NSApplicationWillBecomeActiveNotification object:NSApp queue:nil
+ usingBlock:^(NSNotification *){ applicationDidBecomeActive(); }];
+
+ [NSApp runModalForWindow:m_placeholderWindow.get()];
+
+ [m_placeholderWindow.get() orderOut:nil];
+ m_placeholderWindow = nullptr;
+}
+
+void PluginProcessProxy::endModal()
+{
+ ASSERT(m_placeholderWindow);
+ ASSERT(m_activationObserver);
+
+ [[NSNotificationCenter defaultCenter] removeObserver:m_activationObserver.get()];
+ m_activationObserver = nullptr;
+
+ [NSApp stopModal];
+
+ makeUIProcessTheFrontProcess();
+}
+
+void PluginProcessProxy::applicationDidBecomeActive()
+{
+ makePluginProcessTheFrontProcess();
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp b/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp
index 2138131..f695969 100644
--- a/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp
@@ -27,6 +27,7 @@
#include "PluginInfoStore.h"
#include "NetscapePluginModule.h"
+#include <WebCore/PathWalker.h>
#include <shlwapi.h>
using namespace WebCore;
@@ -254,37 +255,11 @@ Vector<String> PluginInfoStore::pluginsDirectories()
return directories;
}
-class PathWalker {
- WTF_MAKE_NONCOPYABLE(PathWalker);
-public:
- PathWalker(const String& directory)
- {
- String pattern = directory + "\\*";
- m_handle = ::FindFirstFileW(pattern.charactersWithNullTermination(), &m_data);
- }
-
- ~PathWalker()
- {
- if (!isValid())
- return;
- ::FindClose(m_handle);
- }
-
- bool isValid() const { return m_handle != INVALID_HANDLE_VALUE; }
- const WIN32_FIND_DATAW& data() const { return m_data; }
-
- bool step() { return ::FindNextFileW(m_handle, &m_data); }
-
-private:
- HANDLE m_handle;
- WIN32_FIND_DATAW m_data;
-};
-
Vector<String> PluginInfoStore::pluginPathsInDirectory(const String& directory)
{
Vector<String> paths;
- PathWalker walker(directory);
+ PathWalker walker(directory, "*");
if (!walker.isValid())
return paths;
@@ -385,6 +360,11 @@ bool PluginInfoStore::shouldUsePlugin(const Plugin& plugin)
return false;
}
+ if (equalIgnoringCase(plugin.info.file, "npwpf.dll")) {
+ // Bug 57119: Microsoft Windows Presentation Foundation (WPF) plug-in complains about missing xpcom.dll
+ return false;
+ }
+
if (plugin.info.name == "Yahoo Application State Plugin") {
// https://bugs.webkit.org/show_bug.cgi?id=26860
// Bug in Yahoo Application State plug-in earlier than 1.0.0.6 leads to heap corruption.
diff --git a/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp
index 1cf4921..6b24940 100644
--- a/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp
@@ -52,6 +52,11 @@ void WebApplicationCacheManagerProxy::invalidate()
invalidateCallbackMap(m_arrayCallbacks);
}
+bool WebApplicationCacheManagerProxy::shouldTerminate(WebProcessProxy*) const
+{
+ return m_arrayCallbacks.isEmpty();
+}
+
void WebApplicationCacheManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
{
didReceiveWebApplicationCacheManagerProxyMessage(connection, messageID, arguments);
@@ -60,10 +65,7 @@ void WebApplicationCacheManagerProxy::didReceiveMessage(CoreIPC::Connection* con
void WebApplicationCacheManagerProxy::getApplicationCacheOrigins(PassRefPtr<ArrayCallback> prpCallback)
{
RefPtr<ArrayCallback> callback = prpCallback;
- if (!m_webContext->hasValidProcess()) {
- callback->invalidate();
- return;
- }
+ m_webContext->relaunchProcessIfNecessary();
uint64_t callbackID = callback->callbackID();
m_arrayCallbacks.set(callbackID, callback.release());
@@ -78,8 +80,7 @@ void WebApplicationCacheManagerProxy::didGetApplicationCacheOrigins(const Vector
void WebApplicationCacheManagerProxy::deleteEntriesForOrigin(WebSecurityOrigin* origin)
{
- if (!m_webContext->hasValidProcess())
- return;
+ m_webContext->relaunchProcessIfNecessary();
SecurityOriginData securityOriginData;
securityOriginData.protocol = origin->protocol();
@@ -91,8 +92,7 @@ void WebApplicationCacheManagerProxy::deleteEntriesForOrigin(WebSecurityOrigin*
void WebApplicationCacheManagerProxy::deleteAllEntries()
{
- if (!m_webContext->hasValidProcess())
- return;
+ m_webContext->relaunchProcessIfNecessary();
m_webContext->process()->send(Messages::WebApplicationCacheManager::DeleteAllEntries(), 0);
}
diff --git a/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h
index 81637e0..b3dca15 100644
--- a/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h
+++ b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h
@@ -44,6 +44,7 @@ namespace WebKit {
struct SecurityOriginData;
class WebContext;
+class WebProcessProxy;
class WebSecurityOrigin;
typedef GenericCallback<WKArrayRef> ArrayCallback;
@@ -64,6 +65,8 @@ public:
void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+ bool shouldTerminate(WebProcessProxy*) const;
+
private:
WebApplicationCacheManagerProxy(WebContext*);
diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp
index 01b1e0c..0609d68 100644
--- a/Source/WebKit2/UIProcess/WebContext.cpp
+++ b/Source/WebKit2/UIProcess/WebContext.cpp
@@ -29,6 +29,7 @@
#include "DownloadProxy.h"
#include "ImmutableArray.h"
#include "InjectedBundleMessageKinds.h"
+#include "Logging.h"
#include "RunLoop.h"
#include "SandboxExtension.h"
#include "TextChecker.h"
@@ -40,7 +41,9 @@
#include "WebCoreArgumentCoders.h"
#include "WebDatabaseManagerProxy.h"
#include "WebGeolocationManagerProxy.h"
+#include "WebIconDatabase.h"
#include "WebKeyValueStorageManagerProxy.h"
+#include "WebMediaCacheManagerProxy.h"
#include "WebPluginSiteDataManager.h"
#include "WebPageGroup.h"
#include "WebMemorySampler.h"
@@ -116,13 +119,20 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa
, m_cookieManagerProxy(WebCookieManagerProxy::create(this))
, m_databaseManagerProxy(WebDatabaseManagerProxy::create(this))
, m_geolocationManagerProxy(WebGeolocationManagerProxy::create(this))
+ , m_iconDatabase(WebIconDatabase::create(this))
, m_keyValueStorageManagerProxy(WebKeyValueStorageManagerProxy::create(this))
+ , m_mediaCacheManagerProxy(WebMediaCacheManagerProxy::create(this))
, m_pluginSiteDataManager(WebPluginSiteDataManager::create(this))
, m_resourceCacheManagerProxy(WebResourceCacheManagerProxy::create(this))
#if PLATFORM(WIN)
, m_shouldPaintNativeControls(true)
+ , m_initialHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicyAlways)
#endif
{
+#ifndef NDEBUG
+ WebKit::initializeLogChannelsIfNecessary();
+#endif
+
contexts().append(this);
addLanguageChangeObserver(this, languageChanged);
@@ -147,21 +157,29 @@ WebContext::~WebContext()
m_cookieManagerProxy->invalidate();
m_cookieManagerProxy->clearContext();
+ m_databaseManagerProxy->invalidate();
+ m_databaseManagerProxy->clearContext();
+
m_geolocationManagerProxy->invalidate();
m_geolocationManagerProxy->clearContext();
- m_databaseManagerProxy->invalidate();
- m_databaseManagerProxy->clearContext();
+ m_iconDatabase->invalidate();
+ m_iconDatabase->clearContext();
m_keyValueStorageManagerProxy->invalidate();
m_keyValueStorageManagerProxy->clearContext();
+ m_mediaCacheManagerProxy->invalidate();
+ m_mediaCacheManagerProxy->clearContext();
+
m_pluginSiteDataManager->invalidate();
m_pluginSiteDataManager->clearContext();
m_resourceCacheManagerProxy->invalidate();
m_resourceCacheManagerProxy->clearContext();
+ platformInvalidateContext();
+
#ifndef NDEBUG
webContextCounter.decrement();
#endif
@@ -222,6 +240,7 @@ void WebContext::ensureWebProcess()
parameters.languageCode = defaultLanguage();
parameters.applicationCacheDirectory = applicationCacheDirectory();
parameters.databaseDirectory = databaseDirectory();
+ parameters.localStorageDirectory = localStorageDirectory();
parameters.clearResourceCaches = m_clearResourceCachesForNewWebProcess;
parameters.clearApplicationCache = m_clearApplicationCacheForNewWebProcess;
#if PLATFORM(MAC)
@@ -236,6 +255,8 @@ void WebContext::ensureWebProcess()
copyToVector(m_schemesToSetDomainRelaxationForbiddenFor, parameters.urlSchemesForWhichDomainRelaxationIsForbidden);
parameters.shouldAlwaysUseComplexTextCodePath = m_alwaysUsesComplexTextCodePath;
+
+ parameters.iconDatabaseEnabled = !iconDatabasePath().isEmpty();
parameters.textCheckerState = TextChecker::state();
@@ -261,8 +282,20 @@ bool WebContext::shouldTerminate(WebProcessProxy* process)
if (!m_downloads.isEmpty())
return false;
+ if (!m_applicationCacheManagerProxy->shouldTerminate(process))
+ return false;
+ if (!m_cookieManagerProxy->shouldTerminate(process))
+ return false;
+ if (!m_databaseManagerProxy->shouldTerminate(process))
+ return false;
+ if (!m_keyValueStorageManagerProxy->shouldTerminate(process))
+ return false;
+ if (!m_mediaCacheManagerProxy->shouldTerminate(process))
+ return false;
if (!m_pluginSiteDataManager->shouldTerminate(process))
return false;
+ if (!m_resourceCacheManagerProxy->shouldTerminate(process))
+ return false;
return true;
}
@@ -306,6 +339,7 @@ void WebContext::disconnectProcess(WebProcessProxy* process)
m_databaseManagerProxy->invalidate();
m_geolocationManagerProxy->invalidate();
m_keyValueStorageManagerProxy->invalidate();
+ m_mediaCacheManagerProxy->invalidate();
m_resourceCacheManagerProxy->invalidate();
// When out of process plug-ins are enabled, we don't want to invalidate the plug-in site data
@@ -590,12 +624,22 @@ void WebContext::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes
m_geolocationManagerProxy->didReceiveMessage(connection, messageID, arguments);
return;
}
+
+ if (messageID.is<CoreIPC::MessageClassWebIconDatabase>()) {
+ m_iconDatabase->didReceiveMessage(connection, messageID, arguments);
+ return;
+ }
if (messageID.is<CoreIPC::MessageClassWebKeyValueStorageManagerProxy>()) {
m_keyValueStorageManagerProxy->didReceiveMessage(connection, messageID, arguments);
return;
}
+ if (messageID.is<CoreIPC::MessageClassWebMediaCacheManagerProxy>()) {
+ m_mediaCacheManagerProxy->didReceiveMessage(connection, messageID, arguments);
+ return;
+ }
+
if (messageID.is<CoreIPC::MessageClassWebResourceCacheManagerProxy>()) {
m_resourceCacheManagerProxy->didReceiveWebResourceCacheManagerProxyMessage(connection, messageID, arguments);
return;
@@ -631,6 +675,9 @@ CoreIPC::SyncReplyMode WebContext::didReceiveSyncMessage(CoreIPC::Connection* co
return CoreIPC::AutomaticReply;
}
+ if (messageID.is<CoreIPC::MessageClassWebIconDatabase>())
+ return m_iconDatabase->didReceiveSyncMessage(connection, messageID, arguments, reply);
+
switch (messageID.get<WebContextLegacyMessage::Kind>()) {
case WebContextLegacyMessage::PostSynchronousMessage: {
// FIXME: We should probably encode something in the case that the arguments do not decode correctly.
@@ -653,17 +700,20 @@ CoreIPC::SyncReplyMode WebContext::didReceiveSyncMessage(CoreIPC::Connection* co
return CoreIPC::AutomaticReply;
}
-void WebContext::clearResourceCaches()
+void WebContext::clearResourceCaches(ResourceCachesToClear cachesToClear)
{
- if (!hasValidProcess()) {
- // FIXME <rdar://problem/8727879>: Setting this flag ensures that the next time a WebProcess is created, this request to
- // clear the resource cache will be respected. But if the user quits the application before another WebProcess is created,
- // their request will be ignored.
- m_clearResourceCachesForNewWebProcess = true;
+ if (hasValidProcess()) {
+ m_process->send(Messages::WebProcess::ClearResourceCaches(cachesToClear), 0);
return;
}
- m_process->send(Messages::WebProcess::ClearResourceCaches(), 0);
+ if (cachesToClear == InMemoryResourceCachesOnly)
+ return;
+
+ // FIXME <rdar://problem/8727879>: Setting this flag ensures that the next time a WebProcess is created, this request to
+ // clear the resource cache will be respected. But if the user quits the application before another WebProcess is created,
+ // their request will be ignored.
+ m_clearResourceCachesForNewWebProcess = true;
}
void WebContext::clearApplicationCache()
@@ -678,6 +728,14 @@ void WebContext::clearApplicationCache()
m_process->send(Messages::WebProcess::ClearApplicationCache(), 0);
}
+
+void WebContext::setEnhancedAccessibility(bool flag)
+{
+ if (!hasValidProcess())
+ return;
+
+ m_process->send(Messages::WebProcess::SetEnhancedAccessibility(flag), 0);
+}
void WebContext::startMemorySampler(const double interval)
{
@@ -726,4 +784,26 @@ String WebContext::databaseDirectory() const
return platformDefaultDatabaseDirectory();
}
+void WebContext::setIconDatabasePath(const String& path)
+{
+ m_overrideIconDatabasePath = path;
+ m_iconDatabase->setDatabasePath(path);
+}
+
+String WebContext::iconDatabasePath() const
+{
+ if (!m_overrideIconDatabasePath.isEmpty())
+ return m_overrideIconDatabasePath;
+
+ return platformDefaultIconDatabasePath();
+}
+
+String WebContext::localStorageDirectory() const
+{
+ if (!m_overrideLocalStorageDirectory.isEmpty())
+ return m_overrideLocalStorageDirectory;
+
+ return platformDefaultLocalStorageDirectory();
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebContext.h b/Source/WebKit2/UIProcess/WebContext.h
index 72cd5dc..a9ba22f 100644
--- a/Source/WebKit2/UIProcess/WebContext.h
+++ b/Source/WebKit2/UIProcess/WebContext.h
@@ -49,7 +49,9 @@ class WebApplicationCacheManagerProxy;
class WebCookieManagerProxy;
class WebDatabaseManagerProxy;
class WebGeolocationManagerProxy;
+class WebIconDatabase;
class WebKeyValueStorageManagerProxy;
+class WebMediaCacheManagerProxy;
class WebPageGroup;
class WebPageProxy;
class WebResourceCacheManagerProxy;
@@ -118,7 +120,7 @@ public:
void setCacheModel(CacheModel);
CacheModel cacheModel() const { return m_cacheModel; }
- void clearResourceCaches();
+ void clearResourceCaches(ResourceCachesToClear);
void clearApplicationCache();
void setDefaultRequestTimeoutInterval(double);
@@ -128,8 +130,12 @@ public:
#if PLATFORM(WIN)
void setShouldPaintNativeControls(bool);
+
+ void setInitialHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy) { m_initialHTTPCookieAcceptPolicy = policy; }
#endif
+ void setEnhancedAccessibility(bool);
+
// Downloads.
uint64_t createDownloadProxy();
WebDownloadClient& downloadClient() { return m_downloadClient; }
@@ -141,7 +147,9 @@ public:
WebCookieManagerProxy* cookieManagerProxy() const { return m_cookieManagerProxy.get(); }
WebDatabaseManagerProxy* databaseManagerProxy() const { return m_databaseManagerProxy.get(); }
WebGeolocationManagerProxy* geolocationManagerProxy() const { return m_geolocationManagerProxy.get(); }
+ WebIconDatabase* iconDatabase() const { return m_iconDatabase.get(); }
WebKeyValueStorageManagerProxy* keyValueStorageManagerProxy() const { return m_keyValueStorageManagerProxy.get(); }
+ WebMediaCacheManagerProxy* mediaCacheManagerProxy() const { return m_mediaCacheManagerProxy.get(); }
WebPluginSiteDataManager* pluginSiteDataManager() const { return m_pluginSiteDataManager.get(); }
WebResourceCacheManagerProxy* resourceCacheManagerProxy() const { return m_resourceCacheManagerProxy.get(); }
@@ -150,9 +158,11 @@ public:
unsigned wkPageCount;
unsigned wkFrameCount;
};
- static Statistics& statistics();
+ static Statistics& statistics();
void setDatabaseDirectory(const String& dir) { m_overrideDatabaseDirectory = dir; }
+ void setIconDatabasePath(const String&);
+ void setLocalStorageDirectory(const String& dir) { m_overrideLocalStorageDirectory = dir; }
void ensureWebProcess();
@@ -164,7 +174,8 @@ private:
virtual Type type() const { return APIType; }
void platformInitializeWebProcess(WebProcessCreationParameters&);
-
+ void platformInvalidateContext();
+
// History client
void didNavigateWithNavigationData(uint64_t pageID, const WebNavigationDataStore& store, uint64_t frameID);
void didPerformClientRedirect(uint64_t pageID, const String& sourceURLString, const String& destinationURLString, uint64_t frameID);
@@ -189,6 +200,12 @@ private:
String databaseDirectory() const;
String platformDefaultDatabaseDirectory() const;
+ String iconDatabasePath() const;
+ String platformDefaultIconDatabasePath() const;
+
+ String localStorageDirectory() const;
+ String platformDefaultLocalStorageDirectory() const;
+
ProcessModel m_processModel;
// FIXME: In the future, this should be one or more WebProcessProxies.
@@ -228,15 +245,24 @@ private:
RefPtr<WebCookieManagerProxy> m_cookieManagerProxy;
RefPtr<WebDatabaseManagerProxy> m_databaseManagerProxy;
RefPtr<WebGeolocationManagerProxy> m_geolocationManagerProxy;
+ RefPtr<WebIconDatabase> m_iconDatabase;
RefPtr<WebKeyValueStorageManagerProxy> m_keyValueStorageManagerProxy;
+ RefPtr<WebMediaCacheManagerProxy> m_mediaCacheManagerProxy;
RefPtr<WebPluginSiteDataManager> m_pluginSiteDataManager;
RefPtr<WebResourceCacheManagerProxy> m_resourceCacheManagerProxy;
#if PLATFORM(WIN)
bool m_shouldPaintNativeControls;
+ HTTPCookieAcceptPolicy m_initialHTTPCookieAcceptPolicy;
#endif
+#if PLATFORM(MAC)
+ RetainPtr<CFTypeRef> m_enhancedAccessibilityObserver;
+#endif
+
String m_overrideDatabaseDirectory;
+ String m_overrideIconDatabasePath;
+ String m_overrideLocalStorageDirectory;
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp b/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp
index c56374c..a30ab41 100644
--- a/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp
@@ -50,6 +50,12 @@ WebCookieManagerProxy::~WebCookieManagerProxy()
void WebCookieManagerProxy::invalidate()
{
invalidateCallbackMap(m_arrayCallbacks);
+ invalidateCallbackMap(m_httpCookieAcceptPolicyCallbacks);
+}
+
+bool WebCookieManagerProxy::shouldTerminate(WebProcessProxy*) const
+{
+ return m_arrayCallbacks.isEmpty() && m_httpCookieAcceptPolicyCallbacks.isEmpty();
}
void WebCookieManagerProxy::initializeClient(const WKCookieManagerClient* client)
@@ -67,10 +73,7 @@ void WebCookieManagerProxy::getHostnamesWithCookies(PassRefPtr<ArrayCallback> pr
ASSERT(m_webContext);
RefPtr<ArrayCallback> callback = prpCallback;
- if (!m_webContext->hasValidProcess()) {
- callback->invalidate();
- return;
- }
+ m_webContext->relaunchProcessIfNecessary();
uint64_t callbackID = callback->callbackID();
m_arrayCallbacks.set(callbackID, callback.release());
@@ -97,24 +100,21 @@ void WebCookieManagerProxy::didGetHostnamesWithCookies(const Vector<String>& hos
void WebCookieManagerProxy::deleteCookiesForHostname(const String& hostname)
{
ASSERT(m_webContext);
- if (!m_webContext->hasValidProcess())
- return;
+ m_webContext->relaunchProcessIfNecessary();
m_webContext->process()->send(Messages::WebCookieManager::DeleteCookiesForHostname(hostname), 0);
}
void WebCookieManagerProxy::deleteAllCookies()
{
ASSERT(m_webContext);
- if (!m_webContext->hasValidProcess())
- return;
+ m_webContext->relaunchProcessIfNecessary();
m_webContext->process()->send(Messages::WebCookieManager::DeleteAllCookies(), 0);
}
void WebCookieManagerProxy::startObservingCookieChanges()
{
ASSERT(m_webContext);
- if (!m_webContext->hasValidProcess())
- return;
+ m_webContext->relaunchProcessIfNecessary();
m_webContext->process()->send(Messages::WebCookieManager::StartObservingCookieChanges(), 0);
}
@@ -131,4 +131,37 @@ void WebCookieManagerProxy::cookiesDidChange()
m_client.cookiesDidChange(this);
}
+void WebCookieManagerProxy::setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy)
+{
+ ASSERT(m_webContext);
+ m_webContext->relaunchProcessIfNecessary();
+#if PLATFORM(MAC)
+ persistHTTPCookieAcceptPolicy(policy);
+#endif
+ m_webContext->process()->send(Messages::WebCookieManager::SetHTTPCookieAcceptPolicy(policy), 0);
+}
+
+void WebCookieManagerProxy::getHTTPCookieAcceptPolicy(PassRefPtr<HTTPCookieAcceptPolicyCallback> prpCallback)
+{
+ ASSERT(m_webContext);
+
+ RefPtr<HTTPCookieAcceptPolicyCallback> callback = prpCallback;
+ m_webContext->relaunchProcessIfNecessary();
+
+ uint64_t callbackID = callback->callbackID();
+ m_httpCookieAcceptPolicyCallbacks.set(callbackID, callback.release());
+ m_webContext->process()->send(Messages::WebCookieManager::GetHTTPCookieAcceptPolicy(callbackID), 0);
+}
+
+void WebCookieManagerProxy::didGetHTTPCookieAcceptPolicy(uint32_t policy, uint64_t callbackID)
+{
+ RefPtr<HTTPCookieAcceptPolicyCallback> callback = m_httpCookieAcceptPolicyCallbacks.take(callbackID);
+ if (!callback) {
+ // FIXME: Log error or assert.
+ return;
+ }
+
+ callback->performCallbackWithReturnValue(policy);
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebCookieManagerProxy.h b/Source/WebKit2/UIProcess/WebCookieManagerProxy.h
index 9d63265..7dc20d5 100644
--- a/Source/WebKit2/UIProcess/WebCookieManagerProxy.h
+++ b/Source/WebKit2/UIProcess/WebCookieManagerProxy.h
@@ -43,8 +43,10 @@ namespace CoreIPC {
namespace WebKit {
class WebContext;
+class WebProcessProxy;
typedef GenericCallback<WKArrayRef> ArrayCallback;
+typedef GenericCallback<WKHTTPCookieAcceptPolicy, HTTPCookieAcceptPolicy> HTTPCookieAcceptPolicyCallback;
class WebCookieManagerProxy : public APIObject {
public:
@@ -62,24 +64,35 @@ public:
void deleteCookiesForHostname(const String& hostname);
void deleteAllCookies();
+ void setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy);
+ void getHTTPCookieAcceptPolicy(PassRefPtr<HTTPCookieAcceptPolicyCallback>);
+
void startObservingCookieChanges();
void stopObservingCookieChanges();
void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+ bool shouldTerminate(WebProcessProxy*) const;
+
private:
WebCookieManagerProxy(WebContext*);
virtual Type type() const { return APIType; }
void didGetHostnamesWithCookies(const Vector<String>&, uint64_t callbackID);
+ void didGetHTTPCookieAcceptPolicy(uint32_t policy, uint64_t callbackID);
void cookiesDidChange();
void didReceiveWebCookieManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+#if PLATFORM(MAC)
+ void persistHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy);
+#endif
+
WebContext* m_webContext;
HashMap<uint64_t, RefPtr<ArrayCallback> > m_arrayCallbacks;
+ HashMap<uint64_t, RefPtr<HTTPCookieAcceptPolicyCallback> > m_httpCookieAcceptPolicyCallbacks;
WebCookieManagerProxyClient m_client;
};
diff --git a/Source/WebKit2/UIProcess/WebCookieManagerProxy.messages.in b/Source/WebKit2/UIProcess/WebCookieManagerProxy.messages.in
index 808b4c7..2ae0545 100644
--- a/Source/WebKit2/UIProcess/WebCookieManagerProxy.messages.in
+++ b/Source/WebKit2/UIProcess/WebCookieManagerProxy.messages.in
@@ -22,6 +22,7 @@
messages -> WebCookieManagerProxy {
DidGetHostnamesWithCookies(Vector<WTF::String> hostnames, uint64_t callbackID);
+ DidGetHTTPCookieAcceptPolicy(uint32_t policy, uint64_t callbackID);
CookiesDidChange()
}
diff --git a/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp
index 96488fb..67323cd 100644
--- a/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp
@@ -103,6 +103,11 @@ void WebDatabaseManagerProxy::invalidate()
invalidateCallbackMap(m_arrayCallbacks);
}
+bool WebDatabaseManagerProxy::shouldTerminate(WebProcessProxy*) const
+{
+ return m_arrayCallbacks.isEmpty();
+}
+
void WebDatabaseManagerProxy::initializeClient(const WKDatabaseManagerClient* client)
{
m_client.initialize(client);
@@ -111,10 +116,7 @@ void WebDatabaseManagerProxy::initializeClient(const WKDatabaseManagerClient* cl
void WebDatabaseManagerProxy::getDatabasesByOrigin(PassRefPtr<ArrayCallback> prpCallback)
{
RefPtr<ArrayCallback> callback = prpCallback;
- if (!m_webContext->hasValidProcess()) {
- callback->invalidate();
- return;
- }
+ m_webContext->relaunchProcessIfNecessary();
uint64_t callbackID = callback->callbackID();
m_arrayCallbacks.set(callbackID, callback.release());
m_webContext->process()->send(Messages::WebDatabaseManager::GetDatabasesByOrigin(callbackID), 0);
@@ -167,10 +169,7 @@ void WebDatabaseManagerProxy::didGetDatabasesByOrigin(const Vector<OriginAndData
void WebDatabaseManagerProxy::getDatabaseOrigins(PassRefPtr<ArrayCallback> prpCallback)
{
RefPtr<ArrayCallback> callback = prpCallback;
- if (!m_webContext->hasValidProcess()) {
- callback->invalidate();
- return;
- }
+ m_webContext->relaunchProcessIfNecessary();
uint64_t callbackID = callback->callbackID();
m_arrayCallbacks.set(callbackID, callback.release());
m_webContext->process()->send(Messages::WebDatabaseManager::GetDatabaseOrigins(callbackID), 0);
@@ -195,29 +194,25 @@ void WebDatabaseManagerProxy::didGetDatabaseOrigins(const Vector<String>& origin
void WebDatabaseManagerProxy::deleteDatabaseWithNameForOrigin(const String& databaseIdentifier, WebSecurityOrigin* origin)
{
- if (!m_webContext->hasValidProcess())
- return;
+ m_webContext->relaunchProcessIfNecessary();
m_webContext->process()->send(Messages::WebDatabaseManager::DeleteDatabaseWithNameForOrigin(databaseIdentifier, origin->databaseIdentifier()), 0);
}
void WebDatabaseManagerProxy::deleteDatabasesForOrigin(WebSecurityOrigin* origin)
{
- if (!m_webContext->hasValidProcess())
- return;
+ m_webContext->relaunchProcessIfNecessary();
m_webContext->process()->send(Messages::WebDatabaseManager::DeleteDatabasesForOrigin(origin->databaseIdentifier()), 0);
}
void WebDatabaseManagerProxy::deleteAllDatabases()
{
- if (!m_webContext->hasValidProcess())
- return;
+ m_webContext->relaunchProcessIfNecessary();
m_webContext->process()->send(Messages::WebDatabaseManager::DeleteAllDatabases(), 0);
}
void WebDatabaseManagerProxy::setQuotaForOrigin(WebSecurityOrigin* origin, uint64_t quota)
{
- if (!m_webContext->hasValidProcess())
- return;
+ m_webContext->relaunchProcessIfNecessary();
m_webContext->process()->send(Messages::WebDatabaseManager::SetQuotaForOrigin(origin->databaseIdentifier(), quota), 0);
}
diff --git a/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.h b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.h
index 3658845..d70011c 100644
--- a/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.h
+++ b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.h
@@ -43,6 +43,7 @@ class MessageID;
namespace WebKit {
class WebContext;
+class WebProcessProxy;
class WebSecurityOrigin;
typedef GenericCallback<WKArrayRef> ArrayCallback;
@@ -77,6 +78,8 @@ public:
void didReceiveWebDatabaseManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+ bool shouldTerminate(WebProcessProxy*) const;
+
private:
explicit WebDatabaseManagerProxy(WebContext*);
diff --git a/Source/WebKit2/UIProcess/WebDownloadClient.cpp b/Source/WebKit2/UIProcess/WebDownloadClient.cpp
index 4b1b756..612a056 100644
--- a/Source/WebKit2/UIProcess/WebDownloadClient.cpp
+++ b/Source/WebKit2/UIProcess/WebDownloadClient.cpp
@@ -42,6 +42,14 @@ void WebDownloadClient::didStart(WebContext* webContext, DownloadProxy* download
m_client.didStart(toAPI(webContext), toAPI(downloadProxy), m_client.clientInfo);
}
+void WebDownloadClient::didReceiveAuthenticationChallenge(WebContext* webContext, DownloadProxy* downloadProxy, AuthenticationChallengeProxy* authenticationChallengeProxy)
+{
+ if (!m_client.didReceiveAuthenticationChallenge)
+ return;
+
+ m_client.didReceiveAuthenticationChallenge(toAPI(webContext), toAPI(downloadProxy), toAPI(authenticationChallengeProxy), m_client.clientInfo);
+}
+
void WebDownloadClient::didReceiveResponse(WebContext* webContext, DownloadProxy* downloadProxy, const ResourceResponse& response)
{
if (!m_client.didReceiveResponse)
diff --git a/Source/WebKit2/UIProcess/WebDownloadClient.h b/Source/WebKit2/UIProcess/WebDownloadClient.h
index 902c870..46010a1 100644
--- a/Source/WebKit2/UIProcess/WebDownloadClient.h
+++ b/Source/WebKit2/UIProcess/WebDownloadClient.h
@@ -37,12 +37,14 @@ namespace WebCore {
namespace WebKit {
+class AuthenticationChallengeProxy;
class DownloadProxy;
class WebContext;
class WebDownloadClient : public APIClient<WKContextDownloadClient> {
public:
void didStart(WebContext*, DownloadProxy*);
+ void didReceiveAuthenticationChallenge(WebContext*, DownloadProxy*, AuthenticationChallengeProxy*);
void didReceiveResponse(WebContext*, DownloadProxy*, const WebCore::ResourceResponse&);
void didReceiveData(WebContext*, DownloadProxy*, uint64_t length);
bool shouldDecodeSourceDataOfMIMEType(WebContext*, DownloadProxy*, const String& mimeType);
diff --git a/Source/WebKit2/UIProcess/WebEditCommandProxy.cpp b/Source/WebKit2/UIProcess/WebEditCommandProxy.cpp
index 568faa1..b9599f3 100644
--- a/Source/WebKit2/UIProcess/WebEditCommandProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebEditCommandProxy.cpp
@@ -54,7 +54,7 @@ void WebEditCommandProxy::unapply()
return;
m_page->process()->send(Messages::WebPage::UnapplyEditCommand(m_commandID), m_page->pageID());
- m_page->registerEditCommand(this, WebPageProxy::Undo);
+ m_page->registerEditCommand(this, WebPageProxy::Redo);
}
void WebEditCommandProxy::reapply()
@@ -63,7 +63,7 @@ void WebEditCommandProxy::reapply()
return;
m_page->process()->send(Messages::WebPage::ReapplyEditCommand(m_commandID), m_page->pageID());
- m_page->registerEditCommand(this, WebPageProxy::Redo);
+ m_page->registerEditCommand(this, WebPageProxy::Undo);
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebEditCommandProxy.h b/Source/WebKit2/UIProcess/WebEditCommandProxy.h
index 2d21d3f..4c08877 100644
--- a/Source/WebKit2/UIProcess/WebEditCommandProxy.h
+++ b/Source/WebKit2/UIProcess/WebEditCommandProxy.h
@@ -26,6 +26,7 @@
#ifndef WebEditCommandProxy_h
#define WebEditCommandProxy_h
+#include "APIObject.h"
#include <WebCore/EditAction.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
@@ -34,7 +35,7 @@ namespace WebKit {
class WebPageProxy;
-class WebEditCommandProxy : public RefCounted<WebEditCommandProxy> {
+class WebEditCommandProxy : public APIObject {
public:
static PassRefPtr<WebEditCommandProxy> create(uint64_t commandID, WebCore::EditAction editAction, WebPageProxy* page)
{
@@ -53,6 +54,8 @@ public:
private:
WebEditCommandProxy(uint64_t commandID, WebCore::EditAction, WebPageProxy*);
+ virtual Type type() const { return TypeEditCommandProxy; }
+
uint64_t m_commandID;
WebCore::EditAction m_editAction;
WebPageProxy* m_page;
diff --git a/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp b/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp
new file mode 100644
index 0000000..91daf10
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp
@@ -0,0 +1,113 @@
+/*
+ * 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 "WebFullScreenManagerProxy.h"
+
+#if ENABLE(FULLSCREEN_API)
+
+#include "WebContext.h"
+#include "WebFullScreenManagerMessages.h"
+#include "WebFullScreenManagerProxyMessages.h"
+#include "WebProcess.h"
+
+namespace WebKit {
+
+PassRefPtr<WebFullScreenManagerProxy> WebFullScreenManagerProxy::create(WebPageProxy* page)
+{
+ return adoptRef(new WebFullScreenManagerProxy(page));
+}
+
+WebFullScreenManagerProxy::WebFullScreenManagerProxy(WebPageProxy* page)
+ : m_page(page)
+ , m_webView(0)
+{
+}
+
+WebFullScreenManagerProxy::~WebFullScreenManagerProxy()
+{
+}
+
+void WebFullScreenManagerProxy::invalidate()
+{
+ m_webView = 0;
+}
+
+void WebFullScreenManagerProxy::setWebView(PlatformWebView* webView)
+{
+ m_webView = webView;
+}
+
+void WebFullScreenManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
+{
+ didReceiveWebFullScreenManagerProxyMessage(connection, messageID, arguments);
+}
+
+CoreIPC::SyncReplyMode WebFullScreenManagerProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply)
+{
+ return didReceiveSyncWebFullScreenManagerProxyMessage(connection, messageID, arguments, reply);
+}
+
+void WebFullScreenManagerProxy::willEnterFullScreen()
+{
+ m_page->process()->send(Messages::WebFullScreenManager::WillEnterFullScreen(), m_page->pageID());
+}
+
+void WebFullScreenManagerProxy::didEnterFullScreen()
+{
+ m_page->process()->send(Messages::WebFullScreenManager::DidEnterFullScreen(), m_page->pageID());
+}
+
+void WebFullScreenManagerProxy::willExitFullScreen()
+{
+ m_page->process()->send(Messages::WebFullScreenManager::WillExitFullScreen(), m_page->pageID());
+}
+
+void WebFullScreenManagerProxy::didExitFullScreen()
+{
+ m_page->process()->send(Messages::WebFullScreenManager::DidExitFullScreen(), m_page->pageID());
+}
+
+void WebFullScreenManagerProxy::beginEnterFullScreenAnimation(float duration)
+{
+ m_page->process()->send(Messages::WebFullScreenManager::BeginEnterFullScreenAnimation(duration), m_page->pageID());
+}
+
+void WebFullScreenManagerProxy::beginExitFullScreenAnimation(float duration)
+{
+ m_page->process()->send(Messages::WebFullScreenManager::BeginExitFullScreenAnimation(duration), m_page->pageID());
+}
+
+void WebFullScreenManagerProxy::supportsFullScreen(bool withKeyboard, bool& supports)
+{
+ if (withKeyboard)
+ supports = false;
+ else
+ supports = true;
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(FULLSCREEN_API)
diff --git a/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h b/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h
new file mode 100644
index 0000000..1f3dca6
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h
@@ -0,0 +1,110 @@
+/*
+ * 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.
+ */
+
+#ifndef WebFullScreenManagerProxy_h
+#define WebFullScreenManagerProxy_h
+
+#if ENABLE(FULLSCREEN_API)
+
+#include "Connection.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace CoreIPC {
+class ArgumentDecoder;
+class Connection;
+class MessageID;
+}
+
+namespace WebCore {
+class IntRect;
+}
+
+#if PLATFORM(MAC)
+OBJC_CLASS WKView;
+#endif
+
+namespace WebKit {
+
+#if PLATFORM(MAC)
+typedef WKView PlatformWebView;
+#elif PLATFORM(WIN)
+class WebView;
+typedef WebView PlatformWebView;
+#elif PLATFORM(QT)
+typedef QGraphicsWKView PlatformWebView;
+#elif PLATFORM(GTK)
+class WebView;
+typedef WebView PlatformWebView;
+#endif
+
+class WebPageProxy;
+class LayerTreeContext;
+
+class WebFullScreenManagerProxy : public RefCounted<WebFullScreenManagerProxy> {
+public:
+ static PassRefPtr<WebFullScreenManagerProxy> create(WebPageProxy*);
+ virtual ~WebFullScreenManagerProxy();
+
+ void invalidate();
+
+ void setWebView(PlatformWebView*);
+
+ void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+ CoreIPC::SyncReplyMode didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply);
+
+ void willEnterFullScreen();
+ void didEnterFullScreen();
+ void willExitFullScreen();
+ void didExitFullScreen();
+ void beginEnterFullScreenAnimation(float duration);
+ void beginExitFullScreenAnimation(float duration);
+
+private:
+ WebFullScreenManagerProxy(WebPageProxy*);
+
+ void supportsFullScreen(bool withKeyboard, bool&);
+ void enterFullScreen();
+ void exitFullScreen();
+ void beganEnterFullScreenAnimation();
+ void finishedEnterFullScreenAnimation(bool completed);
+ void beganExitFullScreenAnimation();
+ void finishedExitFullScreenAnimation(bool completed);
+ void enterAcceleratedCompositingMode(const LayerTreeContext&);
+ void exitAcceleratedCompositingMode();
+ void getFullScreenRect(WebCore::IntRect&);
+
+ WebPageProxy* m_page;
+ PlatformWebView* m_webView;
+
+ void didReceiveWebFullScreenManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+ CoreIPC::SyncReplyMode didReceiveSyncWebFullScreenManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply);
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(FULLSCREEN_API)
+
+#endif // WebFullScreenManagerProxy_h
diff --git a/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.messages.in b/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.messages.in
new file mode 100644
index 0000000..007e309
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.messages.in
@@ -0,0 +1,38 @@
+# 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.
+
+#if ENABLE(FULLSCREEN_API)
+messages -> WebFullScreenManagerProxy {
+ SupportsFullScreen(bool withKeyboard) -> (bool supportsFullScreen)
+ EnterFullScreen()
+ ExitFullScreen()
+ BeganEnterFullScreenAnimation()
+ FinishedEnterFullScreenAnimation(bool completed)
+ BeganExitFullScreenAnimation()
+ FinishedExitFullScreenAnimation(bool completed)
+ GetFullScreenRect() -> (WebCore::IntRect rect)
+#if USE(ACCELERATED_COMPOSITING)
+ EnterAcceleratedCompositingMode(WebKit::LayerTreeContext context)
+ ExitAcceleratedCompositingMode()
+#endif
+}
+#endif
diff --git a/Source/WebKit2/UIProcess/WebIconDatabase.cpp b/Source/WebKit2/UIProcess/WebIconDatabase.cpp
new file mode 100644
index 0000000..c397a1d
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebIconDatabase.cpp
@@ -0,0 +1,255 @@
+/*
+ * 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 "WebIconDatabase.h"
+
+#include "DataReference.h"
+#include "Logging.h"
+#include "WebContext.h"
+#include "WebIconDatabaseProxyMessages.h"
+#include <WebCore/FileSystem.h>
+#include <WebCore/IconDatabase.h>
+#include <WebCore/IconDatabaseBase.h>
+#include <wtf/text/WTFString.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+PassRefPtr<WebIconDatabase> WebIconDatabase::create(WebContext* context)
+{
+ return adoptRef(new WebIconDatabase(context));
+}
+
+WebIconDatabase::~WebIconDatabase()
+{
+}
+
+WebIconDatabase::WebIconDatabase(WebContext* context)
+ : m_webContext(context)
+ , m_urlImportCompleted(false)
+ , m_databaseCleanupDisabled(false)
+{
+}
+
+void WebIconDatabase::invalidate()
+{
+}
+
+void WebIconDatabase::setDatabasePath(const String& path)
+{
+ if (m_iconDatabaseImpl && m_iconDatabaseImpl->isOpen()) {
+ LOG_ERROR("Icon database already has a path and is already open. We don't currently support changing its path and reopening.");
+ return;
+ }
+
+ m_iconDatabaseImpl = IconDatabase::create();
+ m_iconDatabaseImpl->setClient(this);
+ IconDatabase::delayDatabaseCleanup();
+ m_databaseCleanupDisabled = true;
+ m_iconDatabaseImpl->setEnabled(true);
+ if (!m_iconDatabaseImpl->open(directoryName(path), pathGetFileName(path))) {
+ LOG_ERROR("Unable to open WebKit2 icon database on disk");
+ m_iconDatabaseImpl.clear();
+ setGlobalIconDatabase(0);
+ IconDatabase::allowDatabaseCleanup();
+ m_databaseCleanupDisabled = false;
+ }
+ setGlobalIconDatabase(m_iconDatabaseImpl.get());
+}
+
+void WebIconDatabase::enableDatabaseCleanup()
+{
+ if (!m_iconDatabaseImpl) {
+ LOG_ERROR("Cannot enabled Icon Database cleanup - it hasn't been opened yet.");
+ return;
+ }
+
+ if (!m_databaseCleanupDisabled) {
+ LOG_ERROR("Attempt to enable database cleanup, but it's already enabled.");
+ ASSERT_NOT_REACHED();
+ return;
+ }
+
+ IconDatabase::allowDatabaseCleanup();
+ m_databaseCleanupDisabled = false;
+}
+
+void WebIconDatabase::retainIconForPageURL(const String& pageURL)
+{
+ LOG(IconDatabase, "WK2 UIProcess retaining icon for page URL %s", pageURL.ascii().data());
+ if (m_iconDatabaseImpl)
+ m_iconDatabaseImpl->retainIconForPageURL(pageURL);
+}
+
+void WebIconDatabase::releaseIconForPageURL(const String& pageURL)
+{
+ LOG(IconDatabase, "WK2 UIProcess releasing icon for page URL %s", pageURL.ascii().data());
+ if (m_iconDatabaseImpl)
+ m_iconDatabaseImpl->releaseIconForPageURL(pageURL);
+}
+
+void WebIconDatabase::setIconURLForPageURL(const String& iconURL, const String& pageURL)
+{
+ LOG(IconDatabase, "WK2 UIProcess setting icon URL %s for page URL %s", iconURL.ascii().data(), pageURL.ascii().data());
+ if (m_iconDatabaseImpl)
+ m_iconDatabaseImpl->setIconURLForPageURL(iconURL, pageURL);
+}
+
+void WebIconDatabase::setIconDataForIconURL(const CoreIPC::DataReference& iconData, const String& iconURL)
+{
+ LOG(IconDatabase, "WK2 UIProcess setting icon data (%i bytes) for page URL %s", (int)iconData.size(), iconURL.ascii().data());
+ if (!m_iconDatabaseImpl)
+ return;
+
+ RefPtr<SharedBuffer> buffer = SharedBuffer::create(iconData.data(), iconData.size());
+ m_iconDatabaseImpl->setIconDataForIconURL(buffer.release(), iconURL);
+}
+
+void WebIconDatabase::synchronousIconDataForPageURL(const String&, CoreIPC::DataReference& iconData)
+{
+ iconData = CoreIPC::DataReference();
+}
+
+void WebIconDatabase::synchronousIconURLForPageURL(const String&, String& iconURL)
+{
+ iconURL = String();
+}
+
+void WebIconDatabase::synchronousIconDataKnownForIconURL(const String&, bool& iconDataKnown) const
+{
+ iconDataKnown = false;
+}
+
+void WebIconDatabase::synchronousLoadDecisionForIconURL(const String&, int& loadDecision) const
+{
+ loadDecision = static_cast<int>(IconLoadNo);
+}
+
+void WebIconDatabase::getLoadDecisionForIconURL(const String& iconURL, uint64_t callbackID)
+{
+ LOG(IconDatabase, "WK2 UIProcess getting load decision for icon URL %s with callback ID %lli", iconURL.ascii().data(), static_cast<long long>(callbackID));
+
+ if (!m_webContext)
+ return;
+
+ if (!m_iconDatabaseImpl || !m_iconDatabaseImpl->isOpen() || iconURL.isEmpty()) {
+ m_webContext->process()->send(Messages::WebIconDatabaseProxy::ReceivedIconLoadDecision(static_cast<int>(IconLoadNo), callbackID), 0);
+ return;
+ }
+
+ // If the decision hasn't been read from disk yet, set this url and callback ID aside to be notifed later
+ IconLoadDecision decision = m_iconDatabaseImpl->synchronousLoadDecisionForIconURL(iconURL, 0);
+ if (decision == IconLoadUnknown) {
+ // We should never get an unknown load decision after the URL import has completed.
+ ASSERT(!m_urlImportCompleted);
+
+ m_pendingLoadDecisionURLMap.set(callbackID, iconURL);
+ return;
+ }
+
+ m_webContext->process()->send(Messages::WebIconDatabaseProxy::ReceivedIconLoadDecision((int)decision, callbackID), 0);
+}
+
+Image* WebIconDatabase::imageForPageURL(const String& pageURL)
+{
+ if (!m_webContext)
+ return 0;
+
+ if (!m_iconDatabaseImpl || !m_iconDatabaseImpl->isOpen() || pageURL.isEmpty())
+ return 0;
+
+ // The WebCore IconDatabase ignores the passed in size parameter.
+ // If that changes we'll need to rethink how this API is exposed.
+ return m_iconDatabaseImpl->synchronousIconForPageURL(pageURL, WebCore::IntSize(32, 32));
+}
+
+
+// WebCore::IconDatabaseClient
+bool WebIconDatabase::performImport()
+{
+ // WebKit2 icon database doesn't currently support importing any old icon database formats.
+ return true;
+}
+
+void WebIconDatabase::didImportIconURLForPageURL(const String&)
+{
+ // Send a WK2 client notification out here.
+}
+
+void WebIconDatabase::didImportIconDataForPageURL(const String&)
+{
+ // Send a WK2 client notification out here.
+}
+
+void WebIconDatabase::didChangeIconForPageURL(const String&)
+{
+ // Send a WK2 client notification out here.
+}
+
+void WebIconDatabase::didRemoveAllIcons()
+{
+ // Send a WK2 client notification out here.
+}
+
+void WebIconDatabase::didFinishURLImport()
+{
+ if (!m_webContext)
+ return;
+
+ ASSERT(!m_urlImportCompleted);
+
+ LOG(IconDatabase, "WK2 UIProcess URL import complete, notifying all %i pending page URL load decisions", m_pendingLoadDecisionURLMap.size());
+
+ HashMap<uint64_t, String>::iterator i = m_pendingLoadDecisionURLMap.begin();
+ HashMap<uint64_t, String>::iterator end = m_pendingLoadDecisionURLMap.end();
+
+ for (; i != end; ++i) {
+ LOG(IconDatabase, "WK2 UIProcess performing delayed callback on callback ID %i for page url %s", (int)i->first, i->second.ascii().data());
+ IconLoadDecision decision = m_iconDatabaseImpl->synchronousLoadDecisionForIconURL(i->second, 0);
+
+ // Decisions should never be unknown after the inital import is complete
+ ASSERT(decision != IconLoadUnknown);
+
+ m_webContext->process()->send(Messages::WebIconDatabaseProxy::ReceivedIconLoadDecision(static_cast<int>(decision), i->first), 0);
+ }
+
+ m_pendingLoadDecisionURLMap.clear();
+
+ m_urlImportCompleted = true;
+}
+
+void WebIconDatabase::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* decoder)
+{
+ didReceiveWebIconDatabaseMessage(connection, messageID, decoder);
+}
+
+CoreIPC::SyncReplyMode WebIconDatabase::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* decoder, CoreIPC::ArgumentEncoder* reply)
+{
+ return didReceiveSyncWebIconDatabaseMessage(connection, messageID, decoder, reply);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebIconDatabase.h b/Source/WebKit2/UIProcess/WebIconDatabase.h
new file mode 100644
index 0000000..802f2aa
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebIconDatabase.h
@@ -0,0 +1,110 @@
+/*
+ * 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.
+ */
+
+#ifndef WebIconDatabase_h
+#define WebIconDatabase_h
+
+#include "APIObject.h"
+
+#include "Connection.h"
+#include <WebCore/IconDatabaseClient.h>
+#include <wtf/Forward.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+#include <wtf/text/StringHash.h>
+
+namespace CoreIPC {
+class ArgumentDecoder;
+class DataReference;
+class MessageID;
+}
+
+namespace WebCore {
+class IconDatabase;
+class Image;
+}
+
+namespace WebKit {
+
+class WebContext;
+
+class WebIconDatabase : public APIObject, public WebCore::IconDatabaseClient {
+public:
+ static const Type APIType = TypeIconDatabase;
+
+ static PassRefPtr<WebIconDatabase> create(WebContext*);
+ virtual ~WebIconDatabase();
+
+ void invalidate();
+ void clearContext() { m_webContext = 0; }
+ void setDatabasePath(const String&);
+ void enableDatabaseCleanup();
+
+ void retainIconForPageURL(const String&);
+ void releaseIconForPageURL(const String&);
+ void setIconURLForPageURL(const String&, const String&);
+ void setIconDataForIconURL(const CoreIPC::DataReference&, const String&);
+
+ void synchronousIconDataForPageURL(const String&, CoreIPC::DataReference&);
+ void synchronousIconURLForPageURL(const String&, String&);
+ void synchronousIconDataKnownForIconURL(const String&, bool&) const;
+ void synchronousLoadDecisionForIconURL(const String&, int&) const;
+
+ void getLoadDecisionForIconURL(const String&, uint64_t callbackID);
+
+ WebCore::Image* imageForPageURL(const String&);
+
+ // WebCore::IconDatabaseClient
+ virtual bool performImport();
+ virtual void didImportIconURLForPageURL(const String&);
+ virtual void didImportIconDataForPageURL(const String&);
+ virtual void didChangeIconForPageURL(const String&);
+ virtual void didRemoveAllIcons();
+ virtual void didFinishURLImport();
+
+ void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+ CoreIPC::SyncReplyMode didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
+
+private:
+ WebIconDatabase(WebContext*);
+
+ virtual Type type() const { return APIType; }
+
+ void didReceiveWebIconDatabaseMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+ CoreIPC::SyncReplyMode didReceiveSyncWebIconDatabaseMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
+
+ WebContext* m_webContext;
+
+ OwnPtr<WebCore::IconDatabase> m_iconDatabaseImpl;
+ bool m_urlImportCompleted;
+ bool m_databaseCleanupDisabled;
+ HashMap<uint64_t, String> m_pendingLoadDecisionURLMap;
+
+};
+
+} // namespace WebKit
+
+#endif // WebIconDatabase_h
diff --git a/Source/WebKit2/UIProcess/WebIconDatabase.messages.in b/Source/WebKit2/UIProcess/WebIconDatabase.messages.in
new file mode 100644
index 0000000..b68a0a7
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebIconDatabase.messages.in
@@ -0,0 +1,35 @@
+# 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.
+
+messages -> WebIconDatabase {
+ RetainIconForPageURL(WTF::String pageURL)
+ ReleaseIconForPageURL(WTF::String pageURL)
+ SetIconURLForPageURL(WTF::String iconURL, WTF::String pageURL)
+ SetIconDataForIconURL(CoreIPC::DataReference iconData, WTF::String iconURL)
+
+ SynchronousIconDataForPageURL(WTF::String pageURL) -> (CoreIPC::DataReference iconData)
+ SynchronousIconURLForPageURL(WTF::String pageURL) -> (WTF::String iconURL)
+ SynchronousIconDataKnownForIconURL(WTF::String iconURL) -> (bool dataKnown)
+ SynchronousLoadDecisionForIconURL(WTF::String iconURL) -> (int loadDecision)
+
+ GetLoadDecisionForIconURL(WTF::String iconURL, uint64_t callbackID)
+}
diff --git a/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp b/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp
index dafa613..1de1532 100644
--- a/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp
@@ -52,6 +52,11 @@ void WebKeyValueStorageManagerProxy::invalidate()
invalidateCallbackMap(m_arrayCallbacks);
}
+bool WebKeyValueStorageManagerProxy::shouldTerminate(WebProcessProxy*) const
+{
+ return m_arrayCallbacks.isEmpty();
+}
+
void WebKeyValueStorageManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
{
didReceiveWebKeyValueStorageManagerProxyMessage(connection, messageID, arguments);
@@ -60,10 +65,7 @@ void WebKeyValueStorageManagerProxy::didReceiveMessage(CoreIPC::Connection* conn
void WebKeyValueStorageManagerProxy::getKeyValueStorageOrigins(PassRefPtr<ArrayCallback> prpCallback)
{
RefPtr<ArrayCallback> callback = prpCallback;
- if (!m_webContext->hasValidProcess()) {
- callback->invalidate();
- return;
- }
+ m_webContext->relaunchProcessIfNecessary();
uint64_t callbackID = callback->callbackID();
m_arrayCallbacks.set(callbackID, callback.release());
@@ -78,8 +80,7 @@ void WebKeyValueStorageManagerProxy::didGetKeyValueStorageOrigins(const Vector<S
void WebKeyValueStorageManagerProxy::deleteEntriesForOrigin(WebSecurityOrigin* origin)
{
- if (!m_webContext->hasValidProcess())
- return;
+ m_webContext->relaunchProcessIfNecessary();
SecurityOriginData securityOriginData;
securityOriginData.protocol = origin->protocol();
@@ -91,9 +92,7 @@ void WebKeyValueStorageManagerProxy::deleteEntriesForOrigin(WebSecurityOrigin* o
void WebKeyValueStorageManagerProxy::deleteAllEntries()
{
- if (!m_webContext->hasValidProcess())
- return;
-
+ m_webContext->relaunchProcessIfNecessary();
m_webContext->process()->send(Messages::WebKeyValueStorageManager::DeleteAllEntries(), 0);
}
diff --git a/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h b/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h
index 1c5ea3a..79cb03e 100644
--- a/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h
+++ b/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h
@@ -44,6 +44,7 @@ namespace WebKit {
struct SecurityOriginData;
class WebContext;
+class WebProcessProxy;
class WebSecurityOrigin;
typedef GenericCallback<WKArrayRef> ArrayCallback;
@@ -64,6 +65,8 @@ public:
void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+ bool shouldTerminate(WebProcessProxy*) const;
+
private:
WebKeyValueStorageManagerProxy(WebContext*);
diff --git a/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.cpp b/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.cpp
new file mode 100644
index 0000000..c8a7f51
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.cpp
@@ -0,0 +1,103 @@
+/*
+ * 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 "WebMediaCacheManagerProxy.h"
+
+#include "WebContext.h"
+#include "WebMediaCacheManagerMessages.h"
+#include "WebSecurityOrigin.h"
+
+namespace WebKit {
+
+PassRefPtr<WebMediaCacheManagerProxy> WebMediaCacheManagerProxy::create(WebContext* context)
+{
+ return adoptRef(new WebMediaCacheManagerProxy(context));
+}
+
+WebMediaCacheManagerProxy::WebMediaCacheManagerProxy(WebContext* context)
+ : m_webContext(context)
+{
+}
+
+WebMediaCacheManagerProxy::~WebMediaCacheManagerProxy()
+{
+}
+
+void WebMediaCacheManagerProxy::invalidate()
+{
+ invalidateCallbackMap(m_arrayCallbacks);
+}
+
+bool WebMediaCacheManagerProxy::shouldTerminate(WebProcessProxy*) const
+{
+ return m_arrayCallbacks.isEmpty();
+}
+
+void WebMediaCacheManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
+{
+ didReceiveWebMediaCacheManagerProxyMessage(connection, messageID, arguments);
+}
+
+void WebMediaCacheManagerProxy::getHostnamesWithMediaCache(PassRefPtr<ArrayCallback> prpCallback)
+{
+ RefPtr<ArrayCallback> callback = prpCallback;
+ m_webContext->relaunchProcessIfNecessary();
+
+ uint64_t callbackID = callback->callbackID();
+ m_arrayCallbacks.set(callbackID, callback.release());
+ m_webContext->process()->send(Messages::WebMediaCacheManager::GetHostnamesWithMediaCache(callbackID), 0);
+}
+
+void WebMediaCacheManagerProxy::didGetHostnamesWithMediaCache(const Vector<String>& hostnameList, uint64_t callbackID)
+{
+ RefPtr<ArrayCallback> callback = m_arrayCallbacks.take(callbackID);
+ if (!callback) {
+ // FIXME: Log error or assert.
+ return;
+ }
+
+ size_t hostnameCount = hostnameList.size();
+ Vector<RefPtr<APIObject> > hostnames(hostnameCount);
+
+ for (size_t i = 0; i < hostnameCount; ++i)
+ hostnames[i] = WebString::create(hostnameList[i]);
+
+ callback->performCallbackWithReturnValue(ImmutableArray::adopt(hostnames).get());
+}
+
+void WebMediaCacheManagerProxy::clearCacheForHostname(const String& hostname)
+{
+ m_webContext->relaunchProcessIfNecessary();
+ m_webContext->process()->send(Messages::WebMediaCacheManager::ClearCacheForHostname(hostname), 0);
+}
+
+void WebMediaCacheManagerProxy::clearCacheForAllHostnames()
+{
+ m_webContext->relaunchProcessIfNecessary();
+ m_webContext->process()->send(Messages::WebMediaCacheManager::ClearCacheForAllHostnames(), 0);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.h b/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.h
new file mode 100644
index 0000000..43231e5
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.h
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+
+#ifndef WebMediaCacheManagerProxy_h
+#define WebMediaCacheManagerProxy_h
+
+#include "APIObject.h"
+#include "GenericCallback.h"
+#include "ImmutableArray.h"
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace CoreIPC {
+ class ArgumentDecoder;
+ class Connection;
+ class MessageID;
+}
+
+namespace WebKit {
+
+class WebContext;
+class WebProcessProxy;
+
+typedef GenericCallback<WKArrayRef> ArrayCallback;
+
+class WebMediaCacheManagerProxy : public APIObject {
+public:
+ static const Type APIType = TypeMediaCacheManager;
+
+ static PassRefPtr<WebMediaCacheManagerProxy> create(WebContext*);
+ virtual ~WebMediaCacheManagerProxy();
+
+ void invalidate();
+ void clearContext() { m_webContext = 0; }
+
+ void getHostnamesWithMediaCache(PassRefPtr<ArrayCallback>);
+ void clearCacheForHostname(const String&);
+ void clearCacheForAllHostnames();
+
+ void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+ bool shouldTerminate(WebProcessProxy*) const;
+
+private:
+ WebMediaCacheManagerProxy(WebContext*);
+
+ virtual Type type() const { return APIType; }
+
+ void didGetHostnamesWithMediaCache(const Vector<String>&, uint64_t callbackID);
+
+ void didReceiveWebMediaCacheManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+ WebContext* m_webContext;
+ HashMap<uint64_t, RefPtr<ArrayCallback> > m_arrayCallbacks;
+};
+
+} // namespace WebKit
+
+#endif // WebMediaCacheManagerProxy_h
diff --git a/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.messages.in b/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.messages.in
new file mode 100644
index 0000000..7929064
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.messages.in
@@ -0,0 +1,25 @@
+# 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.
+
+messages -> WebMediaCacheManagerProxy {
+ DidGetHostnamesWithMediaCache(Vector<WTF::String> hostnames, uint64_t callbackID);
+}
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp
index 3813a39..ce3af46 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp
@@ -52,6 +52,8 @@
#include "WebEvent.h"
#include "WebFormSubmissionListenerProxy.h"
#include "WebFramePolicyListenerProxy.h"
+#include "WebFullScreenManagerProxy.h"
+#include "WebInspectorProxy.h"
#include "WebOpenPanelResultListenerProxy.h"
#include "WebPageCreationParameters.h"
#include "WebPageGroup.h"
@@ -71,10 +73,6 @@
#include <WebCore/WindowFeatures.h>
#include <stdio.h>
-#if PLATFORM(MAC)
-#include "DictionaryPopupInfo.h"
-#endif
-
#if PLATFORM(WIN)
#include "WebDragSource.h"
#include <WebCore/BitmapInfo.h>
@@ -220,6 +218,9 @@ void WebPageProxy::initializeResourceLoadClient(const WKPageResourceLoadClient*
void WebPageProxy::initializeUIClient(const WKPageUIClient* client)
{
+ if (!isValid())
+ return;
+
m_uiClient.initialize(client);
process()->send(Messages::WebPage::SetCanRunBeforeUnloadConfirmPanel(m_uiClient.canRunBeforeUnloadConfirmPanel()), m_pageID);
@@ -297,6 +298,13 @@ void WebPageProxy::close()
}
#endif
+#if ENABLE(FULLSCREEN_API)
+ if (m_fullScreenManager) {
+ m_fullScreenManager->invalidate();
+ m_fullScreenManager = 0;
+ }
+#endif
+
if (m_openPanelResultListener) {
m_openPanelResultListener->invalidate();
m_openPanelResultListener = 0;
@@ -315,6 +323,7 @@ void WebPageProxy::close()
invalidateCallbackMap(m_voidCallbacks);
invalidateCallbackMap(m_dataCallbacks);
invalidateCallbackMap(m_stringCallbacks);
+ m_loadDependentStringCallbackIDs.clear();
invalidateCallbackMap(m_scriptValueCallbacks);
invalidateCallbackMap(m_computedPagesCallbacks);
@@ -386,26 +395,27 @@ void WebPageProxy::loadURLRequest(WebURLRequest* urlRequest)
void WebPageProxy::loadHTMLString(const String& htmlString, const String& baseURL)
{
if (!isValid())
- return;
+ reattachToWebProcess();
+
process()->send(Messages::WebPage::LoadHTMLString(htmlString, baseURL), m_pageID);
}
void WebPageProxy::loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL)
{
if (!isValid())
- return;
+ reattachToWebProcess();
- if (!m_mainFrame)
- return;
+ if (m_mainFrame)
+ m_mainFrame->setUnreachableURL(unreachableURL);
- m_mainFrame->setUnreachableURL(unreachableURL);
process()->send(Messages::WebPage::LoadAlternateHTMLString(htmlString, baseURL, unreachableURL), m_pageID);
}
void WebPageProxy::loadPlainTextString(const String& string)
{
if (!isValid())
- return;
+ reattachToWebProcess();
+
process()->send(Messages::WebPage::LoadPlainTextString(string), m_pageID);
}
@@ -509,7 +519,10 @@ bool WebPageProxy::canShowMIMEType(const String& mimeType) const
if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType))
return true;
-
+
+ if (mimeType.startsWith("text/", false))
+ return !MIMETypeRegistry::isUnsupportedTextMIMEType(mimeType);
+
String newMimeType = mimeType;
PluginInfoStore::Plugin plugin = context()->pluginInfoStore()->findPlugin(newMimeType, KURL());
if (!plugin.path.isNull())
@@ -542,11 +555,15 @@ void WebPageProxy::setDrawsTransparentBackground(bool drawsTransparentBackground
void WebPageProxy::viewWillStartLiveResize()
{
+ if (!isValid())
+ return;
process()->send(Messages::WebPage::ViewWillStartLiveResize(), m_pageID);
}
void WebPageProxy::viewWillEndLiveResize()
{
+ if (!isValid())
+ return;
process()->send(Messages::WebPage::ViewWillEndLiveResize(), m_pageID);
}
@@ -633,49 +650,7 @@ void WebPageProxy::executeEditCommand(const String& commandName)
process()->send(Messages::WebPage::ExecuteEditCommand(commandName), m_pageID);
}
-#if PLATFORM(MAC)
-void WebPageProxy::updateWindowIsVisible(bool windowIsVisible)
-{
- if (!isValid())
- return;
- process()->send(Messages::WebPage::SetWindowIsVisible(windowIsVisible), m_pageID);
-}
-
-void WebPageProxy::windowAndViewFramesChanged(const IntRect& windowFrameInScreenCoordinates, const IntRect& viewFrameInWindowCoordinates, const IntPoint& accessibilityViewCoordinates)
-{
- if (!isValid())
- return;
-
- process()->send(Messages::WebPage::WindowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates, accessibilityViewCoordinates), m_pageID);
-}
-
-void WebPageProxy::getMarkedRange(uint64_t& location, uint64_t& length)
-{
- process()->sendSync(Messages::WebPage::GetMarkedRange(), Messages::WebPage::GetMarkedRange::Reply(location, length), m_pageID);
-}
-
-uint64_t WebPageProxy::characterIndexForPoint(const IntPoint point)
-{
- uint64_t result;
- process()->sendSync(Messages::WebPage::CharacterIndexForPoint(point), Messages::WebPage::CharacterIndexForPoint::Reply(result), m_pageID);
- return result;
-}
-
-WebCore::IntRect WebPageProxy::firstRectForCharacterRange(uint64_t location, uint64_t length)
-{
- IntRect resultRect;
- process()->sendSync(Messages::WebPage::FirstRectForCharacterRange(location, length), Messages::WebPage::FirstRectForCharacterRange::Reply(resultRect), m_pageID);
- return resultRect;
-}
-
-bool WebPageProxy::writeSelectionToPasteboard(const String& pasteboardName, const Vector<String>& pasteboardTypes)
-{
- bool result;
- const double MessageTimeout = 20;
- process()->sendSync(Messages::WebPage::WriteSelectionToPasteboard(pasteboardName, pasteboardTypes), Messages::WebPage::WriteSelectionToPasteboard::Reply(result), m_pageID, MessageTimeout);
- return result;
-}
-#elif PLATFORM(WIN)
+#if PLATFORM(WIN)
WebCore::IntRect WebPageProxy::firstRectForCharacterInSelectedRange(int characterPosition)
{
IntRect resultRect;
@@ -719,17 +694,6 @@ void WebPageProxy::didPerformDragControllerAction(uint64_t resultOperation)
m_currentDragOperation = static_cast<DragOperation>(resultOperation);
}
-#if PLATFORM(MAC)
-void WebPageProxy::setDragImage(const WebCore::IntPoint& clientPosition, const IntSize& imageSize, const SharedMemory::Handle& dragImageHandle, bool isLinkDrag)
-{
- RefPtr<ShareableBitmap> dragImage = ShareableBitmap::create(imageSize, dragImageHandle);
- if (!dragImage)
- return;
-
- m_pageClient->setDragImage(clientPosition, imageSize, dragImage.release(), isLinkDrag);
-}
-#endif
-
#if PLATFORM(WIN)
void WebPageProxy::startDragDrop(const IntPoint& imageOrigin, const IntPoint& dragPoint, uint64_t okEffect,
@@ -880,6 +844,14 @@ void WebPageProxy::handleTouchEvent(const WebTouchEvent& event)
}
#endif
+void WebPageProxy::scrollBy(ScrollDirection direction, ScrollGranularity granularity)
+{
+ if (!isValid())
+ return;
+
+ process()->send(Messages::WebPage::ScrollBy(direction, granularity), m_pageID);
+}
+
void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* frame, uint64_t listenerID)
{
if (!isValid())
@@ -1147,6 +1119,7 @@ void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, PassRefPtr<StringCall
{
RefPtr<StringCallback> callback = prpCallback;
uint64_t callbackID = callback->callbackID();
+ m_loadDependentStringCallbackIDs.add(callbackID);
m_stringCallbacks.set(callbackID, callback.get());
process()->send(Messages::WebPage::GetSourceForFrame(frame->frameID(), callbackID), m_pageID);
}
@@ -1155,6 +1128,7 @@ void WebPageProxy::getContentsAsString(PassRefPtr<StringCallback> prpCallback)
{
RefPtr<StringCallback> callback = prpCallback;
uint64_t callbackID = callback->callbackID();
+ m_loadDependentStringCallbackIDs.add(callbackID);
m_stringCallbacks.set(callbackID, callback.get());
process()->send(Messages::WebPage::GetContentsAsString(callbackID), m_pageID);
}
@@ -1205,16 +1179,6 @@ void WebPageProxy::forceRepaint(PassRefPtr<VoidCallback> prpCallback)
process()->send(Messages::WebPage::ForceRepaint(callbackID), m_pageID);
}
-#if PLATFORM(MAC)
-void WebPageProxy::performDictionaryLookupAtLocation(const WebCore::FloatPoint& point)
-{
- if (!isValid())
- return;
-
- process()->send(Messages::WebPage::PerformDictionaryLookupAtLocation(point), m_pageID);
-}
-#endif
-
void WebPageProxy::preferencesDidChange()
{
if (!isValid())
@@ -1257,6 +1221,13 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M
}
#endif
+#if ENABLE(FULLSCREEN_API)
+ if (messageID.is<CoreIPC::MessageClassWebFullScreenManagerProxy>()) {
+ fullScreenManager()->didReceiveMessage(connection, messageID, arguments);
+ return;
+ }
+#endif
+
didReceiveWebPageProxyMessage(connection, messageID, arguments);
}
@@ -1270,17 +1241,17 @@ void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIP
}
#endif
+#if ENABLE(FULLSCREEN_API)
+ if (messageID.is<CoreIPC::MessageClassWebFullScreenManagerProxy>()) {
+ fullScreenManager()->didReceiveSyncMessage(connection, messageID, arguments, reply);
+ return;
+ }
+#endif
+
// FIXME: Do something with reply.
didReceiveSyncWebPageProxyMessage(connection, messageID, arguments, reply);
}
-#if PLATFORM(MAC)
-void WebPageProxy::interpretKeyEvent(uint32_t type, Vector<KeypressCommand>& commandsList, uint32_t selectionStart, uint32_t selectionEnd, Vector<CompositionUnderline>& underlines)
-{
- m_pageClient->interceptKeyEvent(m_keyEventQueue.first(), commandsList, selectionStart, selectionEnd, underlines);
-}
-#endif
-
void WebPageProxy::didCreateMainFrame(uint64_t frameID)
{
MESSAGE_CHECK(!m_mainFrame);
@@ -1382,7 +1353,7 @@ void WebPageProxy::didFinishProgress()
m_loaderClient.didFinishProgress(this);
}
-void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const String& url, bool loadingSubstituteDataForUnreachableURL, CoreIPC::ArgumentDecoder* arguments)
+void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const String& url, const String& unreachableURL, CoreIPC::ArgumentDecoder* arguments)
{
clearPendingAPIRequestURL();
@@ -1394,8 +1365,7 @@ void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const Strin
WebFrameProxy* frame = process()->webFrame(frameID);
MESSAGE_CHECK(frame);
- if (!loadingSubstituteDataForUnreachableURL)
- frame->setUnreachableURL(String());
+ frame->setUnreachableURL(unreachableURL);
frame->didStartProvisionalLoad(url);
m_loaderClient.didStartProvisionalLoadForFrame(this, frame, userData.get());
@@ -1431,6 +1401,19 @@ void WebPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, const Resour
m_loaderClient.didFailProvisionalLoadWithErrorForFrame(this, frame, error, userData.get());
}
+void WebPageProxy::clearLoadDependentCallbacks()
+{
+ Vector<uint64_t> callbackIDsCopy;
+ copyToVector(m_loadDependentStringCallbackIDs, callbackIDsCopy);
+ m_loadDependentStringCallbackIDs.clear();
+
+ for (size_t i = 0; i < callbackIDsCopy.size(); ++i) {
+ RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackIDsCopy[i]);
+ if (callback)
+ callback->invalidate();
+ }
+}
+
void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeType, bool frameHasCustomRepresentation, const PlatformCertificateInfo& certificateInfo, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
@@ -1438,9 +1421,15 @@ void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeTyp
if (!arguments->decode(messageDecoder))
return;
+#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ dismissCorrectionPanel(ReasonForDismissingCorrectionPanelIgnored);
+#endif
+
WebFrameProxy* frame = process()->webFrame(frameID);
MESSAGE_CHECK(frame);
+ clearLoadDependentCallbacks();
+
frame->didCommitLoad(mimeType, certificateInfo);
if (frame->isMainFrame()) {
@@ -1489,6 +1478,8 @@ void WebPageProxy::didFailLoadForFrame(uint64_t frameID, const ResourceError& er
WebFrameProxy* frame = process()->webFrame(frameID);
MESSAGE_CHECK(frame);
+ clearLoadDependentCallbacks();
+
frame->didFailLoad();
m_loaderClient.didFailLoadWithErrorForFrame(this, frame, error, userData.get());
@@ -1798,6 +1789,9 @@ void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message)
WebFrameProxy* frame = process()->webFrame(frameID);
MESSAGE_CHECK(frame);
+ // Since runJavaScriptAlert() can spin a nested run loop we need to turn off the responsiveness timer.
+ process()->responsivenessTimer()->stop();
+
m_uiClient.runJavaScriptAlert(this, message, frame);
}
@@ -1806,6 +1800,9 @@ void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message,
WebFrameProxy* frame = process()->webFrame(frameID);
MESSAGE_CHECK(frame);
+ // Since runJavaScriptConfirm() can spin a nested run loop we need to turn off the responsiveness timer.
+ process()->responsivenessTimer()->stop();
+
result = m_uiClient.runJavaScriptConfirm(this, message, frame);
}
@@ -1814,6 +1811,9 @@ void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message,
WebFrameProxy* frame = process()->webFrame(frameID);
MESSAGE_CHECK(frame);
+ // Since runJavaScriptPrompt() can spin a nested run loop we need to turn off the responsiveness timer.
+ process()->responsivenessTimer()->stop();
+
result = m_uiClient.runJavaScriptPrompt(this, message, defaultValue, frame);
}
@@ -1889,6 +1889,11 @@ void WebPageProxy::getWindowFrame(FloatRect& newWindowFrame)
newWindowFrame = m_pageClient->convertToUserSpace(m_uiClient.windowFrame(this));
}
+void WebPageProxy::windowToScreen(const IntRect& viewRect, IntRect& result)
+{
+ result = m_pageClient->windowToScreen(viewRect);
+}
+
void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose)
{
WebFrameProxy* frame = process()->webFrame(frameID);
@@ -1898,9 +1903,9 @@ void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t f
}
#if ENABLE(TILED_BACKING_STORE)
-void WebPageProxy::pageDidRequestScroll(const IntSize& delta)
+void WebPageProxy::pageDidRequestScroll(const IntPoint& point)
{
- m_pageClient->pageDidRequestScroll(delta);
+ m_pageClient->pageDidRequestScroll(point);
}
#endif
@@ -1983,6 +1988,15 @@ WebInspectorProxy* WebPageProxy::inspector()
#endif
+#if ENABLE(FULLSCREEN_API)
+WebFullScreenManagerProxy* WebPageProxy::fullScreenManager()
+{
+ if (!m_fullScreenManager)
+ m_fullScreenManager = WebFullScreenManagerProxy::create(this);
+ return m_fullScreenManager.get();
+}
+#endif
+
// BackForwardList
void WebPageProxy::backForwardAddItem(uint64_t itemID)
@@ -2016,17 +2030,6 @@ void WebPageProxy::selectionStateChanged(const SelectionState& selectionState)
m_selectionState = selectionState;
}
-#if PLATFORM(MAC)
-// Complex text input support for plug-ins.
-void WebPageProxy::sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput)
-{
- if (!isValid())
- return;
-
- process()->send(Messages::WebPage::SendComplexTextInputToPlugin(pluginComplexTextInputIdentifier, textInput), m_pageID);
-}
-#endif
-
#if PLATFORM(WIN)
void WebPageProxy::didChangeCompositionSelection(bool hasComposition)
{
@@ -2061,7 +2064,7 @@ void WebPageProxy::didCountStringMatches(const String& string, uint32_t matchCou
m_findClient.didCountStringMatches(this, string, matchCount);
}
-void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle, bool fadeOut)
+void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut)
{
RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageHandle);
m_pageClient->setFindIndicator(findIndicator.release(), fadeOut);
@@ -2126,20 +2129,21 @@ void WebPageProxy::showContextMenu(const IntPoint& menuLocation, const ContextMe
m_activeContextMenuState = contextMenuState;
- if (m_activeContextMenu)
+ if (m_activeContextMenu) {
m_activeContextMenu->hideContextMenu();
- else
- m_activeContextMenu = m_pageClient->createContextMenuProxy(this);
+ m_activeContextMenu = 0;
+ }
+
+ m_activeContextMenu = m_pageClient->createContextMenuProxy(this);
+
+ // Since showContextMenu() can spin a nested run loop we need to turn off the responsiveness timer.
+ process()->responsivenessTimer()->stop();
// Give the PageContextMenuClient one last swipe at changing the menu.
Vector<WebContextMenuItemData> items;
-
- if (!m_contextMenuClient.getContextMenuFromProposedMenu(this, proposedItems, items, userData.get())) {
+ if (!m_contextMenuClient.getContextMenuFromProposedMenu(this, proposedItems, items, userData.get()))
m_activeContextMenu->showContextMenu(menuLocation, proposedItems);
- return;
- }
-
- if (items.size())
+ else
m_activeContextMenu->showContextMenu(menuLocation, items);
}
@@ -2176,6 +2180,11 @@ void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item)
process()->updateTextCheckerState();
return;
}
+ if (item.action() == ContextMenuItemTagCorrectSpellingAutomatically) {
+ TextChecker::setAutomaticSpellingCorrectionEnabled(!TextChecker::state().isAutomaticSpellingCorrectionEnabled);
+ process()->updateTextCheckerState();
+ return;
+ }
#endif
if (item.action() == ContextMenuItemTagDownloadImageToDisk) {
m_context->download(this, KURL(KURL(), m_activeContextMenuState.absoluteImageURLString));
@@ -2185,7 +2194,16 @@ void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item)
m_context->download(this, KURL(KURL(), m_activeContextMenuState.absoluteLinkURLString));
return;
}
-
+ if (item.action() == ContextMenuItemTagCheckSpellingWhileTyping) {
+ TextChecker::setContinuousSpellCheckingEnabled(!TextChecker::state().isContinuousSpellCheckingEnabled);
+ process()->updateTextCheckerState();
+ return;
+ }
+ if (item.action() == ContextMenuItemTagCheckGrammarWithSpelling) {
+ TextChecker::setGrammarCheckingEnabled(!TextChecker::state().isGrammarCheckingEnabled);
+ process()->updateTextCheckerState();
+ return;
+ }
if (item.action() == ContextMenuItemTagLearnSpelling || item.action() == ContextMenuItemTagIgnoreSpelling)
++m_pendingLearnOrIgnoreWordMessageCount;
@@ -2247,33 +2265,6 @@ void WebPageProxy::unmarkAllBadGrammar()
process()->send(Messages::WebPage::UnmarkAllBadGrammar(), m_pageID);
}
-#if PLATFORM(MAC)
-void WebPageProxy::uppercaseWord()
-{
- process()->send(Messages::WebPage::UppercaseWord(), m_pageID);
-}
-
-void WebPageProxy::lowercaseWord()
-{
- process()->send(Messages::WebPage::LowercaseWord(), m_pageID);
-}
-
-void WebPageProxy::capitalizeWord()
-{
- process()->send(Messages::WebPage::CapitalizeWord(), m_pageID);
-}
-
-void WebPageProxy::setSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled)
-{
- if (m_isSmartInsertDeleteEnabled == isSmartInsertDeleteEnabled)
- return;
-
- TextChecker::setSmartInsertDeleteEnabled(isSmartInsertDeleteEnabled);
- m_isSmartInsertDeleteEnabled = isSmartInsertDeleteEnabled;
- process()->send(Messages::WebPage::SetSmartInsertDeleteEnabled(isSmartInsertDeleteEnabled), m_pageID);
-}
-#endif
-
void WebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> commandProxy, UndoOrRedo undoOrRedo)
{
m_pageClient->registerEditCommand(commandProxy, undoOrRedo);
@@ -2293,6 +2284,11 @@ void WebPageProxy::removeEditCommand(WebEditCommandProxy* command)
process()->send(Messages::WebPage::DidRemoveEditCommand(command->commandID()), m_pageID);
}
+bool WebPageProxy::isValidEditCommand(WebEditCommandProxy* command)
+{
+ return m_editCommandSet.find(command) != m_editCommandSet.end();
+}
+
int64_t WebPageProxy::spellDocumentTag()
{
if (!m_hasSpellDocumentTag) {
@@ -2341,6 +2337,11 @@ void WebPageProxy::ignoreWord(const String& word)
// Other
+void WebPageProxy::setFocus(bool focused)
+{
+ m_pageClient->setFocus(focused);
+}
+
void WebPageProxy::takeFocus(bool direction)
{
m_pageClient->takeFocus(direction);
@@ -2453,9 +2454,12 @@ void WebPageProxy::stringCallback(const String& resultString, uint64_t callbackI
RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackID);
if (!callback) {
// FIXME: Log error or assert.
+ // this can validly happen if a load invalidated the callback, though
return;
}
+ m_loadDependentStringCallbackIDs.remove(callbackID);
+
callback->performCallbackWithReturnValue(resultString.impl());
}
@@ -2496,26 +2500,6 @@ void WebPageProxy::validateCommandCallback(const String& commandName, bool isEna
callback->performCallbackWithReturnValue(commandName.impl(), isEnabled, state);
}
-#if PLATFORM(MAC)
-void WebPageProxy::didPerformDictionaryLookup(const String& text, const DictionaryPopupInfo& dictionaryPopupInfo)
-{
- m_pageClient->didPerformDictionaryLookup(text, m_viewScaleFactor, dictionaryPopupInfo);
-}
-
-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::RegisterUIProcessAccessibilityTokens(elementToken, windowToken), m_pageID);
-}
-#endif
-
void WebPageProxy::focusedFrameChanged(uint64_t frameID)
{
if (!frameID) {
@@ -2572,6 +2556,13 @@ void WebPageProxy::processDidCrash()
}
#endif
+#if ENABLE(FULLSCREEN_API)
+ if (m_fullScreenManager) {
+ m_fullScreenManager->invalidate();
+ m_fullScreenManager = 0;
+ }
+#endif
+
if (m_openPanelResultListener) {
m_openPanelResultListener->invalidate();
m_openPanelResultListener = 0;
@@ -2590,6 +2581,7 @@ void WebPageProxy::processDidCrash()
invalidateCallbackMap(m_voidCallbacks);
invalidateCallbackMap(m_dataCallbacks);
invalidateCallbackMap(m_stringCallbacks);
+ m_loadDependentStringCallbackIDs.clear();
invalidateCallbackMap(m_scriptValueCallbacks);
invalidateCallbackMap(m_computedPagesCallbacks);
invalidateCallbackMap(m_validateCommandCallbacks);
@@ -2633,6 +2625,7 @@ WebPageCreationParameters WebPageProxy::creationParameters() const
parameters.highestUsedBackForwardItemID = WebBackForwardListItem::highedUsedItemID();
parameters.canRunBeforeUnloadConfirmPanel = m_uiClient.canRunBeforeUnloadConfirmPanel();
parameters.canRunModal = m_uiClient.canRunModal();
+ parameters.userSpaceScaleFactor = m_pageClient->userSpaceScaleFactor();
#if PLATFORM(MAC)
parameters.isSmartInsertDeleteEnabled = m_isSmartInsertDeleteEnabled;
@@ -2677,7 +2670,7 @@ void WebPageProxy::didReceiveAuthenticationChallenge(uint64_t frameID, const Web
WebFrameProxy* frame = process()->webFrame(frameID);
MESSAGE_CHECK(frame);
- RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, this);
+ RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, process());
m_loaderClient.didReceiveAuthenticationChallengeInFrame(this, frame, authenticationChallenge.get());
}
@@ -2748,18 +2741,6 @@ void WebPageProxy::didFinishLoadingDataForCustomRepresentation(const String& sug
m_pageClient->didFinishLoadingDataForCustomRepresentation(suggestedFilename, dataReference);
}
-#if PLATFORM(MAC)
-void WebPageProxy::setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled)
-{
- m_pageClient->setComplexTextInputEnabled(pluginComplexTextInputIdentifier, complexTextInputEnabled);
-}
-
-void WebPageProxy::setAutodisplay(bool newState)
-{
- m_pageClient->setAutodisplay(newState);
-}
-#endif
-
void WebPageProxy::backForwardRemovedItem(uint64_t itemID)
{
process()->send(Messages::WebPage::DidRemoveBackForwardItem(itemID), m_pageID);
@@ -2822,4 +2803,41 @@ Color WebPageProxy::backingStoreUpdatesFlashColor()
return Color(200, 0, 255);
}
+void WebPageProxy::saveDataToFileInDownloadsFolder(const String& suggestedFilename, const String& mimeType, const String& originatingURLString, WebData* data)
+{
+ m_uiClient.saveDataToFileInDownloadsFolder(this, suggestedFilename, mimeType, originatingURLString, data);
+}
+
+#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
+void WebPageProxy::showCorrectionPanel(int32_t panelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings)
+{
+ m_pageClient->showCorrectionPanel((WebCore::CorrectionPanelInfo::PanelType)panelType, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings);
+}
+
+void WebPageProxy::dismissCorrectionPanel(int32_t reason)
+{
+ m_pageClient->dismissCorrectionPanel((WebCore::ReasonForDismissingCorrectionPanel)reason);
+}
+
+void WebPageProxy::dismissCorrectionPanelSoon(int32_t reason, String& result)
+{
+ result = m_pageClient->dismissCorrectionPanelSoon((WebCore::ReasonForDismissingCorrectionPanel)reason);
+}
+
+void WebPageProxy::recordAutocorrectionResponse(int32_t responseType, const String& replacedString, const String& replacementString)
+{
+ m_pageClient->recordAutocorrectionResponse((WebCore::EditorClient::AutocorrectionResponseType)responseType, replacedString, replacementString);
+}
+#endif
+
+#if PLATFORM(MAC)
+void WebPageProxy::handleCorrectionPanelResult(const String& result)
+{
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ if (!isClosed())
+ process()->send(Messages::WebPage::HandleCorrectionPanelResult(result), m_pageID, 0);
+#endif
+}
+#endif
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h
index ce56cea..e3e62d4 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.h
+++ b/Source/WebKit2/UIProcess/WebPageProxy.h
@@ -27,6 +27,7 @@
#define WebPageProxy_h
#include "APIObject.h"
+#include "Connection.h"
#include "ContextMenuState.h"
#include "DragControllerAction.h"
#include "DrawingAreaProxy.h"
@@ -37,24 +38,17 @@
#include "WKBase.h"
#include "WKPagePrivate.h"
#include "WebContextMenuItemData.h"
-#include "WebEvent.h"
#include "WebFindClient.h"
-#include "WebFindOptions.h"
#include "WebFormClient.h"
#include "WebFrameProxy.h"
#include "WebHistoryClient.h"
-#include "WebInspectorProxy.h"
#include "WebLoaderClient.h"
#include "WebPageContextMenuClient.h"
#include "WebPolicyClient.h"
#include "WebPopupMenuProxy.h"
#include "WebResourceLoadClient.h"
#include "WebUIClient.h"
-#include <WebCore/DragActions.h>
-#include <WebCore/EditAction.h>
-#include <WebCore/Editor.h>
-#include <WebCore/FrameLoaderTypes.h>
-#include <WebCore/KeyboardEvent.h>
+#include <WebCore/ScrollTypes.h>
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#include <wtf/OwnPtr.h>
@@ -83,7 +77,6 @@ namespace WebCore {
namespace WebKit {
-class DrawingAreaProxy;
class NativeWebKeyboardEvent;
class PageClient;
class PlatformCertificateInfo;
@@ -93,15 +86,14 @@ class WebBackForwardListItem;
class WebContextMenuProxy;
class WebData;
class WebEditCommandProxy;
+class WebFullScreenManagerProxy;
class WebKeyboardEvent;
class WebMouseEvent;
class WebOpenPanelResultListenerProxy;
class WebPageGroup;
-class WebPopupMenuProxy;
class WebProcessProxy;
class WebURLRequest;
class WebWheelEvent;
-struct ContextMenuState;
struct DictionaryPopupInfo;
struct PlatformPopupMenuData;
struct PrintInfo;
@@ -182,6 +174,10 @@ public:
WebInspectorProxy* inspector();
#endif
+#if ENABLE(FULLSCREEN_API)
+ WebFullScreenManagerProxy* fullScreenManager();
+#endif
+
void initializeContextMenuClient(const WKPageContextMenuClient*);
void initializeFindClient(const WKPageFindClient*);
void initializeFormClient(const WKPageFormClient*);
@@ -282,6 +278,8 @@ public:
void handleTouchEvent(const WebTouchEvent&);
#endif
+ void scrollBy(WebCore::ScrollDirection, WebCore::ScrollGranularity);
+
String pageTitle() const;
const String& toolTip() const { return m_toolTip; }
@@ -331,6 +329,7 @@ public:
// 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);
bool writeSelectionToPasteboard(const String& pasteboardName, const Vector<String>& pasteboardTypes);
+ bool readSelectionFromPasteboard(const String& pasteboardName);
#endif
void viewScaleFactorDidChange(double);
@@ -358,8 +357,6 @@ public:
void drawFooter(WebFrameProxy*, const WebCore::FloatRect&);
#if PLATFORM(MAC)
- void setAutodisplay(bool);
-
// Dictionary.
void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
#endif
@@ -373,7 +370,7 @@ public:
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);
+ void setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::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);
@@ -395,6 +392,7 @@ public:
enum UndoOrRedo { Undo, Redo };
void addEditCommand(WebEditCommandProxy*);
void removeEditCommand(WebEditCommandProxy*);
+ bool isValidEditCommand(WebEditCommandProxy*);
void registerEditCommand(PassRefPtr<WebEditCommandProxy>, UndoOrRedo);
WebProcessProxy* process() const;
@@ -454,14 +452,21 @@ public:
void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
+#if PLATFORM(MAC)
+ void handleCorrectionPanelResult(const String& result);
+#endif
+
static void setDebugPaintFlags(WKPageDebugPaintFlags flags) { s_debugPaintFlags = flags; }
static WKPageDebugPaintFlags debugPaintFlags() { return s_debugPaintFlags; }
// Color to be used with kWKDebugFlashViewUpdates.
static WebCore::Color viewUpdatesFlashColor();
+
// Color to be used with kWKDebugFlashBackingStoreUpdates.
static WebCore::Color backingStoreUpdatesFlashColor();
+ void saveDataToFileInDownloadsFolder(const String& suggestedFilename, const String& mimeType, const String& originatingURLString, WebData*);
+
private:
WebPageProxy(PageClient*, WebContext*, WebPageGroup*, uint64_t pageID);
@@ -480,7 +485,7 @@ private:
void didSaveFrameToPageCache(uint64_t frameID);
void didRestoreFrameFromPageCache(uint64_t frameID, uint64_t parentFrameID);
- void didStartProvisionalLoadForFrame(uint64_t frameID, const String&, bool loadingSubstituteDataForUnreachableURL, CoreIPC::ArgumentDecoder*);
+ void didStartProvisionalLoadForFrame(uint64_t frameID, const String& url, const String& unreachableURL, CoreIPC::ArgumentDecoder*);
void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, const String&, CoreIPC::ArgumentDecoder*);
void didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::ArgumentDecoder*);
void didCommitLoadForFrame(uint64_t frameID, const String& mimeType, bool frameHasCustomRepresentation, const PlatformCertificateInfo&, CoreIPC::ArgumentDecoder*);
@@ -534,6 +539,7 @@ private:
void getIsResizable(bool& isResizable);
void setWindowFrame(const WebCore::FloatRect&);
void getWindowFrame(WebCore::FloatRect&);
+ void windowToScreen(const WebCore::IntRect& viewRect, WebCore::IntRect& result);
void runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose);
void didChangeViewportData(const WebCore::ViewportArguments&);
void pageDidScroll();
@@ -550,7 +556,7 @@ private:
void reattachToWebProcessWithItem(WebBackForwardListItem*);
#if ENABLE(TILED_BACKING_STORE)
- void pageDidRequestScroll(const WebCore::IntSize&);
+ void pageDidRequestScroll(const WebCore::IntPoint&);
#endif
#if PLATFORM(QT)
@@ -580,7 +586,7 @@ private:
// Find.
void didCountStringMatches(const String&, uint32_t matchCount);
- void setFindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle, bool fadeOut);
+ void setFindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut);
void didFindString(const String&, uint32_t matchCount);
void didFailToFindString(const String&);
@@ -610,6 +616,7 @@ private:
void learnWord(const String& word);
void ignoreWord(const String& word);
+ void setFocus(bool focused);
void takeFocus(bool direction);
void setToolTip(const String&);
void setCursor(const WebCore::Cursor&);
@@ -642,6 +649,15 @@ private:
void initializeSandboxExtensionHandle(const WebCore::KURL&, SandboxExtension::Handle&);
+#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ void showCorrectionPanel(int32_t panelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
+ void dismissCorrectionPanel(int32_t reason);
+ void dismissCorrectionPanelSoon(int32_t reason, String& result);
+ void recordAutocorrectionResponse(int32_t responseType, const String& replacedString, const String& replacementString);
+#endif
+
+ void clearLoadDependentCallbacks();
+
PageClient* m_pageClient;
WebLoaderClient m_loaderClient;
WebPolicyClient m_policyClient;
@@ -667,9 +683,14 @@ private:
RefPtr<WebInspectorProxy> m_inspector;
#endif
+#if ENABLE(FULLSCREEN_API)
+ RefPtr<WebFullScreenManagerProxy> m_fullScreenManager;
+#endif
+
HashMap<uint64_t, RefPtr<VoidCallback> > m_voidCallbacks;
HashMap<uint64_t, RefPtr<DataCallback> > m_dataCallbacks;
HashMap<uint64_t, RefPtr<StringCallback> > m_stringCallbacks;
+ HashSet<uint64_t> m_loadDependentStringCallbackIDs;
HashMap<uint64_t, RefPtr<ScriptValueCallback> > m_scriptValueCallbacks;
HashMap<uint64_t, RefPtr<ComputedPagesCallback> > m_computedPagesCallbacks;
HashMap<uint64_t, RefPtr<ValidateCommandCallback> > m_validateCommandCallbacks;
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in
index 8692f14..e145d82 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -35,6 +35,7 @@ messages -> WebPageProxy {
SetCursor(WebCore::Cursor cursor)
SetStatusText(WTF::String statusText)
SetToolTip(WTF::String toolTip)
+ SetFocus(bool focused)
TakeFocus(bool direction)
FocusedFrameChanged(uint64_t frameID)
FrameSetLargestFrameChanged(uint64_t frameID)
@@ -48,6 +49,7 @@ messages -> WebPageProxy {
GetIsResizable() -> (bool isResizable)
SetWindowFrame(WebCore::FloatRect windowFrame)
GetWindowFrame() -> (WebCore::FloatRect windowFrame)
+ WindowToScreen(WebCore::IntRect rect) -> (WebCore::IntRect screenFrame)
RunBeforeUnloadConfirmPanel(WTF::String message, uint64_t frameID) -> (bool shouldClose)
PageDidScroll()
RunOpenPanel(uint64_t frameID, WebKit::WebOpenPanelParameters::Data parameters)
@@ -58,7 +60,7 @@ messages -> WebPageProxy {
DidChangeScrollOffsetPinningForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar)
#if ENABLE(TILED_BACKING_STORE)
- PageDidRequestScroll(WebCore::IntSize delta)
+ PageDidRequestScroll(WebCore::IntPoint point)
#endif
#if PLATFORM(QT)
DidChangeContentsSize(WebCore::IntSize newSize)
@@ -92,7 +94,7 @@ messages -> WebPageProxy {
DidFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData)
DidReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, WTF::String url, WebKit::InjectedBundleUserMessageEncoder userData)
DidRemoveFrameFromHierarchy(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData)
- DidStartProvisionalLoadForFrame(uint64_t frameID, WTF::String url, bool loadingSubstituteDataForUnreachableURL, WebKit::InjectedBundleUserMessageEncoder userData)
+ DidStartProvisionalLoadForFrame(uint64_t frameID, WTF::String url, WTF::String unreachableURL, WebKit::InjectedBundleUserMessageEncoder userData)
DidReceiveTitleForFrame(uint64_t frameID, WTF::String title, WebKit::InjectedBundleUserMessageEncoder userData)
DidDisplayInsecureContentForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData)
DidRunInsecureContentForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData)
@@ -157,7 +159,7 @@ messages -> WebPageProxy {
# Find messages
DidCountStringMatches(WTF::String string, uint32_t matchCount)
- SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, WebKit::SharedMemory::Handle contentImageHandle, bool fadeOut)
+ SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, WebKit::ShareableBitmap::Handle contentImageHandle, bool fadeOut)
DidFindString(WTF::String string, uint32_t matchCount)
DidFailToFindString(WTF::String string)
@@ -201,9 +203,17 @@ messages -> WebPageProxy {
# Drag and drop messages
DidPerformDragControllerAction(uint64_t resultOperation)
#if PLATFORM(MAC)
- SetDragImage(WebCore::IntPoint clientPosition, WebCore::IntSize imageSize, WebKit::SharedMemory::Handle dragImage, bool linkDrag)
+ SetDragImage(WebCore::IntPoint clientPosition, WebKit::ShareableBitmap::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
+
+#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ # Autocorrection messages
+ ShowCorrectionPanel(int32_t panelType, WebCore::FloatRect boundingBoxOfReplacedString, String replacedString, String replacementString, Vector<String> alternativeReplacementStrings)
+ DismissCorrectionPanel(int32_t reason)
+ DismissCorrectionPanelSoon(int32_t reason) -> (String result)
+ RecordAutocorrectionResponse(int32_t responseType, String replacedString, String replacementString);
+#endif
}
diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp
index 42e3408..8a48724 100644
--- a/Source/WebKit2/UIProcess/WebProcessProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp
@@ -252,7 +252,9 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC
|| messageID.is<CoreIPC::MessageClassWebCookieManagerProxy>()
|| messageID.is<CoreIPC::MessageClassWebDatabaseManagerProxy>()
|| messageID.is<CoreIPC::MessageClassWebGeolocationManagerProxy>()
+ || messageID.is<CoreIPC::MessageClassWebIconDatabase>()
|| messageID.is<CoreIPC::MessageClassWebKeyValueStorageManagerProxy>()
+ || messageID.is<CoreIPC::MessageClassWebMediaCacheManagerProxy>()
|| messageID.is<CoreIPC::MessageClassWebResourceCacheManagerProxy>()) {
m_context->didReceiveMessage(connection, messageID, arguments);
return;
@@ -290,7 +292,8 @@ CoreIPC::SyncReplyMode WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connectio
}
#endif
- if (messageID.is<CoreIPC::MessageClassWebContext>() || messageID.is<CoreIPC::MessageClassWebContextLegacy>() || messageID.is<CoreIPC::MessageClassDownloadProxy>())
+ if (messageID.is<CoreIPC::MessageClassWebContext>() || messageID.is<CoreIPC::MessageClassWebContextLegacy>()
+ || messageID.is<CoreIPC::MessageClassDownloadProxy>() || messageID.is<CoreIPC::MessageClassWebIconDatabase>())
return m_context->didReceiveSyncMessage(connection, messageID, arguments, reply);
uint64_t pageID = arguments->destinationID();
diff --git a/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp b/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp
index aa65113..403a8dc 100644
--- a/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp
@@ -56,13 +56,15 @@ void WebResourceCacheManagerProxy::invalidate()
invalidateCallbackMap(m_arrayCallbacks);
}
+bool WebResourceCacheManagerProxy::shouldTerminate(WebProcessProxy*) const
+{
+ return m_arrayCallbacks.isEmpty();
+}
+
void WebResourceCacheManagerProxy::getCacheOrigins(PassRefPtr<ArrayCallback> prpCallback)
{
RefPtr<ArrayCallback> callback = prpCallback;
- if (!m_webContext->hasValidProcess()) {
- callback->invalidate();
- return;
- }
+ m_webContext->relaunchProcessIfNecessary();
uint64_t callbackID = callback->callbackID();
m_arrayCallbacks.set(callbackID, callback.release());
m_webContext->process()->send(Messages::WebResourceCacheManager::GetCacheOrigins(callbackID), 0);
@@ -76,8 +78,7 @@ void WebResourceCacheManagerProxy::didGetCacheOrigins(const Vector<SecurityOrigi
void WebResourceCacheManagerProxy::clearCacheForOrigin(WebSecurityOrigin* origin)
{
- if (!m_webContext->hasValidProcess())
- return;
+ m_webContext->relaunchProcessIfNecessary();
SecurityOriginData securityOrigin;
securityOrigin.protocol = origin->protocol();
@@ -88,8 +89,7 @@ void WebResourceCacheManagerProxy::clearCacheForOrigin(WebSecurityOrigin* origin
void WebResourceCacheManagerProxy::clearCacheForAllOrigins()
{
- if (!m_webContext->hasValidProcess())
- return;
+ m_webContext->relaunchProcessIfNecessary();
m_webContext->process()->send(Messages::WebResourceCacheManager::ClearCacheForAllOrigins(), 0);
}
diff --git a/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.h b/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.h
index 0a2c3c8..1a360b4 100644
--- a/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.h
+++ b/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.h
@@ -42,6 +42,7 @@ namespace WebKit {
struct SecurityOriginData;
class WebContext;
+class WebProcessProxy;
class WebSecurityOrigin;
typedef GenericCallback<WKArrayRef> ArrayCallback;
@@ -62,6 +63,8 @@ public:
void didReceiveWebResourceCacheManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+ bool shouldTerminate(WebProcessProxy*) const;
+
private:
explicit WebResourceCacheManagerProxy(WebContext*);
diff --git a/Source/WebKit2/UIProcess/WebUIClient.cpp b/Source/WebKit2/UIProcess/WebUIClient.cpp
index 31dd458..9bb8efc 100644
--- a/Source/WebKit2/UIProcess/WebUIClient.cpp
+++ b/Source/WebKit2/UIProcess/WebUIClient.cpp
@@ -329,10 +329,18 @@ void WebUIClient::runModal(WebPageProxy* page)
void WebUIClient::didCompleteRubberBandForMainFrame(WebPageProxy* page, const IntSize& initialOverhang)
{
- if (!m_client.runModal)
+ if (!m_client.didCompleteRubberBandForMainFrame)
return;
m_client.didCompleteRubberBandForMainFrame(toAPI(page), toAPI(initialOverhang), m_client.clientInfo);
}
+void WebUIClient::saveDataToFileInDownloadsFolder(WebPageProxy* page, const String& suggestedFilename, const String& mimeType, const String& originatingURLString, WebData* data)
+{
+ if (!m_client.saveDataToFileInDownloadsFolder)
+ return;
+
+ m_client.saveDataToFileInDownloadsFolder(toAPI(page), toAPI(suggestedFilename.impl()), toAPI(mimeType.impl()), toURLRef(originatingURLString.impl()), toAPI(data), m_client.clientInfo);
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebUIClient.h b/Source/WebKit2/UIProcess/WebUIClient.h
index ed47f8f..8fcf7b6 100644
--- a/Source/WebKit2/UIProcess/WebUIClient.h
+++ b/Source/WebKit2/UIProcess/WebUIClient.h
@@ -44,6 +44,7 @@ namespace WebKit {
class APIObject;
class GeolocationPermissionRequestProxy;
class NativeWebKeyboardEvent;
+class WebData;
class WebFrameProxy;
class WebPageProxy;
class WebSecurityOrigin;
@@ -98,6 +99,8 @@ public:
void runModal(WebPageProxy*);
void didCompleteRubberBandForMainFrame(WebPageProxy*, const WebCore::IntSize&);
+
+ void saveDataToFileInDownloadsFolder(WebPageProxy*, const String& suggestedFilename, const String& mimeType, const String& originatingURLString, WebData*);
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp b/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
index dc26899..45e77df 100644
--- a/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
+++ b/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
@@ -151,7 +151,6 @@ void WebPageProxy::restoreFromSessionStateData(WebData* webData)
provisionalURL = static_cast<CFStringRef>(value);
}
- bool restoredFromBackForwardList = false;
if (backForwardListDictionary) {
if (!m_backForwardList->restoreFromCFDictionaryRepresentation(backForwardListDictionary))
LOG(SessionState, "Failed to restore back/forward list from SessionHistory dictionary");
@@ -161,21 +160,23 @@ void WebPageProxy::restoreFromSessionStateData(WebData* webData)
for (size_t i = 0; i < size; ++i)
process()->registerNewWebBackForwardListItem(entries[i].get());
- 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);
-
- restoredFromBackForwardList = true;
+ SessionState state(m_backForwardList->entries(), m_backForwardList->currentIndex());
+ if (provisionalURL)
+ process()->send(Messages::WebPage::RestoreSession(state), m_pageID);
+ else {
+ SandboxExtension::Handle sandboxExtensionHandle;
+ if (WebBackForwardListItem* item = m_backForwardList->currentItem()) {
+ initializeSandboxExtensionHandle(KURL(KURL(), item->url()), sandboxExtensionHandle);
+ setPendingAPIRequestURL(item->url());
+ }
+
+ process()->send(Messages::WebPage::RestoreSessionAndNavigateToCurrentItem(state, sandboxExtensionHandle), m_pageID);
+ }
}
}
}
- // FIXME: It would be better to load the provisional URL even if the back/forward list is also present.
- // But when we tried it, it overwrote the current item in the back/forward list instead of pushing a
- // new item on. For now, just throw away the provisional URL if there is also a back/forward list.
- if (provisionalURL && !restoredFromBackForwardList)
+ if (provisionalURL)
loadURL(provisionalURL);
}
diff --git a/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp
index d67726c..e09bfa5 100644
--- a/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp
+++ b/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp
@@ -41,9 +41,24 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters&)
{
}
+void WebContext::platformInvalidateContext()
+{
+}
+
String WebContext::platformDefaultDatabaseDirectory() const
{
return WTF::String::fromUTF8(g_build_filename(g_get_user_data_dir(), "webkit", "databases", NULL));
}
+String WebContext::platformDefaultIconDatabasePath() const
+{
+ // FIXME: Implement.
+ return WTF::String();
+}
+
+String WebContext::platformDefaultLocalStorageDirectory() const
+{
+ return WTF::String::fromUTF8(g_build_filename(g_get_user_data_dir(), "webkit", "localstorage", NULL));
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/gtk/WebFullScreenManagerProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebFullScreenManagerProxyGtk.cpp
new file mode 100644
index 0000000..82e8657
--- /dev/null
+++ b/Source/WebKit2/UIProcess/gtk/WebFullScreenManagerProxyGtk.cpp
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebFullScreenManagerProxy.h"
+
+#if ENABLE(FULLSCREEN_API)
+
+#include "WebContext.h"
+#include "WebFullScreenManagerMessages.h"
+#include "WebFullScreenManagerProxyMessages.h"
+#include "WebProcess.h"
+
+#include <WebCore/NotImplemented.h>
+
+namespace WebKit {
+
+void WebFullScreenManagerProxy::enterFullScreen()
+{
+ notImplemented();
+}
+
+void WebFullScreenManagerProxy::exitFullScreen()
+{
+ notImplemented();
+}
+
+void WebFullScreenManagerProxy::beganEnterFullScreenAnimation()
+{
+ notImplemented();
+}
+
+void WebFullScreenManagerProxy::finishedEnterFullScreenAnimation(bool completed)
+{
+ notImplemented();
+}
+
+void WebFullScreenManagerProxy::beganExitFullScreenAnimation()
+{
+ notImplemented();
+}
+
+void WebFullScreenManagerProxy::finishedExitFullScreenAnimation(bool completed)
+{
+ notImplemented();
+}
+
+void WebFullScreenManagerProxy::enterAcceleratedCompositingMode(const LayerTreeContext& context)
+{
+ notImplemented();
+}
+
+void WebFullScreenManagerProxy::exitAcceleratedCompositingMode()
+{
+ notImplemented();
+}
+
+void WebFullScreenManagerProxy::getFullScreenRect(WebCore::IntRect& rect)
+{
+ notImplemented();
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(FULLSCREEN_API)
diff --git a/Source/WebKit2/UIProcess/gtk/WebView.cpp b/Source/WebKit2/UIProcess/gtk/WebView.cpp
index 5063922..2ff67cd 100644
--- a/Source/WebKit2/UIProcess/gtk/WebView.cpp
+++ b/Source/WebKit2/UIProcess/gtk/WebView.cpp
@@ -179,6 +179,11 @@ void WebView::didRelaunchProcess()
notImplemented();
}
+void WebView::setFocus(bool)
+{
+ notImplemented();
+}
+
void WebView::takeFocus(bool)
{
notImplemented();
@@ -189,9 +194,17 @@ void WebView::toolTipChanged(const String&, const String&)
notImplemented();
}
-void WebView::setCursor(const Cursor&)
+void WebView::setCursor(const Cursor& cursor)
{
- notImplemented();
+ // [GTK] Widget::setCursor() gets called frequently
+ // http://bugs.webkit.org/show_bug.cgi?id=16388
+ // Setting the cursor may be an expensive operation in some backends,
+ // so don't re-set the cursor if it's already set to the target value.
+ GdkWindow* window = gtk_widget_get_window(m_viewWidget);
+ GdkCursor* currentCursor = gdk_window_get_cursor(window);
+ GdkCursor* newCursor = cursor.platformCursor().get();
+ if (currentCursor != newCursor)
+ gdk_window_set_cursor(window, newCursor);
}
void WebView::setViewportArguments(const WebCore::ViewportArguments&)
@@ -221,6 +234,12 @@ FloatRect WebView::convertToUserSpace(const FloatRect& viewRect)
return viewRect;
}
+IntRect WebView::windowToScreen(const IntRect& rect)
+{
+ notImplemented();
+ return IntRect();
+}
+
void WebView::doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled)
{
notImplemented();
diff --git a/Source/WebKit2/UIProcess/gtk/WebView.h b/Source/WebKit2/UIProcess/gtk/WebView.h
index 256dc04..6c281ed 100644
--- a/Source/WebKit2/UIProcess/gtk/WebView.h
+++ b/Source/WebKit2/UIProcess/gtk/WebView.h
@@ -85,6 +85,7 @@ private:
virtual void processDidCrash();
virtual void didRelaunchProcess();
virtual void pageClosed();
+ virtual void setFocus(bool focused);
virtual void takeFocus(bool direction);
virtual void toolTipChanged(const WTF::String&, const WTF::String&);
virtual void setCursor(const WebCore::Cursor&);
@@ -93,6 +94,7 @@ private:
virtual void clearAllEditCommands();
virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
+ virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&);
virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled);
virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&);
virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*);
@@ -100,6 +102,7 @@ private:
virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut);
virtual void didChangeScrollbarsForMainFrame() const;
virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
+ virtual float userSpaceScaleFactor() const { return 1; }
#if USE(ACCELERATED_COMPOSITING)
virtual void pageDidEnterAcceleratedCompositing();
diff --git a/Source/WebKit2/UIProcess/mac/CorrectionPanel.h b/Source/WebKit2/UIProcess/mac/CorrectionPanel.h
new file mode 100644
index 0000000..d4bc353
--- /dev/null
+++ b/Source/WebKit2/UIProcess/mac/CorrectionPanel.h
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+#ifndef CorrectionPanel_h
+#define CorrectionPanel_h
+
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#import <AppKit/NSTextChecker.h>
+#import <WebCore/CorrectionPanelInfo.h>
+#import <wtf/RetainPtr.h>
+
+@class WKView;
+
+namespace WebKit {
+
+class CorrectionPanel {
+public:
+ CorrectionPanel();
+ ~CorrectionPanel();
+ void show(WKView*, WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
+ void dismiss(WebCore::ReasonForDismissingCorrectionPanel);
+ String dismissSoon(WebCore::ReasonForDismissingCorrectionPanel);
+ static void recordAutocorrectionResponse(WKView*, NSCorrectionResponse, const String& replacedString, const String& replacementString);
+
+private:
+ bool isShowing() const { return m_view; }
+ void dismissInternal(WebCore::ReasonForDismissingCorrectionPanel, bool dismissingExternally);
+ void handleAcceptedReplacement(NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement, NSCorrectionBubbleType);
+
+ bool m_wasDismissedExternally;
+ WebCore::ReasonForDismissingCorrectionPanel m_reasonForDismissing;
+ RetainPtr<WKView> m_view;
+ RetainPtr<NSString> m_resultForSynchronousDismissal;
+ RetainPtr<NSCondition> m_resultCondition;
+};
+
+} // namespace WebKit
+
+#endif // !defined(BUILDING_ON_SNOW_LEOPARD)
+
+#endif // CorrectionPanel_h
diff --git a/Source/WebKit2/UIProcess/mac/CorrectionPanel.mm b/Source/WebKit2/UIProcess/mac/CorrectionPanel.mm
new file mode 100644
index 0000000..ab6818f
--- /dev/null
+++ b/Source/WebKit2/UIProcess/mac/CorrectionPanel.mm
@@ -0,0 +1,166 @@
+/*
+ * 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"
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#import "CorrectionPanel.h"
+
+#import "WebPageProxy.h"
+#import "WKView.h"
+#import "WKViewPrivate.h"
+
+using namespace WebCore;
+
+static inline NSCorrectionBubbleType correctionBubbleType(CorrectionPanelInfo::PanelType panelType)
+{
+ switch (panelType) {
+ case CorrectionPanelInfo::PanelTypeCorrection:
+ return NSCorrectionBubbleTypeCorrection;
+ case CorrectionPanelInfo::PanelTypeReversion:
+ return NSCorrectionBubbleTypeReversion;
+ case CorrectionPanelInfo::PanelTypeSpellingSuggestions:
+ return NSCorrectionBubbleTypeGuesses;
+ }
+ ASSERT_NOT_REACHED();
+ return NSCorrectionBubbleTypeCorrection;
+}
+
+namespace WebKit {
+
+CorrectionPanel::CorrectionPanel()
+ : m_wasDismissedExternally(false)
+ , m_reasonForDismissing(ReasonForDismissingCorrectionPanelIgnored)
+ , m_resultCondition(AdoptNS, [[NSCondition alloc] init])
+{
+}
+
+CorrectionPanel::~CorrectionPanel()
+{
+ dismissInternal(ReasonForDismissingCorrectionPanelIgnored, false);
+}
+
+void CorrectionPanel::show(WKView* view, CorrectionPanelInfo::PanelType type, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings)
+{
+ dismissInternal(ReasonForDismissingCorrectionPanelIgnored, false);
+
+ if (!view)
+ return;
+
+ NSString* replacedStringAsNSString = replacedString;
+ NSString* replacementStringAsNSString = replacementString;
+ m_view = view;
+ NSCorrectionBubbleType bubbleType = correctionBubbleType(type);
+
+ NSMutableArray* alternativeStrings = 0;
+ if (!alternativeReplacementStrings.isEmpty()) {
+ size_t size = alternativeReplacementStrings.size();
+ alternativeStrings = [NSMutableArray arrayWithCapacity:size];
+ for (size_t i = 0; i < size; ++i)
+ [alternativeStrings addObject:(NSString*)alternativeReplacementStrings[i]];
+ }
+
+ NSSpellChecker* spellChecker = [NSSpellChecker sharedSpellChecker];
+ [spellChecker showCorrectionBubbleOfType:bubbleType primaryString:replacementStringAsNSString alternativeStrings:alternativeStrings forStringInRect:boundingBoxOfReplacedString view:m_view.get() completionHandler:^(NSString* acceptedString) {
+ handleAcceptedReplacement(acceptedString, replacedStringAsNSString, replacementStringAsNSString, bubbleType);
+ }];
+}
+
+void CorrectionPanel::dismiss(ReasonForDismissingCorrectionPanel reason)
+{
+ dismissInternal(reason, true);
+}
+
+String CorrectionPanel::dismissSoon(ReasonForDismissingCorrectionPanel reason)
+{
+ if (!isShowing())
+ return String();
+
+ dismissInternal(reason, true);
+ [m_resultCondition.get() lock];
+ while (!m_resultForSynchronousDismissal)
+ [m_resultCondition.get() wait];
+ [m_resultCondition.get() unlock];
+ return m_resultForSynchronousDismissal.get();
+}
+
+void CorrectionPanel::dismissInternal(ReasonForDismissingCorrectionPanel reason, bool dismissingExternally)
+{
+ m_wasDismissedExternally = dismissingExternally;
+ if (!isShowing())
+ return;
+
+ m_reasonForDismissing = reason;
+ m_resultForSynchronousDismissal.clear();
+ [[NSSpellChecker sharedSpellChecker] dismissCorrectionBubbleForView:m_view.get()];
+ m_view.clear();
+}
+
+void CorrectionPanel::recordAutocorrectionResponse(WKView* view, NSCorrectionResponse response, const String& replacedString, const String& replacementString)
+{
+ [[NSSpellChecker sharedSpellChecker] recordResponse:response toCorrection:replacementString forWord:replacedString language:nil inSpellDocumentWithTag:[view spellCheckerDocumentTag]];
+}
+
+void CorrectionPanel::handleAcceptedReplacement(NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement, NSCorrectionBubbleType correctionBubbleType)
+{
+ NSSpellChecker* spellChecker = [NSSpellChecker sharedSpellChecker];
+ NSInteger documentTag = [m_view.get() spellCheckerDocumentTag];
+
+ switch (correctionBubbleType) {
+ case NSCorrectionBubbleTypeCorrection:
+ if (acceptedReplacement)
+ [spellChecker recordResponse:NSCorrectionResponseAccepted toCorrection:acceptedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag];
+ else {
+ if (!m_wasDismissedExternally || m_reasonForDismissing == ReasonForDismissingCorrectionPanelCancelled)
+ [spellChecker recordResponse:NSCorrectionResponseRejected toCorrection:proposedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag];
+ else
+ [spellChecker recordResponse:NSCorrectionResponseIgnored toCorrection:proposedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag];
+ }
+ break;
+ case NSCorrectionBubbleTypeReversion:
+ if (acceptedReplacement)
+ [spellChecker recordResponse:NSCorrectionResponseReverted toCorrection:replaced forWord:acceptedReplacement language:nil inSpellDocumentWithTag:documentTag];
+ break;
+ case NSCorrectionBubbleTypeGuesses:
+ if (acceptedReplacement)
+ [spellChecker recordResponse:NSCorrectionResponseAccepted toCorrection:acceptedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag];
+ break;
+ }
+
+ if (!m_wasDismissedExternally) {
+ [m_view.get() handleCorrectionPanelResult:acceptedReplacement];
+ return;
+ }
+
+ [m_resultCondition.get() lock];
+ if (acceptedReplacement)
+ m_resultForSynchronousDismissal.adoptNS([acceptedReplacement copy]);
+ [m_resultCondition.get() signal];
+ [m_resultCondition.get() unlock];
+}
+
+} // namespace WebKit
+
+#endif //!defined(BUILDING_ON_SNOW_LEOPARD)
+
diff --git a/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h b/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h
new file mode 100644
index 0000000..57311e7
--- /dev/null
+++ b/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+#if ENABLE(FULLSCREEN_API)
+
+#import <Cocoa/Cocoa.h>
+#import <wtf/RetainPtr.h>
+
+namespace WebKit {
+class LayerTreeContext;
+}
+
+namespace WebCore {
+class IntRect;
+}
+
+@class WKView;
+
+@interface WKFullScreenWindowController : NSWindowController {
+@private
+ WKView *_webView;
+ RetainPtr<NSView> _webViewPlaceholder;
+ RetainPtr<NSView> _layerViewPlaceholder;
+ RetainPtr<NSView> _layerHostingView;
+
+ BOOL _isAnimating;
+ BOOL _isFullScreen;
+ BOOL _isWindowLoaded;
+ BOOL _forceDisableAnimation;
+ BOOL _isPlaying;
+ CGRect _initialFrame;
+ uint32_t _idleDisplaySleepAssertion;
+ uint32_t _idleSystemSleepAssertion;
+ NSTimer *_tickleTimer;
+}
+
+- (WKView*)webView;
+- (void)setWebView:(WKView*)webView;
+
+- (void)enterFullScreen:(NSScreen *)screen;
+- (void)exitFullScreen;
+- (void)beganEnterFullScreenAnimation;
+- (void)beganExitFullScreenAnimation;
+- (void)finishedEnterFullScreenAnimation:(bool)completed;
+- (void)finishedExitFullScreenAnimation:(bool)completed;
+- (void)enterAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)context;
+- (void)exitAcceleratedCompositingMode;
+- (WebCore::IntRect)getFullScreenRect;
+
+@end
+
+#endif
diff --git a/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm b/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm
new file mode 100644
index 0000000..91eeaf6
--- /dev/null
+++ b/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm
@@ -0,0 +1,608 @@
+/*
+ * Copyright (C) 2009, 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
+ * 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"
+
+#if ENABLE(FULLSCREEN_API)
+
+#import "WKFullScreenWindowController.h"
+
+#import "LayerTreeContext.h"
+#import "WKAPICast.h"
+#import "WKViewInternal.h"
+#import "WebFullScreenManagerProxy.h"
+#import "WebPageProxy.h"
+#import <Carbon/Carbon.h> // For SetSystemUIMode()
+#import <IOKit/pwr_mgt/IOPMLib.h> // For IOPMAssertionCreate()
+#import <QuartzCore/QuartzCore.h>
+#import <WebCore/FloatRect.h>
+#import <WebCore/IntRect.h>
+#import <WebKitSystemInterface.h>
+
+static const NSTimeInterval tickleTimerInterval = 1.0;
+
+using namespace WebKit;
+using namespace WebCore;
+
+#if defined(BUILDING_ON_LEOPARD)
+@interface CATransaction(SnowLeopardConvenienceFunctions)
++ (void)setDisableActions:(BOOL)flag;
++ (void)setAnimationDuration:(CFTimeInterval)dur;
+@end
+
+@implementation CATransaction(SnowLeopardConvenienceFunctions)
++ (void)setDisableActions:(BOOL)flag
+{
+ [self setValue:[NSNumber numberWithBool:flag] forKey:kCATransactionDisableActions];
+}
+
++ (void)setAnimationDuration:(CFTimeInterval)dur
+{
+ [self setValue:[NSNumber numberWithDouble:dur] forKey:kCATransactionAnimationDuration];
+}
+@end
+
+#endif
+
+@interface WKFullScreenWindow : NSWindow
+{
+ NSView* _animationView;
+ CALayer* _backgroundLayer;
+}
+- (CALayer*)backgroundLayer;
+- (NSView*)animationView;
+@end
+
+@interface WKFullScreenWindowController(Private)
+- (void)_requestExitFullScreenWithAnimation:(BOOL)animation;
+- (void)_updateMenuAndDockForFullScreen;
+- (void)_updatePowerAssertions;
+- (WKFullScreenWindow *)_fullScreenWindow;
+- (CFTimeInterval)_animationDuration;
+- (void)_swapView:(NSView*)view with:(NSView*)otherView;
+- (WebFullScreenManagerProxy*)_manager;
+@end
+
+@interface NSWindow(IsOnActiveSpaceAdditionForTigerAndLeopard)
+- (BOOL)isOnActiveSpace;
+@end
+
+@implementation WKFullScreenWindowController
+
+#pragma mark -
+#pragma mark Initialization
+- (id)init
+{
+ NSWindow *window = [[WKFullScreenWindow alloc] initWithContentRect:NSZeroRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
+ self = [super initWithWindow:window];
+ [window release];
+ if (!self)
+ return nil;
+ [self windowDidLoad];
+
+ return self;
+}
+
+- (void)dealloc
+{
+ [self setWebView:nil];
+
+ [NSObject cancelPreviousPerformRequestsWithTarget:self];
+
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [super dealloc];
+}
+
+- (void)windowDidLoad
+{
+ [super windowDidLoad];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidResignActive:) name:NSApplicationDidResignActiveNotification object:NSApp];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidChangeScreenParameters:) name:NSApplicationDidChangeScreenParametersNotification object:NSApp];
+}
+
+#pragma mark -
+#pragma mark Accessors
+
+- (WKView*)webView
+{
+ return _webView;
+}
+
+- (void)setWebView:(WKView *)webView
+{
+ [webView retain];
+ [_webView release];
+ _webView = webView;
+}
+
+#pragma mark -
+#pragma mark Notifications
+
+- (void)applicationDidResignActive:(NSNotification*)notification
+{
+ // Check to see if the fullScreenWindow is on the active space; this function is available
+ // on 10.6 and later, so default to YES if the function is not available:
+ NSWindow* fullScreenWindow = [self _fullScreenWindow];
+ BOOL isOnActiveSpace = ([fullScreenWindow respondsToSelector:@selector(isOnActiveSpace)] ? [fullScreenWindow isOnActiveSpace] : YES);
+
+ // Replicate the QuickTime Player (X) behavior when losing active application status:
+ // Is the fullScreen screen the main screen? (Note: this covers the case where only a
+ // single screen is available.) Is the fullScreen screen on the current space? IFF so,
+ // then exit fullScreen mode.
+ if ([fullScreenWindow screen] == [[NSScreen screens] objectAtIndex:0] && isOnActiveSpace)
+ [self _requestExitFullScreenWithAnimation:NO];
+}
+
+- (void)applicationDidChangeScreenParameters:(NSNotification*)notification
+{
+ // The user may have changed the main screen by moving the menu bar, or they may have changed
+ // the Dock's size or location, or they may have changed the fullScreen screen's dimensions.
+ // Update our presentation parameters, and ensure that the full screen window occupies the
+ // entire screen:
+ [self _updateMenuAndDockForFullScreen];
+ NSWindow* window = [self window];
+ [window setFrame:[[window screen] frame] display:YES];
+}
+
+#pragma mark -
+#pragma mark Exposed Interface
+
+- (void)enterFullScreen:(NSScreen *)screen
+{
+ if (_isFullScreen)
+ return;
+
+ _isFullScreen = YES;
+ _isAnimating = YES;
+
+ NSDisableScreenUpdates();
+
+ if (!screen)
+ screen = [NSScreen mainScreen];
+ NSRect screenFrame = [screen frame];
+
+ NSRect webViewFrame = [_webView convertRectToBase:[_webView frame]];
+ webViewFrame.origin = [[_webView window] convertBaseToScreen:webViewFrame.origin];
+
+ // In the case of a multi-monitor setup where the webView straddles two
+ // monitors, we must create a window large enough to contain the destination
+ // frame and the initial frame.
+ NSRect windowFrame = NSUnionRect(screenFrame, webViewFrame);
+ [[self window] setFrame:windowFrame display:YES];
+
+ CALayer* backgroundLayer = [[self _fullScreenWindow] backgroundLayer];
+ NSRect backgroundFrame = {[[self window] convertScreenToBase:screenFrame.origin], screenFrame.size};
+ backgroundFrame = [[[self window] contentView] convertRectFromBase:backgroundFrame];
+
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+ [backgroundLayer setFrame:NSRectToCGRect(backgroundFrame)];
+ [CATransaction commit];
+
+ CFTimeInterval duration = [self _animationDuration];
+ [self _manager]->willEnterFullScreen();
+ [self _manager]->beginEnterFullScreenAnimation(duration);
+}
+
+- (void)beganEnterFullScreenAnimation
+{
+ [self _updateMenuAndDockForFullScreen];
+ [self _updatePowerAssertions];
+
+ // In a previous incarnation, the NSWindow attached to this controller may have
+ // been on a different screen. Temporarily change the collectionBehavior of the window:
+ NSWindow* fullScreenWindow = [self window];
+ NSWindowCollectionBehavior behavior = [fullScreenWindow collectionBehavior];
+ [fullScreenWindow setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
+ [fullScreenWindow makeKeyAndOrderFront:self];
+ [fullScreenWindow setCollectionBehavior:behavior];
+
+ // Start the opacity animation. We can use implicit animations here because we don't care when
+ // the animation finishes.
+ [CATransaction begin];
+ [CATransaction setAnimationDuration:[self _animationDuration]];
+ [[[self _fullScreenWindow] backgroundLayer] setOpacity:1];
+ [CATransaction commit];
+
+ NSEnableScreenUpdates();
+ _isAnimating = YES;
+}
+
+- (void)finishedEnterFullScreenAnimation:(bool)completed
+{
+ NSDisableScreenUpdates();
+
+ if (completed) {
+ // Swap the webView placeholder into place.
+ if (!_webViewPlaceholder)
+ _webViewPlaceholder.adoptNS([[NSView alloc] init]);
+ [self _swapView:_webView with:_webViewPlaceholder.get()];
+
+ // Then insert the WebView into the full screen window
+ NSView* animationView = [[self _fullScreenWindow] animationView];
+ [animationView addSubview:_webView positioned:NSWindowBelow relativeTo:_layerHostingView.get()];
+ [_webView setFrame:[animationView bounds]];
+
+ // FIXME: In Barolo, orderIn will animate, which is not what we want. Find a way
+ // to work around this behavior.
+ //[[_webViewPlaceholder.get() window] orderOut:self];
+ [[self window] makeKeyAndOrderFront:self];
+ }
+
+ [self _manager]->didEnterFullScreen();
+ NSEnableScreenUpdates();
+
+ _isAnimating = NO;
+}
+
+- (void)exitFullScreen
+{
+ if (!_isFullScreen)
+ return;
+
+ _isFullScreen = NO;
+ _isAnimating = YES;
+
+ NSDisableScreenUpdates();
+
+ [self _manager]->willExitFullScreen();
+ [self _manager]->beginExitFullScreenAnimation([self _animationDuration]);
+}
+
+- (void)beganExitFullScreenAnimation
+{
+ [self _updateMenuAndDockForFullScreen];
+ [self _updatePowerAssertions];
+
+ // The user may have moved the fullScreen window in Spaces, so temporarily change
+ // the collectionBehavior of the webView's window:
+ NSWindow* webWindow = [[self webView] window];
+ NSWindowCollectionBehavior behavior = [webWindow collectionBehavior];
+ [webWindow setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
+ [webWindow orderWindow:NSWindowBelow relativeTo:[[self window] windowNumber]];
+ [webWindow setCollectionBehavior:behavior];
+
+ // Swap the webView back into its original position:
+ if ([_webView window] == [self window])
+ [self _swapView:_webViewPlaceholder.get() with:_webView];
+
+ [CATransaction begin];
+ [CATransaction setAnimationDuration:[self _animationDuration]];
+ [[[self _fullScreenWindow] backgroundLayer] setOpacity:0];
+ [CATransaction commit];
+
+ NSEnableScreenUpdates();
+ _isAnimating = YES;
+}
+
+- (void)finishedExitFullScreenAnimation:(bool)completed
+{
+ NSDisableScreenUpdates();
+
+ if (completed) {
+ [self _updateMenuAndDockForFullScreen];
+ [self _updatePowerAssertions];
+ [NSCursor setHiddenUntilMouseMoves:YES];
+
+ [[self window] orderOut:self];
+ [[_webView window] makeKeyAndOrderFront:self];
+ }
+
+ [self _manager]->didExitFullScreen();
+ NSEnableScreenUpdates();
+
+ _isAnimating = NO;
+}
+
+- (void)enterAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext
+{
+ if (_layerHostingView)
+ return;
+
+ ASSERT(!layerTreeContext.isEmpty());
+
+ // Create an NSView that will host our layer tree.
+ _layerHostingView.adoptNS([[NSView alloc] initWithFrame:[[self window] frame]]);
+ [_layerHostingView.get() setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+ WKFullScreenWindow* window = [self _fullScreenWindow];
+ [[window animationView] addSubview:_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];
+
+ [_layerHostingView.get() setLayer:rootLayer.get()];
+ [_layerHostingView.get() setWantsLayer:YES];
+ [[window backgroundLayer] setHidden:NO];
+ [CATransaction commit];
+}
+
+- (void)exitAcceleratedCompositingMode
+{
+ if (!_layerHostingView)
+ return;
+
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+ [_layerHostingView.get() removeFromSuperview];
+ [_layerHostingView.get() setLayer:nil];
+ [_layerHostingView.get() setWantsLayer:NO];
+ [[[self _fullScreenWindow] backgroundLayer] setHidden:YES];
+ [CATransaction commit];
+
+ _layerHostingView = 0;
+}
+
+- (WebCore::IntRect)getFullScreenRect
+{
+ return enclosingIntRect([[self window] frame]);
+}
+
+#pragma mark -
+#pragma mark Internal Interface
+
+- (void)_updateMenuAndDockForFullScreen
+{
+ // NSApplicationPresentationOptions is available on > 10.6 only:
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+ NSApplicationPresentationOptions options = NSApplicationPresentationDefault;
+ NSScreen* fullScreenScreen = [[self window] screen];
+
+ if (_isFullScreen) {
+ // Auto-hide the menu bar if the fullScreenScreen contains the menu bar:
+ // NOTE: if the fullScreenScreen contains the menu bar but not the dock, we must still
+ // auto-hide the dock, or an exception will be thrown.
+ if ([[NSScreen screens] objectAtIndex:0] == fullScreenScreen)
+ options |= (NSApplicationPresentationAutoHideMenuBar | NSApplicationPresentationAutoHideDock);
+ // Check if the current screen contains the dock by comparing the screen's frame to its
+ // visibleFrame; if a dock is present, the visibleFrame will differ. If the current screen
+ // contains the dock, hide it.
+ else if (!NSEqualRects([fullScreenScreen frame], [fullScreenScreen visibleFrame]))
+ options |= NSApplicationPresentationAutoHideDock;
+ }
+
+ if ([NSApp respondsToSelector:@selector(setPresentationOptions:)])
+ [NSApp setPresentationOptions:options];
+ else
+#endif
+ SetSystemUIMode(_isFullScreen ? kUIModeNormal : kUIModeAllHidden, 0);
+}
+
+#if !defined(BUILDING_ON_TIGER) // IOPMAssertionCreateWithName not defined on < 10.5
+- (void)_disableIdleDisplaySleep
+{
+ if (_idleDisplaySleepAssertion == kIOPMNullAssertionID)
+#if defined(BUILDING_ON_LEOPARD) // IOPMAssertionCreateWithName is not defined in the 10.5 SDK
+ IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, &_idleDisplaySleepAssertion);
+#else // IOPMAssertionCreate is depreciated in > 10.5
+ IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, CFSTR("WebKit playing a video fullScreen."), &_idleDisplaySleepAssertion);
+#endif
+}
+
+- (void)_enableIdleDisplaySleep
+{
+ if (_idleDisplaySleepAssertion != kIOPMNullAssertionID) {
+ IOPMAssertionRelease(_idleDisplaySleepAssertion);
+ _idleDisplaySleepAssertion = kIOPMNullAssertionID;
+ }
+}
+
+- (void)_disableIdleSystemSleep
+{
+ if (_idleSystemSleepAssertion == kIOPMNullAssertionID)
+#if defined(BUILDING_ON_LEOPARD) // IOPMAssertionCreateWithName is not defined in the 10.5 SDK
+ IOPMAssertionCreate(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, &_idleSystemSleepAssertion);
+#else // IOPMAssertionCreate is depreciated in > 10.5
+ IOPMAssertionCreateWithName(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, CFSTR("WebKit playing a video fullScreen."), &_idleSystemSleepAssertion);
+#endif
+}
+
+- (void)_enableIdleSystemSleep
+{
+ if (_idleSystemSleepAssertion != kIOPMNullAssertionID) {
+ IOPMAssertionRelease(_idleSystemSleepAssertion);
+ _idleSystemSleepAssertion = kIOPMNullAssertionID;
+ }
+}
+
+- (void)_enableTickleTimer
+{
+ [_tickleTimer invalidate];
+ [_tickleTimer release];
+ _tickleTimer = [[NSTimer scheduledTimerWithTimeInterval:tickleTimerInterval target:self selector:@selector(_tickleTimerFired) userInfo:nil repeats:YES] retain];
+}
+
+- (void)_disableTickleTimer
+{
+ [_tickleTimer invalidate];
+ [_tickleTimer release];
+ _tickleTimer = nil;
+}
+
+- (void)_tickleTimerFired
+{
+ UpdateSystemActivity(OverallAct);
+}
+#endif
+
+- (void)_updatePowerAssertions
+{
+#if !defined(BUILDING_ON_TIGER)
+ if (_isPlaying && _isFullScreen) {
+ [self _disableIdleSystemSleep];
+ [self _disableIdleDisplaySleep];
+ [self _enableTickleTimer];
+ } else {
+ [self _enableIdleSystemSleep];
+ [self _enableIdleDisplaySleep];
+ [self _disableTickleTimer];
+ }
+#endif
+}
+
+- (WebFullScreenManagerProxy*)_manager
+{
+ WebPageProxy* webPage = toImpl([_webView pageRef]);
+ if (!webPage)
+ return 0;
+ return webPage->fullScreenManager();
+}
+
+- (void)_requestExit
+{
+ [self exitFullScreen];
+ _forceDisableAnimation = NO;
+}
+
+- (void)_requestExitFullScreenWithAnimation:(BOOL)animation
+{
+ _forceDisableAnimation = !animation;
+ [self performSelector:@selector(_requestExit) withObject:nil afterDelay:0];
+
+}
+
+- (void)_swapView:(NSView*)view with:(NSView*)otherView
+{
+ [otherView setFrame:[view frame]];
+ [otherView setAutoresizingMask:[view autoresizingMask]];
+ [otherView removeFromSuperview];
+ [[view superview] replaceSubview:view with:otherView];
+}
+
+#pragma mark -
+#pragma mark Utility Functions
+
+- (WKFullScreenWindow *)_fullScreenWindow
+{
+ ASSERT([[self window] isKindOfClass:[WKFullScreenWindow class]]);
+ return (WKFullScreenWindow *)[self window];
+}
+
+- (CFTimeInterval)_animationDuration
+{
+ static const CFTimeInterval defaultDuration = 0.5;
+ CFTimeInterval duration = defaultDuration;
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+ NSUInteger modifierFlags = [NSEvent modifierFlags];
+#else
+ NSUInteger modifierFlags = [[NSApp currentEvent] modifierFlags];
+#endif
+ if ((modifierFlags & NSControlKeyMask) == NSControlKeyMask)
+ duration *= 2;
+ if ((modifierFlags & NSShiftKeyMask) == NSShiftKeyMask)
+ duration *= 10;
+ if (_forceDisableAnimation) {
+ // This will disable scale animation
+ duration = 0;
+ }
+ return duration;
+}
+
+@end
+
+#pragma mark -
+@implementation WKFullScreenWindow
+
+- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag
+{
+ UNUSED_PARAM(aStyle);
+ self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:bufferingType defer:flag];
+ if (!self)
+ return nil;
+ [self setOpaque:NO];
+ [self setBackgroundColor:[NSColor clearColor]];
+ [self setIgnoresMouseEvents:NO];
+ [self setAcceptsMouseMovedEvents:YES];
+ [self setReleasedWhenClosed:NO];
+ [self setHasShadow:YES];
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+ [self setMovable:NO];
+#else
+ [self setMovableByWindowBackground:NO];
+#endif
+
+ NSView* contentView = [self contentView];
+ _animationView = [[NSView alloc] initWithFrame:[contentView bounds]];
+
+ CALayer* contentLayer = [[CALayer alloc] init];
+ [_animationView setLayer:contentLayer];
+ [_animationView setWantsLayer:YES];
+ [_animationView setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
+ [contentView addSubview:_animationView];
+
+ _backgroundLayer = [[CALayer alloc] init];
+ [contentLayer addSublayer:_backgroundLayer];
+
+ [_backgroundLayer setBackgroundColor:CGColorGetConstantColor(kCGColorBlack)];
+ [_backgroundLayer setOpacity:0];
+ return self;
+}
+
+- (void)dealloc
+{
+ [_animationView release];
+ [_backgroundLayer release];
+ [super dealloc];
+}
+
+- (BOOL)canBecomeKeyWindow
+{
+ return YES;
+}
+
+- (void)keyDown:(NSEvent *)theEvent
+{
+ if ([[theEvent charactersIgnoringModifiers] isEqual:@"\e"]) // Esacpe key-code
+ [self cancelOperation:self];
+ else [super keyDown:theEvent];
+}
+
+- (void)cancelOperation:(id)sender
+{
+ UNUSED_PARAM(sender);
+ [[self windowController] _requestExitFullScreenWithAnimation:YES];
+}
+
+- (CALayer*)backgroundLayer
+{
+ return _backgroundLayer;
+}
+
+- (NSView*)animationView
+{
+ return _animationView;
+}
+@end
+
+#endif
diff --git a/Source/WebKit2/UIProcess/mac/WebContextMac.mm b/Source/WebKit2/UIProcess/mac/WebContextMac.mm
index 498b6e7..f7c186d 100644
--- a/Source/WebKit2/UIProcess/mac/WebContextMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebContextMac.mm
@@ -35,6 +35,12 @@ using namespace WebCore;
NSString *WebDatabaseDirectoryDefaultsKey = @"WebDatabaseDirectory";
NSString *WebKitLocalCacheDefaultsKey = @"WebKitLocalCache";
+NSString *WebStorageDirectoryDefaultsKey = @"WebKitLocalStorageDatabasePathPreferenceKey";
+
+static NSString *WebKitApplicationDidChangeAccessibilityEnhancedUserInterfaceNotification = @"NSApplicationDidChangeAccessibilityEnhancedUserInterfaceNotification";
+
+// FIXME: <rdar://problem/9138817> - After this "backwards compatibility" radar is removed, this code should be removed to only return an empty String.
+NSString *WebIconDatabaseDirectoryDefaultsKey = @"WebIconDatabaseDirectoryDefaultsKey";
namespace WebKit {
@@ -97,8 +103,18 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para
#if USE(CFURLSTORAGESESSIONS)
parameters.uiProcessBundleIdentifier = String([[NSBundle mainBundle] bundleIdentifier]);
#endif
+
+ // Listen for enhanced accessibility changes and propagate them to the WebProcess.
+ m_enhancedAccessibilityObserver = [[NSNotificationCenter defaultCenter] addObserverForName:WebKitApplicationDidChangeAccessibilityEnhancedUserInterfaceNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *note) {
+ setEnhancedAccessibility([[[note userInfo] objectForKey:@"AXEnhancedUserInterface"] boolValue]);
+ }];
}
+void WebContext::platformInvalidateContext()
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:(id)m_enhancedAccessibilityObserver.get()];
+}
+
String WebContext::platformDefaultDatabaseDirectory() const
{
NSString *databasesDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebDatabaseDirectoryDefaultsKey];
@@ -107,5 +123,22 @@ String WebContext::platformDefaultDatabaseDirectory() const
return [databasesDirectory stringByStandardizingPath];
}
+String WebContext::platformDefaultIconDatabasePath() const
+{
+ // FIXME: <rdar://problem/9138817> - After this "backwards compatibility" radar is removed, this code should be removed to only return an empty String.
+ NSString *databasesDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebIconDatabaseDirectoryDefaultsKey];
+ if (!databasesDirectory || ![databasesDirectory isKindOfClass:[NSString class]])
+ databasesDirectory = @"~/Library/Icons/WebpageIcons.db";
+ return [databasesDirectory stringByStandardizingPath];
+}
+
+String WebContext::platformDefaultLocalStorageDirectory() const
+{
+ NSString *localStorageDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebStorageDirectoryDefaultsKey];
+ if (!localStorageDirectory || ![localStorageDirectory isKindOfClass:[NSString class]])
+ localStorageDirectory = @"~/Library/WebKit/LocalStorage";
+ return [localStorageDirectory stringByStandardizingPath];
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm
index 67139b3..fd0f534 100644
--- a/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm
@@ -199,6 +199,9 @@ void WebContextMenuProxyMac::populate(const Vector<WebContextMenuItemData>& item
void WebContextMenuProxyMac::showContextMenu(const IntPoint& menuLocation, const Vector<WebContextMenuItemData>& items)
{
+ if (items.isEmpty())
+ return;
+
populate(items);
[[WKMenuTarget sharedMenuTarget] setMenuProxy:this];
@@ -215,14 +218,12 @@ void WebContextMenuProxyMac::showContextMenu(const IntPoint& menuLocation, const
float vertOffset = roundf((NSMaxY(menuRect) - NSMaxY(titleFrame)) + NSHeight(titleFrame));
NSPoint location = NSMakePoint(NSMinX(menuRect), NSMaxY(menuRect) - vertOffset);
- RetainPtr<NSView> dummyView(AdoptNS, [[NSView alloc] initWithFrame:menuRect]);
- [m_webView addSubview:dummyView.get()];
- location = [dummyView.get() convertPoint:location fromView:m_webView];
-
- WKPopupMenu(menu, location, roundf(NSWidth(menuRect)), dummyView.get(), -1, nil);
+ location = [m_webView convertPoint:location toView:nil];
+ location = [m_webView.window convertBaseToScreen:location];
+
+ WKPopupContextMenu(menu, location);
[m_popup.get() dismissPopUp];
- [dummyView.get() removeFromSuperview];
}
void WebContextMenuProxyMac::hideContextMenu()
diff --git a/Source/WebKit2/UIProcess/mac/WebCookieManagerProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebCookieManagerProxyMac.mm
new file mode 100644
index 0000000..6a31346
--- /dev/null
+++ b/Source/WebKit2/UIProcess/mac/WebCookieManagerProxyMac.mm
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2011, 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 "WebCookieManagerProxy.h"
+
+namespace WebKit {
+
+void WebCookieManagerProxy::persistHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy)
+{
+ // FIXME: The sandbox appears to prevent persisting the new policy to disk, so we must set the
+ // policy in the UI Process as well as in the Web Process (to make sure it gets set on any
+ // Private Browsing Cookie Storage).
+ [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:policy];
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/mac/WebFullScreenManagerProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebFullScreenManagerProxyMac.mm
new file mode 100644
index 0000000..d533573
--- /dev/null
+++ b/Source/WebKit2/UIProcess/mac/WebFullScreenManagerProxyMac.mm
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2010 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 "WebFullScreenManagerProxy.h"
+#include "LayerTreeContext.h"
+#include "WKFullScreenWindowController.h"
+#include "WKViewInternal.h"
+
+#if ENABLE(FULLSCREEN_API)
+
+namespace WebKit {
+
+void WebFullScreenManagerProxy::enterFullScreen()
+{
+ if (!m_webView)
+ return;
+ [[m_webView fullScreenWindowController] enterFullScreen:nil];
+}
+
+void WebFullScreenManagerProxy::exitFullScreen()
+{
+ if (!m_webView)
+ return;
+ [[m_webView fullScreenWindowController] exitFullScreen];
+}
+
+void WebFullScreenManagerProxy::beganEnterFullScreenAnimation()
+{
+ if (!m_webView)
+ return;
+ [[m_webView fullScreenWindowController] beganEnterFullScreenAnimation];
+}
+
+void WebFullScreenManagerProxy::finishedEnterFullScreenAnimation(bool completed)
+{
+ if (!m_webView)
+ return;
+ [[m_webView fullScreenWindowController] finishedEnterFullScreenAnimation:completed];
+}
+
+void WebFullScreenManagerProxy::beganExitFullScreenAnimation()
+{
+ if (!m_webView)
+ return;
+ [[m_webView fullScreenWindowController] beganExitFullScreenAnimation];
+}
+
+void WebFullScreenManagerProxy::finishedExitFullScreenAnimation(bool completed)
+{
+ if (!m_webView)
+ return;
+ [[m_webView fullScreenWindowController] finishedExitFullScreenAnimation:completed];
+}
+
+void WebFullScreenManagerProxy::enterAcceleratedCompositingMode(const LayerTreeContext& context)
+{
+ if (!m_webView)
+ return;
+ [[m_webView fullScreenWindowController] enterAcceleratedCompositingMode:context];
+}
+
+void WebFullScreenManagerProxy::exitAcceleratedCompositingMode()
+{
+ if (!m_webView)
+ return;
+ [[m_webView fullScreenWindowController] exitAcceleratedCompositingMode];
+}
+
+void WebFullScreenManagerProxy::getFullScreenRect(WebCore::IntRect& rect)
+{
+ if (!m_webView)
+ return;
+ rect = [[m_webView fullScreenWindowController] getFullScreenRect];
+}
+
+} // namespace WebKit
+
+#endif
diff --git a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
index 67d184c..9657764 100644
--- a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
@@ -32,6 +32,7 @@
#import "WKView.h"
#import "WebPageProxy.h"
#import <WebKitSystemInterface.h>
+#import <WebCore/LocalizedStrings.h>
#import <wtf/text/WTFString.h>
using namespace WebCore;
@@ -134,8 +135,7 @@ void WebInspectorProxy::platformClose()
void WebInspectorProxy::platformInspectedURLChanged(const String& urlString)
{
- // FIXME: this should be made localizable once WebKit2 supports it. <rdar://problem/8728860>
- NSString *title = [NSString stringWithFormat:@"Web Inspector \u2014 %@", (NSString *)urlString];
+ NSString *title = [NSString stringWithFormat:UI_STRING("Web Inspector — %@", "Web Inspector window title"), (NSString *)urlString];
[m_inspectorWindow.get() setTitle:title];
}
diff --git a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
index 1d3ed53..90df81e 100644
--- a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.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
@@ -26,7 +26,13 @@
#import "config.h"
#import "WebPageProxy.h"
+#import "DataReference.h"
+#import "DictionaryPopupInfo.h"
+#import "NativeWebKeyboardEvent.h"
#import "PageClient.h"
+#import "TextChecker.h"
+#import "WebPageMessages.h"
+#import "WebProcessProxy.h"
#import <wtf/text/StringConcatenate.h>
@interface NSApplication (Details)
@@ -113,4 +119,133 @@ CGContextRef WebPageProxy::containingWindowGraphicsContext()
return m_pageClient->containingWindowGraphicsContext();
}
+void WebPageProxy::updateWindowIsVisible(bool windowIsVisible)
+{
+ if (!isValid())
+ return;
+ process()->send(Messages::WebPage::SetWindowIsVisible(windowIsVisible), m_pageID);
+}
+
+void WebPageProxy::windowAndViewFramesChanged(const IntRect& windowFrameInScreenCoordinates, const IntRect& viewFrameInWindowCoordinates, const IntPoint& accessibilityViewCoordinates)
+{
+ if (!isValid())
+ return;
+
+ process()->send(Messages::WebPage::WindowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates, accessibilityViewCoordinates), m_pageID);
+}
+
+void WebPageProxy::getMarkedRange(uint64_t& location, uint64_t& length)
+{
+ process()->sendSync(Messages::WebPage::GetMarkedRange(), Messages::WebPage::GetMarkedRange::Reply(location, length), m_pageID);
+}
+
+uint64_t WebPageProxy::characterIndexForPoint(const IntPoint point)
+{
+ uint64_t result;
+ process()->sendSync(Messages::WebPage::CharacterIndexForPoint(point), Messages::WebPage::CharacterIndexForPoint::Reply(result), m_pageID);
+ return result;
+}
+
+WebCore::IntRect WebPageProxy::firstRectForCharacterRange(uint64_t location, uint64_t length)
+{
+ IntRect resultRect;
+ process()->sendSync(Messages::WebPage::FirstRectForCharacterRange(location, length), Messages::WebPage::FirstRectForCharacterRange::Reply(resultRect), m_pageID);
+ return resultRect;
+}
+
+bool WebPageProxy::writeSelectionToPasteboard(const String& pasteboardName, const Vector<String>& pasteboardTypes)
+{
+ bool result;
+ const double MessageTimeout = 20;
+ process()->sendSync(Messages::WebPage::WriteSelectionToPasteboard(pasteboardName, pasteboardTypes), Messages::WebPage::WriteSelectionToPasteboard::Reply(result), m_pageID, MessageTimeout);
+ return result;
+}
+
+bool WebPageProxy::readSelectionFromPasteboard(const String& pasteboardName)
+{
+ bool result;
+ const double MessageTimeout = 20;
+ process()->sendSync(Messages::WebPage::ReadSelectionFromPasteboard(pasteboardName), Messages::WebPage::ReadSelectionFromPasteboard::Reply(result), m_pageID, MessageTimeout);
+ return result;
+}
+
+void WebPageProxy::setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, bool isLinkDrag)
+{
+ RefPtr<ShareableBitmap> dragImage = ShareableBitmap::create(dragImageHandle);
+ if (!dragImage)
+ return;
+
+ m_pageClient->setDragImage(clientPosition, dragImage.release(), isLinkDrag);
+}
+
+void WebPageProxy::performDictionaryLookupAtLocation(const WebCore::FloatPoint& point)
+{
+ if (!isValid())
+ return;
+
+ process()->send(Messages::WebPage::PerformDictionaryLookupAtLocation(point), m_pageID);
+}
+
+void WebPageProxy::interpretKeyEvent(uint32_t type, Vector<KeypressCommand>& commandsList, uint32_t selectionStart, uint32_t selectionEnd, Vector<CompositionUnderline>& underlines)
+{
+ m_pageClient->interceptKeyEvent(m_keyEventQueue.first(), commandsList, selectionStart, selectionEnd, underlines);
+}
+
+// Complex text input support for plug-ins.
+void WebPageProxy::sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput)
+{
+ if (!isValid())
+ return;
+
+ process()->send(Messages::WebPage::SendComplexTextInputToPlugin(pluginComplexTextInputIdentifier, textInput), m_pageID);
+}
+
+void WebPageProxy::uppercaseWord()
+{
+ process()->send(Messages::WebPage::UppercaseWord(), m_pageID);
+}
+
+void WebPageProxy::lowercaseWord()
+{
+ process()->send(Messages::WebPage::LowercaseWord(), m_pageID);
+}
+
+void WebPageProxy::capitalizeWord()
+{
+ process()->send(Messages::WebPage::CapitalizeWord(), m_pageID);
+}
+
+void WebPageProxy::setSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled)
+{
+ if (m_isSmartInsertDeleteEnabled == isSmartInsertDeleteEnabled)
+ return;
+
+ TextChecker::setSmartInsertDeleteEnabled(isSmartInsertDeleteEnabled);
+ m_isSmartInsertDeleteEnabled = isSmartInsertDeleteEnabled;
+ process()->send(Messages::WebPage::SetSmartInsertDeleteEnabled(isSmartInsertDeleteEnabled), m_pageID);
+}
+
+void WebPageProxy::didPerformDictionaryLookup(const String& text, const DictionaryPopupInfo& dictionaryPopupInfo)
+{
+ m_pageClient->didPerformDictionaryLookup(text, m_viewScaleFactor, dictionaryPopupInfo);
+}
+
+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::RegisterUIProcessAccessibilityTokens(elementToken, windowToken), m_pageID);
+}
+
+void WebPageProxy::setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled)
+{
+ m_pageClient->setComplexTextInputEnabled(pluginComplexTextInputIdentifier, complexTextInputEnabled);
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp
index 777f98c..16283bc 100644
--- a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp
@@ -82,6 +82,9 @@ PassRefPtr<WebContextMenuProxyQt> WebContextMenuProxyQt::create(QWKPage* page)
void WebContextMenuProxyQt::showContextMenu(const IntPoint& position, const Vector<WebContextMenuItemData>& items)
{
+ if (items.isEmpty())
+ return;
+
OwnPtr<QMenu> menu = createContextMenu(items);
// We send the signal, even with no items, because the client should be able to show custom items
diff --git a/Source/WebKit2/UIProcess/qt/WebContextQt.cpp b/Source/WebKit2/UIProcess/qt/WebContextQt.cpp
index c1301d5..b46587e 100644
--- a/Source/WebKit2/UIProcess/qt/WebContextQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/WebContextQt.cpp
@@ -47,10 +47,26 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters&)
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
}
+void WebContext::platformInvalidateContext()
+{
+}
+
String WebContext::platformDefaultDatabaseDirectory() const
{
// FIXME: Implement.
return "";
}
+String WebContext::platformDefaultIconDatabasePath() const
+{
+ // FIXME: Implement.
+ return "";
+}
+
+String WebContext::platformDefaultLocalStorageDirectory() const
+{
+ // FIXME: Implement.
+ return "";
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp
index 5afd07e..4b5a5a7 100644
--- a/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp
+++ b/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp
@@ -73,6 +73,9 @@ void WebContextMenuProxyWin::populateMenu(HMENU menu, const Vector<WebContextMen
void WebContextMenuProxyWin::showContextMenu(const IntPoint& origin, const Vector<WebContextMenuItemData>& items)
{
+ if (items.isEmpty())
+ return;
+
// Hide any context menu we have showing (this also destroys the menu).
hideContextMenu();
diff --git a/Source/WebKit2/UIProcess/win/WebContextWin.cpp b/Source/WebKit2/UIProcess/win/WebContextWin.cpp
index 26708d7..d5fd859 100644
--- a/Source/WebKit2/UIProcess/win/WebContextWin.cpp
+++ b/Source/WebKit2/UIProcess/win/WebContextWin.cpp
@@ -64,22 +64,39 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para
RetainPtr<CFStringRef> cfURLCachePath(AdoptCF, wkCopyFoundationCacheDirectory());
parameters.cfURLCachePath = String(cfURLCachePath.get());
- // Remove the ending '/' (necessary to have CFNetwork find the Cache file).
+ // Remove the ending '\' (necessary to have CFNetwork find the Cache file).
ASSERT(parameters.cfURLCachePath.length());
- if (parameters.cfURLCachePath[parameters.cfURLCachePath.length() - 1] == '/')
+ if (parameters.cfURLCachePath[parameters.cfURLCachePath.length() - 1] == '\\')
parameters.cfURLCachePath.remove(parameters.cfURLCachePath.length() - 1);
#if USE(CFURLSTORAGESESSIONS)
parameters.uiProcessBundleIdentifier = String(reinterpret_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleIdentifierKey)));
#endif // USE(CFURLSTORAGESESSIONS)
+ parameters.initialHTTPCookieAcceptPolicy = m_initialHTTPCookieAcceptPolicy;
+
#endif // USE(CFNETWORK)
}
+void WebContext::platformInvalidateContext()
+{
+}
+
String WebContext::platformDefaultDatabaseDirectory() const
{
return WebCore::pathByAppendingComponent(WebCore::localUserSpecificStorageDirectory(), "Databases");
}
+String WebContext::platformDefaultIconDatabasePath() const
+{
+ // IconDatabase should be disabled by default on Windows, and should therefore have no default path.
+ return String();
+}
+
+String WebContext::platformDefaultLocalStorageDirectory() const
+{
+ return WebCore::pathByAppendingComponent(WebCore::localUserSpecificStorageDirectory(), "LocalStorage");
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp
index 186ad44..1745a06 100644
--- a/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp
+++ b/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp
@@ -28,6 +28,7 @@
#include "resource.h"
#include <tchar.h>
+#include <WebCore/SystemInfo.h>
#include <WebCore/WebCoreInstanceHandle.h>
#include <wtf/StdLibExtras.h>
#include <wtf/text/StringConcatenate.h>
@@ -36,30 +37,6 @@ using namespace WebCore;
namespace WebKit {
-static String windowsVersion()
-{
- String osVersion;
- OSVERSIONINFO versionInfo = { 0 };
- versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- ::GetVersionEx(&versionInfo);
-
- if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
- if (versionInfo.dwMajorVersion == 4) {
- if (versionInfo.dwMinorVersion == 0)
- osVersion = "Windows 95";
- else if (versionInfo.dwMinorVersion == 10)
- osVersion = "Windows 98";
- else if (versionInfo.dwMinorVersion == 90)
- osVersion = "Windows 98; Win 9x 4.90";
- }
- } else if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
- osVersion = makeString("Windows NT ", String::number(versionInfo.dwMajorVersion), '.', String::number(versionInfo.dwMinorVersion));
-
- if (!osVersion.length())
- osVersion = makeString("Windows ", String::number(versionInfo.dwMajorVersion), '.', String::number(versionInfo.dwMinorVersion));
- return osVersion;
-}
-
static String userVisibleWebKitVersionString()
{
LPWSTR buildNumberStringPtr;
@@ -71,12 +48,10 @@ static String userVisibleWebKitVersionString()
String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent)
{
- DEFINE_STATIC_LOCAL(String, osVersion, (windowsVersion()));
+ DEFINE_STATIC_LOCAL(String, osVersion, (windowsVersionForUAString()));
DEFINE_STATIC_LOCAL(String, webKitVersion, (userVisibleWebKitVersionString()));
- if (applicationNameForUserAgent.isEmpty())
- return makeString("Mozilla/5.0 (", osVersion, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko)");
- return makeString("Mozilla/5.0 (", osVersion, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko) ", applicationNameForUserAgent);
+ return makeString("Mozilla/5.0 (", osVersion, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko)", applicationNameForUserAgent.isEmpty() ? "" : " ", applicationNameForUserAgent);
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/win/WebUndoClient.cpp b/Source/WebKit2/UIProcess/win/WebUndoClient.cpp
new file mode 100644
index 0000000..9bc96f5
--- /dev/null
+++ b/Source/WebKit2/UIProcess/win/WebUndoClient.cpp
@@ -0,0 +1,53 @@
+/*
+ * 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 "WebUndoClient.h"
+
+#include "WKAPICast.h"
+#include "WebEditCommandProxy.h"
+#include "WebView.h"
+
+namespace WebKit {
+
+void WebUndoClient::registerEditCommand(WebView* view, PassRefPtr<WebEditCommandProxy> prpCommand, WebPageProxy::UndoOrRedo undoOrRedo)
+{
+ if (!m_client.registerEditCommand)
+ return;
+
+ RefPtr<WebEditCommandProxy> command = prpCommand;
+ m_client.registerEditCommand(toAPI(view), toAPI(command.release().releaseRef()), (undoOrRedo == WebPageProxy::Undo) ? kWKViewUndo : kWKViewRedo, m_client.clientInfo);
+}
+
+void WebUndoClient::clearAllEditCommands(WebView* view)
+{
+ if (!m_client.clearAllEditCommands)
+ return;
+
+ m_client.clearAllEditCommands(toAPI(view), m_client.clientInfo);
+}
+
+} // namespace WebKit
+
diff --git a/Source/WebKit2/UIProcess/win/WebUndoClient.h b/Source/WebKit2/UIProcess/win/WebUndoClient.h
new file mode 100755
index 0000000..12582c0
--- /dev/null
+++ b/Source/WebKit2/UIProcess/win/WebUndoClient.h
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+#ifndef WebUndoClient_h
+#define WebUndoClient_h
+
+#include "APIClient.h"
+#include "WKView.h"
+#include "WebPageProxy.h"
+#include <wtf/Forward.h>
+
+namespace WebKit {
+
+class WebEditCommandProxy;
+
+class WebUndoClient : public APIClient<WKViewUndoClient> {
+public:
+ void registerEditCommand(WebView*, PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
+ void clearAllEditCommands(WebView*);
+};
+
+} // namespace WebKit
+
+#endif // WebUndoClient_h
diff --git a/Source/WebKit2/UIProcess/win/WebView.cpp b/Source/WebKit2/UIProcess/win/WebView.cpp
index 62e0c42..1447864 100644
--- a/Source/WebKit2/UIProcess/win/WebView.cpp
+++ b/Source/WebKit2/UIProcess/win/WebView.cpp
@@ -44,7 +44,9 @@
#include <WebCore/BitmapInfo.h>
#include <WebCore/Cursor.h>
#include <WebCore/FloatRect.h>
+#if PLATFORM(CG)
#include <WebCore/GraphicsContextCG.h>
+#endif
#include <WebCore/IntRect.h>
#include <WebCore/SoftLinking.h>
#include <WebCore/WebCoreInstanceHandle.h>
@@ -149,6 +151,12 @@ LRESULT WebView::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_VISTA_MOUSEHWHEEL:
lResult = onWheelEvent(hWnd, message, wParam, lParam, handled);
break;
+ case WM_HSCROLL:
+ lResult = onHorizontalScroll(hWnd, message, wParam, lParam, handled);
+ break;
+ case WM_VSCROLL:
+ lResult = onVerticalScroll(hWnd, message, wParam, lParam, handled);
+ break;
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
case WM_SYSCHAR:
@@ -280,6 +288,20 @@ WebView::~WebView()
void WebView::initialize()
{
::RegisterDragDrop(m_window, this);
+
+ if (shouldInitializeTrackPointHack()) {
+ // If we detected a registry key belonging to a TrackPoint driver, then create fake
+ // scrollbars, so the WebView will receive WM_VSCROLL and WM_HSCROLL messages.
+ // We create an invisible vertical scrollbar and an invisible horizontal scrollbar to allow
+ // for receiving both types of messages.
+ ::CreateWindow(TEXT("SCROLLBAR"), TEXT("FAKETRACKPOINTHSCROLLBAR"), WS_CHILD | WS_VISIBLE | SBS_HORZ, 0, 0, 0, 0, m_window, 0, instanceHandle(), 0);
+ ::CreateWindow(TEXT("SCROLLBAR"), TEXT("FAKETRACKPOINTVSCROLLBAR"), WS_CHILD | WS_VISIBLE | SBS_VERT, 0, 0, 0, 0, m_window, 0, instanceHandle(), 0);
+ }
+}
+
+void WebView::initializeUndoClient(const WKViewUndoClient* client)
+{
+ m_undoClient.initialize(client);
}
void WebView::setParentWindow(HWND parentWindow)
@@ -394,6 +416,70 @@ LRESULT WebView::onWheelEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
return 0;
}
+LRESULT WebView::onHorizontalScroll(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled)
+{
+ ScrollDirection direction;
+ ScrollGranularity granularity;
+ switch (LOWORD(wParam)) {
+ case SB_LINELEFT:
+ granularity = ScrollByLine;
+ direction = ScrollLeft;
+ break;
+ case SB_LINERIGHT:
+ granularity = ScrollByLine;
+ direction = ScrollRight;
+ break;
+ case SB_PAGELEFT:
+ granularity = ScrollByDocument;
+ direction = ScrollLeft;
+ break;
+ case SB_PAGERIGHT:
+ granularity = ScrollByDocument;
+ direction = ScrollRight;
+ break;
+ default:
+ handled = false;
+ return 0;
+ }
+
+ m_page->scrollBy(direction, granularity);
+
+ handled = true;
+ return 0;
+}
+
+LRESULT WebView::onVerticalScroll(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled)
+{
+ ScrollDirection direction;
+ ScrollGranularity granularity;
+ switch (LOWORD(wParam)) {
+ case SB_LINEDOWN:
+ granularity = ScrollByLine;
+ direction = ScrollDown;
+ break;
+ case SB_LINEUP:
+ granularity = ScrollByLine;
+ direction = ScrollUp;
+ break;
+ case SB_PAGEDOWN:
+ granularity = ScrollByDocument;
+ direction = ScrollDown;
+ break;
+ case SB_PAGEUP:
+ granularity = ScrollByDocument;
+ direction = ScrollUp;
+ break;
+ default:
+ handled = false;
+ return 0;
+ }
+
+ m_page->scrollBy(direction, granularity);
+
+ handled = true;
+ return 0;
+}
+
LRESULT WebView::onKeyEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled)
{
m_page->handleKeyboardEvent(NativeWebKeyboardEvent(hWnd, message, wParam, lParam));
@@ -490,8 +576,10 @@ LRESULT WebView::onSizeEvent(HWND, UINT, WPARAM, LPARAM lParam, bool& handled)
int width = LOWORD(lParam);
int height = HIWORD(lParam);
- if (m_page && m_page->drawingArea())
- m_page->drawingArea()->setSize(IntSize(width, height), IntSize());
+ if (m_page && m_page->drawingArea()) {
+ m_page->drawingArea()->setSize(IntSize(width, height), m_nextResizeScrollOffset);
+ m_nextResizeScrollOffset = IntSize();
+ }
handled = true;
return 0;
@@ -638,8 +726,39 @@ void WebView::stopTrackingMouseLeave()
::TrackMouseEvent(&trackMouseEvent);
}
+bool WebView::shouldInitializeTrackPointHack()
+{
+ static bool shouldCreateScrollbars;
+ static bool hasRunTrackPointCheck;
+
+ if (hasRunTrackPointCheck)
+ return shouldCreateScrollbars;
+
+ hasRunTrackPointCheck = true;
+ const wchar_t* trackPointKeys[] = {
+ L"Software\\Lenovo\\TrackPoint",
+ L"Software\\Lenovo\\UltraNav",
+ L"Software\\Alps\\Apoint\\TrackPoint",
+ L"Software\\Synaptics\\SynTPEnh\\UltraNavUSB",
+ L"Software\\Synaptics\\SynTPEnh\\UltraNavPS2"
+ };
+
+ for (size_t i = 0; i < WTF_ARRAY_LENGTH(trackPointKeys); ++i) {
+ HKEY trackPointKey;
+ int readKeyResult = ::RegOpenKeyExW(HKEY_CURRENT_USER, trackPointKeys[i], 0, KEY_READ, &trackPointKey);
+ ::RegCloseKey(trackPointKey);
+ if (readKeyResult == ERROR_SUCCESS) {
+ shouldCreateScrollbars = true;
+ return shouldCreateScrollbars;
+ }
+ }
+
+ return shouldCreateScrollbars;
+}
+
void WebView::close()
{
+ m_undoClient.initialize(0);
::RevokeDragDrop(m_window);
setParentWindow(0);
m_page->close();
@@ -789,16 +908,41 @@ void WebView::setInitialFocus(bool forward)
m_page->setInitialFocus(forward);
}
+void WebView::setScrollOffsetOnNextResize(const IntSize& scrollOffset)
+{
+ // The next time we get a WM_SIZE message, scroll by the specified amount in onSizeEvent().
+ m_nextResizeScrollOffset = scrollOffset;
+}
+
void WebView::setViewportArguments(const WebCore::ViewportArguments&)
{
}
-void WebView::registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo)
+void WebView::registerEditCommand(PassRefPtr<WebEditCommandProxy> prpCommand, WebPageProxy::UndoOrRedo undoOrRedo)
{
+ RefPtr<WebEditCommandProxy> command = prpCommand;
+ m_undoClient.registerEditCommand(this, command, undoOrRedo);
}
void WebView::clearAllEditCommands()
{
+ m_undoClient.clearAllEditCommands(this);
+}
+
+void WebView::reapplyEditCommand(WebEditCommandProxy* command)
+{
+ if (!m_page->isValid() || !m_page->isValidEditCommand(command))
+ return;
+
+ command->reapply();
+}
+
+void WebView::unapplyEditCommand(WebEditCommandProxy* command)
+{
+ if (!m_page->isValid() || !m_page->isValidEditCommand(command))
+ return;
+
+ command->unapply();
}
FloatRect WebView::convertToDeviceSpace(const FloatRect& rect)
@@ -806,6 +950,11 @@ FloatRect WebView::convertToDeviceSpace(const FloatRect& rect)
return rect;
}
+IntRect WebView::windowToScreen(const IntRect& rect)
+{
+ return rect;
+}
+
FloatRect WebView::convertToUserSpace(const FloatRect& rect)
{
return rect;
@@ -1105,11 +1254,15 @@ void WebView::setFindIndicator(PassRefPtr<FindIndicator> prpFindIndicator, bool
hbmp = CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, static_cast<void**>(&bits), 0, 0);
HBITMAP hbmpOld = static_cast<HBITMAP>(SelectObject(hdc, hbmp));
+#if PLATFORM(CG)
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());
+#else
+ // FIXME: Implement!
+#endif
::SelectObject(hdc, hbmpOld);
::DeleteDC(hdc);
diff --git a/Source/WebKit2/UIProcess/win/WebView.h b/Source/WebKit2/UIProcess/win/WebView.h
index 28aedd6..1d65179 100644
--- a/Source/WebKit2/UIProcess/win/WebView.h
+++ b/Source/WebKit2/UIProcess/win/WebView.h
@@ -30,6 +30,7 @@
#include "PageClient.h"
#include "WKView.h"
#include "WebPageProxy.h"
+#include "WebUndoClient.h"
#include <ShlObj.h>
#include <WebCore/COMPtr.h>
#include <WebCore/DragActions.h>
@@ -61,9 +62,14 @@ public:
void setIsInWindow(bool);
void setOverrideCursor(HCURSOR);
void setInitialFocus(bool forward);
+ void setScrollOffsetOnNextResize(const WebCore::IntSize&);
void setFindIndicatorCallback(WKViewFindIndicatorCallback, void*);
WKViewFindIndicatorCallback getFindIndicatorCallback(void**);
void initialize();
+
+ void initializeUndoClient(const WKViewUndoClient*);
+ void reapplyEditCommand(WebEditCommandProxy*);
+ void unapplyEditCommand(WebEditCommandProxy*);
// IUnknown
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
@@ -89,6 +95,8 @@ private:
LRESULT onMouseEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
LRESULT onWheelEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
+ LRESULT onHorizontalScroll(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
+ LRESULT onVerticalScroll(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
LRESULT onKeyEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
LRESULT onPaintEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
LRESULT onPrintClientEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
@@ -123,6 +131,8 @@ private:
void startTrackingMouseLeave();
void stopTrackingMouseLeave();
+ bool shouldInitializeTrackPointHack();
+
void close();
HCURSOR cursorToShow() const;
@@ -134,6 +144,7 @@ private:
virtual void displayView();
virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
+ virtual float userSpaceScaleFactor() const { return 1; }
virtual WebCore::IntSize viewSize();
virtual bool isViewWindowActive();
@@ -144,6 +155,7 @@ private:
virtual void didRelaunchProcess();
virtual void pageClosed();
virtual void takeFocus(bool direction);
+ virtual void setFocus(bool focused) { }
virtual void toolTipChanged(const WTF::String&, const WTF::String&);
virtual void setCursor(const WebCore::Cursor&);
virtual void setViewportArguments(const WebCore::ViewportArguments&);
@@ -151,6 +163,7 @@ private:
virtual void clearAllEditCommands();
virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
+ virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&);
virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled);
virtual void compositionSelectionChanged(bool);
virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*);
@@ -177,6 +190,8 @@ private:
HWND m_window;
HWND m_topLevelParentWindow;
HWND m_toolTipWindow;
+
+ WebCore::IntSize m_nextResizeScrollOffset;
HCURSOR m_lastCursorSet;
HCURSOR m_webCoreCursor;
@@ -192,6 +207,8 @@ private:
unsigned m_inIMEComposition;
+ WebUndoClient m_undoClient;
+
WKViewFindIndicatorCallback m_findIndicatorCallback;
void* m_findIndicatorCallbackContext;