summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/WebProcess
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/WebProcess')
-rw-r--r--Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp1
-rw-r--r--Source/WebKit2/WebProcess/Downloads/Download.cpp19
-rw-r--r--Source/WebKit2/WebProcess/Downloads/Download.h23
-rw-r--r--Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp1
-rw-r--r--Source/WebKit2/WebProcess/Downloads/cf/DownloadCFNet.cpp60
-rw-r--r--Source/WebKit2/WebProcess/Downloads/cf/win/DownloadCFNetWin.cpp56
-rw-r--r--Source/WebKit2/WebProcess/Downloads/curl/DownloadCurl.cpp13
-rw-r--r--Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm29
-rw-r--r--Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp13
-rw-r--r--Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp1
-rw-r--r--Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp1
-rw-r--r--Source/WebKit2/WebProcess/Info.plist2
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h4
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp83
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h7
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp66
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h (renamed from Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDatabaseManagerMac.mm)38
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp67
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.h49
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp30
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h48
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp6
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp5
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp105
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.h75
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp9
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h4
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.cpp72
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.h (renamed from Source/WebKit2/WebProcess/WebCoreSupport/qt/WebDatabaseManagerQt.cpp)31
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp88
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h59
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp21
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h5
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp6
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h2
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp1
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp1
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp1
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp1
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp1
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeUtilities.cpp1
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp14
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp5
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h2
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp1
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/gtk/NetscapePluginGtk.cpp1
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm22
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm7
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp1
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp3
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Plugin.cpp1
-rw-r--r--Source/WebKit2/WebProcess/Plugins/PluginController.h3
-rw-r--r--Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp5
-rw-r--r--Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp7
-rw-r--r--Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp5
-rw-r--r--Source/WebKit2/WebProcess/Plugins/PluginProxy.h6
-rw-r--r--Source/WebKit2/WebProcess/Plugins/PluginView.cpp17
-rw-r--r--Source/WebKit2/WebProcess/Plugins/PluginView.h1
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp54
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h23
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp7
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h3
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp9
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h1
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp157
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h5
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp3
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp8
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h3
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp6
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm13
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm115
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm35
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm15
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm1
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm5
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm43
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragClientWin.cpp89
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragSource.cpp87
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragSource.h46
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/win/WebErrorsWin.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp7
-rw-r--r--Source/WebKit2/WebProcess/WebKitMain.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp15
-rw-r--r--Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp5
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingArea.h15
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in2
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp192
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h24
-rw-r--r--Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/FindController.cpp20
-rw-r--r--Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp7
-rw-r--r--Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h7
-rw-r--r--Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp (renamed from Source/WebKit2/WebProcess/WebCoreSupport/win/WebDatabaseManagerWin.cpp)30
-rw-r--r--Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h69
-rw-r--r--Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp18
-rw-r--r--Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp17
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebFrame.cpp94
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebFrame.h6
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebInspector.cpp14
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebInspector.h29
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.cpp321
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.h68
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.messages.in36
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/gtk/ChunkedUpdateDrawingAreaGtk.cpp (renamed from Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDatabaseManagerGtk.cpp)27
-rw-r--r--Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm3
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm23
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h96
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm279
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm75
-rw-r--r--Source/WebKit2/WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp5
-rw-r--r--Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp7
-rw-r--r--Source/WebKit2/WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp5
-rw-r--r--Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp22
-rw-r--r--Source/WebKit2/WebProcess/WebProcess.cpp20
-rw-r--r--Source/WebKit2/WebProcess/WebProcess.h3
-rw-r--r--Source/WebKit2/WebProcess/com.apple.WebProcess.sb92
-rw-r--r--Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp1
-rw-r--r--Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp13
-rw-r--r--Source/WebKit2/WebProcess/mac/WebProcessMac.mm98
-rw-r--r--Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm9
-rw-r--r--Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp14
-rw-r--r--Source/WebKit2/WebProcess/qt/WebProcessQt.cpp1
-rw-r--r--Source/WebKit2/WebProcess/win/WebProcessMainWin.cpp1
-rw-r--r--Source/WebKit2/WebProcess/win/WebProcessWin.cpp1
172 files changed, 3073 insertions, 702 deletions
diff --git a/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp b/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp
index 36757d6..af35f75 100644
--- a/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp
+++ b/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "AuthenticationManager.h"
#include "MessageID.h"
diff --git a/Source/WebKit2/WebProcess/Downloads/Download.cpp b/Source/WebKit2/WebProcess/Downloads/Download.cpp
index 3cb5588..1c36df2 100644
--- a/Source/WebKit2/WebProcess/Downloads/Download.cpp
+++ b/Source/WebKit2/WebProcess/Downloads/Download.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "Download.h"
#include "Connection.h"
@@ -45,6 +46,9 @@ PassOwnPtr<Download> Download::create(uint64_t downloadID, const ResourceRequest
Download::Download(uint64_t downloadID, const ResourceRequest& request)
: m_downloadID(downloadID)
, m_request(request)
+#if USE(CFNETWORK)
+ , m_allowOverwrite(false)
+#endif
{
ASSERT(m_downloadID);
}
@@ -83,7 +87,7 @@ bool Download::shouldDecodeSourceDataOfMIMEType(const String& mimeType)
return result;
}
-String Download::decideDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite)
+String Download::retrieveDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite)
{
String destination;
SandboxExtension::Handle sandboxExtensionHandle;
@@ -97,6 +101,15 @@ String Download::decideDestinationWithSuggestedFilename(const String& filename,
return destination;
}
+String Download::decideDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite)
+{
+ String destination = retrieveDestinationWithSuggestedFilename(filename, allowOverwrite);
+
+ didDecideDestination(destination, allowOverwrite);
+
+ return destination;
+}
+
void Download::didCreateDestination(const String& path)
{
send(Messages::DownloadProxy::DidCreateDestination(path));
@@ -104,6 +117,8 @@ void Download::didCreateDestination(const String& path)
void Download::didFinish()
{
+ platformDidFinish();
+
send(Messages::DownloadProxy::DidFinish());
if (m_sandboxExtension)
diff --git a/Source/WebKit2/WebProcess/Downloads/Download.h b/Source/WebKit2/WebProcess/Downloads/Download.h
index bacdd01..26d8f3d 100644
--- a/Source/WebKit2/WebProcess/Downloads/Download.h
+++ b/Source/WebKit2/WebProcess/Downloads/Download.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,13 +33,9 @@
#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
-#ifdef __OBJC__
-@class NSURLDownload;
-@class WKDownloadAsDelegate;
-#else
-class NSURLDownload;
-class WKDownloadAsDelegate;
-#endif
+
+OBJC_CLASS NSURLDownload;
+OBJC_CLASS WKDownloadAsDelegate;
#endif
#if USE(CFNETWORK)
@@ -84,14 +80,22 @@ public:
String decideDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite);
void didCreateDestination(const String& path);
void didFinish();
+ void platformDidFinish();
void didFail(const WebCore::ResourceError&, const CoreIPC::DataReference& resumeData);
void didCancel(const CoreIPC::DataReference& resumeData);
+ void didDecideDestination(const String&, bool allowOverwrite);
+
+#if USE(CFNETWORK)
+ const String& destination() const { return m_destination; }
+#endif
private:
Download(uint64_t downloadID, const WebCore::ResourceRequest&);
void platformInvalidate();
+ String retrieveDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite);
+
uint64_t m_downloadID;
WebCore::ResourceRequest m_request;
@@ -102,6 +106,9 @@ private:
RetainPtr<WKDownloadAsDelegate> m_delegate;
#endif
#if USE(CFNETWORK)
+ bool m_allowOverwrite;
+ String m_destination;
+ String m_bundlePath;
RetainPtr<CFURLDownloadRef> m_download;
#endif
};
diff --git a/Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp b/Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp
index e65883a..1cb288e 100644
--- a/Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp
+++ b/Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "DownloadManager.h"
#include "Download.h"
diff --git a/Source/WebKit2/WebProcess/Downloads/cf/DownloadCFNet.cpp b/Source/WebKit2/WebProcess/Downloads/cf/DownloadCFNet.cpp
index 08c381f..c8a065e 100644
--- a/Source/WebKit2/WebProcess/Downloads/cf/DownloadCFNet.cpp
+++ b/Source/WebKit2/WebProcess/Downloads/cf/DownloadCFNet.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,12 +23,14 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "Download.h"
#include "DataReference.h"
#include "NotImplemented.h"
#pragma warning(push, 0)
+#include <WebCore/DownloadBundle.h>
#include <WebCore/LoaderRunLoopCF.h>
#include <WebCore/ResourceError.h>
#include <WebCore/ResourceHandle.h>
@@ -52,7 +54,7 @@ static void didCreateDestinationCallback(CFURLDownloadRef download, CFURLRef pat
static void didFinishCallback(CFURLDownloadRef download, const void* clientInfo);
static void didFailCallback(CFURLDownloadRef download, CFErrorRef error, const void* clientInfo);
-void Download::start(WebPage* initiatingWebPage)
+void Download::start(WebPage*)
{
ASSERT(!m_download);
@@ -70,7 +72,7 @@ void Download::start(WebPage* initiatingWebPage)
CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), loaderRunLoop(), kCFRunLoopDefaultMode);
}
-void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle* handle, const ResourceRequest& initialRequest, const ResourceResponse& response)
+void Download::startWithHandle(WebPage*, ResourceHandle* handle, const ResourceRequest& initialRequest, const ResourceResponse& response)
{
ASSERT(!m_download);
@@ -98,7 +100,18 @@ void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle* handle,
void Download::cancel()
{
- notImplemented();
+ ASSERT(m_download);
+ if (!m_download)
+ return;
+
+ CFURLDownloadSetDeletesUponFailure(m_download.get(), false);
+ CFURLDownloadCancel(m_download.get());
+
+ RetainPtr<CFDataRef> resumeData(AdoptCF, CFURLDownloadCopyResumeData(m_download.get()));
+ if (resumeData)
+ DownloadBundle::appendResumeData(resumeData.get(), m_bundlePath);
+
+ didCancel(CoreIPC::DataReference());
}
void Download::platformInvalidate()
@@ -106,6 +119,21 @@ void Download::platformInvalidate()
m_download = nullptr;
}
+void Download::didDecideDestination(const String& destination, bool allowOverwrite)
+{
+ ASSERT(!destination.isEmpty());
+ if (destination.isEmpty())
+ return;
+
+ m_allowOverwrite = allowOverwrite;
+ m_destination = destination;
+ m_bundlePath = destination + DownloadBundle::fileExtension();
+
+ RetainPtr<CFStringRef> bundlePath(AdoptCF, CFStringCreateWithCharactersNoCopy(0, reinterpret_cast<const UniChar*>(m_bundlePath.characters()), m_bundlePath.length(), kCFAllocatorNull));
+ RetainPtr<CFURLRef> bundlePathURL(AdoptCF, CFURLCreateWithFileSystemPath(0, bundlePath.get(), kCFURLWindowsPathStyle, false));
+ CFURLDownloadSetDestination(m_download.get(), bundlePathURL.get(), allowOverwrite);
+}
+
// CFURLDownload Callbacks ----------------------------------------------------------------
static Download* downloadFromClientInfo(const void* clientInfo)
{
@@ -136,7 +164,7 @@ void didReceiveResponseCallback(CFURLDownloadRef, CFURLResponseRef response, con
}
void willResumeWithResponseCallback(CFURLDownloadRef, CFURLResponseRef response, UInt64 startingByte, const void* clientInfo)
-{
+{
// FIXME: implement.
notImplemented();
}
@@ -151,24 +179,20 @@ Boolean shouldDecodeDataOfMIMETypeCallback(CFURLDownloadRef, CFStringRef encodin
return downloadFromClientInfo(clientInfo)->shouldDecodeSourceDataOfMIMEType(encodingType);
}
-void decideDestinationWithSuggestedObjectNameCallback(CFURLDownloadRef cfURLDownloadRef, CFStringRef objectName, const void* clientInfo)
+void decideDestinationWithSuggestedObjectNameCallback(CFURLDownloadRef, CFStringRef objectName, const void* clientInfo)
{
Download* download = downloadFromClientInfo(clientInfo);
bool allowOverwrite;
- String destination = download->decideDestinationWithSuggestedFilename(objectName, allowOverwrite);
- if (destination.isNull())
- return;
-
- RetainPtr<CFStringRef> cfPath(AdoptCF, CFStringCreateWithCharactersNoCopy(0, reinterpret_cast<const UniChar*>(destination.characters()), destination.length(), kCFAllocatorNull));
- RetainPtr<CFURLRef> pathURL(AdoptCF, CFURLCreateWithFileSystemPath(0, cfPath.get(), kCFURLWindowsPathStyle, false));
- CFURLDownloadSetDestination(cfURLDownloadRef, pathURL.get(), allowOverwrite);
+ download->decideDestinationWithSuggestedFilename(objectName, allowOverwrite);
}
-void didCreateDestinationCallback(CFURLDownloadRef, CFURLRef url, const void* clientInfo)
-{
- RetainPtr<CFStringRef> path(AdoptCF, CFURLCopyFileSystemPath(url, kCFURLWindowsPathStyle));
- String result(path.get());
- downloadFromClientInfo(clientInfo)->didCreateDestination(result);
+void didCreateDestinationCallback(CFURLDownloadRef, CFURLRef, const void* clientInfo)
+{
+ // The concept of the ".download bundle" is internal to the Download, so we try to hide its
+ // existence by reporting the final destination was created, when in reality the bundle was created.
+
+ Download* download = downloadFromClientInfo(clientInfo);
+ download->didCreateDestination(download->destination());
}
void didFinishCallback(CFURLDownloadRef, const void* clientInfo)
diff --git a/Source/WebKit2/WebProcess/Downloads/cf/win/DownloadCFNetWin.cpp b/Source/WebKit2/WebProcess/Downloads/cf/win/DownloadCFNetWin.cpp
new file mode 100644
index 0000000..0dd6508
--- /dev/null
+++ b/Source/WebKit2/WebProcess/Downloads/cf/win/DownloadCFNetWin.cpp
@@ -0,0 +1,56 @@
+/*
+ * 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 "Download.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void Download::platformDidFinish()
+{
+ ASSERT(!m_bundlePath.isEmpty());
+ ASSERT(!m_destination.isEmpty());
+
+ // Try to move the bundle to the final filename.
+ DWORD flags = MOVEFILE_COPY_ALLOWED | (m_allowOverwrite ? MOVEFILE_REPLACE_EXISTING : 0);
+ if (::MoveFileExW(m_bundlePath.charactersWithNullTermination(), m_destination.charactersWithNullTermination(), flags))
+ return;
+
+ // The move failed. Give the client one more chance to choose the final filename.
+ m_destination = retrieveDestinationWithSuggestedFilename(m_destination, m_allowOverwrite);
+ if (m_destination.isEmpty())
+ return;
+
+ // We either need to report our final filename as the bundle filename or the updated destination filename.
+ flags = MOVEFILE_COPY_ALLOWED | (m_allowOverwrite ? MOVEFILE_REPLACE_EXISTING : 0);
+ if (::MoveFileExW(m_bundlePath.charactersWithNullTermination(), m_destination.charactersWithNullTermination(), flags))
+ didCreateDestination(m_destination);
+ else
+ didCreateDestination(m_bundlePath);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/Downloads/curl/DownloadCurl.cpp b/Source/WebKit2/WebProcess/Downloads/curl/DownloadCurl.cpp
index 25ed351..eb0a1cd 100644
--- a/Source/WebKit2/WebProcess/Downloads/curl/DownloadCurl.cpp
+++ b/Source/WebKit2/WebProcess/Downloads/curl/DownloadCurl.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2010 Brent Fulgham <bfulgham@webkit.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "Download.h"
#include "NotImplemented.h"
@@ -52,4 +53,14 @@ void Download::platformInvalidate()
notImplemented();
}
+void Download::didDecideDestination(const String& destination, bool allowOverwrite)
+{
+ notImplemented();
+}
+
+void Download::platformDidFinish()
+{
+ notImplemented();
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm b/Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm
index 6839020..0abd744 100644
--- a/Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm
+++ b/Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,16 +23,17 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "Download.h"
+#import "config.h"
+#import "Download.h"
-#include <WebCore/BackForwardController.h>
-#include <WebCore/HistoryItem.h>
-#include <WebCore/Page.h>
-#include <WebCore/ResourceHandle.h>
-#include <WebCore/ResourceResponse.h>
-#include "DataReference.h"
-#include "NotImplemented.h"
-#include "WebPage.h"
+#import <WebCore/BackForwardController.h>
+#import <WebCore/HistoryItem.h>
+#import <WebCore/Page.h>
+#import <WebCore/ResourceHandle.h>
+#import <WebCore/ResourceResponse.h>
+#import "DataReference.h"
+#import "NotImplemented.h"
+#import "WebPage.h"
@interface NSURLDownload (WebNSURLDownloadDetails)
+(id)_downloadWithLoadingConnection:(NSURLConnection *)connection
@@ -168,6 +169,14 @@ void Download::platformInvalidate()
m_nsURLDownload = nullptr;
}
+void Download::didDecideDestination(const String& destination, bool allowOverwrite)
+{
+}
+
+void Download::platformDidFinish()
+{
+}
+
} // namespace WebKit
@implementation WKDownloadAsDelegate
diff --git a/Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp b/Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp
index 34fd60e..131f53a 100644
--- a/Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp
+++ b/Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "Download.h"
#include "NotImplemented.h"
@@ -51,4 +52,14 @@ void Download::platformInvalidate()
notImplemented();
}
+void Download::didDecideDestination(const String& destination, bool allowOverwrite)
+{
+ notImplemented();
+}
+
+void Download::platformDidFinish()
+{
+ notImplemented();
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp b/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp
index 3068d5e..ba2aad0 100644
--- a/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp
+++ b/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "GeolocationPermissionRequestManager.h"
#include "WebFrame.h"
diff --git a/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp
index 713ba71..cee8e0b 100644
--- a/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp
+++ b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebGeolocationManager.h"
#include "WebGeolocationManagerProxyMessages.h"
diff --git a/Source/WebKit2/WebProcess/Info.plist b/Source/WebKit2/WebProcess/Info.plist
index 1564066..1fa2672 100644
--- a/Source/WebKit2/WebProcess/Info.plist
+++ b/Source/WebKit2/WebProcess/Info.plist
@@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
+ <key>LSFileQuarantineEnabled</key>
+ <true/>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
index 5c4b6e9..a58dbda 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKBundle.h"
#include "WKBundlePrivate.h"
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
index 47ac2d6..db32716 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
@@ -45,11 +45,13 @@ class InjectedBundle;
class InjectedBundleBackForwardList;
class InjectedBundleBackForwardListItem;
class InjectedBundleHitTestResult;
+class InjectedBundleNavigationAction;
class InjectedBundleNodeHandle;
class InjectedBundleRangeHandle;
class InjectedBundleScriptWorld;
class PageOverlay;
class WebFrame;
+class WebInspector;
class WebPage;
class WebPageGroupProxy;
@@ -58,6 +60,8 @@ WK_ADD_API_MAPPING(WKBundleBackForwardListRef, InjectedBundleBackForwardList)
WK_ADD_API_MAPPING(WKBundleCSSStyleDeclarationRef, WebCore::CSSStyleDeclaration)
WK_ADD_API_MAPPING(WKBundleFrameRef, WebFrame)
WK_ADD_API_MAPPING(WKBundleHitTestResultRef, InjectedBundleHitTestResult)
+WK_ADD_API_MAPPING(WKBundleInspectorRef, WebInspector)
+WK_ADD_API_MAPPING(WKBundleNavigationActionRef, InjectedBundleNavigationAction)
WK_ADD_API_MAPPING(WKBundleNodeHandleRef, InjectedBundleNodeHandle)
WK_ADD_API_MAPPING(WKBundlePageGroupRef, WebPageGroupProxy)
WK_ADD_API_MAPPING(WKBundlePageOverlayRef, PageOverlay)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp
index 288c676..7ffa3ce 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKBundleBackForwardList.h"
#include "InjectedBundleBackForwardList.h"
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp
index cde15c4..e9845e3 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKBundleBackForwardListItem.h"
#include "ImmutableArray.h"
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
index f02044c..82f616a 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKBundleFrame.h"
#include "WKBundleFramePrivate.h"
@@ -55,6 +56,29 @@ WKURLRef WKBundleFrameCopyProvisionalURL(WKBundleFrameRef frameRef)
return toCopiedURLAPI(toImpl(frameRef)->provisionalURL());
}
+WKFrameLoadState WKBundleFrameGetFrameLoadState(WKBundleFrameRef frameRef)
+{
+ Frame* coreFrame = toImpl(frameRef)->coreFrame();
+ if (!coreFrame)
+ return kWKFrameLoadStateFinished;
+
+ FrameLoader* loader = coreFrame->loader();
+ if (!loader)
+ return kWKFrameLoadStateFinished;
+
+ switch (loader->state()) {
+ case FrameStateProvisional:
+ return kWKFrameLoadStateProvisional;
+ case FrameStateCommittedPage:
+ return kWKFrameLoadStateCommitted;
+ case FrameStateComplete:
+ return kWKFrameLoadStateFinished;
+ }
+
+ ASSERT_NOT_REACHED();
+ return kWKFrameLoadStateFinished;
+}
+
WKArrayRef WKBundleFrameCopyChildFrames(WKBundleFrameRef frameRef)
{
return toAPI(toImpl(frameRef)->childFrames().releaseRef());
@@ -152,58 +176,35 @@ bool WKBundleFrameAllowsFollowingLink(WKBundleFrameRef frameRef, WKURLRef urlRef
WKRect WKBundleFrameGetContentBounds(WKBundleFrameRef frameRef)
{
- WKRect contentBounds = { { 0, 0 }, { 0, 0 } };
-
- Frame* coreFrame = toImpl(frameRef)->coreFrame();
- if (!coreFrame)
- return contentBounds;
-
- FrameView* view = coreFrame->view();
- if (!view)
- return contentBounds;
-
- contentBounds.size.width = view->contentsWidth();
- contentBounds.size.height = view->contentsHeight();
-
- return contentBounds;
+ return toAPI(toImpl(frameRef)->contentBounds());
}
WKRect WKBundleFrameGetVisibleContentBounds(WKBundleFrameRef frameRef)
{
- WKRect visibleContentBounds = { { 0, 0 }, { 0, 0 } };
-
- Frame* coreFrame = toImpl(frameRef)->coreFrame();
- if (!coreFrame)
- return visibleContentBounds;
-
- FrameView* view = coreFrame->view();
- if (!view)
- return visibleContentBounds;
-
- FloatRect bounds = view->visibleContentRect(true);
+ return toAPI(toImpl(frameRef)->visibleContentBounds());
+}
- visibleContentBounds.size.width = bounds.width();
- visibleContentBounds.size.height = bounds.height();
-
- return visibleContentBounds;
+WKRect WKBundleFrameGetVisibleContentBoundsExcludingScrollbars(WKBundleFrameRef frameRef)
+{
+ return toAPI(toImpl(frameRef)->visibleContentBoundsExcludingScrollbars());
}
-WK_EXPORT WKSize WKBundleFrameGetScrollOffset(WKBundleFrameRef frameRef)
+WKSize WKBundleFrameGetScrollOffset(WKBundleFrameRef frameRef)
{
- WKSize scrollOffset = { 0, 0 };
-
- Frame* coreFrame = toImpl(frameRef)->coreFrame();
- if (!coreFrame)
- return scrollOffset;
-
- FrameView* view = coreFrame->view();
- if (!view)
- return scrollOffset;
-
- return toAPI(view->scrollOffset());
+ return toAPI(toImpl(frameRef)->scrollOffset());
+}
+
+bool WKBundleFrameGetDocumentBackgroundColor(WKBundleFrameRef frameRef, double* red, double* green, double* blue, double* alpha)
+{
+ return toImpl(frameRef)->getDocumentBackgroundColor(red, green, blue, alpha);
}
WKStringRef WKBundleFrameCopySuggestedFilenameForResourceWithURL(WKBundleFrameRef frameRef, WKURLRef urlRef)
{
return toCopiedAPI(toImpl(frameRef)->suggestedFilenameForResourceWithURL(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string())));
}
+
+WKStringRef WKBundleFrameCopyMIMETypeForResourceWithURL(WKBundleFrameRef frameRef, WKURLRef urlRef)
+{
+ return toCopiedAPI(toImpl(frameRef)->mimeTypeForResourceWithURL(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string())));
+}
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
index 59c2d75..3c7c52d 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
@@ -28,6 +28,7 @@
#include <JavaScriptCore/JavaScript.h>
#include <WebKit2/WKBase.h>
+#include <WebKit2/WKFrame.h>
#include <WebKit2/WKGeometry.h>
#ifdef __cplusplus
@@ -43,6 +44,8 @@ WK_EXPORT WKStringRef WKBundleFrameCopyName(WKBundleFrameRef frame);
WK_EXPORT WKURLRef WKBundleFrameCopyURL(WKBundleFrameRef frame);
WK_EXPORT WKURLRef WKBundleFrameCopyProvisionalURL(WKBundleFrameRef frame);
+WK_EXPORT WKFrameLoadState WKBundleFrameGetFrameLoadState(WKBundleFrameRef frame);
+
WK_EXPORT JSGlobalContextRef WKBundleFrameGetJavaScriptContext(WKBundleFrameRef frame);
WK_EXPORT JSGlobalContextRef WKBundleFrameGetJavaScriptContextForWorld(WKBundleFrameRef frame, WKBundleScriptWorldRef world);
@@ -57,9 +60,13 @@ WK_EXPORT bool WKBundleFrameAllowsFollowingLink(WKBundleFrameRef frame, WKURLRef
WK_EXPORT WKRect WKBundleFrameGetContentBounds(WKBundleFrameRef frame);
WK_EXPORT WKRect WKBundleFrameGetVisibleContentBounds(WKBundleFrameRef frame);
+WK_EXPORT WKRect WKBundleFrameGetVisibleContentBoundsExcludingScrollbars(WKBundleFrameRef frame);
WK_EXPORT WKSize WKBundleFrameGetScrollOffset(WKBundleFrameRef frame);
+WK_EXPORT bool WKBundleFrameGetDocumentBackgroundColor(WKBundleFrameRef frame, double* red, double* green, double* blue, double* alpha);
+
WK_EXPORT WKStringRef WKBundleFrameCopySuggestedFilenameForResourceWithURL(WKBundleFrameRef frame, WKURLRef url);
+WK_EXPORT WKStringRef WKBundleFrameCopyMIMETypeForResourceWithURL(WKBundleFrameRef frame, WKURLRef url);
#ifdef __cplusplus
}
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp
index 7e74262..b764ee9 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKBundleHitTestResult.h"
#include "InjectedBundleHitTestResult.h"
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp
new file mode 100644
index 0000000..ae69a53
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp
@@ -0,0 +1,66 @@
+/*
+ * 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 "WKBundleInspector.h"
+
+#if ENABLE(INSPECTOR)
+
+#include "WKAPICast.h"
+#include "WKBundleAPICast.h"
+#include "WebInspector.h"
+
+using namespace WebCore;
+using namespace WebKit;
+
+WKTypeID WKBundleInspectorGetTypeID()
+{
+ return toAPI(WebInspector::APIType);
+}
+
+void WKBundleInspectorShow(WKBundleInspectorRef inspectorRef)
+{
+ return toImpl(inspectorRef)->show();
+}
+
+void WKBundleInspectorClose(WKBundleInspectorRef inspectorRef)
+{
+ return toImpl(inspectorRef)->close();
+}
+
+void WKBundleInspectorEvaluateScriptForTest(WKBundleInspectorRef inspectorRef, long callID, WKStringRef script)
+{
+ return toImpl(inspectorRef)->evaluateScriptForTest(callID, toImpl(script)->string());
+}
+
+void WKBundleInspectorSetPageProfilingEnabled(WKBundleInspectorRef inspectorRef, bool enabled)
+{
+ if (enabled)
+ toImpl(inspectorRef)->startPageProfiling();
+ else
+ toImpl(inspectorRef)->stopPageProfiling();
+}
+
+#endif // ENABLE(INSPECTOR)
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDatabaseManagerMac.mm b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h
index d4eb3ac..e32fdf2 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDatabaseManagerMac.mm
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.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,20 +23,34 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "WebDatabaseManager.h"
+#ifndef WKBundleInspector_h
+#define WKBundleInspector_h
-namespace WebKit {
+#include <WebKit2/WKBase.h>
-NSString *WebDatabaseDirectoryDefaultsKey = @"WebDatabaseDirectory";
+#if ENABLE(INSPECTOR)
-String WebDatabaseManager::databaseDirectory() const
-{
- NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
- NSString *databasesDirectory = [defaults objectForKey:WebDatabaseDirectoryDefaultsKey];
- if (!databasesDirectory || ![databasesDirectory isKindOfClass:[NSString class]])
- databasesDirectory = @"~/Library/WebKit/Databases";
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
- return [databasesDirectory stringByStandardizingPath];
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKBundleInspectorGetTypeID();
+
+WK_EXPORT void WKBundleInspectorShow(WKBundleInspectorRef inspector);
+WK_EXPORT void WKBundleInspectorClose(WKBundleInspectorRef inspector);
+
+WK_EXPORT void WKBundleInspectorEvaluateScriptForTest(WKBundleInspectorRef inspector, long callID, WKStringRef script);
+WK_EXPORT void WKBundleInspectorSetPageProfilingEnabled(WKBundleInspectorRef inspector, bool enabled);
+
+#ifdef __cplusplus
}
+#endif
+
+#endif // ENABLE(INSPECTOR)
+
+#endif // WKBundleInspector_h
-} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp
new file mode 100644
index 0000000..c26ec3e
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp
@@ -0,0 +1,67 @@
+/*
+ * 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 "WKBundleNavigationAction.h"
+
+#include "InjectedBundleHitTestResult.h"
+#include "InjectedBundleNavigationAction.h"
+#include "InjectedBundleNodeHandle.h"
+#include "WKAPICast.h"
+#include "WKBundleAPICast.h"
+
+using namespace WebKit;
+
+WKTypeID WKBundleNavigationActionGetTypeID()
+{
+ return toAPI(InjectedBundleNavigationAction::APIType);
+}
+
+WKFrameNavigationType WKBundleNavigationActionGetNavigationType(WKBundleNavigationActionRef navigationActionRef)
+{
+ return toAPI(toImpl(navigationActionRef)->navigationType());
+}
+
+WKEventModifiers WKBundleNavigationActionGetEventModifiers(WKBundleNavigationActionRef navigationActionRef)
+{
+ return toAPI(toImpl(navigationActionRef)->modifiers());
+}
+
+WKEventMouseButton WKBundleNavigationActionGetEventMouseButton(WKBundleNavigationActionRef navigationActionRef)
+{
+ return toAPI(toImpl(navigationActionRef)->mouseButton());
+}
+
+WKBundleHitTestResultRef WKBundleNavigationActionCopyHitTestResult(WKBundleNavigationActionRef navigationActionRef)
+{
+ RefPtr<InjectedBundleHitTestResult> hitTestResult = toImpl(navigationActionRef)->hitTestResult();
+ return toAPI(hitTestResult.release().leakRef());
+}
+
+WKBundleNodeHandleRef WKBundleNavigationActionCopyFormElement(WKBundleNavigationActionRef navigationActionRef)
+{
+ RefPtr<InjectedBundleNodeHandle> formElement = toImpl(navigationActionRef)->formElement();
+ return toAPI(formElement.release().leakRef());
+}
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.h
new file mode 100644
index 0000000..03f083a
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.h
@@ -0,0 +1,49 @@
+/*
+ * 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 WKBundleNavigationAction_h
+#define WKBundleNavigationAction_h
+
+#include <WebKit2/WKBase.h>
+#include <WebKit2/WKEvent.h>
+#include <WebKit2/WKPageLoadTypes.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKBundleNavigationActionGetTypeID();
+
+WK_EXPORT WKFrameNavigationType WKBundleNavigationActionGetNavigationType(WKBundleNavigationActionRef navigationAction);
+WK_EXPORT WKEventModifiers WKBundleNavigationActionGetEventModifiers(WKBundleNavigationActionRef navigationAction);
+WK_EXPORT WKEventMouseButton WKBundleNavigationActionGetEventMouseButton(WKBundleNavigationActionRef navigationAction);
+WK_EXPORT WKBundleHitTestResultRef WKBundleNavigationActionCopyHitTestResult(WKBundleNavigationActionRef navigationAction);
+WK_EXPORT WKBundleNodeHandleRef WKBundleNavigationActionCopyFormElement(WKBundleNavigationActionRef navigationAction);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKBundleNavigationAction_h */
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp
index bf853d1..9b0eaf1 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKBundleNodeHandle.h"
#include "WKBundleNodeHandlePrivate.h"
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
index 9693b6a..a1a4da3 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKBundlePage.h"
#include "WKBundlePagePrivate.h"
@@ -64,13 +65,27 @@ void WKBundlePageSetFormClient(WKBundlePageRef pageRef, WKBundlePageFormClient*
toImpl(pageRef)->initializeInjectedBundleFormClient(wkClient);
}
-void WKBundlePageSetLoaderClient(WKBundlePageRef pageRef, WKBundlePageLoaderClient* wkClient)
+void WKBundlePageSetPageLoaderClient(WKBundlePageRef pageRef, WKBundlePageLoaderClient* wkClient)
{
if (wkClient && wkClient->version)
return;
toImpl(pageRef)->initializeInjectedBundleLoaderClient(wkClient);
}
+void WKBundlePageSetResourceLoadClient(WKBundlePageRef pageRef, WKBundlePageResourceLoadClient* wkClient)
+{
+ if (wkClient && wkClient->version)
+ return;
+ toImpl(pageRef)->initializeInjectedBundleResourceLoadClient(wkClient);
+}
+
+void WKBundlePageSetPolicyClient(WKBundlePageRef pageRef, WKBundlePagePolicyClient* wkClient)
+{
+ if (wkClient && wkClient->version)
+ return;
+ toImpl(pageRef)->initializeInjectedBundlePolicyClient(wkClient);
+}
+
void WKBundlePageSetUIClient(WKBundlePageRef pageRef, WKBundlePageUIClient* wkClient)
{
if (wkClient && wkClient->version)
@@ -184,3 +199,16 @@ WKImageRef WKBundlePageCreateSnapshotInDocumentCoordinates(WKBundlePageRef pageR
RefPtr<WebImage> webImage = toImpl(pageRef)->snapshotInDocumentCoordinates(toIntRect(rect), toImageOptions(options));
return toAPI(webImage.release().leakRef());
}
+
+WKImageRef WKBundlePageCreateScaledSnapshotInDocumentCoordinates(WKBundlePageRef pageRef, WKRect rect, double scaleFactor, WKImageOptions options)
+{
+ RefPtr<WebImage> webImage = toImpl(pageRef)->scaledSnapshotInDocumentCoordinates(toIntRect(rect), scaleFactor, toImageOptions(options));
+ return toAPI(webImage.release().leakRef());
+}
+
+#if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR
+WKBundleInspectorRef WKBundlePageGetInspector(WKBundlePageRef pageRef)
+{
+ return toAPI(toImpl(pageRef)->inspector());
+}
+#endif
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
index 00db56f..944a5b6 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
@@ -87,8 +87,6 @@ typedef void (*WKBundlePageDidClearWindowObjectForFrameCallback)(WKBundlePageRef
typedef void (*WKBundlePageDidCancelClientRedirectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo);
typedef void (*WKBundlePageWillPerformClientRedirectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKURLRef url, double delay, double date, const void *clientInfo);
typedef void (*WKBundlePageDidHandleOnloadEventsForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo);
-typedef bool (*WKBundlePageShouldLoadResourceForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKStringRef url, const void *clientInfo);
-
struct WKBundlePageLoaderClient {
int version;
@@ -113,10 +111,43 @@ struct WKBundlePageLoaderClient {
WKBundlePageDidCancelClientRedirectForFrameCallback didCancelClientRedirectForFrame;
WKBundlePageWillPerformClientRedirectForFrameCallback willPerformClientRedirectForFrame;
WKBundlePageDidHandleOnloadEventsForFrameCallback didHandleOnloadEventsForFrame;
- WKBundlePageShouldLoadResourceForFrameCallback shouldLoadResourceForFrame;
};
typedef struct WKBundlePageLoaderClient WKBundlePageLoaderClient;
+// Policy Client
+typedef void (*WKBundlePageDecidePolicyForNavigationActionCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNavigationActionRef navigationAction, WKURLRequestRef request, WKTypeRef* userData, const void* clientInfo);
+typedef void (*WKBundlePageDecidePolicyForNewWindowActionCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNavigationActionRef navigationAction, WKURLRequestRef request, WKStringRef frameName, WKTypeRef* userData, const void* clientInfo);
+typedef void (*WKBundlePageDecidePolicyForMIMETypeCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKStringRef MIMEType, WKURLRequestRef request, WKTypeRef* userData, const void* clientInfo);
+
+struct WKBundlePagePolicyClient {
+ int version;
+ const void * clientInfo;
+ WKBundlePageDecidePolicyForNavigationActionCallback decidePolicyForNavigationAction;
+ WKBundlePageDecidePolicyForNewWindowActionCallback decidePolicyForNewWindowAction;
+ WKBundlePageDecidePolicyForMIMETypeCallback decidePolicyForMIMEType;
+};
+typedef struct WKBundlePagePolicyClient WKBundlePagePolicyClient;
+
+// Resource Load Client
+typedef void (*WKBundlePageDidInitiateLoadForResourceCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, WKURLRequestRef, bool pageIsProvisionallyLoading, const void* clientInfo);
+typedef WKURLRequestRef (*WKBundlePageWillSendRequestForFrameCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, WKURLRequestRef, WKURLResponseRef redirectResponse, const void *clientInfo);
+typedef void (*WKBundlePageDidReceiveResponseForResourceCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, WKURLResponseRef, const void* clientInfo);
+typedef void (*WKBundlePageDidReceiveContentLengthForResourceCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, uint64_t contentLength, const void* clientInfo);
+typedef void (*WKBundlePageDidFinishLoadForResourceCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, const void* clientInfo);
+typedef void (*WKBundlePageDidFailLoadForResourceCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, WKErrorRef, const void* clientInfo);
+
+struct WKBundlePageResourceLoadClient {
+ int version;
+ const void * clientInfo;
+ WKBundlePageDidInitiateLoadForResourceCallback didInitiateLoadForResource;
+ WKBundlePageWillSendRequestForFrameCallback willSendRequestForFrame;
+ WKBundlePageDidReceiveResponseForResourceCallback didReceiveResponseForResource;
+ WKBundlePageDidReceiveContentLengthForResourceCallback didReceiveContentLengthForResource;
+ WKBundlePageDidFinishLoadForResourceCallback didFinishLoadForResource;
+ WKBundlePageDidFailLoadForResourceCallback didFailLoadForResource;
+};
+typedef struct WKBundlePageResourceLoadClient WKBundlePageResourceLoadClient;
+
// UI Client
typedef void (*WKBundlePageWillAddMessageToConsoleCallback)(WKBundlePageRef page, WKStringRef message, uint32_t lineNumber, const void *clientInfo);
typedef void (*WKBundlePageWillSetStatusbarTextCallback)(WKBundlePageRef page, WKStringRef statusbarText, const void *clientInfo);
@@ -125,6 +156,7 @@ typedef void (*WKBundlePageWillRunJavaScriptConfirmCallback)(WKBundlePageRef pag
typedef void (*WKBundlePageWillRunJavaScriptPromptCallback)(WKBundlePageRef page, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void *clientInfo);
typedef void (*WKBundlePageMouseDidMoveOverElementCallback)(WKBundlePageRef page, WKBundleHitTestResultRef hitTestResult, WKEventModifiers modifiers, WKTypeRef* userData, const void *clientInfo);
typedef void (*WKBundlePageDidScrollCallback)(WKBundlePageRef page, const void *clientInfo);
+typedef void (*WKBundlePagePaintCustomOverhangAreaCallback)(WKBundlePageRef page, WKGraphicsContextRef graphicsContext, WKRect horizontalOverhang, WKRect verticalOverhang, WKRect dirtyRect, const void* clientInfo);
struct WKBundlePageUIClient {
int version;
@@ -136,6 +168,7 @@ struct WKBundlePageUIClient {
WKBundlePageWillRunJavaScriptPromptCallback willRunJavaScriptPrompt;
WKBundlePageMouseDidMoveOverElementCallback mouseDidMoveOverElement;
WKBundlePageDidScrollCallback pageDidScroll;
+ WKBundlePagePaintCustomOverhangAreaCallback paintCustomOverhangArea;
};
typedef struct WKBundlePageUIClient WKBundlePageUIClient;
@@ -201,7 +234,9 @@ WK_EXPORT WKTypeID WKBundlePageGetTypeID();
WK_EXPORT void WKBundlePageSetContextMenuClient(WKBundlePageRef page, WKBundlePageContextMenuClient* client);
WK_EXPORT void WKBundlePageSetEditorClient(WKBundlePageRef page, WKBundlePageEditorClient* client);
WK_EXPORT void WKBundlePageSetFormClient(WKBundlePageRef page, WKBundlePageFormClient* client);
-WK_EXPORT void WKBundlePageSetLoaderClient(WKBundlePageRef page, WKBundlePageLoaderClient* client);
+WK_EXPORT void WKBundlePageSetPageLoaderClient(WKBundlePageRef page, WKBundlePageLoaderClient* client);
+WK_EXPORT void WKBundlePageSetResourceLoadClient(WKBundlePageRef page, WKBundlePageResourceLoadClient* client);
+WK_EXPORT void WKBundlePageSetPolicyClient(WKBundlePageRef page, WKBundlePagePolicyClient* client);
WK_EXPORT void WKBundlePageSetUIClient(WKBundlePageRef page, WKBundlePageUIClient* client);
WK_EXPORT WKBundlePageGroupRef WKBundlePageGetPageGroup(WKBundlePageRef page);
@@ -219,6 +254,11 @@ WK_EXPORT bool WKBundlePageFindString(WKBundlePageRef page, WKStringRef target,
WK_EXPORT WKImageRef WKBundlePageCreateSnapshotInViewCoordinates(WKBundlePageRef page, WKRect rect, WKImageOptions options);
WK_EXPORT WKImageRef WKBundlePageCreateSnapshotInDocumentCoordinates(WKBundlePageRef page, WKRect rect, WKImageOptions options);
+WK_EXPORT WKImageRef WKBundlePageCreateScaledSnapshotInDocumentCoordinates(WKBundlePageRef page, WKRect rect, double scaleFactor, WKImageOptions options);
+
+#if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR
+WK_EXPORT WKBundleInspectorRef WKBundlePageGetInspector(WKBundlePageRef page);
+#endif
#ifdef __cplusplus
}
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp
index 47d4cf1..e076cb9 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKBundlePageGroup.h"
#include "WKAPICast.h"
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp
index 48fcab4..d86c2e0 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKBundlePageOverlay.h"
#include "PageOverlay.h"
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp
index 78047af..c868fab 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKBundleRangeHandle.h"
#include "InjectedBundleRangeHandle.h"
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp
index a7a4a8d..1133e3e 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WKBundleScriptWorld.h"
#include "InjectedBundleScriptWorld.h"
@@ -46,3 +47,8 @@ WKBundleScriptWorldRef WKBundleScriptWorldNormalWorld()
{
return toAPI(InjectedBundleScriptWorld::normalWorld());
}
+
+void WKBundleScriptWorldClearWrappers(WKBundleScriptWorldRef scriptWorldRef)
+{
+ toImpl(scriptWorldRef)->clearWrappers();
+}
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h
index 0763efa..013cdc9 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h
@@ -36,6 +36,7 @@ WK_EXPORT WKTypeID WKBundleScriptWorldGetTypeID();
WK_EXPORT WKBundleScriptWorldRef WKBundleScriptWorldCreateWorld();
WK_EXPORT WKBundleScriptWorldRef WKBundleScriptWorldNormalWorld();
+WK_EXPORT void WKBundleScriptWorldClearWrappers(WKBundleScriptWorldRef scriptWorld);
#ifdef __cplusplus
}
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
index 6ee3b31..43cf1ef 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundleNodeHandle.h"
#include "WebFrame.h"
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp
index 9186637..e94edfd 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundleRangeHandle.h"
#include <WebCore/Range.h>
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
index c9f1a6d..b887374 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundle.h"
#include "Arguments.h"
@@ -70,7 +71,7 @@ void InjectedBundle::initializeClient(WKBundleClient* client)
void InjectedBundle::postMessage(const String& messageName, APIObject* messageBody)
{
- WebProcess::shared().connection()->send(WebContextLegacyMessage::PostMessage, 0, CoreIPC::In(messageName, InjectedBundleUserMessageEncoder(messageBody)));
+ WebProcess::shared().connection()->deprecatedSend(WebContextLegacyMessage::PostMessage, 0, CoreIPC::In(messageName, InjectedBundleUserMessageEncoder(messageBody)));
}
void InjectedBundle::postSynchronousMessage(const String& messageName, APIObject* messageBody, RefPtr<APIObject>& returnData)
@@ -78,7 +79,7 @@ void InjectedBundle::postSynchronousMessage(const String& messageName, APIObject
RefPtr<APIObject> returnDataTmp;
InjectedBundleUserMessageDecoder messageDecoder(returnDataTmp);
- bool succeeded = WebProcess::shared().connection()->sendSync(WebContextLegacyMessage::PostSynchronousMessage, 0, CoreIPC::In(messageName, InjectedBundleUserMessageEncoder(messageBody)), CoreIPC::Out(messageDecoder));
+ bool succeeded = WebProcess::shared().connection()->deprecatedSendSync(WebContextLegacyMessage::PostSynchronousMessage, 0, CoreIPC::In(messageName, InjectedBundleUserMessageEncoder(messageBody)), CoreIPC::Out(messageDecoder));
if (!succeeded)
return;
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp
index 9f50942..d7fb9ec 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundleBackForwardList.h"
#include "InjectedBundleBackForwardListItem.h"
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp
index 222dfa3..92a7e69 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundleBackForwardListItem.h"
#include "ImmutableArray.h"
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp
index de572d0..f2e4f2b 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundleClient.h"
#include "WKBundleAPICast.h"
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp
index ab59226..c359b42 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundleHitTestResult.h"
#include "InjectedBundleNodeHandle.h"
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp
new file mode 100644
index 0000000..7a40ee6
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp
@@ -0,0 +1,105 @@
+/*
+ * 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 "InjectedBundleNavigationAction.h"
+
+#include "WebFrame.h"
+#include <WebCore/Frame.h>
+#include <WebCore/HTMLFormElement.h>
+#include <WebCore/MouseEvent.h>
+#include <WebCore/NavigationAction.h>
+#include <WebCore/UIEventWithKeyState.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static const MouseEvent* mouseEventForNavigationAction(const NavigationAction& navigationAction)
+{
+ for (const Event* e = navigationAction.event(); e; e = e->underlyingEvent()) {
+ if (e->isMouseEvent())
+ return static_cast<const MouseEvent*>(e);
+ }
+ return 0;
+}
+
+static WebMouseEvent::Button mouseButtonForMouseEvent(const MouseEvent* mouseEvent)
+{
+ if (!mouseEvent)
+ return WebMouseEvent::NoButton;
+
+ if (!mouseEvent->buttonDown())
+ return WebMouseEvent::NoButton;
+
+ return static_cast<WebMouseEvent::Button>(mouseEvent->button());
+}
+
+WebEvent::Modifiers InjectedBundleNavigationAction::modifiersForNavigationAction(const NavigationAction& navigationAction)
+{
+ uint32_t modifiers = 0;
+ if (const UIEventWithKeyState* keyStateEvent = findEventWithKeyState(const_cast<Event*>(navigationAction.event()))) {
+ if (keyStateEvent->shiftKey())
+ modifiers |= WebEvent::ShiftKey;
+ if (keyStateEvent->ctrlKey())
+ modifiers |= WebEvent::ControlKey;
+ if (keyStateEvent->altKey())
+ modifiers |= WebEvent::AltKey;
+ if (keyStateEvent->metaKey())
+ modifiers |= WebEvent::MetaKey;
+ }
+
+ return static_cast<WebEvent::Modifiers>(modifiers);
+}
+
+WebMouseEvent::Button InjectedBundleNavigationAction::mouseButtonForNavigationAction(const NavigationAction& navigationAction)
+{
+ return mouseButtonForMouseEvent(mouseEventForNavigationAction(navigationAction));
+}
+
+
+PassRefPtr<InjectedBundleNavigationAction> InjectedBundleNavigationAction::create(WebFrame* frame, const NavigationAction& action, PassRefPtr<FormState> formState)
+{
+ return adoptRef(new InjectedBundleNavigationAction(frame, action, formState));
+}
+
+InjectedBundleNavigationAction::InjectedBundleNavigationAction(WebFrame* frame, const NavigationAction& navigationAction, PassRefPtr<FormState> prpFormState)
+{
+ m_navigationType = navigationAction.type();
+ m_modifiers = modifiersForNavigationAction(navigationAction);
+
+ if (const MouseEvent* mouseEvent = mouseEventForNavigationAction(navigationAction)) {
+ m_hitTestResult = InjectedBundleHitTestResult::create(frame->coreFrame()->eventHandler()->hitTestResultAtPoint(mouseEvent->absoluteLocation(), false));
+ m_mouseButton = mouseButtonForMouseEvent(mouseEvent);
+ }
+
+ RefPtr<FormState> formState = prpFormState;
+ if (formState) {
+ ASSERT(formState->form());
+ m_formElement = InjectedBundleNodeHandle::getOrCreate(formState->form());
+ }
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.h
new file mode 100644
index 0000000..128c9fb
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.h
@@ -0,0 +1,75 @@
+/*
+ * 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 InjectedBundleNavigationAction_h
+#define InjectedBundleNavigationAction_h
+
+#include "APIObject.h"
+#include "InjectedBundleHitTestResult.h"
+#include "InjectedBundleNodeHandle.h"
+#include "WebEvent.h"
+#include <WebCore/FrameLoaderTypes.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+ class FormState;
+ class NavigationAction;
+}
+
+namespace WebKit {
+
+class WebFrame;
+
+class InjectedBundleNavigationAction : public APIObject {
+public:
+ static const Type APIType = TypeBundleNavigationAction;
+
+ static PassRefPtr<InjectedBundleNavigationAction> create(WebFrame*, const WebCore::NavigationAction&, PassRefPtr<WebCore::FormState>);
+
+ static WebEvent::Modifiers modifiersForNavigationAction(const WebCore::NavigationAction&);
+ static WebMouseEvent::Button mouseButtonForNavigationAction(const WebCore::NavigationAction&);
+
+ WebCore::NavigationType navigationType() const { return m_navigationType; }
+ WebEvent::Modifiers modifiers() const { return m_modifiers; }
+ WebMouseEvent::Button mouseButton() const { return m_mouseButton; }
+ InjectedBundleHitTestResult* hitTestResult() const { return m_hitTestResult.get(); }
+ InjectedBundleNodeHandle* formElement() const { return m_formElement.get(); }
+
+private:
+ InjectedBundleNavigationAction(WebFrame*, const WebCore::NavigationAction&, PassRefPtr<WebCore::FormState>);
+
+ virtual Type type() const { return APIType; }
+
+ WebCore::NavigationType m_navigationType;
+ WebEvent::Modifiers m_modifiers;
+ WebMouseEvent::Button m_mouseButton;
+ RefPtr<InjectedBundleHitTestResult> m_hitTestResult;
+ RefPtr<InjectedBundleNodeHandle> m_formElement;
+};
+
+} // namespace WebKit
+
+#endif // InjectedBundleNavigationAction_h
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp
index a2d16cb..9df0081 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundlePageContextMenuClient.h"
#include "ImmutableArray.h"
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp
index 40996c2..633936b 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundlePageEditorClient.h"
#include "InjectedBundleNodeHandle.h"
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp
index 4d210f2..39924ec 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundlePageFormClient.h"
#include "ImmutableDictionary.h"
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp
index 23341c5..58a20cf 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundlePageLoaderClient.h"
#include "InjectedBundleScriptWorld.h"
@@ -175,14 +176,6 @@ void InjectedBundlePageLoaderClient::didRunInsecureContentForFrame(WebPage* page
userData = adoptRef(toImpl(userDataToPass));
}
-bool InjectedBundlePageLoaderClient::shouldLoadResourceForFrame(WebPage* page, WebFrame* frame, const String& resourceURL)
-{
- if (!m_client.shouldLoadResourceForFrame)
- return true;
-
- return m_client.shouldLoadResourceForFrame(toAPI(page), toAPI(frame), toAPI(resourceURL.impl()), m_client.clientInfo);
-}
-
void InjectedBundlePageLoaderClient::didClearWindowObjectForFrame(WebPage* page, WebFrame* frame, DOMWrapperWorld* world)
{
if (!m_client.didClearWindowObjectForFrame)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h
index e983b48..88cb824 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h
@@ -35,6 +35,8 @@
namespace WebCore {
class DOMWrapperWorld;
class ResourceError;
+class ResourceRequest;
+class ResourceResponse;
}
namespace WebKit {
@@ -60,8 +62,6 @@ public:
void didDisplayInsecureContentForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
void didRunInsecureContentForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
- bool shouldLoadResourceForFrame(WebPage*, WebFrame*, const String&);
-
void didClearWindowObjectForFrame(WebPage*, WebFrame*, WebCore::DOMWrapperWorld*);
void didCancelClientRedirectForFrame(WebPage*, WebFrame*);
void willPerformClientRedirectForFrame(WebPage*, WebFrame*, const String& url, double delay, double date);
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.cpp
new file mode 100644
index 0000000..c55e729
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.cpp
@@ -0,0 +1,72 @@
+/*
+ * 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 "InjectedBundlePagePolicyClient.h"
+
+#include "WKBundleAPICast.h"
+#include "WebURLRequest.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void InjectedBundlePagePolicyClient::decidePolicyForNavigationAction(WebPage* page, WebFrame* frame, InjectedBundleNavigationAction* action, const ResourceRequest& resourceRequest, RefPtr<APIObject>& userData)
+{
+ if (!m_client.decidePolicyForNavigationAction)
+ return;
+
+ RefPtr<WebURLRequest> request = WebURLRequest::create(resourceRequest);
+
+ WKTypeRef userDataToPass = 0;
+ m_client.decidePolicyForNavigationAction(toAPI(page), toAPI(frame), toAPI(action), toAPI(request.get()), &userDataToPass, m_client.clientInfo);
+ userData = adoptRef(toImpl(userDataToPass));
+}
+
+void InjectedBundlePagePolicyClient::decidePolicyForNewWindowAction(WebPage* page, WebFrame* frame, InjectedBundleNavigationAction* action, const ResourceRequest& resourceRequest, const String& frameName, RefPtr<APIObject>& userData)
+{
+ if (!m_client.decidePolicyForNewWindowAction)
+ return;
+
+ RefPtr<WebURLRequest> request = WebURLRequest::create(resourceRequest);
+
+ WKTypeRef userDataToPass = 0;
+ m_client.decidePolicyForNewWindowAction(toAPI(page), toAPI(frame), toAPI(action), toAPI(request.get()), toAPI(frameName.impl()), &userDataToPass, m_client.clientInfo);
+ userData = adoptRef(toImpl(userDataToPass));
+}
+
+void InjectedBundlePagePolicyClient::decidePolicyForMIMEType(WebPage* page, WebFrame* frame, const String& MIMEType, const ResourceRequest& resourceRequest, RefPtr<APIObject>& userData)
+{
+ if (!m_client.decidePolicyForMIMEType)
+ return;
+
+ RefPtr<WebURLRequest> request = WebURLRequest::create(resourceRequest);
+
+ WKTypeRef userDataToPass = 0;
+ m_client.decidePolicyForMIMEType(toAPI(page), toAPI(frame), toAPI(MIMEType.impl()), toAPI(request.get()), &userDataToPass, m_client.clientInfo);
+ userData = adoptRef(toImpl(userDataToPass));
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebDatabaseManagerQt.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.h
index 11f929c..2145ac4 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebDatabaseManagerQt.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.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,14 +23,31 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "WebDatabaseManager.h"
+#ifndef InjectedBundlePagePolicyClient_h
+#define InjectedBundlePagePolicyClient_h
-namespace WebKit {
+#include "APIClient.h"
+#include "APIObject.h"
+#include "WKBundlePage.h"
+#include <wtf/Forward.h>
-String WebDatabaseManager::databaseDirectory() const
-{
- // FIXME: Implement.
- return "";
+namespace WebCore {
+ class ResourceRequest;
}
+namespace WebKit {
+
+class InjectedBundleNavigationAction;
+class WebFrame;
+class WebPage;
+
+class InjectedBundlePagePolicyClient : public APIClient<WKBundlePagePolicyClient> {
+public:
+ void decidePolicyForNavigationAction(WebPage*, WebFrame*, InjectedBundleNavigationAction*, const WebCore::ResourceRequest&, RefPtr<APIObject>& userData);
+ void decidePolicyForNewWindowAction(WebPage*, WebFrame*, InjectedBundleNavigationAction*, const WebCore::ResourceRequest&, const String& frameName, RefPtr<APIObject>& userData);
+ void decidePolicyForMIMEType(WebPage*, WebFrame*, const String& MIMEType, const WebCore::ResourceRequest&, RefPtr<APIObject>& userData);
+};
+
} // namespace WebKit
+
+#endif // InjectedBundlePagePolicyClient_h
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp
new file mode 100644
index 0000000..c2866a8
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp
@@ -0,0 +1,88 @@
+/*
+ * 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 "InjectedBundlePageResourceLoadClient.h"
+
+#include "WKAPICast.h"
+#include "WKBundleAPICast.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void InjectedBundlePageResourceLoadClient::didInitiateLoadForResource(WebPage* page, WebFrame* frame, uint64_t identifier, const WebCore::ResourceRequest& request, bool pageIsProvisionallyLoading)
+{
+ if (!m_client.didInitiateLoadForResource)
+ return;
+
+ m_client.didInitiateLoadForResource(toAPI(page), toAPI(frame), identifier, toAPI(request), pageIsProvisionallyLoading, m_client.clientInfo);
+}
+
+void InjectedBundlePageResourceLoadClient::willSendRequestForFrame(WebPage* page, WebFrame* frame, uint64_t identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
+{
+ if (!m_client.willSendRequestForFrame)
+ return;
+
+ RefPtr<WebURLRequest> returnedRequest = toImpl(m_client.willSendRequestForFrame(toAPI(page), toAPI(frame), identifier, toAPI(request), toAPI(redirectResponse), m_client.clientInfo));
+ if (returnedRequest)
+ request = returnedRequest->resourceRequest();
+ else
+ request = ResourceRequest();
+}
+
+void InjectedBundlePageResourceLoadClient::didReceiveResponseForResource(WebPage* page, WebFrame* frame, uint64_t identifier, const WebCore::ResourceResponse& response)
+{
+ if (!m_client.didReceiveResponseForResource)
+ return;
+
+ m_client.didReceiveResponseForResource(toAPI(page), toAPI(frame), identifier, toAPI(response), m_client.clientInfo);
+}
+
+void InjectedBundlePageResourceLoadClient::didReceiveContentLengthForResource(WebPage* page, WebFrame* frame, uint64_t identifier, uint64_t contentLength)
+{
+ if (!m_client.didReceiveContentLengthForResource)
+ return;
+
+ m_client.didReceiveContentLengthForResource(toAPI(page), toAPI(frame), identifier, contentLength, m_client.clientInfo);
+}
+
+void InjectedBundlePageResourceLoadClient::didFinishLoadForResource(WebPage* page, WebFrame* frame, uint64_t identifier)
+{
+ if (!m_client.didFinishLoadForResource)
+ return;
+
+ m_client.didFinishLoadForResource(toAPI(page), toAPI(frame), identifier, m_client.clientInfo);
+}
+
+void InjectedBundlePageResourceLoadClient::didFailLoadForResource(WebPage* page, WebFrame* frame, uint64_t identifier, const WebCore::ResourceError& error)
+{
+ if (!m_client.didFailLoadForResource)
+ return;
+
+ m_client.didFailLoadForResource(toAPI(page), toAPI(frame), identifier, toAPI(error), m_client.clientInfo);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h
new file mode 100644
index 0000000..c2b654f
--- /dev/null
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+#ifndef InjectedBundlePageResourceLoadClient_h
+#define InjectedBundlePageResourceLoadClient_h
+
+#include "APIClient.h"
+#include "SameDocumentNavigationType.h"
+#include "WKBundlePage.h"
+#include <JavaScriptCore/JSBase.h>
+#include <wtf/Forward.h>
+
+namespace WebCore {
+class ResourceError;
+class ResourceRequest;
+class ResourceResponse;
+}
+
+namespace WebKit {
+
+class APIObject;
+class WebPage;
+class WebFrame;
+
+class InjectedBundlePageResourceLoadClient : public APIClient<WKBundlePageResourceLoadClient> {
+public:
+ void didInitiateLoadForResource(WebPage*, WebFrame*, uint64_t identifier, const WebCore::ResourceRequest&, bool pageIsProvisionallyLoading);
+ void willSendRequestForFrame(WebPage*, WebFrame*, uint64_t identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
+ void didReceiveResponseForResource(WebPage*, WebFrame*, uint64_t identifier, const WebCore::ResourceResponse&);
+ void didReceiveContentLengthForResource(WebPage*, WebFrame*, uint64_t identifier, uint64_t contentLength);
+ void didFinishLoadForResource(WebPage*, WebFrame*, uint64_t identifier);
+ void didFailLoadForResource(WebPage*, WebFrame*, uint64_t identifier, const WebCore::ResourceError&);
+};
+
+} // namespace WebKit
+
+#endif // InjectedBundlePageResourceLoadClient_h
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp
index 56e4434..7bb4f89 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp
@@ -23,10 +23,12 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundlePageUIClient.h"
#include "InjectedBundleHitTestResult.h"
#include "WKAPICast.h"
+#include "WebGraphicsContext.h"
#include "WKBundleAPICast.h"
#include <wtf/text/WTFString.h>
@@ -78,8 +80,23 @@ void InjectedBundlePageUIClient::mouseDidMoveOverElement(WebPage* page, const Hi
void InjectedBundlePageUIClient::pageDidScroll(WebPage* page)
{
- if (m_client.pageDidScroll)
- m_client.pageDidScroll(toAPI(page), m_client.clientInfo);
+ if (!m_client.pageDidScroll)
+ return;
+
+ m_client.pageDidScroll(toAPI(page), m_client.clientInfo);
+}
+
+bool InjectedBundlePageUIClient::shouldPaintCustomOverhangArea()
+{
+ return m_client.paintCustomOverhangArea;
+}
+
+void InjectedBundlePageUIClient::paintCustomOverhangArea(WebPage* page, GraphicsContext* graphicsContext, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect)
+{
+ ASSERT(shouldPaintCustomOverhangArea());
+
+ RefPtr<WebGraphicsContext> context = WebGraphicsContext::create(graphicsContext);
+ m_client.paintCustomOverhangArea(toAPI(page), toAPI(context.get()), toAPI(horizontalOverhangArea), toAPI(verticalOverhangArea), toAPI(dirtyRect), m_client.clientInfo);
}
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h
index 93c19e9..94925b7 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h
@@ -32,7 +32,9 @@
#include <wtf/Forward.h>
namespace WebCore {
+ class GraphicsContext;
class HitTestResult;
+ class IntRect;
}
namespace WebKit {
@@ -50,6 +52,9 @@ public:
void willRunJavaScriptPrompt(WebPage*, const String&, const String&, WebFrame*);
void mouseDidMoveOverElement(WebPage*, const WebCore::HitTestResult&, WebEvent::Modifiers, RefPtr<APIObject>& userData);
void pageDidScroll(WebPage*);
+
+ bool shouldPaintCustomOverhangArea();
+ void paintCustomOverhangArea(WebPage*, WebCore::GraphicsContext*, const WebCore::IntRect&, const WebCore::IntRect&, const WebCore::IntRect&);
};
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp
index d764cf2..2f40fd3 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundleScriptWorld.h"
#include <WebCore/DOMWrapperWorld.h>
@@ -80,5 +81,10 @@ DOMWrapperWorld* InjectedBundleScriptWorld::coreWorld() const
{
return m_world.get();
}
+
+void InjectedBundleScriptWorld::clearWrappers()
+{
+ m_world->clearWrappers();
+}
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h
index 00dd14a..7562a6f 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h
@@ -47,6 +47,8 @@ public:
virtual ~InjectedBundleScriptWorld();
WebCore::DOMWrapperWorld* coreWorld() const;
+
+ void clearWrappers();
private:
InjectedBundleScriptWorld(PassRefPtr<WebCore::DOMWrapperWorld>);
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp b/Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp
index f992af2..c75e433 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundle.h"
#include "NotImplemented.h"
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp b/Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp
index f278ea9..00e4dff 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundle.h"
#include "WKBundleAPICast.h"
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp b/Source/WebKit2/WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp
index 9d397e8..a5183b1 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundle.h"
#include "WKBundleAPICast.h"
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp b/Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp
index 3fd3333..1e593fc 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "InjectedBundle.h"
#include "WKBundleAPICast.h"
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp
index c094505..edd2b44 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "JSNPMethod.h"
#include "JSNPObject.h"
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp
index d7d626f..f6939cb 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "JSNPObject.h"
#include "JSNPMethod.h"
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp
index 45c1e6e..345bd54 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "NPJSObject.h"
#include "JSNPObject.h"
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp
index 4fa37c1..0a96ad7 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "NPRuntimeObjectMap.h"
#include "JSNPObject.h"
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeUtilities.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeUtilities.cpp
index 20ff478..e92f026 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeUtilities.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeUtilities.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "NPRuntimeUtilities.h"
#include <wtf/text/CString.h>
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
index ba21db1..5f8ee5c 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "NetscapeBrowserFuncs.h"
#include "NPRuntimeUtilities.h"
@@ -387,8 +388,12 @@ static NPError NPN_PostURLNotify(NPP npp, const char* url, const char* target, u
}
#if PLATFORM(MAC)
-/* TRUE if the browser supports hardware compositing of Core Animation plug-ins */
+// true if the browser supports hardware compositing of Core Animation plug-ins.
static const unsigned WKNVSupportsCompositingCoreAnimationPluginsBool = 74656;
+
+// The Core Animation render server port.
+static const unsigned WKNVCALayerRenderServerPort = 71879;
+
#endif
static NPError NPN_GetValue(NPP npp, NPNVariable variable, void *value)
@@ -432,6 +437,13 @@ static NPError NPN_GetValue(NPP npp, NPNVariable variable, void *value)
*(NPBool*)value = true;
break;
+ case WKNVCALayerRenderServerPort: {
+ RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp);
+
+ *(mach_port_t*)value = plugin->compositingRenderServerPort();
+ break;
+ }
+
#ifndef NP_NO_QUICKDRAW
case NPNVsupportsQuickDrawBool:
// We don't support the QuickDraw drawing model.
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
index 5674ba5..e746d5a 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "NetscapePlugin.h"
#include "NPRuntimeObjectMap.h"
@@ -351,8 +352,8 @@ void NetscapePlugin::callSetWindow()
m_npWindow.height = m_frameRect.height();
m_npWindow.clipRect.top = m_clipRect.y();
m_npWindow.clipRect.left = m_clipRect.x();
- m_npWindow.clipRect.bottom = m_clipRect.bottom();
- m_npWindow.clipRect.right = m_clipRect.right();
+ m_npWindow.clipRect.bottom = m_clipRect.maxY();
+ m_npWindow.clipRect.right = m_clipRect.maxX();
NPP_SetWindow(&m_npWindow);
}
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
index 95ff714..e807beb 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
@@ -56,6 +56,8 @@ public:
NPBool convertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double& destX, double& destY, NPCoordinateSpace destSpace);
NPError popUpContextMenu(NPMenu*);
+ mach_port_t compositingRenderServerPort();
+
#ifndef NP_NO_CARBON
WindowRef windowRef() const;
bool isWindowActive() const { return m_windowHasFocus; }
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp
index be60795..9450317 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "NetscapePluginStream.h"
#include "NetscapePlugin.h"
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/gtk/NetscapePluginGtk.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/gtk/NetscapePluginGtk.cpp
index 64239f3..2b734fd 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/gtk/NetscapePluginGtk.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/gtk/NetscapePluginGtk.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "NetscapePlugin.h"
#include "NotImplemented.h"
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
index d57e8d1..46671b8 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
@@ -23,13 +23,14 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "NetscapePlugin.h"
+#import "config.h"
+#import "NetscapePlugin.h"
-#include "PluginController.h"
-#include "WebEvent.h"
-#include <WebCore/GraphicsContext.h>
-#include <Carbon/Carbon.h>
-#include <WebKitSystemInterface.h>
+#import "PluginController.h"
+#import "WebEvent.h"
+#import <WebCore/GraphicsContext.h>
+#import <Carbon/Carbon.h>
+#import <WebKitSystemInterface.h>
using namespace WebCore;
@@ -171,6 +172,11 @@ NPError NetscapePlugin::popUpContextMenu(NPMenu* npMenu)
return NPERR_NO_ERROR;
}
+mach_port_t NetscapePlugin::compositingRenderServerPort()
+{
+ return m_pluginController->compositingRenderServerPort();
+}
+
#ifndef NP_NO_CARBON
typedef HashMap<WindowRef, NetscapePlugin*> WindowMap;
@@ -779,8 +785,8 @@ static Rect computeFakeWindowBoundsRect(const WebCore::IntRect& windowFrameInScr
// Carbon global coordinates has the origin set at the top left corner of the main viewing screen, so we want to flip the y coordinate.
CGFloat maxY = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]);
- int flippedWindowFrameYCoordinate = maxY - windowFrameInScreenCoordinates.bottom();
- int flippedViewFrameYCoordinate = windowFrameInScreenCoordinates.height() - viewFrameInWindowCoordinates.bottom();
+ int flippedWindowFrameYCoordinate = maxY - windowFrameInScreenCoordinates.maxY();
+ int flippedViewFrameYCoordinate = windowFrameInScreenCoordinates.height() - viewFrameInWindowCoordinates.maxY();
Rect bounds;
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm
index 6ecf7b9..d331506 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm
@@ -23,11 +23,12 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if ENABLE(PLUGIN_PROCESS)
+#import "config.h"
+#import "PluginProxy.h"
-#include "PluginProxy.h"
+#if ENABLE(PLUGIN_PROCESS)
-#include <WebKitSystemInterface.h>
+#import <WebKitSystemInterface.h>
namespace WebKit {
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp
index 77efc01..1ede2c3 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "NetscapePlugin.h"
#include "NotImplemented.h"
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp
index 930f87b..e713f83 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "NetscapePlugin.h"
#include "NotImplemented.h"
@@ -126,7 +127,7 @@ void NetscapePlugin::platformGeometryDidChange()
IntRect clipRectInPluginWindowCoordinates = m_clipRect;
clipRectInPluginWindowCoordinates.move(-m_frameRect.x(), -m_frameRect.y());
- OwnPtr<HRGN> clipRegion = adoptPtr(::CreateRectRgn(clipRectInPluginWindowCoordinates.x(), clipRectInPluginWindowCoordinates.y(), clipRectInPluginWindowCoordinates.right(), clipRectInPluginWindowCoordinates.bottom()));
+ OwnPtr<HRGN> clipRegion = adoptPtr(::CreateRectRgn(clipRectInPluginWindowCoordinates.x(), clipRectInPluginWindowCoordinates.y(), clipRectInPluginWindowCoordinates.maxX(), clipRectInPluginWindowCoordinates.maxY()));
setWindowRegion(m_window, clipRegion.release(), Redraw);
// FIXME: We should only update the size here and let the UI process update our position so
diff --git a/Source/WebKit2/WebProcess/Plugins/Plugin.cpp b/Source/WebKit2/WebProcess/Plugins/Plugin.cpp
index 32ad92d..98e1128 100644
--- a/Source/WebKit2/WebProcess/Plugins/Plugin.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Plugin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "Plugin.h"
#include "WebCoreArgumentCoders.h"
diff --git a/Source/WebKit2/WebProcess/Plugins/PluginController.h b/Source/WebKit2/WebProcess/Plugins/PluginController.h
index 06cf2d7..9dc8ec3 100644
--- a/Source/WebKit2/WebProcess/Plugins/PluginController.h
+++ b/Source/WebKit2/WebProcess/Plugins/PluginController.h
@@ -91,6 +91,9 @@ public:
#if PLATFORM(MAC)
// Tells the controller that complex text input be enabled or disabled for the plug-in.
virtual void setComplexTextInputEnabled(bool) = 0;
+
+ // Returns the mach port of the compositing render server.
+ virtual mach_port_t compositingRenderServerPort() = 0;
#endif
// Returns the proxies for the given URL or null on failure.
diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
index 7c09e56..ef931c8 100644
--- a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
@@ -23,10 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if ENABLE(PLUGIN_PROCESS)
-
+#include "config.h"
#include "PluginProcessConnection.h"
+#if ENABLE(PLUGIN_PROCESS)
+
#include "NPRemoteObjectMap.h"
#include "PluginProcessConnectionManager.h"
#include "PluginProxy.h"
diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp
index 99848ef..1290391 100644
--- a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp
@@ -23,10 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if ENABLE(PLUGIN_PROCESS)
-
+#include "config.h"
#include "PluginProcessConnectionManager.h"
+#if ENABLE(PLUGIN_PROCESS)
+
#include "ArgumentDecoder.h"
#include "ArgumentEncoder.h"
#include "MachPort.h"
@@ -61,7 +62,7 @@ PluginProcessConnection* PluginProcessConnectionManager::getPluginProcessConnect
CoreIPC::Connection::Identifier connectionIdentifier;
CoreIPC::MachPort connectionMachPort;
- if (!WebProcess::shared().connection()->sendSync(WebProcessProxyLegacyMessage::GetPluginProcessConnection, 0, CoreIPC::In(pluginPath), CoreIPC::Out(connectionMachPort)))
+ if (!WebProcess::shared().connection()->deprecatedSendSync(WebProcessProxyLegacyMessage::GetPluginProcessConnection, 0, CoreIPC::In(pluginPath), CoreIPC::Out(connectionMachPort)))
return 0;
connectionIdentifier = connectionMachPort.port();
diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp
index f029cbf..551e458 100644
--- a/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp
@@ -23,10 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if ENABLE(PLUGIN_PROCESS)
-
+#include "config.h"
#include "PluginProxy.h"
+#if ENABLE(PLUGIN_PROCESS)
+
#include "DataReference.h"
#include "NPRemoteObjectMap.h"
#include "NPRuntimeUtilities.h"
diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProxy.h b/Source/WebKit2/WebProcess/Plugins/PluginProxy.h
index 2c3b052..9be7bd1 100644
--- a/Source/WebKit2/WebProcess/Plugins/PluginProxy.h
+++ b/Source/WebKit2/WebProcess/Plugins/PluginProxy.h
@@ -33,11 +33,7 @@
#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
-#ifdef __OBJC__
-@class CALayer;
-#else
-class CALayer;
-#endif
+OBJC_CLASS CALayer;
#endif
namespace WebCore {
diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp
index 00271c1..8ac7d3a 100644
--- a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "PluginView.h"
#include "NPRuntimeUtilities.h"
@@ -30,6 +31,7 @@
#include "WebEvent.h"
#include "WebPage.h"
#include "WebPageProxyMessages.h"
+#include "WebProcess.h"
#include <WebCore/Chrome.h>
#include <WebCore/CookieJar.h>
#include <WebCore/DocumentLoader.h>
@@ -282,8 +284,11 @@ PluginView::~PluginView()
// Invalidate the object map.
m_npRuntimeObjectMap.invalidate();
- // Cancel all streams.
cancelAllStreams();
+
+ // Null out the plug-in element explicitly so we'll crash earlier if we try to use
+ // the plug-in view after it's been destroyed.
+ m_pluginElement = nullptr;
}
Frame* PluginView::frame()
@@ -901,6 +906,10 @@ bool PluginView::evaluate(NPObject* npObject, const String& scriptString, NPVari
bool oldAllowPopups = frame()->script()->allowPopupsFromPlugin();
frame()->script()->setAllowPopupsFromPlugin(allowPopups);
+ // Calling evaluate will run JavaScript that can potentially remove the plug-in element, so we need to
+ // protect the plug-in view from destruction.
+ NPRuntimeObjectMap::PluginProtector pluginProtector(&m_npRuntimeObjectMap);
+
bool returnValue = m_npRuntimeObjectMap.evaluate(npObject, scriptString, result);
frame()->script()->setAllowPopupsFromPlugin(oldAllowPopups);
@@ -959,6 +968,12 @@ void PluginView::setComplexTextInputEnabled(bool complexTextInputEnabled)
{
m_webPage->send(Messages::WebPageProxy::SetComplexTextInputEnabled(m_plugin->pluginComplexTextInputIdentifier(), complexTextInputEnabled));
}
+
+mach_port_t PluginView::compositingRenderServerPort()
+{
+ return WebProcess::shared().compositingRenderServerPort();
+}
+
#endif
String PluginView::proxiesForURL(const String& urlString)
diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.h b/Source/WebKit2/WebProcess/Plugins/PluginView.h
index 07511d7..dca3a62 100644
--- a/Source/WebKit2/WebProcess/Plugins/PluginView.h
+++ b/Source/WebKit2/WebProcess/Plugins/PluginView.h
@@ -132,6 +132,7 @@ private:
#endif
#if PLATFORM(MAC)
virtual void setComplexTextInputEnabled(bool);
+ virtual mach_port_t compositingRenderServerPort();
#endif
virtual String proxiesForURL(const String&);
virtual String cookiesForURL(const String&);
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
index 6da6c6e..2394141 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
@@ -24,12 +24,14 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebChromeClient.h"
#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
#include "NotImplemented.h"
#include "DrawingArea.h"
+#include "InjectedBundleNavigationAction.h"
#include "InjectedBundleUserMessageCoders.h"
#include "WebContextMenu.h"
#include "WebCoreArgumentCoders.h"
@@ -49,6 +51,7 @@
#include <WebCore/FileChooser.h>
#include <WebCore/Frame.h>
#include <WebCore/FrameLoader.h>
+#include <WebCore/FrameView.h>
#include <WebCore/HTMLNames.h>
#include <WebCore/HTMLPlugInImageElement.h>
#include <WebCore/Page.h>
@@ -151,8 +154,8 @@ void WebChromeClient::focusedFrameChanged(Frame* frame)
Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures& windowFeatures, const NavigationAction& navigationAction)
{
- uint32_t modifiers = modifiersForNavigationAction(navigationAction);
- int32_t mouseButton = mouseButtonForNavigationAction(navigationAction);
+ uint32_t modifiers = static_cast<uint32_t>(InjectedBundleNavigationAction::modifiersForNavigationAction(navigationAction));
+ int32_t mouseButton = static_cast<int32_t>(InjectedBundleNavigationAction::mouseButtonForNavigationAction(navigationAction));
uint64_t newPageID = 0;
WebPageCreationParameters parameters;
@@ -354,11 +357,15 @@ void WebChromeClient::invalidateWindow(const IntRect&, bool)
void WebChromeClient::invalidateContentsAndWindow(const IntRect& rect, bool)
{
+ if (m_page->corePage()->mainFrame()->document()->printing())
+ return;
m_page->drawingArea()->setNeedsDisplay(rect);
}
void WebChromeClient::invalidateContentsForSlowScroll(const IntRect& rect, bool)
{
+ if (m_page->corePage()->mainFrame()->document()->printing())
+ return;
m_page->pageDidScroll();
m_page->drawingArea()->setNeedsDisplay(rect);
}
@@ -413,7 +420,23 @@ void WebChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) con
WebFrame* largestFrame = findLargestFrameInFrameSet(m_page);
if (largestFrame != m_cachedFrameSetLargestFrame.get()) {
m_cachedFrameSetLargestFrame = largestFrame;
- WebProcess::shared().connection()->send(Messages::WebPageProxy::FrameSetLargestFrameChanged(largestFrame ? largestFrame->frameID() : 0), m_page->pageID());
+ m_page->send(Messages::WebPageProxy::FrameSetLargestFrameChanged(largestFrame ? largestFrame->frameID() : 0));
+ }
+
+ if (frame->page()->mainFrame() != frame)
+ return;
+ FrameView* frameView = frame->view();
+ if (!frameView)
+ return;
+
+ bool hasHorizontalScrollbar = frameView->horizontalScrollbar();
+ bool hasVerticalScrollbar = frameView->verticalScrollbar();
+
+ if (hasHorizontalScrollbar != m_cachedMainFrameHasHorizontalScrollbar || hasVerticalScrollbar != m_cachedMainFrameHasVerticalScrollbar) {
+ m_page->send(Messages::WebPageProxy::DidChangeScrollbarsForMainFrame(hasHorizontalScrollbar, hasVerticalScrollbar));
+
+ m_cachedMainFrameHasHorizontalScrollbar = hasHorizontalScrollbar;
+ m_cachedMainFrameHasVerticalScrollbar = hasVerticalScrollbar;
}
}
@@ -550,6 +573,15 @@ bool WebChromeClient::paintCustomScrollCorner(GraphicsContext*, const FloatRect&
return false;
}
+bool WebChromeClient::paintCustomOverhangArea(GraphicsContext* context, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect)
+{
+ if (!m_page->injectedBundleUIClient().shouldPaintCustomOverhangArea())
+ return false;
+
+ m_page->injectedBundleUIClient().paintCustomOverhangArea(m_page, context, horizontalOverhangArea, verticalOverhangArea, dirtyRect);
+ return true;
+}
+
void WebChromeClient::requestGeolocationPermissionForFrame(Frame*, Geolocation*)
{
notImplemented();
@@ -611,6 +643,11 @@ void WebChromeClient::formDidBlur(const Node*)
bool WebChromeClient::selectItemWritingDirectionIsNatural()
{
+ return false;
+}
+
+bool WebChromeClient::selectItemAlignmentFollowsMenuWritingDirection()
+{
return true;
}
@@ -631,12 +668,6 @@ void WebChromeClient::showContextMenu()
}
#endif
-PassOwnPtr<HTMLParserQuirks> WebChromeClient::createHTMLParserQuirks()
-{
- notImplemented();
- return 0;
-}
-
#if USE(ACCELERATED_COMPOSITING)
void WebChromeClient::attachRootGraphicsLayer(Frame*, GraphicsLayer* layer)
{
@@ -683,4 +714,9 @@ void WebChromeClient::dispatchViewportDataDidChange(const ViewportArguments& arg
m_page->send(Messages::WebPageProxy::DidChangeViewportData(args));
}
+void WebChromeClient::didCompleteRubberBandForMainFrame(const IntSize& initialOverhang) const
+{
+ m_page->send(Messages::WebPageProxy::DidCompleteRubberBandForMainFrame(initialOverhang));
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
index d749833..82ba36e 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
@@ -39,11 +39,14 @@ class WebPage;
class WebChromeClient : public WebCore::ChromeClient {
public:
WebChromeClient(WebPage* page)
- : m_page(page)
+ : m_cachedMainFrameHasHorizontalScrollbar(false)
+ , m_cachedMainFrameHasVerticalScrollbar(false)
+ , m_page(page)
{
}
WebPage* page() const { return m_page; }
+
private:
virtual void chromeDestroyed();
@@ -154,27 +157,28 @@ private:
WebCore::ScrollbarControlState, WebCore::ScrollbarPart pressedPart, bool vertical,
float value, float proportion, WebCore::ScrollbarControlPartMask);
virtual bool paintCustomScrollCorner(WebCore::GraphicsContext*, const WebCore::FloatRect&);
-
+
+ virtual bool paintCustomOverhangArea(WebCore::GraphicsContext*, const WebCore::IntRect&, const WebCore::IntRect&, const WebCore::IntRect&);
+
// This is an asynchronous call. The ChromeClient can display UI asking the user for permission
// to use Geolococation. The ChromeClient must call Geolocation::setShouldClearCache() appropriately.
virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*);
virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*);
-
+
virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
virtual void chooseIconForFiles(const Vector<String>&, WebCore::FileChooser*);
virtual void setCursor(const WebCore::Cursor&);
-
+
// Notification that the given form element has changed. This function
// will be called frequently, so handling should be very fast.
virtual void formStateDidChange(const WebCore::Node*);
-
+
virtual void formDidFocus(const WebCore::Node*);
virtual void formDidBlur(const WebCore::Node*);
-
- virtual PassOwnPtr<WebCore::HTMLParserQuirks> createHTMLParserQuirks();
virtual bool selectItemWritingDirectionIsNatural();
+ virtual bool selectItemAlignmentFollowsMenuWritingDirection();
virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const;
virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const;
@@ -202,8 +206,13 @@ private:
virtual void dispatchViewportDataDidChange(const WebCore::ViewportArguments&) const;
+ virtual void didCompleteRubberBandForMainFrame(const WebCore::IntSize&) const;
+
String m_cachedToolTip;
mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame;
+ mutable bool m_cachedMainFrameHasHorizontalScrollbar;
+ mutable bool m_cachedMainFrameHasVerticalScrollbar;
+
WebPage* m_page;
};
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp
index 42b60a5..0c83cda 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebContextMenuClient.h"
#include "WebContextMenuItemData.h"
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp
index cc61b04..caa6eda 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebDatabaseManager.h"
#include "Connection.h"
@@ -45,9 +46,13 @@ WebDatabaseManager& WebDatabaseManager::shared()
return shared;
}
+void WebDatabaseManager::initialize(const String& databaseDirectory)
+{
+ DatabaseTracker::initializeTracker(databaseDirectory);
+}
+
WebDatabaseManager::WebDatabaseManager()
{
- DatabaseTracker::initializeTracker(databaseDirectory());
DatabaseTracker::tracker().setClient(this);
}
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h
index 4701645..96ed83e 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h
@@ -43,6 +43,7 @@ class WebDatabaseManager : public WebCore::DatabaseTrackerClient {
WTF_MAKE_NONCOPYABLE(WebDatabaseManager);
public:
static WebDatabaseManager& shared();
+ static void initialize(const String& databaseDirectory);
void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
@@ -63,8 +64,6 @@ private:
// WebCore::DatabaseTrackerClient
virtual void dispatchDidModifyOrigin(WebCore::SecurityOrigin*);
virtual void dispatchDidModifyDatabase(WebCore::SecurityOrigin*, const String& databaseIdentifier);
-
- String databaseDirectory() const;
};
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp
index e3d401d..9e348cd 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebDragClient.h"
#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
@@ -50,16 +51,10 @@ DragSourceAction WebDragClient::dragSourceActionMaskForPoint(const IntPoint& win
return DragSourceActionAny;
}
-#if !PLATFORM(MAC)
+#if !PLATFORM(MAC) && !PLATFORM(WIN)
void WebDragClient::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard*, Frame*, bool)
{
}
-
-DragImageRef WebDragClient::createDragImageForLink(KURL&, const String&, Frame*)
-{
- notImplemented();
- return 0;
-}
#endif
void WebDragClient::dragControllerDestroyed()
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h
index 6f7cf85..389680a 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h
@@ -46,7 +46,6 @@ private:
virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint& windowPoint);
virtual void startDrag(WebCore::DragImageRef dragImage, const WebCore::IntPoint& dragImageOrigin, const WebCore::IntPoint& eventPos, WebCore::Clipboard*, WebCore::Frame*, bool linkDrag = false);
- virtual WebCore::DragImageRef createDragImageForLink(WebCore::KURL&, const String& label, WebCore::Frame*);
#if PLATFORM(MAC)
virtual void declareAndWriteDragImage(NSPasteboard*, DOMElement*, NSURL*, NSString*, WebCore::Frame*);
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
index e3db967..5ed1c60 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebEditorClient.h"
#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
index 49ce240..4be913f 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebFrameLoaderClient.h"
#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
@@ -30,6 +31,7 @@
#include "AuthenticationManager.h"
#include "DataReference.h"
+#include "InjectedBundleNavigationAction.h"
#include "InjectedBundleUserMessageCoders.h"
#include "PlatformCertificateInfo.h"
#include "PluginView.h"
@@ -57,6 +59,7 @@
#include <WebCore/FrameView.h>
#include <WebCore/HTMLAppletElement.h>
#include <WebCore/HTMLFormElement.h>
+#include <WebCore/HistoryItem.h>
#include <WebCore/MIMETypeRegistry.h>
#include <WebCore/MouseEvent.h>
#include <WebCore/Page.h>
@@ -141,13 +144,18 @@ void WebFrameLoaderClient::detachedFromParent3()
notImplemented();
}
-void WebFrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest& request)
+void WebFrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request)
{
WebPage* webPage = m_frame->page();
if (!webPage)
return;
- webPage->send(Messages::WebPageProxy::DidInitiateLoadForResource(m_frame->frameID(), identifier, request));
+ bool pageIsProvisionallyLoading = false;
+ if (FrameLoader* frameLoader = loader->frameLoader())
+ pageIsProvisionallyLoading = frameLoader->provisionalDocumentLoader() == loader;
+
+ webPage->injectedBundleResourceLoadClient().didInitiateLoadForResource(webPage, m_frame, identifier, request, pageIsProvisionallyLoading);
+ webPage->send(Messages::WebPageProxy::DidInitiateLoadForResource(m_frame->frameID(), identifier, request, pageIsProvisionallyLoading));
}
void WebFrameLoaderClient::dispatchWillSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
@@ -156,8 +164,9 @@ void WebFrameLoaderClient::dispatchWillSendRequest(DocumentLoader*, unsigned lon
if (!webPage)
return;
- if (!webPage->injectedBundleLoaderClient().shouldLoadResourceForFrame(webPage, m_frame, request.url().string())) {
- request = ResourceRequest();
+ webPage->injectedBundleResourceLoadClient().willSendRequestForFrame(webPage, m_frame, identifier, request, redirectResponse);
+
+ if (request.isNull()) {
// FIXME: We should probably send a message saying we cancelled the request for the resource.
return;
}
@@ -211,6 +220,7 @@ void WebFrameLoaderClient::dispatchDidReceiveResponse(DocumentLoader*, unsigned
if (!webPage)
return;
+ webPage->injectedBundleResourceLoadClient().didReceiveResponseForResource(webPage, m_frame, identifier, response);
webPage->send(Messages::WebPageProxy::DidReceiveResponseForResource(m_frame->frameID(), identifier, response));
}
@@ -220,6 +230,7 @@ void WebFrameLoaderClient::dispatchDidReceiveContentLength(DocumentLoader*, unsi
if (!webPage)
return;
+ webPage->injectedBundleResourceLoadClient().didReceiveContentLengthForResource(webPage, m_frame, identifier, lengthReceived);
webPage->send(Messages::WebPageProxy::DidReceiveContentLengthForResource(m_frame->frameID(), identifier, lengthReceived));
}
@@ -229,6 +240,7 @@ void WebFrameLoaderClient::dispatchDidFinishLoading(DocumentLoader*, unsigned lo
if (!webPage)
return;
+ webPage->injectedBundleResourceLoadClient().didFinishLoadForResource(webPage, m_frame, identifier);
webPage->send(Messages::WebPageProxy::DidFinishLoadForResource(m_frame->frameID(), identifier));
}
@@ -238,6 +250,7 @@ void WebFrameLoaderClient::dispatchDidFailLoading(DocumentLoader*, unsigned long
if (!webPage)
return;
+ webPage->injectedBundleResourceLoadClient().didFailLoadForResource(webPage, m_frame, identifier, error);
webPage->send(Messages::WebPageProxy::DidFailLoadForResource(m_frame->frameID(), identifier, error));
}
@@ -311,7 +324,7 @@ void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage()
webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(webPage, m_frame, SameDocumentNavigationAnchorNavigation, userData);
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationAnchorNavigation, m_frame->coreFrame()->loader()->url().string(), InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationAnchorNavigation, m_frame->coreFrame()->document()->url().string(), InjectedBundleUserMessageEncoder(userData.get())));
}
void WebFrameLoaderClient::dispatchDidPushStateWithinPage()
@@ -326,7 +339,7 @@ void WebFrameLoaderClient::dispatchDidPushStateWithinPage()
webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(webPage, m_frame, SameDocumentNavigationSessionStatePush, userData);
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationSessionStatePush, m_frame->coreFrame()->loader()->url().string(), InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationSessionStatePush, m_frame->coreFrame()->document()->url().string(), InjectedBundleUserMessageEncoder(userData.get())));
}
void WebFrameLoaderClient::dispatchDidReplaceStateWithinPage()
@@ -341,7 +354,7 @@ void WebFrameLoaderClient::dispatchDidReplaceStateWithinPage()
webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(webPage, m_frame, SameDocumentNavigationSessionStateReplace, userData);
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationSessionStateReplace, m_frame->coreFrame()->loader()->url().string(), InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationSessionStateReplace, m_frame->coreFrame()->document()->url().string(), InjectedBundleUserMessageEncoder(userData.get())));
}
void WebFrameLoaderClient::dispatchDidPopStateWithinPage()
@@ -356,7 +369,7 @@ void WebFrameLoaderClient::dispatchDidPopStateWithinPage()
webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(webPage, m_frame, SameDocumentNavigationSessionStatePop, userData);
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationSessionStatePop, m_frame->coreFrame()->loader()->url().string(), InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationSessionStatePop, m_frame->coreFrame()->document()->url().string(), InjectedBundleUserMessageEncoder(userData.get())));
}
void WebFrameLoaderClient::dispatchWillClose()
@@ -426,7 +439,14 @@ void WebFrameLoaderClient::dispatchDidCommitLoad()
webPage->sandboxExtensionTracker().didCommitProvisionalLoad(m_frame);
// Notify the UIProcess.
+
webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), response.mimeType(), m_frameHasCustomRepresentation, PlatformCertificateInfo(response), InjectedBundleUserMessageEncoder(userData.get())));
+
+ // Only restore the scale factor for standard frame loads (of the main frame).
+ if (m_frame->isMainFrame() && m_frame->coreFrame()->loader()->loadType() == FrameLoadTypeStandard) {
+ if (m_frame->coreFrame()->pageScaleFactor() != 1)
+ webPage->scaleWebView(1, IntPoint());
+ }
}
void WebFrameLoaderClient::dispatchDidFailProvisionalLoad(const ResourceError& error)
@@ -556,64 +576,27 @@ void WebFrameLoaderClient::dispatchShow()
webPage->show();
}
-uint32_t modifiersForNavigationAction(const NavigationAction& navigationAction)
-{
- uint32_t modifiers = 0;
- if (const UIEventWithKeyState* keyStateEvent = findEventWithKeyState(const_cast<Event*>(navigationAction.event()))) {
- if (keyStateEvent->shiftKey())
- modifiers |= WebEvent::ShiftKey;
- if (keyStateEvent->ctrlKey())
- modifiers |= WebEvent::ControlKey;
- if (keyStateEvent->altKey())
- modifiers |= WebEvent::AltKey;
- if (keyStateEvent->metaKey())
- modifiers |= WebEvent::MetaKey;
- }
-
- return modifiers;
-}
-
-static const MouseEvent* findMouseEvent(const Event* event)
-{
- for (const Event* e = event; e; e = e->underlyingEvent()) {
- if (e->isMouseEvent())
- return static_cast<const MouseEvent*>(e);
- }
- return 0;
-}
-
-int32_t mouseButtonForNavigationAction(const NavigationAction& navigationAction)
-{
- const MouseEvent* mouseEvent = findMouseEvent(navigationAction.event());
- if (!mouseEvent)
- return -1;
-
- if (!mouseEvent->buttonDown())
- return -1;
-
- return mouseEvent->button();
-}
-
void WebFrameLoaderClient::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const String& MIMEType, const ResourceRequest& request)
{
- if (m_frame->coreFrame()->loader()->documentLoader()->url().isEmpty() && request.url() == blankURL()) {
- // WebKit2 loads initial about:blank documents synchronously, without consulting the policy delegate
- ASSERT(m_frame->coreFrame()->loader()->stateMachine()->committingFirstRealLoad());
- (m_frame->coreFrame()->loader()->policyChecker()->*function)(PolicyUse);
- return;
- }
-
WebPage* webPage = m_frame->page();
if (!webPage)
return;
- uint64_t listenerID = m_frame->setUpPolicyListener(function);
- const String& url = request.url().string(); // FIXME: Pass entire request.
+ if (!request.url().string())
+ return;
+
+ RefPtr<APIObject> userData;
+
+ // Notify the bundle client.
+ webPage->injectedBundlePolicyClient().decidePolicyForMIMEType(webPage, m_frame, MIMEType, request, userData);
+ uint64_t listenerID = m_frame->setUpPolicyListener(function);
bool receivedPolicyAction;
uint64_t policyAction;
uint64_t downloadID;
- if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForMIMEType(m_frame->frameID(), MIMEType, url, listenerID), Messages::WebPageProxy::DecidePolicyForMIMEType::Reply(receivedPolicyAction, policyAction, downloadID)))
+
+ // Notify the UIProcess.
+ if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForMIMEType(m_frame->frameID(), MIMEType, request, listenerID, InjectedBundleUserMessageEncoder(userData.get())), Messages::WebPageProxy::DecidePolicyForMIMEType::Reply(receivedPolicyAction, policyAction, downloadID)))
return;
// We call this synchronously because CFNetwork can only convert a loading connection to a download from its didReceiveResponse callback.
@@ -621,54 +604,50 @@ void WebFrameLoaderClient::dispatchDecidePolicyForMIMEType(FramePolicyFunction f
m_frame->didReceivePolicyDecision(listenerID, static_cast<PolicyAction>(policyAction), downloadID);
}
-void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction& navigationAction, const ResourceRequest& request, PassRefPtr<FormState>, const String& frameName)
+void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction& navigationAction, const ResourceRequest& request, PassRefPtr<FormState> formState, const String& frameName)
{
WebPage* webPage = m_frame->page();
if (!webPage)
return;
- uint64_t listenerID = m_frame->setUpPolicyListener(function);
+ RefPtr<APIObject> userData;
+
+ RefPtr<InjectedBundleNavigationAction> action = InjectedBundleNavigationAction::create(m_frame, navigationAction, formState);
+
+ // Notify the bundle client.
+ webPage->injectedBundlePolicyClient().decidePolicyForNewWindowAction(webPage, m_frame, action.get(), request, frameName, userData);
- // FIXME: Pass more than just the navigation action type.
- // FIXME: Pass the frame name.
- const String& url = request.url().string(); // FIXME: Pass entire request.
- uint32_t navigationType = static_cast<uint32_t>(navigationAction.type());
- uint32_t modifiers = modifiersForNavigationAction(navigationAction);
- int32_t mouseButton = mouseButtonForNavigationAction(navigationAction);
+ uint64_t listenerID = m_frame->setUpPolicyListener(function);
- webPage->send(Messages::WebPageProxy::DecidePolicyForNewWindowAction(m_frame->frameID(), navigationType, modifiers, mouseButton, url, listenerID));
+ // Notify the UIProcess.
+ webPage->send(Messages::WebPageProxy::DecidePolicyForNewWindowAction(m_frame->frameID(), action->navigationType(), action->modifiers(), action->mouseButton(), request, frameName, listenerID, InjectedBundleUserMessageEncoder(userData.get())));
}
-void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& navigationAction, const ResourceRequest& request, PassRefPtr<FormState>)
+void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& navigationAction, const ResourceRequest& request, PassRefPtr<FormState> formState)
{
- if (m_frame->coreFrame()->loader()->documentLoader()->url().isEmpty() && request.url() == blankURL()) {
- // WebKit2 loads initial about:blank documents synchronously, without consulting the policy delegate
- ASSERT(m_frame->coreFrame()->loader()->stateMachine()->committingFirstRealLoad());
- (m_frame->coreFrame()->loader()->policyChecker()->*function)(PolicyUse);
- return;
- }
-
- // Always ignore requests with empty URLs.
- if (request.isEmpty()) {
- (m_frame->coreFrame()->loader()->policyChecker()->*function)(PolicyIgnore);
- return;
- }
-
WebPage* webPage = m_frame->page();
if (!webPage)
return;
- uint64_t listenerID = m_frame->setUpPolicyListener(function);
+ RefPtr<APIObject> userData;
+
+ RefPtr<InjectedBundleNavigationAction> action = InjectedBundleNavigationAction::create(m_frame, navigationAction, formState);
+
+ // Notify the bundle client.
+ webPage->injectedBundlePolicyClient().decidePolicyForNavigationAction(webPage, m_frame, action.get(), request, userData);
- // FIXME: Pass more than just the navigation action type.
- const String& url = request.url().string(); // FIXME: Pass entire request.
+ uint64_t listenerID = m_frame->setUpPolicyListener(function);
+ bool receivedPolicyAction;
+ uint64_t policyAction;
- uint32_t navigationType = static_cast<uint32_t>(navigationAction.type());
- uint32_t modifiers = modifiersForNavigationAction(navigationAction);
- int32_t mouseButton = mouseButtonForNavigationAction(navigationAction);
+ // Notify the UIProcess.
+ if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForNavigationAction(m_frame->frameID(), action->navigationType(), action->modifiers(), action->mouseButton(), request, listenerID, InjectedBundleUserMessageEncoder(userData.get())), Messages::WebPageProxy::DecidePolicyForNavigationAction::Reply(receivedPolicyAction, policyAction)))
+ return;
- webPage->send(Messages::WebPageProxy::DecidePolicyForNavigationAction(m_frame->frameID(), navigationType, modifiers, mouseButton, url, listenerID));
+ // We call this synchronously because WebCore cannot gracefully handle a frame load without a synchronous navigation policy reply.
+ if (receivedPolicyAction)
+ m_frame->didReceivePolicyDecision(listenerID, static_cast<PolicyAction>(policyAction), 0);
}
void WebFrameLoaderClient::cancelPolicyCheck()
@@ -900,7 +879,7 @@ void WebFrameLoaderClient::didDisplayInsecureContent()
webPage->send(Messages::WebPageProxy::DidDisplayInsecureContentForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get())));
}
-void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin*)
+void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin*, const KURL&)
{
WebPage* webPage = m_frame->page();
if (!webPage)
@@ -1003,7 +982,9 @@ void WebFrameLoaderClient::saveViewStateToItem(HistoryItem*)
void WebFrameLoaderClient::restoreViewState()
{
- notImplemented();
+ // Inform the UI process of the scale factor.
+ double scaleFactor = m_frame->coreFrame()->loader()->history()->currentItem()->pageScaleFactor();
+ m_frame->page()->send(Messages::WebPageProxy::ViewScaleFactorDidChange(scaleFactor));
}
void WebFrameLoaderClient::provisionalLoadStarted()
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
index 29c8bdd..9070b3a 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
@@ -137,7 +137,7 @@ private:
virtual void dispatchDidChangeBackForwardIndex() const;
virtual void didDisplayInsecureContent();
- virtual void didRunInsecureContent(WebCore::SecurityOrigin*);
+ virtual void didRunInsecureContent(WebCore::SecurityOrigin*, const WebCore::KURL&);
virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&);
virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&);
@@ -222,9 +222,6 @@ private:
bool m_frameHasCustomRepresentation;
};
-uint32_t modifiersForNavigationAction(const WebCore::NavigationAction&);
-int32_t mouseButtonForNavigationAction(const WebCore::NavigationAction&);
-
} // namespace WebKit
#endif // WebFrameLoaderClient_h
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp
index 8701022..1f920a1 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebGeolocationClient.h"
#if ENABLE(CLIENT_BASED_GEOLOCATION)
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp
index ddd1fa8..80552f0 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebInspectorClient.h"
#if ENABLE(INSPECTOR)
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp
index 28d3b3d..6298293 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebInspectorFrontendClient.h"
#if ENABLE(INSPECTOR)
@@ -40,7 +41,7 @@ using namespace WebCore;
namespace WebKit {
WebInspectorFrontendClient::WebInspectorFrontendClient(WebPage* page, WebPage* inspectorPage)
- : InspectorFrontendClientLocal(page->corePage()->inspectorController(), inspectorPage->corePage())
+ : InspectorFrontendClientLocal(page->corePage()->inspectorController(), inspectorPage->corePage(), new Settings())
, m_page(page)
{
}
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
index 49b31ef..479252a 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPlatformStrategies.h"
#if USE(PLATFORM_STRATEGIES)
@@ -213,6 +214,13 @@ String WebPlatformStrategies::contextMenuItemTagCopyImageToClipboard()
return UI_STRING("Copy Image", "Copy Image context menu item");
}
+#if PLATFORM(QT)
+String WebPlatformStrategies::contextMenuItemTagCopyImageUrlToClipboard()
+{
+ return UI_STRING("Copy Image Address", "Copy Image Address menu item");
+}
+#endif
+
String WebPlatformStrategies::contextMenuItemTagOpenVideoInNewWindow()
{
return UI_STRING("Open Video in New Window", "Open Video in New Window context menu item");
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h
index b584f8d..a763475 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h
@@ -68,6 +68,9 @@ private:
virtual String contextMenuItemTagOpenImageInNewWindow();
virtual String contextMenuItemTagDownloadImageToDisk();
virtual String contextMenuItemTagCopyImageToClipboard();
+#if PLATFORM(QT)
+ virtual String contextMenuItemTagCopyImageUrlToClipboard();
+#endif
virtual String contextMenuItemTagOpenFrameInNewWindow();
virtual String contextMenuItemTagCopy();
virtual String contextMenuItemTagGoBack();
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp
index ea0ad2d..7242d4f 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "config.h"
#include "WebPopupMenu.h"
#include "PlatformPopupMenuData.h"
@@ -85,7 +86,8 @@ Vector<WebPopupItem> WebPopupMenu::populateItems()
// FIXME: Add support for styling the font.
// FIXME: Add support for styling the foreground and background colors.
// FIXME: Find a way to customize text color when an item is highlighted.
- items.append(WebPopupItem(WebPopupItem::Item, m_popupClient->itemText(i), m_popupClient->itemToolTip(i), m_popupClient->itemAccessibilityText(i), m_popupClient->itemIsEnabled(i), m_popupClient->itemIsLabel(i)));
+ PopupMenuStyle itemStyle = m_popupClient->itemStyle(i);
+ items.append(WebPopupItem(WebPopupItem::Item, m_popupClient->itemText(i), itemStyle.textDirection(), itemStyle.hasTextDirectionOverride(), m_popupClient->itemToolTip(i), m_popupClient->itemAccessibilityText(i), m_popupClient->itemIsEnabled(i), m_popupClient->itemIsLabel(i)));
}
}
@@ -110,7 +112,7 @@ void WebPopupMenu::show(const IntRect& rect, FrameView* view, int index)
PlatformPopupMenuData platformData;
setUpPlatformData(pageCoordinates, platformData);
- WebProcess::shared().connection()->send(Messages::WebPageProxy::ShowPopupMenu(pageCoordinates, items, index, platformData), m_page->pageID());
+ WebProcess::shared().connection()->send(Messages::WebPageProxy::ShowPopupMenu(pageCoordinates, m_popupClient->menuStyle().textDirection(), items, index, platformData), m_page->pageID());
}
void WebPopupMenu::hide()
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp
index acec5f2..b875f32 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp
@@ -20,6 +20,7 @@
*/
+#include "config.h"
#include "WebSearchPopupMenu.h"
using namespace WebCore;
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp
index db9500a..b21be47 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebContextMenuClient.h"
#include "NotImplemented.h"
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp
index 6cda476..b6d71bb 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPopupMenu.h"
#include "NotImplemented.h"
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm
index 32d08b2..750a397 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm
@@ -23,13 +23,14 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "WebContextMenuClient.h"
+#import "config.h"
+#import "WebContextMenuClient.h"
-#include "NotImplemented.h"
-#include "WebPage.h"
-#include <WebCore/Frame.h>
-#include <WebCore/Page.h>
-#include <wtf/text/WTFString.h>
+#import "NotImplemented.h"
+#import "WebPage.h"
+#import <WebCore/Frame.h>
+#import <WebCore/Page.h>
+#import <wtf/text/WTFString.h>
using namespace WebCore;
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm
index 9952e3f..5169b23 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm
@@ -23,10 +23,12 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import "config.h"
+#import "WebDragClient.h"
+
#import "PasteboardTypes.h"
#import "ShareableBitmap.h"
#import "WebCoreArgumentCoders.h"
-#import "WebDragClient.h"
#import "WebPage.h"
#import "WebPageProxyMessages.h"
#import <WebCore/CachedImage.h>
@@ -45,35 +47,8 @@ using namespace WebCore;
namespace WebKit {
-const float DragLabelBorderX = 4;
-//Keep border_y in synch with DragController::LinkDragBorderInset
-const float DragLabelBorderY = 2;
-const float DragLabelRadius = 5;
-const float LabelBorderYOffset = 2;
-
-const float MinDragLabelWidthBeforeClip = 120;
-const float MaxDragLabelWidth = 320;
-
-const float DragLinkLabelFontsize = 11;
-const float DragLinkUrlFontSize = 10;
-
using namespace WebCore;
-
-static Font& fontFromNSFont(NSFont *font)
-{
- static NSFont *currentFont;
- DEFINE_STATIC_LOCAL(Font, currentRenderer, ());
-
- if ([font isEqual:currentFont])
- return currentRenderer;
- if (currentFont)
- CFRelease(currentFont);
- currentFont = font;
- CFRetain(currentFont);
- currentRenderer = Font(FontPlatformData(font, [font pointSize]), ![[NSGraphicsContext currentContext] isDrawingToScreen]);
- return currentRenderer;
-}
-
+
void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& at, const IntPoint& eventPos, Clipboard* clipboard, Frame* frame, bool linkDrag)
{
if (!frame)
@@ -98,88 +73,6 @@ void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& at, const
m_page->send(Messages::WebPageProxy::SetDragImage(clientPoint, IntSize([dragNSImage size]), handle, linkDrag));
}
-DragImageRef WebDragClient::createDragImageForLink(KURL& url, const String& title, Frame* frame)
-{
- if (!frame)
- return nil;
- NSString *label = 0;
- if (!title.isEmpty())
- label = title;
- NSURL *cocoaURL = url;
- NSString *urlString = [cocoaURL _web_userVisibleString];
-
- BOOL drawURLString = YES;
- BOOL clipURLString = NO;
- BOOL clipLabelString = NO;
-
- if (!label) {
- drawURLString = NO;
- label = urlString;
- }
-
- NSFont *labelFont = [[NSFontManager sharedFontManager] convertFont:[NSFont systemFontOfSize:DragLinkLabelFontsize]
- toHaveTrait:NSBoldFontMask];
- NSFont *urlFont = [NSFont systemFontOfSize:DragLinkUrlFontSize];
- NSSize labelSize;
- labelSize.width = [label _web_widthWithFont: labelFont];
- labelSize.height = [labelFont ascender] - [labelFont descender];
- if (labelSize.width > MaxDragLabelWidth){
- labelSize.width = MaxDragLabelWidth;
- clipLabelString = YES;
- }
-
- NSSize imageSize;
- imageSize.width = labelSize.width + DragLabelBorderX * 2;
- imageSize.height = labelSize.height + DragLabelBorderY * 2;
- if (drawURLString) {
- NSSize urlStringSize;
- urlStringSize.width = [urlString _web_widthWithFont: urlFont];
- urlStringSize.height = [urlFont ascender] - [urlFont descender];
- imageSize.height += urlStringSize.height;
- if (urlStringSize.width > MaxDragLabelWidth) {
- imageSize.width = max(MaxDragLabelWidth + DragLabelBorderY * 2, MinDragLabelWidthBeforeClip);
- clipURLString = YES;
- } else
- imageSize.width = max(labelSize.width + DragLabelBorderX * 2, urlStringSize.width + DragLabelBorderX * 2);
- }
- NSImage *dragImage = [[[NSImage alloc] initWithSize: imageSize] autorelease];
- [dragImage lockFocus];
-
- [[NSColor colorWithDeviceRed: 0.7f green: 0.7f blue: 0.7f alpha: 0.8f] set];
-
- // Drag a rectangle with rounded corners
- NSBezierPath *path = [NSBezierPath bezierPath];
- [path appendBezierPathWithOvalInRect: NSMakeRect(0, 0, DragLabelRadius * 2, DragLabelRadius * 2)];
- [path appendBezierPathWithOvalInRect: NSMakeRect(0, imageSize.height - DragLabelRadius * 2, DragLabelRadius * 2, DragLabelRadius * 2)];
- [path appendBezierPathWithOvalInRect: NSMakeRect(imageSize.width - DragLabelRadius * 2, imageSize.height - DragLabelRadius * 2, DragLabelRadius * 2, DragLabelRadius * 2)];
- [path appendBezierPathWithOvalInRect: NSMakeRect(imageSize.width - DragLabelRadius * 2, 0, DragLabelRadius * 2, DragLabelRadius * 2)];
-
- [path appendBezierPathWithRect: NSMakeRect(DragLabelRadius, 0, imageSize.width - DragLabelRadius * 2, imageSize.height)];
- [path appendBezierPathWithRect: NSMakeRect(0, DragLabelRadius, DragLabelRadius + 10, imageSize.height - 2 * DragLabelRadius)];
- [path appendBezierPathWithRect: NSMakeRect(imageSize.width - DragLabelRadius - 20, DragLabelRadius, DragLabelRadius + 20, imageSize.height - 2 * DragLabelRadius)];
- [path fill];
-
- NSColor *topColor = [NSColor colorWithDeviceWhite:0.0f alpha:0.75f];
- NSColor *bottomColor = [NSColor colorWithDeviceWhite:1.0f alpha:0.5f];
- if (drawURLString) {
- if (clipURLString)
- //urlString = [WebStringTruncator centerTruncateString: urlString toWidth:imageSize.width - (DragLabelBorderX * 2) withFont:urlFont];
- urlString = StringTruncator::centerTruncate(urlString, imageSize.width - (DragLabelBorderX * 2), fontFromNSFont(urlFont));
- [urlString _web_drawDoubledAtPoint:NSMakePoint(DragLabelBorderX, DragLabelBorderY - [urlFont descender])
- withTopColor:topColor bottomColor:bottomColor font:urlFont];
- }
-
- if (clipLabelString)
- //label = [WebStringTruncator rightTruncateString: label toWidth:imageSize.width - (DragLabelBorderX * 2) withFont:labelFont];
- label = StringTruncator::rightTruncate(label, imageSize.width - (DragLabelBorderX * 2), fontFromNSFont(labelFont));
- [label _web_drawDoubledAtPoint:NSMakePoint (DragLabelBorderX, imageSize.height - LabelBorderYOffset - [labelFont pointSize])
- withTopColor:topColor bottomColor:bottomColor font:labelFont];
-
- [dragImage unlockFocus];
-
- return dragImage;
-}
-
static void writeURL(NSPasteboard* pasteboard, NSURL* URL, NSString* title, NSArray* types)
{
ASSERT(URL);
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
index ce33890..ee87ea2 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
@@ -27,26 +27,27 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import "config.h"
#import "WebEditorClient.h"
#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
-#include "NotImplemented.h"
-
-#include "WebCoreArgumentCoders.h"
-#include "WebPage.h"
-#include "WebFrame.h"
-#include "WebPageProxyMessages.h"
-#include "WebProcess.h"
-#include <WebCore/ArchiveResource.h>
-#include <WebCore/DocumentFragment.h>
-#include <WebCore/DOMDocumentFragmentInternal.h>
-#include <WebCore/DOMDocumentInternal.h>
-#include <WebCore/FocusController.h>
-#include <WebCore/Frame.h>
-#include <WebCore/KeyboardEvent.h>
-#include <WebCore/Page.h>
-#include <WebKit/WebResource.h>
-#include <WebKit/WebNSURLExtras.h>
+#import "NotImplemented.h"
+
+#import "WebCoreArgumentCoders.h"
+#import "WebPage.h"
+#import "WebFrame.h"
+#import "WebPageProxyMessages.h"
+#import "WebProcess.h"
+#import <WebCore/ArchiveResource.h>
+#import <WebCore/DocumentFragment.h>
+#import <WebCore/DOMDocumentFragmentInternal.h>
+#import <WebCore/DOMDocumentInternal.h>
+#import <WebCore/FocusController.h>
+#import <WebCore/Frame.h>
+#import <WebCore/KeyboardEvent.h>
+#import <WebCore/Page.h>
+#import <WebKit/WebResource.h>
+#import <WebKit/WebNSURLExtras.h>
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
#import <AppKit/NSTextChecker.h>
#endif
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm
index 549d7ee..677c537 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm
@@ -23,13 +23,14 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "WebErrors.h"
-
-#include "WKError.h"
-#include "WebError.h"
-#include <WebCore/ResourceRequest.h>
-#include <WebCore/ResourceResponse.h>
-#include <pthread.h>
+#import "config.h"
+#import "WebErrors.h"
+
+#import "WKError.h"
+#import "WebError.h"
+#import <WebCore/ResourceRequest.h>
+#import <WebCore/ResourceResponse.h>
+#import <pthread.h>
using namespace WebCore;
using namespace WebKit;
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm
index 570d351..d91e8e8 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm
@@ -17,6 +17,7 @@
Boston, MA 02110-1301, USA.
*/
+#import "config.h"
#import "WebFrameNetworkingContext.h"
#import <WebCore/Page.h>
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm
index 4d3d167..7e446b7 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm
@@ -23,9 +23,10 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "WebPopupMenu.h"
+#import "config.h"
+#import "WebPopupMenu.h"
-#include "PlatformPopupMenuData.h"
+#import "PlatformPopupMenuData.h"
using namespace WebCore;
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
index f81b627..2d74bbc 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import "config.h"
#import "WebSystemInterface.h"
#import <WebCore/WebCoreSystemInterface.h>
@@ -55,6 +56,7 @@ void InitWebCoreSystemInterface(void)
INIT(GetFontInLanguageForRange);
INIT(GetGlyphTransformedAdvances);
INIT(GetGlyphsForCharacters);
+ INIT(GetHTTPPipeliningPriority);
INIT(GetMIMETypeForExtension);
INIT(GetNSURLResponseLastModifiedDate);
INIT(GetPreferredExtensionForMIMEType);
@@ -82,6 +84,7 @@ void InitWebCoreSystemInterface(void)
INIT(SetCONNECTProxyForStream);
INIT(SetCookieStoragePrivateBrowsingEnabled);
INIT(SetDragImage);
+ INIT(SetHTTPPipeliningPriority);
INIT(SetNSURLConnectionDefersCallbacks);
INIT(SetNSURLRequestShouldContentSniff);
INIT(SetPatternBaseCTM);
@@ -92,11 +95,51 @@ void InitWebCoreSystemInterface(void)
INIT(SignalCFReadStreamHasBytes);
#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ INIT(IOSurfaceContextCreate);
+ INIT(IOSurfaceContextCreateImage);
INIT(CreateCTTypesetterWithUniCharProviderAndOptions);
INIT(MakeScrollbarPainter);
+ INIT(ScrollbarPainterSetDelegate);
INIT(ScrollbarPainterPaint);
+ INIT(ScrollbarThickness);
+ INIT(ScrollbarMinimumThumbLength);
+ INIT(ScrollbarMinimumTotalLengthNeededForThumb);
+ INIT(ScrollbarPainterKnobAlpha);
+ INIT(SetScrollbarPainterKnobAlpha);
+ INIT(ScrollbarPainterTrackAlpha);
+ INIT(SetScrollbarPainterTrackAlpha);
+ INIT(ScrollbarPainterIsHorizontal);
+ INIT(ScrollbarPainterSetOverlayState);
+ INIT(MakeScrollbarPainterController);
+ INIT(MakeScrollbarReplacementPainter);
+ INIT(SetPainterForPainterController);
+ INIT(VerticalScrollbarPainterForController);
+ INIT(HorizontalScrollbarPainterForController);
+ INIT(SetScrollbarPainterControllerStyle);
+ INIT(ContentAreaScrolled);
+ INIT(ContentAreaWillPaint);
+ INIT(MouseEnteredContentArea);
+ INIT(MouseExitedContentArea);
+ INIT(MouseMovedInContentArea);
+ INIT(WillStartLiveResize);
+ INIT(ContentAreaResized);
+ INIT(WillEndLiveResize);
+ INIT(ContentAreaDidShow);
+ INIT(ContentAreaDidHide);
+ INIT(ScrollbarPainterUsesOverlayScrollers);
#else
INIT(GetHyphenationLocationBeforeIndex);
#endif
+
+ INIT(GetAXTextMarkerTypeID);
+ INIT(GetAXTextMarkerRangeTypeID);
+ INIT(CreateAXTextMarker);
+ INIT(GetBytesFromAXTextMarker);
+ INIT(CreateAXTextMarkerRange);
+ INIT(CopyAXTextMarkerRangeStart);
+ INIT(CopyAXTextMarkerRangeEnd);
+ INIT(AccessibilityHandleFocusChanged);
+ INIT(CreateAXUIElementRef);
+ INIT(UnregisterUniqueIdForElement);
});
}
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp
index abfb70a..f6c45b0 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebContextMenuClient.h"
#include "NotImplemented.h"
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp
index cee6842..61c2a3a 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebErrors.h"
#include <WebCore/ResourceRequest.h>
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp
index 55552e1..5fcaa84 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp
@@ -18,7 +18,6 @@
*/
#include "config.h"
-
#include "WebFrameNetworkingContext.h"
#include "WebProcess.h"
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp
index 4d3d167..b21f06c 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPopupMenu.h"
#include "PlatformPopupMenuData.h"
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp
index c16a4d6..c866c1d 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebContextMenuClient.h"
#include <WebCore/NotImplemented.h>
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragClientWin.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragClientWin.cpp
new file mode 100644
index 0000000..7381096
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragClientWin.cpp
@@ -0,0 +1,89 @@
+/*
+ * 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 "WebDragClient.h"
+
+#include "ShareableBitmap.h"
+#include "WebCoreArgumentCoders.h"
+#include "WebPage.h"
+#include "WebPageProxyMessages.h"
+#include <WebCore/BitmapInfo.h>
+#include <WebCore/COMPtr.h>
+#include <WebCore/ClipboardWin.h>
+#include <WebCore/DragController.h>
+#include <WebCore/Frame.h>
+#include <WebCore/GraphicsContext.h>
+#include <WebCore/Page.h>
+#include <shlobj.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static DWORD draggingSourceOperationMaskToDragCursors(DragOperation op)
+{
+ DWORD result = DROPEFFECT_NONE;
+ if (op == DragOperationEvery)
+ return DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOVE;
+ if (op & DragOperationCopy)
+ result |= DROPEFFECT_COPY;
+ if (op & DragOperationLink)
+ result |= DROPEFFECT_LINK;
+ if (op & DragOperationMove)
+ result |= DROPEFFECT_MOVE;
+ if (op & DragOperationGeneric)
+ result |= DROPEFFECT_MOVE;
+ return result;
+}
+
+void WebDragClient::startDrag(DragImageRef image, const IntPoint& imageOrigin, const IntPoint& dragPoint, Clipboard* clipboard, Frame* frame, bool isLink)
+{
+ COMPtr<IDataObject> dataObject = static_cast<ClipboardWin*>(clipboard)->dataObject();
+
+ if (!dataObject)
+ return;
+
+ OwnPtr<HDC> bitmapDC(CreateCompatibleDC(0));
+ BITMAPINFO bitmapInfo = {0};
+ bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ GetDIBits(bitmapDC.get(), image, 0, 0, 0, &bitmapInfo, DIB_RGB_COLORS);
+ if (bitmapInfo.bmiHeader.biSizeImage <= 0)
+ bitmapInfo.bmiHeader.biSizeImage = bitmapInfo.bmiHeader.biWidth * abs(bitmapInfo.bmiHeader.biHeight) * (bitmapInfo.bmiHeader.biBitCount + 7) / 8;
+
+ RefPtr<SharedMemory> memoryBuffer = SharedMemory::create(bitmapInfo.bmiHeader.biSizeImage);
+
+ bitmapInfo.bmiHeader.biCompression = BI_RGB;
+ GetDIBits(bitmapDC.get(), image, 0, bitmapInfo.bmiHeader.biHeight, memoryBuffer->data(), &bitmapInfo, DIB_RGB_COLORS);
+
+ SharedMemory::Handle handle;
+ if (!memoryBuffer->createHandle(handle, SharedMemory::ReadOnly))
+ return;
+ DWORD okEffect = draggingSourceOperationMaskToDragCursors(m_page->corePage()->dragController()->sourceDragOperation());
+ DragData dragData(dataObject.get(), IntPoint(), IntPoint(), DragOperationNone);
+ m_page->send(Messages::WebPageProxy::StartDragDrop(imageOrigin, dragPoint, okEffect, dragData.dragDataMap(), IntSize(bitmapInfo.bmiHeader.biWidth, bitmapInfo.bmiHeader.biHeight), handle, isLink), m_page->pageID());
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragSource.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragSource.cpp
new file mode 100644
index 0000000..b4f1414
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragSource.cpp
@@ -0,0 +1,87 @@
+/*
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR
+ * 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 "WebDragSource.h"
+
+#include <WebCore/Cursor.h>
+#include <WebCore/DragActions.h>
+#include <WebCore/EventHandler.h>
+#include <WebCore/Frame.h>
+#include <WebCore/Page.h>
+#include <WebCore/PlatformMouseEvent.h>
+#include <wtf/CurrentTime.h>
+
+using namespace WebCore;
+
+PassRefPtr<WebDragSource> WebDragSource::createInstance()
+{
+ return adoptRef(new WebDragSource);
+}
+
+WebDragSource::WebDragSource()
+{
+}
+
+HRESULT WebDragSource::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IDropSource)) {
+ *ppvObject = this;
+ AddRef();
+
+ return S_OK;
+ }
+
+ return E_NOINTERFACE;
+}
+
+ULONG WebDragSource::AddRef(void)
+{
+ ref();
+ return refCount();
+}
+
+ULONG WebDragSource::Release(void)
+{
+ deref();
+ return refCount();
+}
+
+HRESULT WebDragSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfState)
+{
+ if (fEscapePressed)
+ return DRAGDROP_S_CANCEL;
+
+ if (grfState & (MK_LBUTTON | MK_RBUTTON))
+ return S_OK;
+
+ return DRAGDROP_S_DROP;
+}
+
+HRESULT WebDragSource::GiveFeedback(DWORD dwEffect)
+{
+ return DRAGDROP_S_USEDEFAULTCURSORS;
+}
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragSource.h b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragSource.h
new file mode 100644
index 0000000..c2c5f3f
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragSource.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 COMPUTER, INC. ``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 COMPUTER, INC. OR
+ * 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 WebDragSource_h
+#define WebDragSource_h
+
+#include <WTF/RefCounted.h>
+#include <WebCore/COMPtr.h>
+#include <objidl.h>
+
+class WebDragSource : public IDropSource, public RefCounted<WebDragSource> {
+public:
+ static PassRefPtr<WebDragSource> createInstance();
+
+private:
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef();
+ virtual ULONG STDMETHODCALLTYPE Release();
+ virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(BOOL fEscapePressed, DWORD grfState);
+ virtual HRESULT STDMETHODCALLTYPE GiveFeedback(DWORD dwEffect);
+ WebDragSource();
+};
+
+#endif // !WebDragSource_h
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebErrorsWin.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebErrorsWin.cpp
index b29b461..b31920c 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebErrorsWin.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebErrorsWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebErrors.h"
#include "WKError.h"
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp
index 9c23133..b80dccd 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPopupMenu.h"
#include "PlatformPopupMenuData.h"
@@ -49,7 +50,7 @@ void WebPopupMenu::setUpPlatformData(const WebCore::IntRect& pageCoordinates, Pl
data.m_clientPaddingRight = m_popupClient->clientPaddingRight();
data.m_clientInsetLeft = m_popupClient->clientInsetLeft();
data.m_clientInsetRight = m_popupClient->clientInsetRight();
- data.m_itemHeight = m_popupClient->menuStyle().font().height() + 1;
+ data.m_itemHeight = m_popupClient->menuStyle().font().fontMetrics().height() + 1;
int popupWidth = 0;
for (size_t i = 0; i < itemCount; ++i) {
@@ -115,7 +116,7 @@ void WebPopupMenu::setUpPlatformData(const WebCore::IntRect& pageCoordinates, Pl
unsigned length = itemText.length();
const UChar* string = itemText.characters();
- TextRun textRun(string, length, false, 0, 0, itemText.defaultWritingDirection() == WTF::Unicode::RightToLeft);
+ TextRun textRun(string, length, false, 0, 0, TextRun::AllowTrailingExpansion, itemText.defaultWritingDirection() == WTF::Unicode::RightToLeft);
notSelectedBackingStoreContext->setFillColor(optionTextColor, ColorSpaceDeviceRGB);
selectedBackingStoreContext->setFillColor(activeOptionTextColor, ColorSpaceDeviceRGB);
@@ -133,7 +134,7 @@ void WebPopupMenu::setUpPlatformData(const WebCore::IntRect& pageCoordinates, Pl
int textX = std::max(0, data.m_clientPaddingLeft - data.m_clientInsetLeft);
if (RenderTheme::defaultTheme()->popupOptionSupportsTextIndent() && itemStyle.textDirection() == LTR)
textX += itemStyle.textIndent().calcMinValue(itemRect.width());
- int textY = itemRect.y() + itemFont.ascent() + (itemRect.height() - itemFont.height()) / 2;
+ int textY = itemRect.y() + itemFont.fontMetrics().ascent() + (itemRect.height() - itemFont.fontMetrics().height()) / 2;
notSelectedBackingStoreContext->drawBidiText(itemFont, textRun, IntPoint(textX, textY));
selectedBackingStoreContext->drawBidiText(itemFont, textRun, IntPoint(textX, textY));
diff --git a/Source/WebKit2/WebProcess/WebKitMain.cpp b/Source/WebKit2/WebProcess/WebKitMain.cpp
index 53084a6..d8bebb0 100644
--- a/Source/WebKit2/WebProcess/WebKitMain.cpp
+++ b/Source/WebKit2/WebProcess/WebKitMain.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "CommandLine.h"
#include "PluginProcessMain.h"
diff --git a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp
index d629ced..f5100aa 100644
--- a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ChunkedUpdateDrawingArea.h"
#include "DrawingAreaMessageKinds.h"
@@ -89,12 +90,18 @@ void ChunkedUpdateDrawingArea::display()
UpdateChunk updateChunk(dirtyRect);
paintIntoUpdateChunk(&updateChunk);
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::Update, m_webPage->pageID(), CoreIPC::In(updateChunk));
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::Update, m_webPage->pageID(), CoreIPC::In(updateChunk));
m_isWaitingForUpdate = true;
m_displayTimer.stop();
}
+void ChunkedUpdateDrawingArea::forceRepaint()
+{
+ m_isWaitingForUpdate = false;
+ display();
+}
+
void ChunkedUpdateDrawingArea::scheduleDisplay()
{
if (m_paintingIsSuspended)
@@ -132,7 +139,7 @@ void ChunkedUpdateDrawingArea::setSize(const IntSize& viewSize)
ASSERT(!m_displayTimer.isActive());
// Painting is suspended, just send back an empty update chunk.
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(UpdateChunk()));
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(UpdateChunk()));
return;
}
@@ -142,7 +149,7 @@ void ChunkedUpdateDrawingArea::setSize(const IntSize& viewSize)
m_displayTimer.stop();
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(updateChunk));
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(updateChunk));
}
void ChunkedUpdateDrawingArea::suspendPainting()
@@ -161,7 +168,7 @@ void ChunkedUpdateDrawingArea::resumePainting(bool forceRepaint)
if (forceRepaint) {
// Just set the dirty rect to the entire page size.
- m_dirtyRect = IntRect(IntPoint(0, 0), m_webPage->size());
+ m_dirtyRect = m_webPage->bounds();
}
// Schedule a display.
diff --git a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h
index 08aa3e7..d32ed4c 100644
--- a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h
+++ b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h
@@ -42,6 +42,7 @@ public:
virtual void setNeedsDisplay(const WebCore::IntRect&);
virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
virtual void display();
+ virtual void forceRepaint();
#if USE(ACCELERATED_COMPOSITING)
virtual void attachCompositingContext() { }
diff --git a/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp b/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp
index e5de52f..1649fb1 100644
--- a/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "DecoderAdapter.h"
#include "WebCoreArgumentCoders.h"
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp
index ea5b443..10a8dbf 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp
@@ -23,12 +23,13 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "DrawingArea.h"
// Subclasses
#include "ChunkedUpdateDrawingArea.h"
-#ifdef __APPLE__
+#if PLATFORM(MAC) || PLATFORM(WIN)
#include "DrawingAreaImpl.h"
#endif
@@ -52,7 +53,7 @@ PassRefPtr<DrawingArea> DrawingArea::create(WebPage* webPage, const WebPageCreat
break;
case DrawingAreaInfo::Impl:
-#ifdef __APPLE__
+#if PLATFORM(MAC) || PLATFORM(WIN)
return DrawingAreaImpl::create(webPage, parameters);
#else
return 0;
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
index 713994d..de256b6 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
@@ -40,7 +40,7 @@ namespace WebCore {
namespace WebKit {
class WebPage;
-class WebPageCreationParameters;
+struct WebPageCreationParameters;
class DrawingArea : public RefCounted<DrawingArea> {
public:
@@ -48,17 +48,22 @@ public:
static PassRefPtr<DrawingArea> create(WebPage*, const WebPageCreationParameters&);
virtual ~DrawingArea();
-#ifdef __APPLE__
+#if PLATFORM(MAC) || PLATFORM(WIN)
void didReceiveDrawingAreaMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
#endif
virtual void setNeedsDisplay(const WebCore::IntRect&) = 0;
virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) = 0;
+ // FIXME: These should be pure virtual.
virtual void pageBackgroundTransparencyChanged() { }
-
virtual void onPageClose() { }
-
+ virtual void forceRepaint() { }
+
+ virtual void didInstallPageOverlay() { }
+ virtual void didUninstallPageOverlay() { }
+ virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&) { }
+
#if USE(ACCELERATED_COMPOSITING)
virtual void attachCompositingContext() = 0;
virtual void detachCompositingContext() = 0;
@@ -80,7 +85,7 @@ protected:
private:
// CoreIPC message handlers.
// FIXME: These should be pure virtual.
- virtual void setSize(const WebCore::IntSize&) { }
+ virtual void setSize(const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset) { }
virtual void didUpdate() { }
virtual void suspendPainting() { }
virtual void resumePainting() { }
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in b/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in
index 682ef5a..ec09e18 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in
@@ -21,7 +21,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
messages -> DrawingArea {
- SetSize(WebCore::IntSize size)
+ SetSize(WebCore::IntSize size, WebCore::IntSize scrollOffset)
DidUpdate()
SuspendPainting()
ResumePainting()
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
index 2063bd6..6d65fae 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
@@ -23,9 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "DrawingAreaImpl.h"
#include "DrawingAreaProxyMessages.h"
+#include "LayerTreeContext.h"
#include "ShareableBitmap.h"
#include "UpdateInfo.h"
#include "WebPage.h"
@@ -33,7 +35,7 @@
#include "WebProcess.h"
#include <WebCore/GraphicsContext.h>
-#ifndef __APPLE__
+#if !PLATFORM(MAC) && !PLATFORM(WIN)
#error "This drawing area is not ready for use by other ports yet."
#endif
@@ -41,6 +43,12 @@ using namespace WebCore;
namespace WebKit {
+static uint64_t generateSequenceNumber()
+{
+ static uint64_t sequenceNumber;
+ return ++sequenceNumber;
+}
+
PassRefPtr<DrawingAreaImpl> DrawingAreaImpl::create(WebPage* webPage, const WebPageCreationParameters& parameters)
{
return adoptRef(new DrawingAreaImpl(webPage, parameters));
@@ -48,27 +56,50 @@ PassRefPtr<DrawingAreaImpl> DrawingAreaImpl::create(WebPage* webPage, const WebP
DrawingAreaImpl::~DrawingAreaImpl()
{
+ if (m_layerTreeHost)
+ m_layerTreeHost->invalidate();
}
DrawingAreaImpl::DrawingAreaImpl(WebPage* webPage, const WebPageCreationParameters& parameters)
: DrawingArea(DrawingAreaInfo::Impl, parameters.drawingAreaInfo.identifier, webPage)
+ , m_inSetSize(false)
, m_isWaitingForDidUpdate(false)
, m_isPaintingSuspended(!parameters.isVisible)
, m_displayTimer(WebProcess::shared().runLoop(), this, &DrawingAreaImpl::display)
+ , m_exitCompositingTimer(WebProcess::shared().runLoop(), this, &DrawingAreaImpl::exitAcceleratedCompositingMode)
{
}
void DrawingAreaImpl::setNeedsDisplay(const IntRect& rect)
{
- if (rect.isEmpty())
+ IntRect dirtyRect = rect;
+ dirtyRect.intersect(m_webPage->bounds());
+
+ if (dirtyRect.isEmpty())
return;
- m_dirtyRegion.unite(rect);
+ if (m_layerTreeHost) {
+ ASSERT(m_dirtyRegion.isEmpty());
+
+ m_layerTreeHost->setNonCompositedContentsNeedDisplay(dirtyRect);
+ return;
+ }
+
+ m_dirtyRegion.unite(dirtyRect);
scheduleDisplay();
}
void DrawingAreaImpl::scroll(const IntRect& scrollRect, const IntSize& scrollOffset)
{
+ if (m_layerTreeHost) {
+ ASSERT(m_scrollRect.isEmpty());
+ ASSERT(m_scrollOffset.isEmpty());
+ ASSERT(m_dirtyRegion.isEmpty());
+
+ m_layerTreeHost->scrollNonCompositedContents(scrollRect, scrollOffset);
+ return;
+ }
+
if (!m_scrollRect.isEmpty() && scrollRect != m_scrollRect) {
unsigned scrollArea = scrollRect.width() * scrollRect.height();
unsigned currentScrollArea = m_scrollRect.width() * m_scrollRect.height();
@@ -109,6 +140,36 @@ void DrawingAreaImpl::scroll(const IntRect& scrollRect, const IntSize& scrollOff
m_scrollOffset += scrollOffset;
}
+void DrawingAreaImpl::forceRepaint()
+{
+ m_isWaitingForDidUpdate = false;
+ display();
+}
+
+void DrawingAreaImpl::didInstallPageOverlay()
+{
+ if (m_layerTreeHost)
+ m_layerTreeHost->didInstallPageOverlay();
+}
+
+void DrawingAreaImpl::didUninstallPageOverlay()
+{
+ if (m_layerTreeHost)
+ m_layerTreeHost->didUninstallPageOverlay();
+
+ setNeedsDisplay(m_webPage->bounds());
+}
+
+void DrawingAreaImpl::setPageOverlayNeedsDisplay(const IntRect& rect)
+{
+ if (m_layerTreeHost) {
+ m_layerTreeHost->setPageOverlayNeedsDisplay(rect);
+ return;
+ }
+
+ setNeedsDisplay(rect);
+}
+
void DrawingAreaImpl::attachCompositingContext()
{
}
@@ -117,12 +178,31 @@ void DrawingAreaImpl::detachCompositingContext()
{
}
-void DrawingAreaImpl::setRootCompositingLayer(WebCore::GraphicsLayer*)
+void DrawingAreaImpl::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
{
+ if (graphicsLayer) {
+ if (!m_layerTreeHost) {
+ // We're actually entering accelerated compositing mode.
+ enterAcceleratedCompositingMode(graphicsLayer);
+ } else {
+ m_exitCompositingTimer.stop();
+ // We're already in accelerated compositing mode, but the root compositing layer changed.
+ m_layerTreeHost->setRootCompositingLayer(graphicsLayer);
+ }
+ } else {
+ if (m_layerTreeHost) {
+ // We'll exit accelerated compositing mode on a timer, to avoid re-entering
+ // compositing code via display() and layout.
+ exitAcceleratedCompositingModeSoon();
+ }
+ }
}
void DrawingAreaImpl::scheduleCompositingLayerSync()
{
+ if (!m_layerTreeHost)
+ return;
+ m_layerTreeHost->scheduleLayerFlush();
}
void DrawingAreaImpl::syncCompositingLayers()
@@ -133,27 +213,48 @@ void DrawingAreaImpl::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID
{
}
-void DrawingAreaImpl::setSize(const IntSize& size)
+void DrawingAreaImpl::setSize(const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset)
{
+ ASSERT(!m_inSetSize);
+ m_inSetSize = true;
+
// Set this to false since we're about to call display().
m_isWaitingForDidUpdate = false;
m_webPage->setSize(size);
m_webPage->layoutIfNeeded();
+ m_webPage->scrollMainFrameIfNotAtMaxScrollPosition(scrollOffset);
UpdateInfo updateInfo;
+ LayerTreeContext layerTreeContext;
- if (m_isPaintingSuspended) {
- updateInfo.timestamp = currentTime();
+ if (m_layerTreeHost) {
+ m_layerTreeHost->sizeDidChange(size);
+ layerTreeContext = m_layerTreeHost->layerTreeContext();
+ }
+
+ if (m_isPaintingSuspended || m_layerTreeHost)
updateInfo.viewSize = m_webPage->size();
- } else
+ else {
+ m_dirtyRegion.unite(m_webPage->bounds());
+
+ // The display here should not cause layout to happen, so we can't enter accelerated compositing mode here.
display(updateInfo);
+ ASSERT(!m_layerTreeHost);
+ }
- m_webPage->send(Messages::DrawingAreaProxy::DidSetSize(updateInfo));
+ m_webPage->send(Messages::DrawingAreaProxy::DidSetSize(generateSequenceNumber(), updateInfo, layerTreeContext));
+
+ m_inSetSize = false;
}
void DrawingAreaImpl::didUpdate()
{
+ // We might get didUpdate messages from the UI process even after we've
+ // entered accelerated compositing mode. Ignore them.
+ if (m_layerTreeHost)
+ return;
+
m_isWaitingForDidUpdate = false;
// Display if needed.
@@ -174,7 +275,62 @@ void DrawingAreaImpl::resumePainting()
m_isPaintingSuspended = false;
- // FIXME: Repaint if needed.
+ // FIXME: We shouldn't always repaint everything here.
+ setNeedsDisplay(m_webPage->bounds());
+}
+
+void DrawingAreaImpl::enterAcceleratedCompositingMode(GraphicsLayer* graphicsLayer)
+{
+ m_exitCompositingTimer.stop();
+
+ ASSERT(!m_layerTreeHost);
+
+ m_layerTreeHost = LayerTreeHost::create(m_webPage);
+ m_layerTreeHost->setRootCompositingLayer(graphicsLayer);
+
+ // Non-composited content will now be handled exclusively by the layer tree host.
+ m_dirtyRegion = Region();
+ m_scrollRect = IntRect();
+ m_scrollOffset = IntSize();
+ m_displayTimer.stop();
+ m_isWaitingForDidUpdate = false;
+
+ if (!m_inSetSize)
+ m_webPage->send(Messages::DrawingAreaProxy::EnterAcceleratedCompositingMode(generateSequenceNumber(), m_layerTreeHost->layerTreeContext()));
+}
+
+void DrawingAreaImpl::exitAcceleratedCompositingMode()
+{
+ m_exitCompositingTimer.stop();
+
+ ASSERT(m_layerTreeHost);
+
+ m_layerTreeHost->invalidate();
+ m_layerTreeHost = nullptr;
+
+ if (m_inSetSize)
+ return;
+
+ UpdateInfo updateInfo;
+ if (m_isPaintingSuspended)
+ updateInfo.viewSize = m_webPage->size();
+ else {
+ m_dirtyRegion = m_webPage->bounds();
+ display(updateInfo);
+ }
+
+ // Send along a complete update of the page so we can paint the contents right after we exit the
+ // accelerated compositing mode, eliminiating flicker.
+ if (!m_inSetSize)
+ m_webPage->send(Messages::DrawingAreaProxy::ExitAcceleratedCompositingMode(generateSequenceNumber(), updateInfo));
+}
+
+void DrawingAreaImpl::exitAcceleratedCompositingModeSoon()
+{
+ if (m_exitCompositingTimer.isActive())
+ return;
+
+ m_exitCompositingTimer.startOneShot(0);
}
void DrawingAreaImpl::scheduleDisplay()
@@ -196,6 +352,7 @@ void DrawingAreaImpl::scheduleDisplay()
void DrawingAreaImpl::display()
{
+ ASSERT(!m_layerTreeHost);
ASSERT(!m_isWaitingForDidUpdate);
if (m_isPaintingSuspended)
@@ -207,7 +364,13 @@ void DrawingAreaImpl::display()
UpdateInfo updateInfo;
display(updateInfo);
- m_webPage->send(Messages::DrawingAreaProxy::Update(updateInfo));
+ if (m_layerTreeHost) {
+ // The call to update caused layout which turned on accelerated compositing.
+ // Don't send an Update message in this case.
+ return;
+ }
+
+ m_webPage->send(Messages::DrawingAreaProxy::Update(generateSequenceNumber(), updateInfo));
m_isWaitingForDidUpdate = true;
}
@@ -235,6 +398,8 @@ static bool shouldPaintBoundsRect(const IntRect& bounds, const Vector<IntRect>&
void DrawingAreaImpl::display(UpdateInfo& updateInfo)
{
ASSERT(!m_isPaintingSuspended);
+ ASSERT(!m_layerTreeHost);
+ ASSERT(!m_webPage->size().isEmpty());
// FIXME: It would be better if we could avoid painting altogether when there is a custom representation.
if (m_webPage->mainFrameHasCustomRepresentation())
@@ -263,7 +428,6 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo)
m_webPage->layoutIfNeeded();
- updateInfo.timestamp = currentTime();
updateInfo.viewSize = m_webPage->size();
updateInfo.updateRectBounds = bounds;
@@ -271,9 +435,11 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo)
for (size_t i = 0; i < rects.size(); ++i) {
m_webPage->drawRect(*graphicsContext, rects[i]);
+ if (m_webPage->hasPageOverlay())
+ m_webPage->drawPageOverlay(*graphicsContext, rects[i]);
updateInfo.updateRects.append(rects[i]);
}
-
+
// Layout can trigger more calls to setNeedsDisplay and we don't want to process them
// until the UI process has painted the update, so we stop the timer here.
m_displayTimer.stop();
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
index e008adc..cbb94c2 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
@@ -27,12 +27,13 @@
#define DrawingAreaImpl_h
#include "DrawingArea.h"
+#include "LayerTreeHost.h"
#include "Region.h"
#include "RunLoop.h"
namespace WebKit {
-struct UpdateInfo;
+class UpdateInfo;
class DrawingAreaImpl : public DrawingArea {
public:
@@ -45,6 +46,12 @@ private:
// DrawingArea
virtual void setNeedsDisplay(const WebCore::IntRect&);
virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
+ virtual void forceRepaint();
+
+ virtual void didInstallPageOverlay();
+ virtual void didUninstallPageOverlay();
+ virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&);
+
virtual void attachCompositingContext();
virtual void detachCompositingContext();
virtual void setRootCompositingLayer(WebCore::GraphicsLayer*);
@@ -53,11 +60,15 @@ private:
virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
// CoreIPC message handlers.
- virtual void setSize(const WebCore::IntSize&);
+ virtual void setSize(const WebCore::IntSize&, const WebCore::IntSize& scrollOffset);
virtual void didUpdate();
virtual void suspendPainting();
virtual void resumePainting();
+ void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*);
+ void exitAcceleratedCompositingModeSoon();
+ void exitAcceleratedCompositingMode();
+
void scheduleDisplay();
void display();
void display(UpdateInfo&);
@@ -65,7 +76,10 @@ private:
Region m_dirtyRegion;
WebCore::IntRect m_scrollRect;
WebCore::IntSize m_scrollOffset;
-
+
+ // Whether we're currently processing a setSize message.
+ bool m_inSetSize;
+
// Whether we're waiting for a DidUpdate message. Used for throttling paints so that the
// web process won't paint more frequent than the UI process can handle.
bool m_isWaitingForDidUpdate;
@@ -75,6 +89,10 @@ private:
bool m_isPaintingSuspended;
RunLoop::Timer<DrawingAreaImpl> m_displayTimer;
+ RunLoop::Timer<DrawingAreaImpl> m_exitCompositingTimer;
+
+ // The layer tree host that handles accelerated compositing.
+ RefPtr<LayerTreeHost> m_layerTreeHost;
};
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp b/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp
index 00edcce..590010b 100644
--- a/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "EncoderAdapter.h"
#include "DataReference.h"
diff --git a/Source/WebKit2/WebProcess/WebPage/FindController.cpp b/Source/WebKit2/WebProcess/WebPage/FindController.cpp
index 9b8669d..8e9dba7 100644
--- a/Source/WebKit2/WebProcess/WebPage/FindController.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/FindController.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "FindController.h"
#include "ShareableBitmap.h"
@@ -151,22 +152,30 @@ bool FindController::updateFindIndicator(Frame* selectedFrame, bool isShowingOve
if (!selectedFrame)
return false;
+ IntRect selectionRect = enclosingIntRect(selectedFrame->selection()->bounds());
+
// We want the selection rect in window coordinates.
- IntRect selectionRectInWindowCoordinates = selectedFrame->view()->contentsToWindow(enclosingIntRect(selectedFrame->selection()->bounds()));
+ IntRect selectionRectInWindowCoordinates = selectedFrame->view()->contentsToWindow(selectionRect);
Vector<FloatRect> textRects;
selectedFrame->selection()->getClippedVisibleTextRectangles(textRects);
// Create a backing store and paint the find indicator text into it.
- RefPtr<ShareableBitmap> findIndicatorTextBackingStore = ShareableBitmap::createShareable(selectionRectInWindowCoordinates.size());
+ RefPtr<ShareableBitmap> findIndicatorTextBackingStore = ShareableBitmap::createShareable(selectionRect.size());
+ if (!findIndicatorTextBackingStore)
+ return false;
+
OwnPtr<GraphicsContext> graphicsContext = findIndicatorTextBackingStore->createGraphicsContext();
- graphicsContext->translate(-selectionRectInWindowCoordinates.x(), -selectionRectInWindowCoordinates.y());
+ IntRect paintRect = selectionRect;
+ paintRect.move(selectedFrame->view()->frameRect().x(), selectedFrame->view()->frameRect().y());
+ paintRect.move(-selectedFrame->view()->scrollOffset());
+
+ graphicsContext->translate(-paintRect.x(), -paintRect.y());
selectedFrame->view()->setPaintBehavior(PaintBehaviorSelectionOnly | PaintBehaviorForceBlackText | PaintBehaviorFlattenCompositingLayers);
selectedFrame->document()->updateLayout();
- graphicsContext->clip(selectionRectInWindowCoordinates);
- selectedFrame->view()->paint(graphicsContext.get(), selectionRectInWindowCoordinates);
+ selectedFrame->view()->paint(graphicsContext.get(), paintRect);
selectedFrame->view()->setPaintBehavior(PaintBehaviorNormal);
SharedMemory::Handle handle;
@@ -259,7 +268,6 @@ static Color overlayBackgroundColor()
void FindController::drawRect(PageOverlay*, GraphicsContext& graphicsContext, const IntRect& dirtyRect)
{
Vector<IntRect> rects = rectsForTextMatches();
- ASSERT(!rects.isEmpty());
// Draw the background.
graphicsContext.fillRect(dirtyRect, overlayBackgroundColor(), ColorSpaceSRGB);
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp
index b104b29..44b3bd6 100644
--- a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp
@@ -23,10 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if USE(ACCELERATED_COMPOSITING)
-
+#include "config.h"
#include "LayerBackedDrawingArea.h"
+#if USE(ACCELERATED_COMPOSITING)
+
#include "DrawingAreaMessageKinds.h"
#include "DrawingAreaProxyMessageKinds.h"
#include "MessageID.h"
@@ -121,7 +122,7 @@ void LayerBackedDrawingArea::setSize(const IntSize& viewSize)
if (m_webPage->drawingArea() != this)
return;
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(viewSize));
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(viewSize));
}
void LayerBackedDrawingArea::suspendPainting()
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h
index ed05cc7..400c8c5 100644
--- a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h
+++ b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h
@@ -35,11 +35,8 @@
#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
-#ifdef __OBJC__
-@class CALayer;
-#else
-class CALayer;
-#endif
+OBJC_CLASS NSPopUpButtonCell;
+OBJC_CLASS WKView;
typedef struct __WKCARemoteLayerClientRef *WKCARemoteLayerClientRef;
#endif
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDatabaseManagerWin.cpp b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp
index b6d15fd..1112d39 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDatabaseManagerWin.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp
@@ -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,17 +23,37 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "WebDatabaseManager.h"
+#include "config.h"
+#include "LayerTreeHost.h"
-#include <WebCore/FileSystem.h>
+#if PLATFORM(MAC)
+#include "LayerTreeHostMac.h"
+#endif
+
+#if !PLATFORM(MAC) && !PLATFORM(WIN)
+#error "This class is not ready for use by other ports yet."
+#endif
using namespace WebCore;
namespace WebKit {
-String WebDatabaseManager::databaseDirectory() const
+PassRefPtr<LayerTreeHost> LayerTreeHost::create(WebPage* webPage)
+{
+#if PLATFORM(MAC)
+ return LayerTreeHostMac::create(webPage);
+#endif
+
+ return 0;
+}
+
+LayerTreeHost::LayerTreeHost(WebPage* webPage)
+ : m_webPage(webPage)
+{
+}
+
+LayerTreeHost::~LayerTreeHost()
{
- return WebCore::pathByAppendingComponent(WebCore::localUserSpecificStorageDirectory(), "Databases");
}
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
new file mode 100644
index 0000000..4ca1137
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
@@ -0,0 +1,69 @@
+/*
+ * 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 LayerTreeHost_h
+#define LayerTreeHost_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+ class IntRect;
+ class IntSize;
+ class GraphicsLayer;
+}
+
+namespace WebKit {
+
+class LayerTreeContext;
+class WebPage;
+
+class LayerTreeHost : public RefCounted<LayerTreeHost> {
+public:
+ static PassRefPtr<LayerTreeHost> create(WebPage*);
+ virtual ~LayerTreeHost();
+
+ virtual const LayerTreeContext& layerTreeContext() = 0;
+ virtual void scheduleLayerFlush() = 0;
+ virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) = 0;
+ virtual void invalidate() = 0;
+
+ virtual void setNonCompositedContentsNeedDisplay(const WebCore::IntRect&) = 0;
+ virtual void scrollNonCompositedContents(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) = 0;
+ virtual void sizeDidChange(const WebCore::IntSize& newSize) = 0;
+
+ virtual void didInstallPageOverlay() = 0;
+ virtual void didUninstallPageOverlay() = 0;
+ virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&) = 0;
+
+protected:
+ explicit LayerTreeHost(WebPage*);
+
+ WebPage* m_webPage;
+};
+
+} // namespace WebKit
+
+#endif // LayerTreeHost_h
diff --git a/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp b/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp
index 091f460..67c1165 100644
--- a/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "PageOverlay.h"
#include "WebPage.h"
@@ -30,6 +31,7 @@
#include <WebCore/FrameView.h>
#include <WebCore/GraphicsContext.h>
#include <WebCore/Page.h>
+#include <WebCore/ScrollbarTheme.h>
using namespace WebCore;
@@ -55,12 +57,14 @@ IntRect PageOverlay::bounds() const
FrameView* frameView = webPage()->corePage()->mainFrame()->view();
int width = frameView->width();
- if (frameView->verticalScrollbar())
- width -= frameView->verticalScrollbar()->width();
int height = frameView->height();
- if (frameView->horizontalScrollbar())
- height -= frameView->horizontalScrollbar()->height();
-
+
+ if (!ScrollbarTheme::nativeTheme()->usesOverlayScrollbars()) {
+ if (frameView->verticalScrollbar())
+ width -= frameView->verticalScrollbar()->width();
+ if (frameView->horizontalScrollbar())
+ height -= frameView->horizontalScrollbar()->height();
+ }
return IntRect(0, 0, width, height);
}
@@ -71,10 +75,10 @@ void PageOverlay::setPage(WebPage* webPage)
m_client->didMoveToWebPage(this, webPage);
}
-void PageOverlay::setNeedsDisplay(const WebCore::IntRect& dirtyRect)
+void PageOverlay::setNeedsDisplay(const IntRect& dirtyRect)
{
if (m_webPage)
- m_webPage->drawingArea()->setNeedsDisplay(dirtyRect);
+ m_webPage->drawingArea()->setPageOverlayNeedsDisplay(dirtyRect);
}
void PageOverlay::setNeedsDisplay()
diff --git a/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp
index 74aa4b2..f27f14f 100644
--- a/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp
@@ -23,10 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if ENABLE(TILED_BACKING_STORE)
-
+#include "config.h"
#include "TiledDrawingArea.h"
+#if ENABLE(TILED_BACKING_STORE)
+
#include "DrawingAreaMessageKinds.h"
#include "DrawingAreaProxyMessageKinds.h"
#include "MessageID.h"
@@ -81,7 +82,7 @@ void TiledDrawingArea::display()
IntRect dirtyRect = m_dirtyRect;
m_dirtyRect = IntRect();
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::Invalidate, m_webPage->pageID(), CoreIPC::In(dirtyRect));
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::Invalidate, m_webPage->pageID(), CoreIPC::In(dirtyRect));
m_displayTimer.stop();
}
@@ -106,7 +107,7 @@ void TiledDrawingArea::setSize(const IntSize& viewSize)
scheduleDisplay();
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(viewSize));
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(viewSize));
}
void TiledDrawingArea::suspendPainting()
@@ -141,7 +142,7 @@ void TiledDrawingArea::updateTile(int tileID, const IntRect& dirtyRect, float sc
paintIntoUpdateChunk(&updateChunk, scale);
unsigned pendingUpdateCount = m_pendingUpdates.size();
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::TileUpdated, m_webPage->pageID(), CoreIPC::In(tileID, updateChunk, scale, pendingUpdateCount));
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::TileUpdated, m_webPage->pageID(), CoreIPC::In(tileID, updateChunk, scale, pendingUpdateCount));
}
void TiledDrawingArea::tileUpdateTimerFired()
@@ -155,7 +156,7 @@ void TiledDrawingArea::tileUpdateTimerFired()
updateTile(update.tileID, update.dirtyRect, update.scale);
if (m_pendingUpdates.isEmpty())
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::AllTileUpdatesProcessed, m_webPage->pageID(), CoreIPC::In());
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::AllTileUpdatesProcessed, m_webPage->pageID(), CoreIPC::In());
else
m_tileUpdateTimer.startOneShot(0.001);
}
@@ -185,7 +186,7 @@ void TiledDrawingArea::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageI
if (it != m_pendingUpdates.end()) {
m_pendingUpdates.remove(it);
if (m_pendingUpdates.isEmpty()) {
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::AllTileUpdatesProcessed, m_webPage->pageID(), CoreIPC::In());
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::AllTileUpdatesProcessed, m_webPage->pageID(), CoreIPC::In());
m_tileUpdateTimer.stop();
}
}
@@ -221,7 +222,7 @@ void TiledDrawingArea::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageI
UpdateChunk updateChunk(IntRect(IntPoint(contentsRect.x() * targetScale, contentsRect.y() * targetScale), targetSize));
paintIntoUpdateChunk(&updateChunk, targetScale);
- WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::SnapshotTaken, m_webPage->pageID(), CoreIPC::In(updateChunk));
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::SnapshotTaken, m_webPage->pageID(), CoreIPC::In(updateChunk));
break;
}
default:
diff --git a/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp b/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
index 21f4fba..7b958bf 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebBackForwardListProxy.h"
#include "DataReference.h"
diff --git a/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp b/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp
index b496128..35058de 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "config.h"
#include "WebContextMenu.h"
#include "ContextMenuState.h"
diff --git a/Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp b/Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp
index 198cb6d..dce1a68 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebEditCommand.h"
namespace WebKit {
diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
index 42eacc1..fa4dc2c 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebFrame.h"
#include "DownloadManager.h"
@@ -334,7 +335,7 @@ String WebFrame::url() const
if (!m_coreFrame)
return String();
- return m_coreFrame->loader()->url().string();
+ return m_coreFrame->document()->url().string();
}
String WebFrame::innerText() const
@@ -457,6 +458,81 @@ JSGlobalContextRef WebFrame::jsContextForWorld(InjectedBundleScriptWorld* world)
return toGlobalRef(m_coreFrame->script()->globalObject(world->coreWorld())->globalExec());
}
+IntRect WebFrame::contentBounds() const
+{
+ if (!m_coreFrame)
+ return IntRect();
+
+ FrameView* view = m_coreFrame->view();
+ if (!view)
+ return IntRect();
+
+ return IntRect(0, 0, view->contentsWidth(), view->contentsHeight());
+}
+
+IntRect WebFrame::visibleContentBounds() const
+{
+ if (!m_coreFrame)
+ return IntRect();
+
+ FrameView* view = m_coreFrame->view();
+ if (!view)
+ return IntRect();
+
+ IntRect contentRect = view->visibleContentRect(true);
+ return IntRect(0, 0, contentRect.width(), contentRect.height());
+}
+
+IntRect WebFrame::visibleContentBoundsExcludingScrollbars() const
+{
+ if (!m_coreFrame)
+ return IntRect();
+
+ FrameView* view = m_coreFrame->view();
+ if (!view)
+ return IntRect();
+
+ IntRect contentRect = view->visibleContentRect(false);
+ return IntRect(0, 0, contentRect.width(), contentRect.height());
+}
+
+IntSize WebFrame::scrollOffset() const
+{
+ if (!m_coreFrame)
+ return IntSize();
+
+ FrameView* view = m_coreFrame->view();
+ if (!view)
+ return IntSize();
+
+ return view->scrollOffset();
+}
+
+bool WebFrame::getDocumentBackgroundColor(double* red, double* green, double* blue, double* alpha)
+{
+ if (!m_coreFrame)
+ return false;
+ Document* document = m_coreFrame->document();
+ if (!document)
+ return false;
+
+ Element* rootElementToUse = document->body();
+ if (!rootElementToUse)
+ rootElementToUse = document->documentElement();
+ if (!rootElementToUse)
+ return false;
+
+ RenderObject* renderer = rootElementToUse->renderer();
+ if (!renderer)
+ return false;
+ Color color = renderer->style()->visitedDependentColor(CSSPropertyBackgroundColor);
+ if (!color.isValid())
+ return false;
+
+ color.getRGBA(*red, *green, *blue, *alpha);
+ return true;
+}
+
WebFrame* WebFrame::frameForContext(JSContextRef context)
{
JSObjectRef globalObjectRef = JSContextGetGlobalObject(context);
@@ -543,4 +619,20 @@ String WebFrame::suggestedFilenameForResourceWithURL(const KURL& url) const
return resource->response().suggestedFilename();
}
+String WebFrame::mimeTypeForResourceWithURL(const KURL& url) const
+{
+ if (!m_coreFrame)
+ return String();
+
+ DocumentLoader* loader = m_coreFrame->loader()->documentLoader();
+ if (!loader)
+ return String();
+
+ RefPtr<ArchiveResource> resource = loader->subresource(url);
+ if (resource)
+ return resource->mimeType();
+
+ return page()->cachedResponseMIMETypeForURL(url);
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.h b/Source/WebKit2/WebProcess/WebPage/WebFrame.h
index f254e7a..3c63cf3 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebFrame.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.h
@@ -89,6 +89,11 @@ public:
JSValueRef computedStyleIncludingVisitedInfo(JSObjectRef element);
JSGlobalContextRef jsContext();
JSGlobalContextRef jsContextForWorld(InjectedBundleScriptWorld*);
+ WebCore::IntRect contentBounds() const;
+ WebCore::IntRect visibleContentBounds() const;
+ WebCore::IntRect visibleContentBoundsExcludingScrollbars() const;
+ WebCore::IntSize scrollOffset() const;
+ bool getDocumentBackgroundColor(double* red, double* green, double* blue, double* alpha);
static WebFrame* frameForContext(JSContextRef);
@@ -110,6 +115,7 @@ public:
String provisionalURL() const;
String suggestedFilenameForResourceWithURL(const WebCore::KURL&) const;
+ String mimeTypeForResourceWithURL(const WebCore::KURL&) const;
// Simple listener class used by plug-ins to know when frames finish or fail loading.
class LoadListener {
diff --git a/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp b/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp
index 559b8b6..4b3fdaf 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebInspector.h"
#if ENABLE(INSPECTOR)
@@ -38,6 +39,11 @@ using namespace WebCore;
namespace WebKit {
+PassRefPtr<WebInspector> WebInspector::create(WebPage* page)
+{
+ return adoptRef(new WebInspector(page));
+}
+
WebInspector::WebInspector(WebPage* page)
: m_page(page)
, m_inspectorPage(0)
@@ -91,9 +97,14 @@ void WebInspector::close()
m_page->corePage()->inspectorController()->close();
}
+void WebInspector::evaluateScriptForTest(long callID, const String& script)
+{
+ m_page->corePage()->inspectorController()->evaluateForTestInFrontend(callID, script);
+}
+
void WebInspector::showConsole()
{
- m_page->corePage()->inspectorController()->showPanel(InspectorController::ConsolePanel);
+ m_page->corePage()->inspectorController()->showConsole();
}
void WebInspector::startJavaScriptDebugging()
@@ -121,7 +132,6 @@ void WebInspector::stopJavaScriptProfiling()
{
#if ENABLE(JAVASCRIPT_DEBUGGER)
m_page->corePage()->inspectorController()->stopUserInitiatedProfiling();
- m_page->corePage()->inspectorController()->showPanel(InspectorController::ProfilesPanel);
#endif
}
diff --git a/Source/WebKit2/WebProcess/WebPage/WebInspector.h b/Source/WebKit2/WebProcess/WebPage/WebInspector.h
index 21a7529..517ae8e 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebInspector.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebInspector.h
@@ -28,6 +28,7 @@
#if ENABLE(INSPECTOR)
+#include "APIObject.h"
#include "Connection.h"
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
@@ -37,11 +38,11 @@ namespace WebKit {
class WebPage;
struct WebPageCreationParameters;
-class WebInspector {
- WTF_MAKE_NONCOPYABLE(WebInspector);
-
+class WebInspector : public APIObject {
public:
- explicit WebInspector(WebPage*);
+ static const Type APIType = TypeBundleInspector;
+
+ static PassRefPtr<WebInspector> create(WebPage*);
WebPage* page() const { return m_page; }
WebPage* inspectorPage() const { return m_inspectorPage; }
@@ -49,10 +50,23 @@ public:
// Implemented in generated WebInspectorMessageReceiver.cpp
void didReceiveWebInspectorMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+ // Called by WebInspector messages
+ void show();
+ void close();
+
+ void evaluateScriptForTest(long callID, const String& script);
+
+ void startPageProfiling();
+ void stopPageProfiling();
+
private:
friend class WebInspectorClient;
friend class WebInspectorFrontendClient;
+ explicit WebInspector(WebPage*);
+
+ virtual Type type() const { return APIType; }
+
// Called from WebInspectorClient
WebPage* createInspectorPage();
@@ -63,10 +77,6 @@ private:
// Implemented in platform WebInspector file
String localizedStringsURL() const;
- // Called by WebInspector messages
- void show();
- void close();
-
void showConsole();
void startJavaScriptDebugging();
@@ -75,9 +85,6 @@ private:
void startJavaScriptProfiling();
void stopJavaScriptProfiling();
- void startPageProfiling();
- void stopPageProfiling();
-
WebPage* m_page;
WebPage* m_inspectorPage;
};
diff --git a/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp b/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp
index d42e313..bcf3e80 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebOpenPanelResultListener.h"
namespace WebKit {
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
index af236e9..462d352 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPage.h"
#include "Arguments.h"
@@ -254,6 +255,16 @@ void WebPage::initializeInjectedBundleLoaderClient(WKBundlePageLoaderClient* cli
m_loaderClient.initialize(client);
}
+void WebPage::initializeInjectedBundlePolicyClient(WKBundlePagePolicyClient* client)
+{
+ m_policyClient.initialize(client);
+}
+
+void WebPage::initializeInjectedBundleResourceLoadClient(WKBundlePageResourceLoadClient* client)
+{
+ m_resourceLoadClient.initialize(client);
+}
+
void WebPage::initializeInjectedBundleUIClient(WKBundlePageUIClient* client)
{
m_uiClient.initialize(client);
@@ -313,6 +324,11 @@ void WebPage::changeAcceleratedCompositingMode(WebCore::GraphicsLayer* layer)
if (m_isClosed)
return;
+ // With the new drawing area we don't need to inform the UI process when the accelerated
+ // compositing mode changes.
+ if (m_drawingArea->info().type == DrawingAreaInfo::Impl)
+ return;
+
bool compositing = layer;
// Tell the UI process that accelerated compositing changed. It may respond by changing
@@ -342,6 +358,7 @@ void WebPage::enterAcceleratedCompositingMode(GraphicsLayer* layer)
void WebPage::exitAcceleratedCompositingMode()
{
changeAcceleratedCompositingMode(0);
+ m_drawingArea->setRootCompositingLayer(0);
}
#endif
@@ -463,20 +480,26 @@ void WebPage::reload(bool reloadFromOrigin)
m_mainFrame->coreFrame()->loader()->reload(reloadFromOrigin);
}
-void WebPage::goForward(uint64_t backForwardItemID)
+void WebPage::goForward(uint64_t backForwardItemID, const SandboxExtension::Handle& sandboxExtensionHandle)
{
+ m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), sandboxExtensionHandle);
+
HistoryItem* item = WebBackForwardListProxy::itemForID(backForwardItemID);
m_page->goToItem(item, FrameLoadTypeForward);
}
-void WebPage::goBack(uint64_t backForwardItemID)
+void WebPage::goBack(uint64_t backForwardItemID, const SandboxExtension::Handle& sandboxExtensionHandle)
{
+ m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), sandboxExtensionHandle);
+
HistoryItem* item = WebBackForwardListProxy::itemForID(backForwardItemID);
m_page->goToItem(item, FrameLoadTypeBack);
}
-void WebPage::goToBackForwardItem(uint64_t backForwardItemID)
+void WebPage::goToBackForwardItem(uint64_t backForwardItemID, const SandboxExtension::Handle& sandboxExtensionHandle)
{
+ m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), sandboxExtensionHandle);
+
HistoryItem* item = WebBackForwardListProxy::itemForID(backForwardItemID);
m_page->goToItem(item, FrameLoadTypeIndexedBackForward);
}
@@ -553,6 +576,27 @@ void WebPage::resizeToContentsIfNeeded()
}
#endif
+void WebPage::scrollMainFrameIfNotAtMaxScrollPosition(const IntSize& scrollOffset)
+{
+ Frame* frame = m_page->mainFrame();
+
+ IntPoint scrollPosition = frame->view()->scrollPosition();
+ IntPoint maximumScrollPosition = frame->view()->maximumScrollPosition();
+
+ // If the current scroll position in a direction is the max scroll position
+ // we don't want to scroll at all.
+ IntSize newScrollOffset;
+ if (scrollPosition.x() < maximumScrollPosition.x())
+ newScrollOffset.setWidth(scrollOffset.width());
+ if (scrollPosition.y() < maximumScrollPosition.y())
+ newScrollOffset.setHeight(scrollOffset.height());
+
+ if (newScrollOffset.isZero())
+ return;
+
+ frame->view()->setScrollPosition(frame->view()->scrollPosition() + newScrollOffset);
+}
+
void WebPage::drawRect(GraphicsContext& graphicsContext, const IntRect& rect)
{
graphicsContext.save();
@@ -560,12 +604,19 @@ void WebPage::drawRect(GraphicsContext& graphicsContext, const IntRect& rect)
m_mainFrame->coreFrame()->view()->paint(&graphicsContext, rect);
graphicsContext.restore();
- if (m_pageOverlay) {
- graphicsContext.save();
- graphicsContext.clip(rect);
- m_pageOverlay->drawRect(graphicsContext, rect);
- graphicsContext.restore();
- }
+ // FIXME: Remove this code once we're using the new drawing area on mac and windows.
+ if (m_pageOverlay && m_drawingArea->info().type != DrawingAreaInfo::Impl)
+ drawPageOverlay(graphicsContext, rect);
+}
+
+void WebPage::drawPageOverlay(GraphicsContext& graphicsContext, const IntRect& rect)
+{
+ ASSERT(m_pageOverlay);
+
+ graphicsContext.save();
+ graphicsContext.clip(rect);
+ m_pageOverlay->drawRect(graphicsContext, rect);
+ graphicsContext.restore();
}
double WebPage::textZoomFactor() const
@@ -614,6 +665,8 @@ void WebPage::scaleWebView(double scale, const IntPoint& origin)
if (!frame)
return;
frame->scalePage(scale, origin);
+
+ send(Messages::WebPageProxy::ViewScaleFactorDidChange(scale));
}
double WebPage::viewScaleFactor() const
@@ -660,6 +713,9 @@ void WebPage::installPageOverlay(PassRefPtr<PageOverlay> pageOverlay)
m_pageOverlay = pageOverlay;
m_pageOverlay->setPage(this);
+
+ m_drawingArea->didInstallPageOverlay();
+
m_pageOverlay->setNeedsDisplay();
}
@@ -670,7 +726,8 @@ void WebPage::uninstallPageOverlay(PageOverlay* pageOverlay)
m_pageOverlay->setPage(0);
m_pageOverlay = nullptr;
- m_drawingArea->setNeedsDisplay(IntRect(IntPoint(0, 0), m_viewSize));
+
+ m_drawingArea->didUninstallPageOverlay();
}
PassRefPtr<WebImage> WebPage::snapshotInViewCoordinates(const IntRect& rect, ImageOptions options)
@@ -697,7 +754,7 @@ PassRefPtr<WebImage> WebPage::snapshotInViewCoordinates(const IntRect& rect, Ima
return snapshot.release();
}
-PassRefPtr<WebImage> WebPage::snapshotInDocumentCoordinates(const IntRect& rect, ImageOptions options)
+PassRefPtr<WebImage> WebPage::scaledSnapshotInDocumentCoordinates(const IntRect& rect, double scaleFactor, ImageOptions options)
{
FrameView* frameView = m_mainFrame->coreFrame()->view();
if (!frameView)
@@ -708,10 +765,18 @@ PassRefPtr<WebImage> WebPage::snapshotInDocumentCoordinates(const IntRect& rect,
PaintBehavior oldBehavior = frameView->paintBehavior();
frameView->setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers);
- RefPtr<WebImage> snapshot = WebImage::create(rect.size(), options);
- OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext();
+ bool scale = scaleFactor != 1;
+ IntSize size = rect.size();
+ if (scale)
+ size = IntSize(ceil(rect.width() * scaleFactor), ceil(rect.height() * scaleFactor));
+ RefPtr<WebImage> snapshot = WebImage::create(size, options);
+ OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext();
graphicsContext->save();
+
+ if (scale)
+ graphicsContext->scale(FloatSize(scaleFactor, scaleFactor));
+
graphicsContext->translate(-rect.x(), -rect.y());
frameView->paintContents(graphicsContext.get(), rect);
graphicsContext->restore();
@@ -721,6 +786,11 @@ PassRefPtr<WebImage> WebPage::snapshotInDocumentCoordinates(const IntRect& rect,
return snapshot.release();
}
+PassRefPtr<WebImage> WebPage::snapshotInDocumentCoordinates(const IntRect& rect, ImageOptions options)
+{
+ return scaledSnapshotInDocumentCoordinates(rect, 1, options);
+}
+
void WebPage::pageDidScroll()
{
// Hide the find indicator.
@@ -909,6 +979,26 @@ void WebPage::keyEvent(const WebKeyboardEvent& keyboardEvent)
send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(keyboardEvent.type()), handled));
}
+#if ENABLE(GESTURE_EVENTS)
+static bool handleGestureEvent(const WebGestureEvent& gestureEvent, Page* page)
+{
+ Frame* frame = page->mainFrame();
+ if (!frame->view())
+ return false;
+
+ PlatformGestureEvent platformGestureEvent = platform(gestureEvent);
+ return frame->eventHandler()->handleGestureEvent(platformGestureEvent);
+}
+
+void WebPage::gestureEvent(const WebGestureEvent& gestureEvent)
+{
+ CurrentEvent currentEvent(gestureEvent);
+
+ bool handled = handleGestureEvent(gestureEvent, m_page.get());
+ send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(gestureEvent.type()), handled));
+}
+#endif
+
void WebPage::validateMenuItem(const String& commandName)
{
bool isEnabled = false;
@@ -952,10 +1042,10 @@ uint64_t WebPage::restoreSession(const SessionState& sessionState)
return currentItemID;
}
-void WebPage::restoreSessionAndNavigateToCurrentItem(const SessionState& sessionState)
+void WebPage::restoreSessionAndNavigateToCurrentItem(const SessionState& sessionState, const SandboxExtension::Handle& sandboxExtensionHandle)
{
if (uint64_t currentItemID = restoreSession(sessionState))
- goToBackForwardItem(currentItemID);
+ goToBackForwardItem(currentItemID, sandboxExtensionHandle);
}
#if ENABLE(TOUCH_EVENTS)
@@ -1022,6 +1112,30 @@ void WebPage::setDrawsTransparentBackground(bool drawsTransparentBackground)
m_drawingArea->setNeedsDisplay(IntRect(IntPoint(0, 0), m_viewSize));
}
+void WebPage::viewWillStartLiveResize()
+{
+ if (!m_page)
+ return;
+
+ // FIXME: This should propagate to all ScrollableAreas.
+ if (Frame* frame = m_page->focusController()->focusedOrMainFrame()) {
+ if (FrameView* view = frame->view())
+ view->willStartLiveResize();
+ }
+}
+
+void WebPage::viewWillEndLiveResize()
+{
+ if (!m_page)
+ return;
+
+ // FIXME: This should propagate to all ScrollableAreas.
+ if (Frame* frame = m_page->focusController()->focusedOrMainFrame()) {
+ if (FrameView* view = frame->view())
+ view->willEndLiveResize();
+ }
+}
+
void WebPage::setFocused(bool isFocused)
{
m_page->focusController()->setFocused(isFocused);
@@ -1161,7 +1275,7 @@ void WebPage::getResourceDataFromFrame(uint64_t frameID, const String& resourceU
if (WebFrame* frame = WebProcess::shared().webFrame(frameID)) {
if (DocumentLoader* loader = frame->coreFrame()->loader()->documentLoader()) {
if (RefPtr<ArchiveResource> subresource = loader->subresource(KURL(KURL(), resourceURL))) {
- if (buffer = subresource->data())
+ if ((buffer = subresource->data()))
dataReference = CoreIPC::DataReference(reinterpret_cast<const uint8_t*>(buffer->data()), buffer->size());
}
}
@@ -1187,6 +1301,12 @@ void WebPage::getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID)
send(Messages::WebPageProxy::DataCallback(dataReference, callbackID));
}
+void WebPage::forceRepaint(uint64_t callbackID)
+{
+ m_drawingArea->forceRepaint();
+ send(Messages::WebPageProxy::VoidCallback(callbackID));
+}
+
void WebPage::preferencesDidChange(const WebPreferencesStore& store)
{
WebPreferencesStore::removeTestRunnerOverrides();
@@ -1224,12 +1344,15 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
settings->setJavaScriptCanOpenWindowsAutomatically(store.getBoolValueForKey(WebPreferencesKey::javaScriptCanOpenWindowsAutomaticallyKey()));
settings->setForceFTPDirectoryListings(store.getBoolValueForKey(WebPreferencesKey::forceFTPDirectoryListingsKey()));
settings->setDNSPrefetchingEnabled(store.getBoolValueForKey(WebPreferencesKey::dnsPrefetchingEnabledKey()));
+#if ENABLE(WEB_ARCHIVE)
settings->setWebArchiveDebugModeEnabled(store.getBoolValueForKey(WebPreferencesKey::webArchiveDebugModeEnabledKey()));
+#endif
settings->setLocalFileContentSniffingEnabled(store.getBoolValueForKey(WebPreferencesKey::localFileContentSniffingEnabledKey()));
settings->setUsesPageCache(store.getBoolValueForKey(WebPreferencesKey::usesPageCacheKey()));
settings->setAuthorAndUserStylesEnabled(store.getBoolValueForKey(WebPreferencesKey::authorAndUserStylesEnabledKey()));
settings->setPaginateDuringLayoutEnabled(store.getBoolValueForKey(WebPreferencesKey::paginateDuringLayoutEnabledKey()));
settings->setDOMPasteAllowed(store.getBoolValueForKey(WebPreferencesKey::domPasteAllowedKey()));
+ settings->setJavaScriptCanAccessClipboard(store.getBoolValueForKey(WebPreferencesKey::javaScriptCanAccessClipboardKey()));
settings->setShouldPrintBackgrounds(store.getBoolValueForKey(WebPreferencesKey::shouldPrintBackgroundsKey()));
settings->setMinimumFontSize(store.getUInt32ValueForKey(WebPreferencesKey::minimumFontSizeKey()));
@@ -1245,6 +1368,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
#endif
settings->setShowDebugBorders(store.getBoolValueForKey(WebPreferencesKey::compositingBordersVisibleKey()));
settings->setShowRepaintCounter(store.getBoolValueForKey(WebPreferencesKey::compositingRepaintCountersVisibleKey()));
+ settings->setWebGLEnabled(store.getBoolValueForKey(WebPreferencesKey::webGLEnabledKey()));
#if ENABLE(DATABASE)
AbstractDatabase::setIsAvailable(store.getBoolValueForKey(WebPreferencesKey::databasesEnabledKey()));
@@ -1259,7 +1383,7 @@ WebInspector* WebPage::inspector()
if (m_isClosed)
return 0;
if (!m_inspector)
- m_inspector = adoptPtr(new WebInspector(this));
+ m_inspector = WebInspector::create(this);
return m_inspector.get();
}
#endif
@@ -1296,6 +1420,37 @@ bool WebPage::handleEditingKeyboardEvent(KeyboardEvent* evt)
}
#endif
+#if PLATFORM(WIN)
+void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WebCore::DragDataMap& dataMap, uint32_t flags)
+{
+ if (!m_page) {
+ send(Messages::WebPageProxy::DidPerformDragControllerAction(DragOperationNone));
+ return;
+ }
+
+ DragData dragData(dataMap, clientPosition, globalPosition, static_cast<DragOperation>(draggingSourceOperationMask), static_cast<DragApplicationFlags>(flags));
+ switch (action) {
+ case DragControllerActionEntered:
+ send(Messages::WebPageProxy::DidPerformDragControllerAction(m_page->dragController()->dragEntered(&dragData)));
+ break;
+
+ case DragControllerActionUpdated:
+ send(Messages::WebPageProxy::DidPerformDragControllerAction(m_page->dragController()->dragUpdated(&dragData)));
+ break;
+
+ case DragControllerActionExited:
+ m_page->dragController()->dragExited(&dragData);
+ break;
+
+ case DragControllerActionPerformDrag:
+ m_page->dragController()->performDrag(&dragData);
+ break;
+
+ default:
+ ASSERT_NOT_REACHED();
+ }
+}
+#else
void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const String& dragStorageName, uint32_t flags)
{
if (!m_page) {
@@ -1325,6 +1480,7 @@ void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint cli
ASSERT_NOT_REACHED();
}
}
+#endif
void WebPage::dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation)
{
@@ -1433,6 +1589,13 @@ void WebPage::didCancelForOpenPanel()
m_activeOpenPanelResultListener = 0;
}
+#if ENABLE(WEB_PROCESS_SANDBOX)
+void WebPage::extendSandboxForFileFromOpenPanel(const SandboxExtension::Handle& handle)
+{
+ SandboxExtension::create(handle)->consumePermanently();
+}
+#endif
+
void WebPage::didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed)
{
m_geolocationPermissionRequestManager.didReceiveGeolocationPermissionDecision(geolocationID, allowed);
@@ -1563,7 +1726,7 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
return;
}
-#ifdef __APPLE__
+#if PLATFORM(MAC) || PLATFORM(WIN)
if (messageID.is<CoreIPC::MessageClassDrawingArea>()) {
if (m_drawingArea)
m_drawingArea->didReceiveDrawingAreaMessage(connection, messageID, arguments);
@@ -1650,11 +1813,39 @@ void WebPage::SandboxExtensionTracker::beginLoad(WebFrame* frame, const SandboxE
m_pendingProvisionalSandboxExtension = SandboxExtension::create(handle);
}
+static bool shouldReuseCommittedSandboxExtension(WebFrame* frame)
+{
+ ASSERT(frame->isMainFrame());
+
+ FrameLoader* frameLoader = frame->coreFrame()->loader();
+ FrameLoadType frameLoadType = frameLoader->loadType();
+
+ // If the page is being reloaded, it should reuse whatever extension is committed.
+ if (frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTypeReloadFromOrigin)
+ return true;
+
+ DocumentLoader* documentLoader = frameLoader->documentLoader();
+ DocumentLoader* provisionalDocumentLoader = frameLoader->provisionalDocumentLoader();
+ if (!documentLoader || !provisionalDocumentLoader)
+ return false;
+
+ if (documentLoader->url().isLocalFile() && provisionalDocumentLoader->url().isLocalFile()
+ && provisionalDocumentLoader->triggeringAction().type() == NavigationTypeLinkClicked)
+ return true;
+
+ return false;
+}
+
void WebPage::SandboxExtensionTracker::didStartProvisionalLoad(WebFrame* frame)
{
if (!frame->isMainFrame())
return;
+ if (shouldReuseCommittedSandboxExtension(frame)) {
+ m_pendingProvisionalSandboxExtension = m_committedSandboxExtension.release();
+ ASSERT(!m_committedSandboxExtension);
+ }
+
ASSERT(!m_provisionalSandboxExtension);
m_provisionalSandboxExtension = m_pendingProvisionalSandboxExtension.release();
@@ -1749,6 +1940,9 @@ void WebPage::beginPrinting(uint64_t frameID, const PrintInfo& printInfo)
m_printContext = adoptPtr(new PrintContext(coreFrame));
m_printContext->begin(printInfo.availablePaperWidth, printInfo.availablePaperHeight);
+
+ float fullPageHeight;
+ m_printContext->computePageRects(FloatRect(0, 0, printInfo.availablePaperWidth, printInfo.availablePaperHeight), 0, 0, printInfo.pageSetupScaleFactor, fullPageHeight, true);
}
void WebPage::endPrinting()
@@ -1756,57 +1950,90 @@ void WebPage::endPrinting()
m_printContext = nullptr;
}
-void WebPage::computePagesForPrinting(uint64_t frameID, const PrintInfo& printInfo, Vector<IntRect>& resultPageRects, double& resultTotalScaleFactorForPrinting)
+void WebPage::computePagesForPrinting(uint64_t frameID, const PrintInfo& printInfo, uint64_t callbackID)
{
- beginPrinting(frameID, printInfo);
+ Vector<IntRect> resultPageRects;
+ double resultTotalScaleFactorForPrinting = 1;
- WebFrame* frame = WebProcess::shared().webFrame(frameID);
- if (!frame)
- return;
-
- float fullPageHeight;
- m_printContext->computePageRects(FloatRect(0, 0, printInfo.availablePaperWidth, printInfo.availablePaperHeight), 0, 0, printInfo.pageSetupScaleFactor, fullPageHeight, true);
+ beginPrinting(frameID, printInfo);
- resultTotalScaleFactorForPrinting = m_printContext->computeAutomaticScaleFactor(printInfo.availablePaperWidth) * printInfo.pageSetupScaleFactor;
- resultPageRects = m_printContext->pageRects();
+ if (m_printContext) {
+ resultPageRects = m_printContext->pageRects();
+ resultTotalScaleFactorForPrinting = m_printContext->computeAutomaticScaleFactor(FloatSize(printInfo.availablePaperWidth, printInfo.availablePaperHeight)) * printInfo.pageSetupScaleFactor;
+ }
// If we're asked to print, we should actually print at least a blank page.
if (resultPageRects.isEmpty())
resultPageRects.append(IntRect(0, 0, 1, 1));
+
+ send(Messages::WebPageProxy::ComputedPagesCallback(resultPageRects, resultTotalScaleFactorForPrinting, callbackID));
}
#if PLATFORM(MAC)
// FIXME: Find a better place for Mac specific code.
-void WebPage::drawRectToPDF(uint64_t frameID, const WebCore::IntRect& rect, Vector<uint8_t>& pdfData)
+void WebPage::drawRectToPDF(uint64_t frameID, const WebCore::IntRect& rect, uint64_t callbackID)
{
WebFrame* frame = WebProcess::shared().webFrame(frameID);
- if (!frame)
- return;
+ Frame* coreFrame = frame ? frame->coreFrame() : 0;
- Frame* coreFrame = frame->coreFrame();
- if (!coreFrame)
- return;
+ RetainPtr<CFMutableDataRef> pdfPageData(AdoptCF, CFDataCreateMutable(0, 0));
- ASSERT(coreFrame->document()->printing());
+ if (coreFrame) {
+ ASSERT(coreFrame->document()->printing());
+
+ // FIXME: Use CGDataConsumerCreate with callbacks to avoid copying the data.
+ RetainPtr<CGDataConsumerRef> pdfDataConsumer(AdoptCF, CGDataConsumerCreateWithCFData(pdfPageData.get()));
+
+ CGRect mediaBox = CGRectMake(0, 0, rect.width(), rect.height());
+ RetainPtr<CGContextRef> context(AdoptCF, CGPDFContextCreate(pdfDataConsumer.get(), &mediaBox, 0));
+ RetainPtr<CFDictionaryRef> pageInfo(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ CGPDFContextBeginPage(context.get(), pageInfo.get());
+
+ GraphicsContext ctx(context.get());
+ ctx.scale(FloatSize(1, -1));
+ ctx.translate(0, -rect.height());
+ m_printContext->spoolRect(ctx, rect);
+
+ CGPDFContextEndPage(context.get());
+ CGPDFContextClose(context.get());
+ }
+
+ send(Messages::WebPageProxy::DataCallback(CoreIPC::DataReference(CFDataGetBytePtr(pdfPageData.get()), CFDataGetLength(pdfPageData.get())), callbackID));
+}
+
+void WebPage::drawPagesToPDF(uint64_t frameID, uint32_t first, uint32_t count, uint64_t callbackID)
+{
+ WebFrame* frame = WebProcess::shared().webFrame(frameID);
+ Frame* coreFrame = frame ? frame->coreFrame() : 0;
RetainPtr<CFMutableDataRef> pdfPageData(AdoptCF, CFDataCreateMutable(0, 0));
- // FIXME: Use CGDataConsumerCreate with callbacks to avoid copying the data.
- RetainPtr<CGDataConsumerRef> pdfDataConsumer(AdoptCF, CGDataConsumerCreateWithCFData(pdfPageData.get()));
+ if (coreFrame) {
+ ASSERT(coreFrame->document()->printing());
- CGRect mediaBox = CGRectMake(0, 0, frame->size().width(), frame->size().height());
- RetainPtr<CGContextRef> context(AdoptCF, CGPDFContextCreate(pdfDataConsumer.get(), &mediaBox, 0));
- CFDictionaryRef pageInfo = CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
- CGPDFContextBeginPage(context.get(), pageInfo);
+ // FIXME: Use CGDataConsumerCreate with callbacks to avoid copying the data.
+ RetainPtr<CGDataConsumerRef> pdfDataConsumer(AdoptCF, CGDataConsumerCreateWithCFData(pdfPageData.get()));
- GraphicsContext ctx(context.get());
- m_printContext->spoolRect(ctx, rect);
+ CGRect mediaBox = m_printContext->pageCount() ? m_printContext->pageRect(0) : CGRectMake(0, 0, 1, 1);
+ RetainPtr<CGContextRef> context(AdoptCF, CGPDFContextCreate(pdfDataConsumer.get(), &mediaBox, 0));
+ for (uint32_t page = first; page < first + count; ++page) {
+ if (page >= m_printContext->pageCount())
+ break;
- CGPDFContextEndPage(context.get());
- CGPDFContextClose(context.get());
+ RetainPtr<CFDictionaryRef> pageInfo(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ CGPDFContextBeginPage(context.get(), pageInfo.get());
+
+ GraphicsContext ctx(context.get());
+ ctx.scale(FloatSize(1, -1));
+ ctx.translate(0, -m_printContext->pageRect(page).height());
+ m_printContext->spoolPage(ctx, page, m_printContext->pageRect(page).width());
+
+ CGPDFContextEndPage(context.get());
+ }
+ CGPDFContextClose(context.get());
+ }
- pdfData.resize(CFDataGetLength(pdfPageData.get()));
- CFDataGetBytes(pdfPageData.get(), CFRangeMake(0, pdfData.size()), pdfData.data());
+ send(Messages::WebPageProxy::DataCallback(CoreIPC::DataReference(CFDataGetBytePtr(pdfPageData.get()), CFDataGetLength(pdfPageData.get())), callbackID));
}
#endif
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h
index d29400f..89087b0 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h
@@ -35,11 +35,14 @@
#include "InjectedBundlePageEditorClient.h"
#include "InjectedBundlePageFormClient.h"
#include "InjectedBundlePageLoaderClient.h"
+#include "InjectedBundlePagePolicyClient.h"
+#include "InjectedBundlePageResourceLoadClient.h"
#include "InjectedBundlePageUIClient.h"
#include "MessageSender.h"
#include "Plugin.h"
#include "SandboxExtension.h"
#include "WebEditCommand.h"
+#include <WebCore/DragData.h>
#include <WebCore/Editor.h>
#include <WebCore/FrameLoaderTypes.h>
#include <WebCore/IntRect.h>
@@ -55,11 +58,7 @@
#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
-#ifdef __OBJC__
-@class AccessibilityWebPageObject;
-#else
-class AccessibilityWebPageObject;
-#endif
+OBJC_CLASS AccessibilityWebPageObject;
#endif
namespace CoreIPC {
@@ -100,6 +99,10 @@ struct PrintInfo;
struct WebPageCreationParameters;
struct WebPreferencesStore;
+#if ENABLE(GESTURE_EVENTS)
+class WebGestureEvent;
+#endif
+
#if ENABLE(TOUCH_EVENTS)
class WebTouchEvent;
#endif
@@ -122,12 +125,15 @@ public:
void setSize(const WebCore::IntSize&);
const WebCore::IntSize& size() const { return m_viewSize; }
-
+ WebCore::IntRect bounds() const { return WebCore::IntRect(WebCore::IntPoint(), size()); }
+
InjectedBundleBackForwardList* backForwardList();
DrawingArea* drawingArea() const { return m_drawingArea.get(); }
WebPageGroupProxy* pageGroup() const { return m_pageGroup.get(); }
+ void scrollMainFrameIfNotAtMaxScrollPosition(const WebCore::IntSize& scrollOffset);
+
#if ENABLE(INSPECTOR)
WebInspector* inspector();
#endif
@@ -135,6 +141,7 @@ public:
// -- Called by the DrawingArea.
// FIXME: We could genericize these into a DrawingArea client interface. Would that be beneficial?
void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect&);
+ void drawPageOverlay(WebCore::GraphicsContext&, const WebCore::IntRect&);
void layoutIfNeeded();
// -- Called from WebCore clients.
@@ -165,12 +172,16 @@ public:
void initializeInjectedBundleEditorClient(WKBundlePageEditorClient*);
void initializeInjectedBundleFormClient(WKBundlePageFormClient*);
void initializeInjectedBundleLoaderClient(WKBundlePageLoaderClient*);
+ void initializeInjectedBundlePolicyClient(WKBundlePagePolicyClient*);
+ void initializeInjectedBundleResourceLoadClient(WKBundlePageResourceLoadClient*);
void initializeInjectedBundleUIClient(WKBundlePageUIClient*);
InjectedBundlePageContextMenuClient& injectedBundleContextMenuClient() { return m_contextMenuClient; }
InjectedBundlePageEditorClient& injectedBundleEditorClient() { return m_editorClient; }
InjectedBundlePageFormClient& injectedBundleFormClient() { return m_formClient; }
InjectedBundlePageLoaderClient& injectedBundleLoaderClient() { return m_loaderClient; }
+ InjectedBundlePagePolicyClient& injectedBundlePolicyClient() { return m_policyClient; }
+ InjectedBundlePageResourceLoadClient& injectedBundleResourceLoadClient() { return m_resourceLoadClient; }
InjectedBundlePageUIClient& injectedBundleUIClient() { return m_uiClient; }
bool findStringFromInjectedBundle(const String&, FindOptions);
@@ -224,9 +235,11 @@ public:
void installPageOverlay(PassRefPtr<PageOverlay>);
void uninstallPageOverlay(PageOverlay*);
+ bool hasPageOverlay() const { return m_pageOverlay; }
PassRefPtr<WebImage> snapshotInViewCoordinates(const WebCore::IntRect&, ImageOptions);
PassRefPtr<WebImage> snapshotInDocumentCoordinates(const WebCore::IntRect&, ImageOptions);
+ PassRefPtr<WebImage> scaledSnapshotInDocumentCoordinates(const WebCore::IntRect&, double scaleFactor, ImageOptions);
static const WebEvent* currentEvent();
@@ -247,6 +260,7 @@ public:
WebContextMenu* contextMenu();
bool hasLocalDataForURL(const WebCore::KURL&);
+ String cachedResponseMIMETypeForURL(const WebCore::KURL&);
static bool canHandleRequest(const WebCore::ResourceRequest&);
@@ -271,7 +285,7 @@ public:
static void getLocationAndLengthFromRange(WebCore::Range*, uint64_t& location, uint64_t& length);
#if PLATFORM(MAC)
- void sendAccessibilityPresenterToken(const CoreIPC::DataReference&);
+ void registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elemenToken, const CoreIPC::DataReference& windowToken);
AccessibilityWebPageObject* accessibilityRemoteObject();
WebCore::IntPoint accessibilityPosition() const { return m_accessibilityPosition; }
@@ -300,14 +314,19 @@ public:
#endif
void replaceSelectionWithText(WebCore::Frame*, const String&);
+#if PLATFORM(WIN)
+ void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WebCore::DragDataMap&, uint32_t flags);
+#else
void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WTF::String& dragStorageName, uint32_t flags);
+#endif
void dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation);
void beginPrinting(uint64_t frameID, const PrintInfo&);
void endPrinting();
- void computePagesForPrinting(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects, double& resultTotalScaleFactorForPrinting);
+ void computePagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
#if PLATFORM(MAC)
- void drawRectToPDF(uint64_t frameID, const WebCore::IntRect&, Vector<uint8_t>& pdfData);
+ void drawRectToPDF(uint64_t frameID, const WebCore::IntRect&, uint64_t callbackID);
+ void drawPagesToPDF(uint64_t frameID, uint32_t first, uint32_t count, uint64_t callbackID);
#endif
bool mainFrameHasCustomRepresentation() const;
@@ -336,37 +355,44 @@ private:
// Actions
void tryClose();
- void loadURL(const String&, const SandboxExtension::Handle& sandboxExtensionHandle);
- void loadURLRequest(const WebCore::ResourceRequest&, const SandboxExtension::Handle& sandboxExtensionHandle);
+ void loadURL(const String&, const SandboxExtension::Handle&);
+ void loadURLRequest(const WebCore::ResourceRequest&, const SandboxExtension::Handle&);
void loadHTMLString(const String& htmlString, const String& baseURL);
void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL);
void loadPlainTextString(const String&);
void reload(bool reloadFromOrigin);
- void goForward(uint64_t);
- void goBack(uint64_t);
- void goToBackForwardItem(uint64_t);
+ void goForward(uint64_t, const SandboxExtension::Handle&);
+ void goBack(uint64_t, const SandboxExtension::Handle&);
+ void goToBackForwardItem(uint64_t, const SandboxExtension::Handle&);
void setActive(bool);
void setFocused(bool);
void setInitialFocus(bool);
void setWindowResizerSize(const WebCore::IntSize&);
void setIsInWindow(bool);
+ void validateMenuItem(const String&);
+ void executeEditCommand(const String&);
+
void mouseEvent(const WebMouseEvent&);
void wheelEvent(const WebWheelEvent&);
void keyEvent(const WebKeyboardEvent&);
- void validateMenuItem(const String&);
- void executeEditCommand(const String&);
+#if ENABLE(GESTURE_EVENTS)
+ void gestureEvent(const WebGestureEvent&);
+#endif
#if ENABLE(TOUCH_EVENTS)
void touchEvent(const WebTouchEvent&);
#endif
uint64_t restoreSession(const SessionState&);
- void restoreSessionAndNavigateToCurrentItem(const SessionState&);
+ void restoreSessionAndNavigateToCurrentItem(const SessionState&, const SandboxExtension::Handle&);
void didRemoveBackForwardItem(uint64_t);
void setDrawsBackground(bool);
void setDrawsTransparentBackground(bool);
+ void viewWillStartLiveResize();
+ void viewWillEndLiveResize();
+
void getContentsAsString(uint64_t callbackID);
void getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID);
void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, uint64_t callbackID);
@@ -375,6 +401,7 @@ private:
void getSourceForFrame(uint64_t frameID, uint64_t callbackID);
void getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID);
void runJavaScriptInMainFrame(const String&, uint64_t callbackID);
+ void forceRepaint(uint64_t callbackID);
void preferencesDidChange(const WebPreferencesStore&);
void platformPreferencesDidChange(const WebPreferencesStore&);
@@ -406,6 +433,9 @@ private:
void didChooseFilesForOpenPanel(const Vector<String>&);
void didCancelForOpenPanel();
+#if ENABLE(WEB_PROCESS_SANDBOX)
+ void extendSandboxForFileFromOpenPanel(const SandboxExtension::Handle&);
+#endif
void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
@@ -477,6 +507,8 @@ private:
InjectedBundlePageEditorClient m_editorClient;
InjectedBundlePageFormClient m_formClient;
InjectedBundlePageLoaderClient m_loaderClient;
+ InjectedBundlePagePolicyClient m_policyClient;
+ InjectedBundlePageResourceLoadClient m_resourceLoadClient;
InjectedBundlePageUIClient m_uiClient;
#if ENABLE(TILED_BACKING_STORE)
@@ -487,7 +519,7 @@ private:
RefPtr<PageOverlay> m_pageOverlay;
#if ENABLE(INSPECTOR)
- OwnPtr<WebInspector> m_inspector;
+ RefPtr<WebInspector> m_inspector;
#endif
RefPtr<WebPopupMenu> m_activePopupMenu;
RefPtr<WebContextMenu> m_contextMenu;
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
index e001864..e47a013 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -1,4 +1,4 @@
-# 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
@@ -29,16 +29,22 @@ messages -> WebPage {
SetDrawsBackground(bool drawsBackground)
SetDrawsTransparentBackground(bool drawsTransparentBackground)
+ ViewWillStartLiveResize()
+ ViewWillEndLiveResize()
+
KeyEvent(WebKit::WebKeyboardEvent event)
MouseEvent(WebKit::WebMouseEvent event)
WheelEvent(WebKit::WebWheelEvent event)
+#if ENABLE(GESTURE_EVENTS)
+ GestureEvent(WebKit::WebGestureEvent event)
+#endif
#if ENABLE(TOUCH_EVENTS)
TouchEvent(WebKit::WebTouchEvent event)
#endif
- GoBack(uint64_t backForwardItemID)
- GoForward(uint64_t backForwardItemID)
- GoToBackForwardItem(uint64_t backForwardItemID)
+ GoBack(uint64_t backForwardItemID, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
+ GoForward(uint64_t backForwardItemID, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
+ GoToBackForwardItem(uint64_t backForwardItemID, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
LoadHTMLString(WTF::String htmlString, WTF::String baseURL)
LoadAlternateHTMLString(WTF::String htmlString, WTF::String baseURL, WTF::String unreachableURL);
LoadPlainTextString(WTF::String string)
@@ -49,7 +55,7 @@ messages -> WebPage {
StopLoadingFrame(uint64_t frameID)
- RestoreSessionAndNavigateToCurrentItem(WebKit::SessionState state)
+ RestoreSessionAndNavigateToCurrentItem(WebKit::SessionState state, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
DidRemoveBackForwardItem(uint64_t backForwardItemID)
@@ -65,6 +71,9 @@ messages -> WebPage {
GetWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID)
RunJavaScriptInMainFrame(WTF::String script, uint64_t callbackID)
+ # FIXME: This should be a drawing area message.
+ ForceRepaint(uint64_t callbackID)
+
PreferencesDidChange(WebKit::WebPreferencesStore store)
SetUserAgent(WTF::String userAgent)
@@ -100,7 +109,12 @@ messages -> WebPage {
CountStringMatches(WTF::String string, uint32_t findOptions, unsigned maxMatchCount)
# Drag and drop.
+#if PLATFORM(WIN)
+ PerformDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, HashMap<UINT,Vector<String>> dataMap, uint32_t flags)
+#endif
+#if !PLATFORM(WIN)
PerformDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, WTF::String dragStorageName, uint32_t flags)
+#endif
DragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation)
# Popup menu.
@@ -113,6 +127,9 @@ messages -> WebPage {
# Open panel.
DidChooseFilesForOpenPanel(Vector<WTF::String> fileURLs)
DidCancelForOpenPanel()
+#if ENABLE(WEB_PROCESS_SANDBOX)
+ ExtendSandboxForFileFromOpenPanel(WebKit::SandboxExtension::Handle sandboxExtensionHandle)
+#endif
# Spelling and grammar.
AdvanceToNextMisspelling(bool startBeforeSelection)
@@ -133,11 +150,12 @@ messages -> WebPage {
SetWindowResizerSize(WebCore::IntSize intersectsView)
# Printing.
- BeginPrinting(uint64_t frameID, WebKit::PrintInfo printInfo);
+ BeginPrinting(uint64_t frameID, WebKit::PrintInfo printInfo)
EndPrinting();
- ComputePagesForPrinting(uint64_t frameID, WebKit::PrintInfo printInfo) -> (Vector<WebCore::IntRect> pageRects, double totalScaleFactorForPrinting)
+ ComputePagesForPrinting(uint64_t frameID, WebKit::PrintInfo printInfo, uint64_t callbackID)
#if PLATFORM(MAC)
- DrawRectToPDF(uint64_t frameID, WebCore::IntRect rect) -> (Vector<uint8_t> pdfData)
+ DrawRectToPDF(uint64_t frameID, WebCore::IntRect rect, uint64_t callbackID)
+ DrawPagesToPDF(uint64_t frameID, uint32_t first, uint32_t count, uint64_t callbackID)
#endif
// FIXME: This a dummy message, to avoid breaking the build for platforms that don't require
@@ -153,7 +171,7 @@ messages -> WebPage {
GetMarkedRange() -> (uint64_t location, uint64_t length)
CharacterIndexForPoint(WebCore::IntPoint point) -> (uint64_t result)
FirstRectForCharacterRange(uint64_t location, uint64_t length) -> (WebCore::IntRect resultRect)
- SendAccessibilityPresenterToken(CoreIPC::DataReference token)
+ RegisterUIProcessAccessibilityTokens(CoreIPC::DataReference elemenToken, CoreIPC::DataReference windowToken)
#endif
#if PLATFORM(WIN)
ConfirmComposition(WTF::String compositionString)
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp b/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp
index 67109ec..3bd20c8 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPageGroupProxy.h"
#include "WebProcess.h"
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDatabaseManagerGtk.cpp b/Source/WebKit2/WebProcess/WebPage/gtk/ChunkedUpdateDrawingAreaGtk.cpp
index b3c1289..313ad3f 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDatabaseManagerGtk.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/gtk/ChunkedUpdateDrawingAreaGtk.cpp
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
* Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ * Copyright (C) 2011 Igalia S.L.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -24,16 +25,32 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "WebDatabaseManager.h"
+#include "config.h"
+#include "ChunkedUpdateDrawingArea.h"
-#include "NotImplemented.h"
+#include "RefPtrCairo.h"
+#include "UpdateChunk.h"
+#include "WebPage.h"
+
+#include <WebCore/GraphicsContext.h>
+#include <WebCore/IntRect.h>
+
+using namespace WebCore;
namespace WebKit {
-String WebDatabaseManager::databaseDirectory() const
+void ChunkedUpdateDrawingArea::paintIntoUpdateChunk(UpdateChunk* updateChunk)
{
- notImplemented();
- return String();
+ ASSERT(!updateChunk->isEmpty());
+
+ RefPtr<cairo_surface_t> image = updateChunk->createImage();
+ RefPtr<cairo_t> cr = cairo_create(image.get());
+ GraphicsContext gc(cr.get());
+ gc.save();
+ IntRect rect = updateChunk->rect();
+ gc.translate(-rect.x(), -rect.y());
+ m_webPage->drawRect(gc, updateChunk->rect());
+ gc.restore();
}
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp b/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp
index 4697f62..36bde01 100644
--- a/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebInspector.h"
#if ENABLE(INSPECTOR)
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm b/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm
index fa4aa1a..c88ab7e 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import "config.h"
#import "AccessibilityWebPageObject.h"
#import "WebFrame.h"
@@ -32,6 +33,7 @@
#import <WebCore/FrameView.h>
#import <WebCore/ScrollView.h>
#import <WebCore/Scrollbar.h>
+#import <WebKitSystemInterface.h>
using namespace WebCore;
using namespace WebKit;
@@ -70,6 +72,7 @@ using namespace WebKit;
- (void)dealloc
{
+ WKUnregisterUniqueIdForElement(self);
[m_accessibilityChildren release];
[m_attributeNames release];
[m_parent release];
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp b/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp
index 6bcecfd..b39598f 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ChunkedUpdateDrawingArea.h"
#include "UpdateChunk.h"
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm
index 24fa124..25a1dfd 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm
@@ -23,18 +23,19 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if USE(ACCELERATED_COMPOSITING)
+#import "config.h"
+#import "LayerBackedDrawingArea.h"
-#include "LayerBackedDrawingArea.h"
+#if USE(ACCELERATED_COMPOSITING)
-#include "DrawingAreaProxyMessageKinds.h"
-#include "WebKitSystemInterface.h"
-#include "WebPage.h"
-#include "WebProcess.h"
-#include <WebCore/Frame.h>
-#include <WebCore/FrameView.h>
-#include <WebCore/GraphicsLayer.h>
-#include <WebCore/Page.h>
+#import "DrawingAreaProxyMessageKinds.h"
+#import "WebKitSystemInterface.h"
+#import "WebPage.h"
+#import "WebProcess.h"
+#import <WebCore/Frame.h>
+#import <WebCore/FrameView.h>
+#import <WebCore/GraphicsLayer.h>
+#import <WebCore/Page.h>
using namespace WebCore;
@@ -83,7 +84,7 @@ void LayerBackedDrawingArea::attachCompositingContext()
WKCARemoteLayerClientSetLayer(m_remoteLayerRef.get(), m_hostingLayer->platformLayer());
uint32_t contextID = WKCARemoteLayerClientGetClientId(m_remoteLayerRef.get());
- WebProcess::shared().connection()->sendSync(DrawingAreaProxyLegacyMessage::AttachCompositingContext, m_webPage->pageID(), CoreIPC::In(contextID), CoreIPC::Out());
+ WebProcess::shared().connection()->deprecatedSendSync(DrawingAreaProxyLegacyMessage::AttachCompositingContext, m_webPage->pageID(), CoreIPC::In(contextID), CoreIPC::Out());
#endif
}
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h
new file mode 100644
index 0000000..016f0d6
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h
@@ -0,0 +1,96 @@
+/*
+ * 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 LayerTreeHostMac_h
+#define LayerTreeHostMac_h
+
+#include "LayerTreeContext.h"
+#include "LayerTreeHost.h"
+#include <WebCore/GraphicsLayerClient.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/RetainPtr.h>
+
+typedef struct __WKCARemoteLayerClientRef* WKCARemoteLayerClientRef;
+
+namespace WebKit {
+
+class LayerTreeHostMac : public LayerTreeHost, WebCore::GraphicsLayerClient {
+public:
+ static PassRefPtr<LayerTreeHostMac> create(WebPage*);
+ ~LayerTreeHostMac();
+
+private:
+ explicit LayerTreeHostMac(WebPage*);
+
+ // LayerTreeHost.
+ virtual const LayerTreeContext& layerTreeContext();
+ virtual void scheduleLayerFlush();
+ virtual void setRootCompositingLayer(WebCore::GraphicsLayer*);
+ virtual void invalidate();
+
+ virtual void setNonCompositedContentsNeedDisplay(const WebCore::IntRect&);
+ virtual void scrollNonCompositedContents(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
+ virtual void sizeDidChange(const WebCore::IntSize& newSize);
+
+ virtual void didInstallPageOverlay();
+ virtual void didUninstallPageOverlay();
+ virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&);
+
+ // GraphicsLayerClient
+ virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time);
+ virtual void notifySyncRequired(const WebCore::GraphicsLayer*);
+ virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect);
+ virtual bool showDebugBorders() const;
+ virtual bool showRepaintCounter() const;
+
+ static void flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void*);
+ void flushPendingLayerChangesRunLoopObserverCallback();
+ bool flushPendingLayerChanges();
+
+ void createPageOverlayLayer();
+ void destroyPageOverlayLayer();
+
+ // The context for this layer tree.
+ LayerTreeContext m_layerTreeContext;
+
+ // Whether the layer tree host is valid or not.
+ bool m_isValid;
+
+ // The root layer.
+ OwnPtr<WebCore::GraphicsLayer> m_rootLayer;
+
+ // The layer which contains all non-composited content.
+ OwnPtr<WebCore::GraphicsLayer> m_nonCompositedContentLayer;
+
+ // The page overlay layer. Will be null if there's no page overlay.
+ OwnPtr<WebCore::GraphicsLayer> m_pageOverlayLayer;
+
+ RetainPtr<WKCARemoteLayerClientRef> m_remoteLayerClient;
+ RetainPtr<CFRunLoopObserverRef> m_flushPendingLayerChangesRunLoopObserver;
+};
+
+} // namespace WebKit
+
+#endif // LayerTreeHostMac_h
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
new file mode 100644
index 0000000..9734aec
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
@@ -0,0 +1,279 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "LayerTreeHostMac.h"
+
+#import "WebPage.h"
+#import "WebProcess.h"
+#import <QuartzCore/CATransaction.h>
+#import <WebCore/Frame.h>
+#import <WebCore/FrameView.h>
+#import <WebCore/Page.h>
+#import <WebCore/Settings.h>
+#import <WebKitSystemInterface.h>
+
+@interface CATransaction (Details)
++ (void)synchronize;
+@end
+
+using namespace WebCore;
+
+namespace WebKit {
+
+PassRefPtr<LayerTreeHostMac> LayerTreeHostMac::create(WebPage* webPage)
+{
+ return adoptRef(new LayerTreeHostMac(webPage));
+}
+
+LayerTreeHostMac::LayerTreeHostMac(WebPage* webPage)
+ : LayerTreeHost(webPage)
+ , m_isValid(true)
+{
+ mach_port_t serverPort = WebProcess::shared().compositingRenderServerPort();
+ m_remoteLayerClient = WKCARemoteLayerClientMakeWithServerPort(serverPort);
+
+ // Create a root layer.
+ m_rootLayer = GraphicsLayer::create(this);
+#ifndef NDEBUG
+ m_rootLayer->setName("LayerTreeHost root layer");
+#endif
+ m_rootLayer->setDrawsContent(false);
+ m_rootLayer->setSize(webPage->size());
+
+ [m_rootLayer->platformLayer() setGeometryFlipped:YES];
+
+ m_nonCompositedContentLayer = GraphicsLayer::create(this);
+#ifndef NDEBUG
+ m_nonCompositedContentLayer->setName("LayerTreeHost non-composited content");
+#endif
+ m_nonCompositedContentLayer->setDrawsContent(true);
+ m_nonCompositedContentLayer->setContentsOpaque(m_webPage->drawsBackground() && !m_webPage->drawsTransparentBackground());
+ m_nonCompositedContentLayer->setSize(webPage->size());
+
+ m_rootLayer->addChild(m_nonCompositedContentLayer.get());
+
+ WKCARemoteLayerClientSetLayer(m_remoteLayerClient.get(), m_rootLayer->platformLayer());
+
+ if (m_webPage->hasPageOverlay())
+ createPageOverlayLayer();
+
+ scheduleLayerFlush();
+
+ m_layerTreeContext.contextID = WKCARemoteLayerClientGetClientId(m_remoteLayerClient.get());
+}
+
+LayerTreeHostMac::~LayerTreeHostMac()
+{
+ ASSERT(!m_isValid);
+ ASSERT(!m_flushPendingLayerChangesRunLoopObserver);
+ ASSERT(!m_remoteLayerClient);
+ ASSERT(!m_rootLayer);
+}
+
+const LayerTreeContext& LayerTreeHostMac::layerTreeContext()
+{
+ return m_layerTreeContext;
+}
+
+void LayerTreeHostMac::scheduleLayerFlush()
+{
+ CFRunLoopRef currentRunLoop = CFRunLoopGetCurrent();
+
+ // Make sure we wake up the loop or the observer could be delayed until some other source fires.
+ CFRunLoopWakeUp(currentRunLoop);
+
+ if (m_flushPendingLayerChangesRunLoopObserver)
+ return;
+
+ // Run before the Core Animation commit observer, which has order 2000000.
+ const CFIndex runLoopOrder = 2000000 - 1;
+ CFRunLoopObserverContext context = { 0, this, 0, 0, 0 };
+ m_flushPendingLayerChangesRunLoopObserver.adoptCF(CFRunLoopObserverCreate(0, kCFRunLoopBeforeWaiting | kCFRunLoopExit, true, runLoopOrder, flushPendingLayerChangesRunLoopObserverCallback, &context));
+
+ CFRunLoopAddObserver(currentRunLoop, m_flushPendingLayerChangesRunLoopObserver.get(), kCFRunLoopCommonModes);
+}
+
+void LayerTreeHostMac::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
+{
+ ASSERT(graphicsLayer);
+
+ m_nonCompositedContentLayer->removeAllChildren();
+
+ // Add the accelerated layer tree hierarchy.
+ m_nonCompositedContentLayer->addChild(graphicsLayer);
+}
+
+void LayerTreeHostMac::invalidate()
+{
+ ASSERT(m_isValid);
+
+ if (m_flushPendingLayerChangesRunLoopObserver) {
+ CFRunLoopObserverInvalidate(m_flushPendingLayerChangesRunLoopObserver.get());
+ m_flushPendingLayerChangesRunLoopObserver = nullptr;
+ }
+
+ WKCARemoteLayerClientInvalidate(m_remoteLayerClient.get());
+ m_remoteLayerClient = nullptr;
+ m_rootLayer = nullptr;
+ m_isValid = false;
+}
+
+void LayerTreeHostMac::setNonCompositedContentsNeedDisplay(const IntRect& rect)
+{
+ m_nonCompositedContentLayer->setNeedsDisplayInRect(rect);
+ if (m_pageOverlayLayer)
+ m_pageOverlayLayer->setNeedsDisplayInRect(rect);
+
+ scheduleLayerFlush();
+}
+
+void LayerTreeHostMac::scrollNonCompositedContents(const IntRect& scrollRect, const IntSize& scrollOffset)
+{
+ setNonCompositedContentsNeedDisplay(scrollRect);
+}
+
+void LayerTreeHostMac::sizeDidChange(const IntSize& newSize)
+{
+ m_rootLayer->setSize(newSize);
+ m_nonCompositedContentLayer->setSize(newSize);
+
+ if (m_pageOverlayLayer)
+ m_pageOverlayLayer->setSize(newSize);
+
+ scheduleLayerFlush();
+ flushPendingLayerChanges();
+
+ [CATransaction flush];
+ [CATransaction synchronize];
+}
+
+void LayerTreeHostMac::didInstallPageOverlay()
+{
+ createPageOverlayLayer();
+ scheduleLayerFlush();
+}
+
+void LayerTreeHostMac::didUninstallPageOverlay()
+{
+ destroyPageOverlayLayer();
+ scheduleLayerFlush();
+}
+
+void LayerTreeHostMac::setPageOverlayNeedsDisplay(const IntRect& rect)
+{
+ ASSERT(m_pageOverlayLayer);
+ m_pageOverlayLayer->setNeedsDisplayInRect(rect);
+ scheduleLayerFlush();
+}
+
+void LayerTreeHostMac::notifyAnimationStarted(const WebCore::GraphicsLayer*, double time)
+{
+}
+
+void LayerTreeHostMac::notifySyncRequired(const WebCore::GraphicsLayer*)
+{
+}
+
+void LayerTreeHostMac::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const IntRect& clipRect)
+{
+ if (graphicsLayer == m_nonCompositedContentLayer) {
+ m_webPage->drawRect(graphicsContext, clipRect);
+ return;
+ }
+
+ if (graphicsLayer == m_pageOverlayLayer) {
+ m_webPage->drawPageOverlay(graphicsContext, clipRect);
+ return;
+ }
+}
+
+bool LayerTreeHostMac::showDebugBorders() const
+{
+ return m_webPage->corePage()->settings()->showDebugBorders();
+}
+
+bool LayerTreeHostMac::showRepaintCounter() const
+{
+ return m_webPage->corePage()->settings()->showRepaintCounter();
+}
+
+void LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void* context)
+{
+ static_cast<LayerTreeHostMac*>(context)->flushPendingLayerChangesRunLoopObserverCallback();
+}
+
+void LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback()
+{
+ {
+ RefPtr<LayerTreeHostMac> protect(this);
+ m_webPage->layoutIfNeeded();
+
+ if (!m_isValid)
+ return;
+ }
+
+ if (!flushPendingLayerChanges())
+ return;
+
+ // We successfully flushed the pending layer changes, remove the run loop observer.
+ ASSERT(m_flushPendingLayerChangesRunLoopObserver);
+ CFRunLoopObserverInvalidate(m_flushPendingLayerChangesRunLoopObserver.get());
+ m_flushPendingLayerChangesRunLoopObserver = 0;
+}
+
+bool LayerTreeHostMac::flushPendingLayerChanges()
+{
+ m_rootLayer->syncCompositingStateForThisLayerOnly();
+ m_nonCompositedContentLayer->syncCompositingStateForThisLayerOnly();
+ if (m_pageOverlayLayer)
+ m_pageOverlayLayer->syncCompositingStateForThisLayerOnly();
+
+ return m_webPage->corePage()->mainFrame()->view()->syncCompositingStateIncludingSubframes();
+}
+
+void LayerTreeHostMac::createPageOverlayLayer()
+{
+ ASSERT(!m_pageOverlayLayer);
+
+ m_pageOverlayLayer = GraphicsLayer::create(this);
+#ifndef NDEBUG
+ m_pageOverlayLayer->setName("LayerTreeHost page overlay content");
+#endif
+
+ m_pageOverlayLayer->setDrawsContent(true);
+ m_pageOverlayLayer->setSize(m_webPage->size());
+
+ m_rootLayer->addChild(m_pageOverlayLayer.get());
+}
+
+void LayerTreeHostMac::destroyPageOverlayLayer()
+{
+ ASSERT(m_pageOverlayLayer);
+ m_pageOverlayLayer->removeFromParent();
+ m_pageOverlayLayer = nullptr;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm
index 83909be..f053cab 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import "config.h"
#import "WebInspector.h"
#import <wtf/text/WTFString.h>
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
index f3211f2..71bbf78 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
@@ -23,28 +23,29 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "WebPage.h"
+#import "config.h"
+#import "WebPage.h"
-#include "AccessibilityWebPageObject.h"
-#include "DataReference.h"
-#include "PluginView.h"
-#include "WebCoreArgumentCoders.h"
-#include "WebEvent.h"
-#include "WebFrame.h"
-#include "WebPageProxyMessages.h"
-#include "WebProcess.h"
-#include <WebCore/AXObjectCache.h>
-#include <WebCore/FocusController.h>
-#include <WebCore/Frame.h>
-#include <WebCore/FrameView.h>
-#include <WebCore/HitTestResult.h>
-#include <WebCore/KeyboardEvent.h>
-#include <WebCore/Page.h>
-#include <WebCore/PlatformKeyboardEvent.h>
-#include <WebCore/ScrollView.h>
-#include <WebCore/TextIterator.h>
-#include <WebCore/WindowsKeyboardCodes.h>
-#include <WebKitSystemInterface.h>
+#import "AccessibilityWebPageObject.h"
+#import "DataReference.h"
+#import "PluginView.h"
+#import "WebCoreArgumentCoders.h"
+#import "WebEvent.h"
+#import "WebFrame.h"
+#import "WebPageProxyMessages.h"
+#import "WebProcess.h"
+#import <WebCore/AXObjectCache.h>
+#import <WebCore/FocusController.h>
+#import <WebCore/Frame.h>
+#import <WebCore/FrameView.h>
+#import <WebCore/HitTestResult.h>
+#import <WebCore/KeyboardEvent.h>
+#import <WebCore/Page.h>
+#import <WebCore/PlatformKeyboardEvent.h>
+#import <WebCore/ScrollView.h>
+#import <WebCore/TextIterator.h>
+#import <WebCore/WindowsKeyboardCodes.h>
+#import <WebKitSystemInterface.h>
using namespace WebCore;
@@ -65,7 +66,7 @@ void WebPage::platformInitialize()
// send data back over
NSData* remoteToken = (NSData *)WKAXRemoteTokenForElement(mockAccessibilityElement);
CoreIPC::DataReference dataToken = CoreIPC::DataReference(reinterpret_cast<const uint8_t*>([remoteToken bytes]), [remoteToken length]);
- send(Messages::WebPageProxy::DidReceiveAccessibilityPageToken(dataToken));
+ send(Messages::WebPageProxy::RegisterWebProcessAccessibilityToken(dataToken));
m_mockAccessibilityElement = mockAccessibilityElement;
#endif
}
@@ -230,10 +231,11 @@ void WebPage::firstRectForCharacterRange(uint64_t location, uint64_t length, Web
resultRect.setSize(IntSize(0, 0));
RefPtr<Range> range = convertToRange(frame, NSMakeRange(location, length));
- if (range) {
- ASSERT(range->startContainer());
- ASSERT(range->endContainer());
- }
+ if (!range)
+ return;
+
+ ASSERT(range->startContainer());
+ ASSERT(range->endContainer());
IntRect rect = frame->editor()->firstRectForRange(range.get());
resultRect = frame->view()->contentsToWindow(rect);
@@ -334,11 +336,16 @@ bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent& keyboard
return true;
}
-void WebPage::sendAccessibilityPresenterToken(const CoreIPC::DataReference& data)
+void WebPage::registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elementToken, const CoreIPC::DataReference& windowToken)
{
#if !defined(BUILDING_ON_SNOW_LEOPARD)
- NSData* tokenData = [NSData dataWithBytes:data.data() length:data.size()];
- [m_mockAccessibilityElement.get() setRemoteParent:WKAXRemoteElementForToken((CFDataRef)tokenData)];
+ NSData* elementTokenData = [NSData dataWithBytes:elementToken.data() length:elementToken.size()];
+ NSData* windowTokenData = [NSData dataWithBytes:windowToken.data() length:windowToken.size()];
+ id remoteElement = WKAXRemoteElementForToken(elementTokenData);
+ id remoteWindow = WKAXRemoteElementForToken(windowTokenData);
+ WKAXSetWindowForRemoteElement(remoteWindow, remoteElement);
+
+ [accessibilityRemoteObject() setRemoteParent:remoteElement];
#endif
}
@@ -357,6 +364,16 @@ bool WebPage::platformHasLocalDataForURL(const WebCore::KURL& url)
return cachedResponse;
}
+String WebPage::cachedResponseMIMETypeForURL(const WebCore::KURL& url)
+{
+ NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url];
+ [request setValue:(NSString*)userAgent() forHTTPHeaderField:@"User-Agent"];
+ NSCachedURLResponse *cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
+ [request release];
+
+ return [[cachedResponse response] MIMEType];
+}
+
bool WebPage::canHandleRequest(const WebCore::ResourceRequest& request)
{
if ([NSURLConnection canHandleRequest:request.nsURLRequest()])
diff --git a/Source/WebKit2/WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp
index 25ed3e7..ec65b4e 100644
--- a/Source/WebKit2/WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ChunkedUpdateDrawingArea.h"
#include "UpdateChunk.h"
diff --git a/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp
index b7ad782..c9ae03d 100644
--- a/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp
@@ -23,10 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if ENABLE(TILED_BACKING_STORE)
-
+#include "config.h"
#include "TiledDrawingArea.h"
+#if ENABLE(TILED_BACKING_STORE)
+
#include "UpdateChunk.h"
#include "WebPage.h"
#include <WebCore/GraphicsContext.h>
diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp
index 99aa1eb..1675d77 100644
--- a/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebInspector.h"
#if ENABLE(INSPECTOR)
diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp
index fe1a89c..cad0c04 100644
--- a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPage.h"
#include "WebEvent.h"
@@ -270,6 +271,12 @@ bool WebPage::platformHasLocalDataForURL(const WebCore::KURL&)
return false;
}
+String WebPage::cachedResponseMIMETypeForURL(const WebCore::KURL&)
+{
+ // FIXME: Implement
+ return String();
+}
+
bool WebPage::canHandleRequest(const WebCore::ResourceRequest&)
{
// FIXME: Implement
diff --git a/Source/WebKit2/WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp
index aa1f975..13f1e3f 100644
--- a/Source/WebKit2/WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "ChunkedUpdateDrawingArea.h"
#include "UpdateChunk.h"
diff --git a/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp
index cae79c2..3c2f3c9 100644
--- a/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp
@@ -23,10 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if USE(ACCELERATED_COMPOSITING)
-
+#include "config.h"
#include "LayerBackedDrawingArea.h"
+#if USE(ACCELERATED_COMPOSITING)
+
using namespace WebCore;
namespace WebKit {
diff --git a/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp
index 4c30b8b..3ae0dae 100644
--- a/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebInspector.h"
#if ENABLE(INSPECTOR)
diff --git a/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp
index d41972c..e20af3a 100644
--- a/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebPage.h"
#include "FontSmoothingLevel.h"
@@ -261,6 +262,27 @@ bool WebPage::platformHasLocalDataForURL(const WebCore::KURL& url)
#endif
}
+String WebPage::cachedResponseMIMETypeForURL(const WebCore::KURL& url)
+{
+#if USE(CFNETWORK)
+ RetainPtr<CFURLRef> cfURL(AdoptCF, url.createCFURL());
+ RetainPtr<CFMutableURLRequestRef> request(AdoptCF, CFURLRequestCreateMutable(0, cfURL.get(), kCFURLRequestCachePolicyReloadIgnoringCache, 60, 0));
+
+ RetainPtr<CFStringRef> userAgent(AdoptCF, userAgent().createCFString());
+ CFURLRequestSetHTTPHeaderFieldValue(request.get(), CFSTR("User-Agent"), userAgent.get());
+
+ RetainPtr<CFURLCacheRef> cache(AdoptCF, CFURLCacheCopySharedURLCache());
+
+ RetainPtr<CFCachedURLResponseRef> cachedResponse(AdoptCF, CFURLCacheCopyResponseForRequest(cache.get(), request.get()));
+
+ CFURLResponseRef response = CFCachedURLResponseGetWrappedResponse(cachedResponse.get());
+
+ return response ? CFURLResponseGetMIMEType(response) : String();
+#else
+ return String();
+#endif
+}
+
bool WebPage::canHandleRequest(const WebCore::ResourceRequest& request)
{
#if USE(CFNETWORK)
diff --git a/Source/WebKit2/WebProcess/WebProcess.cpp b/Source/WebKit2/WebProcess/WebProcess.cpp
index 47f4125..97faec4 100644
--- a/Source/WebKit2/WebProcess/WebProcess.cpp
+++ b/Source/WebKit2/WebProcess/WebProcess.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebProcess.h"
#include "AuthenticationManager.h"
@@ -119,11 +120,6 @@ WebProcess::WebProcess()
// Initialize our platform strategies.
WebPlatformStrategies::initialize();
#endif // USE(PLATFORM_STRATEGIES)
-
-#if ENABLE(DATABASE)
- // Make sure the WebDatabaseManager is initialized so that the Database directory is set.
- WebDatabaseManager::shared();
-#endif
}
void WebProcess::initialize(CoreIPC::Connection::Identifier serverIdentifier, RunLoop* runLoop)
@@ -131,6 +127,8 @@ void WebProcess::initialize(CoreIPC::Connection::Identifier serverIdentifier, Ru
ASSERT(!m_connection);
m_connection = CoreIPC::Connection::createClientConnection(serverIdentifier, this, runLoop);
+ m_connection->setDidCloseOnConnectionWorkQueueCallback(didCloseOnConnectionWorkQueue);
+
m_connection->open();
m_runLoop = runLoop;
@@ -159,6 +157,11 @@ void WebProcess::initializeWebProcess(const WebProcessCreationParameters& parame
}
}
+#if ENABLE(DATABASE)
+ // Make sure the WebDatabaseManager is initialized so that the Database directory is set.
+ WebDatabaseManager::initialize(parameters.databaseDirectory);
+#endif
+
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
if (!parameters.applicationCacheDirectory.isEmpty())
cacheStorage().setCacheDirectory(parameters.applicationCacheDirectory);
@@ -564,6 +567,13 @@ void WebProcess::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::Message
// we'll let it slide.
}
+NO_RETURN void WebProcess::didFailToSendSyncMessage(CoreIPC::Connection*)
+{
+ // We were making a synchronous call to a UI process that doesn't exist any more.
+ // Callers are unlikely to be prepared for an error like this, so it's best to exit immediately.
+ exit(0);
+}
+
WebFrame* WebProcess::webFrame(uint64_t frameID) const
{
return m_frameMap.get(frameID);
diff --git a/Source/WebKit2/WebProcess/WebProcess.h b/Source/WebKit2/WebProcess/WebProcess.h
index e82cf15..993cf38 100644
--- a/Source/WebKit2/WebProcess/WebProcess.h
+++ b/Source/WebKit2/WebProcess/WebProcess.h
@@ -68,7 +68,7 @@ class WebProcess : ChildProcess {
public:
static WebProcess& shared();
- void initialize(CoreIPC::Connection::Identifier, RunLoop* runLoop);
+ void initialize(CoreIPC::Connection::Identifier, RunLoop*);
CoreIPC::Connection* connection() const { return m_connection.get(); }
RunLoop* runLoop() const { return m_runLoop; }
@@ -156,6 +156,7 @@ private:
CoreIPC::SyncReplyMode didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
void didClose(CoreIPC::Connection*);
void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID);
+ NO_RETURN void didFailToSendSyncMessage(CoreIPC::Connection*);
// Implemented in generated WebProcessMessageReceiver.cpp
void didReceiveWebProcessMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
diff --git a/Source/WebKit2/WebProcess/com.apple.WebProcess.sb b/Source/WebKit2/WebProcess/com.apple.WebProcess.sb
index df57bde..5d81971 100644
--- a/Source/WebKit2/WebProcess/com.apple.WebProcess.sb
+++ b/Source/WebKit2/WebProcess/com.apple.WebProcess.sb
@@ -6,48 +6,57 @@
;; Read-only preferences and data
(allow file-read*
- ;; Basic system paths
- (subpath "/Library/Fonts")
- (subpath "/Library/Frameworks")
- (subpath "/Library/Keychains")
- (subpath "/private/var/db/mds")
- (regex #"^/private/etc/(hosts|group|passwd)$")
-
- ;; Plugins
- (subpath "/Library/Internet Plug-Ins")
- (subpath (string-append (param "_HOME") "/Library/Internet Plug-Ins"))
-
- ;; System and user preferences
- (literal "/Library/Preferences/.GlobalPreferences.plist")
- (literal "/Library/Preferences/com.apple.security.plist")
- (literal (string-append (param "_HOME") "/Library/Preferences/.GlobalPreferences.plist"))
- (regex (string-append "^" (param "_HOME") "/Library/Preferences/ByHost/\.GlobalPreferences\."))
- (literal (string-append (param "_HOME") "/Library/Preferences/com.apple.ATS.plist"))
- (literal (string-append (param "_HOME") "/Library/Preferences/com.apple.HIToolbox.plist"))
- (literal (string-append (param "_HOME") "/Library/Preferences/com.apple.LaunchServices.plist"))
- (literal (string-append (param "_HOME") "/Library/Preferences/com.apple.WebFoundation.plist"))
- (literal (string-append (param "_HOME") "/Library/Preferences/com.apple.security.plist"))
- (literal (string-append (param "_HOME") "/Library/Preferences/com.apple.security.revocation.plist"))
- (subpath (string-append (param "_HOME") "/Library/Keychains"))
-
- ;; On-disk WebKit2 framework location, to account for debug installations
- ;; outside of /System/Library/Frameworks
- (subpath (param "WEBKIT2_FRAMEWORK_DIR"))
-
- ;; Extensions from UIProcess
- (extension)
+ ;; Basic system paths
+ (subpath "/Library/Fonts")
+ (subpath "/Library/Frameworks")
+ (subpath "/Library/Keychains")
+ (subpath "/private/var/db/mds")
+ (subpath "/private/var/db/DetachedSignatures")
+ (regex #"^/private/etc/(hosts|group|passwd)$")
+
+ ;; Plugins
+ (subpath "/Library/Internet Plug-Ins")
+ (subpath (string-append (param "HOME_DIR") "/Library/Internet Plug-Ins"))
+
+ ;; System and user preferences
+ (literal "/Library/Preferences/.GlobalPreferences.plist")
+ (literal "/Library/Preferences/com.apple.crypto.plist")
+ (literal "/Library/Preferences/com.apple.security.plist")
+ (literal "/Library/Preferences/com.apple.security.common.plist")
+ (literal "/Library/Preferences/com.apple.security.revocation.plist")
+ (literal (string-append (param "HOME_DIR") "/Library/Preferences/.GlobalPreferences.plist"))
+ (regex (string-append "^" (param "HOME_DIR") "/Library/Preferences/ByHost/\.GlobalPreferences\."))
+ (literal (string-append (param "HOME_DIR") "/Library/Preferences/com.apple.ATS.plist"))
+ (literal (string-append (param "HOME_DIR") "/Library/Preferences/com.apple.HIToolbox.plist"))
+ (literal (string-append (param "HOME_DIR") "/Library/Preferences/com.apple.LaunchServices.plist"))
+ (literal (string-append (param "HOME_DIR") "/Library/Preferences/com.apple.WebFoundation.plist"))
+ (literal (string-append (param "HOME_DIR") "/Library/Preferences/com.apple.security.plist"))
+ (literal (string-append (param "HOME_DIR") "/Library/Preferences/com.apple.security.revocation.plist"))
+ (literal (string-append (param "HOME_DIR") "/Library/Application Support/SyncServices/Local/ClientsWithChanges/com.apple.Keychain"))
+ (regex (string-append "^" (param "HOME_DIR") "/Library/Preferences/com\.apple\.driver\.(AppleBluetoothMultitouch\.mouse|AppleBluetoothMultitouch\.trackpad|AppleHIDMouse)\.plist$"))
+
+ ;; On-disk WebKit2 framework location, to account for debug installations
+ ;; outside of /System/Library/Frameworks
+ (subpath (param "WEBKIT2_FRAMEWORK_DIR"))
+
+ ;; FIXME: This should be removed when <rdar://problem/8957845> is fixed.
+ (subpath (string-append (param "HOME_DIR") "/Library/Fonts"))
+
+ ;; Extensions from UIProcess
+ (extension)
)
(allow file-write*
- ;; Extensions from UIProcess
- (extension)
+ ;; Extensions from UIProcess
+ (extension)
)
;; Writable preferences and temporary files
(allow file*
- (subpath (string-append (param "_HOME") "/Library/Caches/com.apple.WebProcess"))
- (regex (string-append "^" (param "_HOME") "/Library/Preferences/ByHost/com\.apple\.HIToolbox\."))
- (regex (string-append "^" (param "_HOME") "/Library/Preferences/com\.apple\.WebProcess\."))
+ (subpath (string-append (param "HOME_DIR") "/Library/Caches/com.apple.WebProcess"))
+ (regex (string-append "^" (param "HOME_DIR") "/Library/Preferences/ByHost/com\.apple\.HIToolbox\."))
+ (regex (string-append "^" (param "HOME_DIR") "/Library/Preferences/com\.apple\.WebProcess\."))
+ (subpath (string-append (param "HOME_DIR") "/Library/Keychains"))
)
;; Darwin temporary files and caches, if present
@@ -56,6 +65,10 @@
(if (positive? (string-length (param "DARWIN_USER_TEMP_DIR")))
(allow file* (subpath (param "DARWIN_USER_TEMP_DIR"))))
+;; Database dir
+(if (positive? (string-length (param "WEBKIT_DATABASE_DIR")))
+ (allow file* (subpath (param "WEBKIT_DATABASE_DIR"))))
+
;; The NSURLCache directory.
(if (positive? (string-length (param "NSURL_CACHE_DIR")))
(allow file* (subpath (param "NSURL_CACHE_DIR"))))
@@ -89,6 +102,7 @@
(global-name "com.apple.dock.server")
(global-name "com.apple.ocspd")
(global-name "com.apple.pasteboard.1")
+ (global-name "com.apple.system.opendirectoryd.api")
(global-name "com.apple.window_proxies")
(global-name "com.apple.windowserver.active")
(global-name-regex #"^com\.apple\.WebKit\.WebProcess-")
@@ -107,8 +121,8 @@
;; FIXME: These rules are required until plug-ins are moved out of the web process.
(allow file-read*
- (regex (string-append "^" (param "_HOME") "/Library/Preferences/ByHost/com\.apple\.ist\."))
- (literal (string-append (param "_HOME") "/Library/Preferences/edu.mit.Kerberos"))
+ (regex (string-append "^" (param "HOME_DIR") "/Library/Preferences/ByHost/com\.apple\.ist\."))
+ (literal (string-append (param "HOME_DIR") "/Library/Preferences/edu.mit.Kerberos"))
(literal "/Library/Preferences/edu.mit.Kerberos")
)
@@ -127,6 +141,10 @@
;; FIXME: Once <rdar://problem/8900275> has been fixed, these rules can be removed.
(allow mach-lookup (global-name "com.apple.pubsub.ipc"))
(allow network-outbound (regex #"^/private/tmp/launch-[^/]+/Render"))
+(allow file-read*
+ (literal (string-append (param "HOME_DIR") "/Library/Preferences/com.apple.Safari.RSS.plist"))
+ (literal (string-append (param "HOME_DIR") "/Library/Preferences/com.apple.Syndication.plist"))
+)
;; FIXME: Investigate these.
(allow appleevent-send (appleevent-destination "com.apple.WebProcess"))
diff --git a/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp b/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp
index 4c26c08..43e9776 100644
--- a/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp
+++ b/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebProcess.h"
#include "NotImplemented.h"
diff --git a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
index dcac73f..60e537f 100644
--- a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
+++ b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebProcessMainGtk.h"
#include "WKBase.h"
@@ -51,10 +52,16 @@ WK_EXPORT int WebProcessMainGtk(int argc, char* argv[])
JSC::initializeThreading();
WTF::initializeMainThread();
-
+
RunLoop::initializeMainRunLoop();
- WebCore::ResourceHandle::defaultSession();
-
+ SoupSession* session = WebCore::ResourceHandle::defaultSession();
+
+ SoupSessionFeature* sniffer = static_cast<SoupSessionFeature*>(g_object_new(SOUP_TYPE_CONTENT_SNIFFER, NULL));
+ soup_session_add_feature(session, sniffer);
+ g_object_unref(sniffer);
+
+ soup_session_add_feature_by_type(session, SOUP_TYPE_CONTENT_DECODER);
+
int socket = atoi(argv[1]);
WebProcess::shared().initialize(socket, RunLoop::main());
RunLoop::run();
diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm
index d394c98..fc06d2c 100644
--- a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm
+++ b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm
@@ -23,23 +23,24 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "WebProcess.h"
-
-#include "SandboxExtension.h"
-#include "WebProcessCreationParameters.h"
-#include <WebCore/MemoryCache.h>
-#include <WebCore/PageCache.h>
-#include <WebKitSystemInterface.h>
-#include <algorithm>
-#include <dispatch/dispatch.h>
-#include <mach/host_info.h>
-#include <mach/mach.h>
-#include <mach/mach_error.h>
+#import "config.h"
+#import "WebProcess.h"
+
+#import "SandboxExtension.h"
+#import "WebProcessCreationParameters.h"
+#import <WebCore/MemoryCache.h>
+#import <WebCore/PageCache.h>
+#import <WebKitSystemInterface.h>
+#import <algorithm>
+#import <dispatch/dispatch.h>
+#import <mach/host_info.h>
+#import <mach/mach.h>
+#import <mach/mach_error.h>
#if ENABLE(WEB_PROCESS_SANDBOX)
-#include <sandbox.h>
-#include <stdlib.h>
-#include <sysexits.h>
+#import <sandbox.h>
+#import <stdlib.h>
+#import <sysexits.h>
#endif
using namespace WebCore;
@@ -75,7 +76,7 @@ void WebProcess::platformSetCacheModel(CacheModel cacheModel)
{
RetainPtr<NSString> nsurlCacheDirectory(AdoptNS, (NSString *)WKCopyFoundationCacheDirectory());
if (!nsurlCacheDirectory)
- nsurlCacheDirectory.adoptNS(NSHomeDirectory());
+ nsurlCacheDirectory = NSHomeDirectory();
// As a fudge factor, use 1000 instead of 1024, in case the reported byte
// count doesn't align exactly to a megabyte boundary.
@@ -109,6 +110,27 @@ void WebProcess::platformClearResourceCaches()
[[NSURLCache sharedURLCache] removeAllCachedResponses];
}
+#if ENABLE(WEB_PROCESS_SANDBOX)
+static void appendSandboxParameterPath(Vector<const char*>& vector, const char* name, const char* path)
+{
+ char normalizedPath[PATH_MAX];
+ if (!realpath(path, normalizedPath))
+ normalizedPath[0] = '\0';
+
+ vector.append(name);
+ vector.append(fastStrDup(normalizedPath));
+}
+
+static void appendSandboxParameterConfPath(Vector<const char*>& vector, const char* name, int confID)
+{
+ char path[PATH_MAX];
+ if (confstr(confID, path, PATH_MAX) <= 0)
+ path[0] = '\0';
+
+ appendSandboxParameterPath(vector, name, path);
+}
+#endif
+
static void initializeSandbox(const WebProcessCreationParameters& parameters)
{
#if ENABLE(WEB_PROCESS_SANDBOX)
@@ -117,33 +139,29 @@ static void initializeSandbox(const WebProcessCreationParameters& parameters)
return;
}
+ Vector<const char*> sandboxParameters;
+
+ appendSandboxParameterPath(sandboxParameters, "HOME_DIR", [NSHomeDirectory() fileSystemRepresentation]);
+ appendSandboxParameterPath(sandboxParameters, "WEBKIT2_FRAMEWORK_DIR", [[[[NSBundle bundleForClass:NSClassFromString(@"WKView")] bundlePath] stringByDeletingLastPathComponent] fileSystemRepresentation]);
+ appendSandboxParameterConfPath(sandboxParameters, "DARWIN_USER_TEMP_DIR", _CS_DARWIN_USER_TEMP_DIR);
+ appendSandboxParameterConfPath(sandboxParameters, "DARWIN_USER_CACHE_DIR", _CS_DARWIN_USER_CACHE_DIR);
+ appendSandboxParameterPath(sandboxParameters, "WEBKIT_DATABASE_DIR", [(NSString *)parameters.databaseDirectory fileSystemRepresentation]);
+ appendSandboxParameterPath(sandboxParameters, "NSURL_CACHE_DIR", parameters.nsURLCachePath.data());
+ appendSandboxParameterPath(sandboxParameters, "UI_PROCESS_BUNDLE_RESOURCE_DIR", parameters.uiProcessBundleResourcePath.data());
+ sandboxParameters.append(static_cast<const char*>(0));
+
+ const char* profilePath = [[[NSBundle mainBundle] pathForResource:@"com.apple.WebProcess" ofType:@"sb"] fileSystemRepresentation];
+
char* errorBuf;
- char tmpPath[PATH_MAX];
- char tmpRealPath[PATH_MAX];
- char cachePath[PATH_MAX];
- char cacheRealPath[PATH_MAX];
- const char* frameworkPath = [[[[NSBundle bundleForClass:NSClassFromString(@"WKView")] bundlePath] stringByDeletingLastPathComponent] UTF8String];
- const char* profilePath = [[[NSBundle mainBundle] pathForResource:@"com.apple.WebProcess" ofType:@"sb"] UTF8String];
-
- if (confstr(_CS_DARWIN_USER_TEMP_DIR, tmpPath, PATH_MAX) <= 0 || !realpath(tmpPath, tmpRealPath))
- tmpRealPath[0] = '\0';
-
- if (confstr(_CS_DARWIN_USER_CACHE_DIR, cachePath, PATH_MAX) <= 0 || !realpath(cachePath, cacheRealPath))
- cacheRealPath[0] = '\0';
-
- const char* const sandboxParam[] = {
- "WEBKIT2_FRAMEWORK_DIR", frameworkPath,
- "DARWIN_USER_TEMP_DIR", (const char*)tmpRealPath,
- "DARWIN_USER_CACHE_DIR", (const char*)cacheRealPath,
- "NSURL_CACHE_DIR", (const char*)parameters.nsURLCachePath.data(),
- "UI_PROCESS_BUNDLE_RESOURCE_DIR", (const char*)parameters.uiProcessBundleResourcePath.data(),
- NULL
- };
-
- if (sandbox_init_with_parameters(profilePath, SANDBOX_NAMED_EXTERNAL, sandboxParam, &errorBuf)) {
- fprintf(stderr, "WebProcess: couldn't initialize sandbox profile [%s] with framework path [%s], tmp path [%s], cache path [%s]: %s\n", profilePath, frameworkPath, tmpRealPath, cacheRealPath, errorBuf);
+ if (sandbox_init_with_parameters(profilePath, SANDBOX_NAMED_EXTERNAL, sandboxParameters.data(), &errorBuf)) {
+ fprintf(stderr, "WebProcess: couldn't initialize sandbox profile [%s]\n", profilePath);
+ for (size_t i = 0; sandboxParameters[i]; i += 2)
+ fprintf(stderr, "%s=%s\n", sandboxParameters[i], sandboxParameters[i + 1]);
exit(EX_NOPERM);
}
+
+ for (size_t i = 0; sandboxParameters[i]; i += 2)
+ fastFree(const_cast<char*>(sandboxParameters[i + 1]));
#endif
}
diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm
index a44dc23..846d7a1 100644
--- a/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm
+++ b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import "config.h"
#import "WebProcessMain.h"
#import "CommandLine.h"
@@ -45,6 +46,10 @@
// FIXME: We should be doing this another way.
extern "C" kern_return_t bootstrap_look_up2(mach_port_t, const name_t, mach_port_t*, pid_t, uint64_t);
+@interface NSApplication (WebNSApplicationDetails)
+-(void)_installAutoreleasePoolsOnCurrentThreadIfNecessary;
+@end
+
#define SHOW_CRASH_REPORTER 1
using namespace WebCore;
@@ -88,6 +93,10 @@ int WebProcessMain(const CommandLine& commandLine)
// Initialize AppKit.
[NSApplication sharedApplication];
+ // Installs autorelease pools on the current CFRunLoop which prevents memory from accumulating between user events.
+ // FIXME: Remove when <rdar://problem/8929426> is fixed.
+ [[NSApplication sharedApplication] _installAutoreleasePoolsOnCurrentThreadIfNecessary];
+
#if !defined(BUILDING_ON_SNOW_LEOPARD)
WKAXRegisterRemoteApp();
#endif
diff --git a/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp b/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp
index bd4e370..291c3e7 100644
--- a/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp
+++ b/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp
@@ -24,6 +24,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "RunLoop.h"
#include <runtime/InitializeThreading.h>
#include "WebProcess.h"
@@ -160,7 +161,18 @@ QWEBKIT_EXPORT int WebProcessMainQt(int argc, char** argv)
RunLoop::initializeMainRunLoop();
// Create the connection.
- QString identifier(app->arguments().size() > 1 ? app->arguments().at(1) : "");
+ if (app->arguments().size() <= 1) {
+ qDebug() << "Error: wrong number of arguments.";
+ return 1;
+ }
+
+ bool wasNumber = false;
+ int identifier = app->arguments().at(1).toInt(&wasNumber, 10);
+ if (!wasNumber) {
+ qDebug() << "Error: connection identifier wrong.";
+ return 1;
+ }
+
WebKit::WebProcess::shared().initialize(identifier, RunLoop::main());
RunLoop::run();
diff --git a/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp b/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp
index 53a51d3..c45ea32 100644
--- a/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp
+++ b/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebProcess.h"
#include "WebProcessCreationParameters.h"
diff --git a/Source/WebKit2/WebProcess/win/WebProcessMainWin.cpp b/Source/WebKit2/WebProcess/win/WebProcessMainWin.cpp
index 944d8ff..2533c00 100644
--- a/Source/WebKit2/WebProcess/win/WebProcessMainWin.cpp
+++ b/Source/WebKit2/WebProcess/win/WebProcessMainWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebProcessMain.h"
#include "CommandLine.h"
diff --git a/Source/WebKit2/WebProcess/win/WebProcessWin.cpp b/Source/WebKit2/WebProcess/win/WebProcessWin.cpp
index 7f53cd3..97e2385 100644
--- a/Source/WebKit2/WebProcess/win/WebProcessWin.cpp
+++ b/Source/WebKit2/WebProcess/win/WebProcessWin.cpp
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "WebProcess.h"
#include "WebProcessCreationParameters.h"