summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/Shared
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/Shared')
-rw-r--r--Source/WebKit2/Shared/API/c/WKBase.h5
-rw-r--r--Source/WebKit2/Shared/API/c/WKURLRequest.cpp5
-rw-r--r--Source/WebKit2/Shared/API/c/WKURLRequest.h2
-rw-r--r--Source/WebKit2/Shared/APIObject.h5
-rw-r--r--Source/WebKit2/Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h3
-rw-r--r--Source/WebKit2/Shared/DictionaryPopupInfo.cpp (renamed from Source/WebKit2/Shared/qt/CleanupHandler.cpp)38
-rw-r--r--Source/WebKit2/Shared/DictionaryPopupInfo.h55
-rw-r--r--Source/WebKit2/Shared/DrawingAreaInfo.h49
-rw-r--r--Source/WebKit2/Shared/FontInfo.cpp54
-rw-r--r--Source/WebKit2/Shared/FontInfo.h51
-rw-r--r--Source/WebKit2/Shared/NativeWebKeyboardEvent.h12
-rw-r--r--Source/WebKit2/Shared/PlatformPopupMenuData.cpp29
-rw-r--r--Source/WebKit2/Shared/PlatformPopupMenuData.h7
-rw-r--r--Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp2
-rw-r--r--Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp2
-rw-r--r--Source/WebKit2/Shared/Plugins/NPVariantData.cpp2
-rw-r--r--Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp115
-rw-r--r--Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h20
-rw-r--r--Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm1
-rw-r--r--Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp28
-rw-r--r--Source/WebKit2/Shared/Plugins/PluginQuirks.h10
-rw-r--r--Source/WebKit2/Shared/SecurityOriginData.cpp70
-rw-r--r--Source/WebKit2/Shared/SecurityOriginData.h58
-rw-r--r--Source/WebKit2/Shared/SelectionState.h4
-rw-r--r--Source/WebKit2/Shared/ShareableBitmap.cpp17
-rw-r--r--Source/WebKit2/Shared/ShareableBitmap.h5
-rw-r--r--Source/WebKit2/Shared/WebContextMenuItem.cpp4
-rw-r--r--Source/WebKit2/Shared/WebCoreArgumentCoders.cpp69
-rw-r--r--Source/WebKit2/Shared/WebCoreArgumentCoders.h57
-rw-r--r--Source/WebKit2/Shared/WebEvent.h4
-rw-r--r--Source/WebKit2/Shared/WebEventConversion.cpp1
-rw-r--r--Source/WebKit2/Shared/WebPageCreationParameters.cpp13
-rw-r--r--Source/WebKit2/Shared/WebPageCreationParameters.h5
-rw-r--r--Source/WebKit2/Shared/WebPreferencesStore.h1
-rw-r--r--Source/WebKit2/Shared/WebProcessCreationParameters.cpp28
-rw-r--r--Source/WebKit2/Shared/WebProcessCreationParameters.h14
-rw-r--r--Source/WebKit2/Shared/WebURLRequest.cpp17
-rw-r--r--Source/WebKit2/Shared/WebURLRequest.h3
-rw-r--r--Source/WebKit2/Shared/WebWheelEvent.cpp6
-rw-r--r--Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp2
-rw-r--r--Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp22
-rw-r--r--Source/WebKit2/Shared/cg/WebCoreArgumentCodersCG.cpp46
-rw-r--r--Source/WebKit2/Shared/gtk/NativeWebKeyboardEventGtk.cpp48
-rw-r--r--Source/WebKit2/Shared/gtk/ShareableBitmapGtk.cpp2
-rw-r--r--Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp2
-rw-r--r--Source/WebKit2/Shared/gtk/WebEventFactory.cpp189
-rw-r--r--Source/WebKit2/Shared/gtk/WebEventFactory.h (renamed from Source/WebKit2/Shared/qt/CleanupHandler.h)57
-rw-r--r--Source/WebKit2/Shared/mac/PasteboardTypes.h1
-rw-r--r--Source/WebKit2/Shared/mac/PasteboardTypes.mm6
-rw-r--r--Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm19
-rw-r--r--Source/WebKit2/Shared/mac/WebEventFactory.mm23
-rw-r--r--Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp15
-rw-r--r--Source/WebKit2/Shared/win/LayerTreeContextWin.cpp2
-rw-r--r--Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp18
-rw-r--r--Source/WebKit2/Shared/win/WebKitBundle.cpp63
-rw-r--r--Source/WebKit2/Shared/win/WebKitBundle.h (renamed from Source/WebKit2/Shared/NotImplemented.h)25
56 files changed, 1206 insertions, 205 deletions
diff --git a/Source/WebKit2/Shared/API/c/WKBase.h b/Source/WebKit2/Shared/API/c/WKBase.h
index 1db647a..900cd51 100644
--- a/Source/WebKit2/Shared/API/c/WKBase.h
+++ b/Source/WebKit2/Shared/API/c/WKBase.h
@@ -67,11 +67,14 @@ typedef const struct OpaqueWKUserContentURLPattern* WKUserContentURLPatternRef;
/* WebKit2 main API types */
+typedef const struct OpaqueWKApplicationCacheManager* WKApplicationCacheManagerRef;
typedef const struct OpaqueWKAuthenticationChallenge* WKAuthenticationChallengeRef;
typedef const struct OpaqueWKAuthenticationDecisionListener* WKAuthenticationDecisionListenerRef;
typedef const struct OpaqueWKBackForwardList* WKBackForwardListRef;
typedef const struct OpaqueWKBackForwardListItem* WKBackForwardListItemRef;
+typedef const struct OpaqueWKResourceCacheManager* WKResourceCacheManagerRef;
typedef const struct OpaqueWKContext* WKContextRef;
+typedef const struct OpaqueWKCookieManager* WKCookieManagerRef;
typedef const struct OpaqueWKCredential* WKCredentialRef;
typedef const struct OpaqueWKDatabaseManager* WKDatabaseManagerRef;
typedef const struct OpaqueWKDownload* WKDownloadRef;
@@ -82,11 +85,13 @@ typedef const struct OpaqueWKGeolocationManager* WKGeolocationManagerRef;
typedef const struct OpaqueWKGeolocationPermissionRequest* WKGeolocationPermissionRequestRef;
typedef const struct OpaqueWKGeolocationPosition* WKGeolocationPositionRef;
typedef const struct OpaqueWKInspector* WKInspectorRef;
+typedef const struct OpaqueWKKeyValueStorageManager* WKKeyValueStorageManagerRef;
typedef const struct OpaqueWKNavigationData* WKNavigationDataRef;
typedef const struct OpaqueWKOpenPanelParameters* WKOpenPanelParametersRef;
typedef const struct OpaqueWKOpenPanelResultListener* WKOpenPanelResultListenerRef;
typedef const struct OpaqueWKPage* WKPageRef;
typedef const struct OpaqueWKPageGroup* WKPageGroupRef;
+typedef const struct OpaqueWKPluginSiteDataManager* WKPluginSiteDataManagerRef;
typedef const struct OpaqueWKPreferences* WKPreferencesRef;
typedef const struct OpaqueWKProtectionSpace* WKProtectionSpaceRef;
diff --git a/Source/WebKit2/Shared/API/c/WKURLRequest.cpp b/Source/WebKit2/Shared/API/c/WKURLRequest.cpp
index 433db05..776367b 100644
--- a/Source/WebKit2/Shared/API/c/WKURLRequest.cpp
+++ b/Source/WebKit2/Shared/API/c/WKURLRequest.cpp
@@ -47,3 +47,8 @@ WKURLRef WKURLRequestCopyURL(WKURLRequestRef requestRef)
{
return toCopiedURLAPI(toImpl(requestRef)->url());
}
+
+void WKURLRequestSetDefaultTimeoutInterval(double timeoutInterval)
+{
+ WebURLRequest::setDefaultTimeoutInterval(timeoutInterval);
+}
diff --git a/Source/WebKit2/Shared/API/c/WKURLRequest.h b/Source/WebKit2/Shared/API/c/WKURLRequest.h
index 7d146f2..a53ce16 100644
--- a/Source/WebKit2/Shared/API/c/WKURLRequest.h
+++ b/Source/WebKit2/Shared/API/c/WKURLRequest.h
@@ -38,6 +38,8 @@ WK_EXPORT WKURLRequestRef WKURLRequestCreateWithWKURL(WKURLRef);
WK_EXPORT WKURLRef WKURLRequestCopyURL(WKURLRequestRef);
+WK_EXPORT void WKURLRequestSetDefaultTimeoutInterval(double);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/Shared/APIObject.h b/Source/WebKit2/Shared/APIObject.h
index 10149b0..24f8cba 100644
--- a/Source/WebKit2/Shared/APIObject.h
+++ b/Source/WebKit2/Shared/APIObject.h
@@ -61,9 +61,12 @@ public:
TypeUInt64,
// UIProcess types
+ TypeApplicationCacheManager,
TypeBackForwardList,
TypeBackForwardListItem,
+ TypeCacheManager,
TypeContext,
+ TypeCookieManager,
TypeDatabaseManager,
TypeDownload,
TypeFormSubmissionListener,
@@ -73,11 +76,13 @@ public:
TypeGeolocationPermissionRequest,
TypeGeolocationPosition,
TypeInspector,
+ TypeKeyValueStorageManager,
TypeNavigationData,
TypeOpenPanelParameters,
TypeOpenPanelResultListener,
TypePage,
TypePageGroup,
+ TypePluginSiteDataManager,
TypePreferences,
// Bundle types
diff --git a/Source/WebKit2/Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h b/Source/WebKit2/Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h
index c5ab54b..9de20f7 100644
--- a/Source/WebKit2/Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h
+++ b/Source/WebKit2/Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h
@@ -35,9 +35,6 @@ namespace DrawingAreaProxyLegacyMessage {
enum Kind {
Update,
DidSetSize,
-#if USE(ACCELERATED_COMPOSITING)
- AttachCompositingContext,
-#endif
#if ENABLE(TILED_BACKING_STORE)
Invalidate,
TileUpdated,
diff --git a/Source/WebKit2/Shared/qt/CleanupHandler.cpp b/Source/WebKit2/Shared/DictionaryPopupInfo.cpp
index 1ec44d4..15cb306 100644
--- a/Source/WebKit2/Shared/qt/CleanupHandler.cpp
+++ b/Source/WebKit2/Shared/DictionaryPopupInfo.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 University of Szeged. 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
@@ -24,36 +24,28 @@
*/
#include "config.h"
-#include "CleanupHandler.h"
+#include "DictionaryPopupInfo.h"
-#include "MappedMemoryPool.h"
-#include "RunLoop.h"
-#include <csignal>
-#include <cstdlib>
-#include <QApplication>
+#include "WebCoreArgumentCoders.h"
namespace WebKit {
-CleanupHandler* CleanupHandler::theInstance = 0;
-
-CleanupHandler::CleanupHandler()
- : m_hasStartedDeleting(false)
-{
- moveToThread(qApp->thread()); // Ensure that we are acting on the main thread.
- connect(qApp, SIGNAL(aboutToQuit()), SLOT(deleteObjects()), Qt::DirectConnection);
- signal(SIGTERM, &CleanupHandler::sigTermHandler);
-}
-
-void CleanupHandler::sigTermHandler(int)
+void DictionaryPopupInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
{
- ::RunLoop::main()->stop();
+ encoder->encode(origin);
+ encoder->encode(fontInfo);
+ encoder->encodeEnum(type);
}
-void CleanupHandler::deleteObjects()
+bool DictionaryPopupInfo::decode(CoreIPC::ArgumentDecoder* decoder, DictionaryPopupInfo& result)
{
- m_hasStartedDeleting = true;
- for (unsigned i = 0; i < m_objects.size(); ++i)
- m_objects[i]->deleteLater();
+ if (!decoder->decode(result.origin))
+ return false;
+ if (!decoder->decode(result.fontInfo))
+ return false;
+ if (!decoder->decodeEnum(result.type))
+ return false;
+ return true;
}
} // namespace WebKit
diff --git a/Source/WebKit2/Shared/DictionaryPopupInfo.h b/Source/WebKit2/Shared/DictionaryPopupInfo.h
new file mode 100644
index 0000000..5682fcd
--- /dev/null
+++ b/Source/WebKit2/Shared/DictionaryPopupInfo.h
@@ -0,0 +1,55 @@
+/*
+ * 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 DictionaryPopupInfo_h
+#define DictionaryPopupInfo_h
+
+#include "FontInfo.h"
+#include <WebCore/FloatPoint.h>
+
+namespace CoreIPC {
+ class ArgumentDecoder;
+ class ArgumentEncoder;
+}
+
+namespace WebKit {
+
+struct DictionaryPopupInfo {
+ void encode(CoreIPC::ArgumentEncoder*) const;
+ static bool decode(CoreIPC::ArgumentDecoder*, DictionaryPopupInfo&);
+
+ enum Type {
+ ContextMenu,
+ HotKey
+ };
+
+ WebCore::FloatPoint origin;
+ FontInfo fontInfo;
+ Type type;
+};
+
+} // namespace WebKit
+
+#endif // DictionaryPopupInfo_h
diff --git a/Source/WebKit2/Shared/DrawingAreaInfo.h b/Source/WebKit2/Shared/DrawingAreaInfo.h
index fdbfc75..6f804ed 100644
--- a/Source/WebKit2/Shared/DrawingAreaInfo.h
+++ b/Source/WebKit2/Shared/DrawingAreaInfo.h
@@ -23,54 +23,19 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef DrawingAreaInfo_h
-#define DrawingAreaInfo_h
-
-#include "ArgumentCoders.h"
-#include "Connection.h"
-
-namespace WebCore {
- class IntRect;
- class IntSize;
-}
+#ifndef DrawingAreaType_h
+#define DrawingAreaType_h
namespace WebKit {
-struct DrawingAreaInfo {
- enum Type {
- None,
- Impl,
- ChunkedUpdate,
-#if USE(ACCELERATED_COMPOSITING)
- LayerBacked,
-#endif
+enum DrawingAreaType {
+ DrawingAreaTypeImpl,
+ DrawingAreaTypeChunkedUpdate,
#if ENABLE(TILED_BACKING_STORE)
- Tiled,
+ DrawingAreaTypeTiled,
#endif
- };
-
- typedef uint64_t Identifier;
-
- DrawingAreaInfo()
- : type(None)
- , identifier(0)
- {
- }
-
- DrawingAreaInfo(Type type, Identifier identifier)
- : type(type)
- , identifier(identifier)
- {
- }
-
- Type type;
- Identifier identifier;
};
} // namespace WebKit
-namespace CoreIPC {
-template<> struct ArgumentCoder<WebKit::DrawingAreaInfo> : SimpleArgumentCoder<WebKit::DrawingAreaInfo> { };
-}
-
-#endif // DrawingAreaInfo_h
+#endif // DrawingAreaType_h
diff --git a/Source/WebKit2/Shared/FontInfo.cpp b/Source/WebKit2/Shared/FontInfo.cpp
new file mode 100644
index 0000000..d4ab78e
--- /dev/null
+++ b/Source/WebKit2/Shared/FontInfo.cpp
@@ -0,0 +1,54 @@
+/*
+ * 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 "FontInfo.h"
+
+#include "WebCoreArgumentCoders.h"
+
+#if PLATFORM(MAC)
+#include "ArgumentCodersCF.h"
+#endif
+
+namespace WebKit {
+
+void FontInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
+{
+#if PLATFORM(MAC)
+ CoreIPC::encode(encoder, fontAttributeDictionary.get());
+#endif
+}
+
+bool FontInfo::decode(CoreIPC::ArgumentDecoder* decoder, FontInfo& fontInfo)
+{
+#if PLATFORM(MAC)
+ if (!CoreIPC::decode(decoder, fontInfo.fontAttributeDictionary))
+ return false;
+#endif
+
+ return true;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/FontInfo.h b/Source/WebKit2/Shared/FontInfo.h
new file mode 100644
index 0000000..23ea945
--- /dev/null
+++ b/Source/WebKit2/Shared/FontInfo.h
@@ -0,0 +1,51 @@
+/*
+ * 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 FontInfo_h
+#define FontInfo_h
+
+#if PLATFORM(MAC)
+#include <wtf/RetainPtr.h>
+#endif
+
+namespace CoreIPC {
+ class ArgumentDecoder;
+ class ArgumentEncoder;
+}
+
+namespace WebKit {
+
+struct FontInfo {
+ void encode(CoreIPC::ArgumentEncoder*) const;
+ static bool decode(CoreIPC::ArgumentDecoder*, FontInfo&);
+
+#if PLATFORM(MAC)
+ RetainPtr<CFDictionaryRef> fontAttributeDictionary;
+#endif
+};
+
+} // namespace WebKit
+
+#endif // FontInfo_h
diff --git a/Source/WebKit2/Shared/NativeWebKeyboardEvent.h b/Source/WebKit2/Shared/NativeWebKeyboardEvent.h
index cdf1aef..d88455c 100644
--- a/Source/WebKit2/Shared/NativeWebKeyboardEvent.h
+++ b/Source/WebKit2/Shared/NativeWebKeyboardEvent.h
@@ -1,5 +1,7 @@
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ * Copyright (C) 2011 Igalia S.L
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,6 +35,9 @@
OBJC_CLASS NSView;
#elif PLATFORM(QT)
#include <QKeyEvent>
+#elif PLATFORM(GTK)
+#include <GOwnPtrGtk.h>
+typedef union _GdkEvent GdkEvent;
#endif
namespace WebKit {
@@ -45,6 +50,9 @@ public:
NativeWebKeyboardEvent(HWND, UINT message, WPARAM, LPARAM);
#elif PLATFORM(QT)
explicit NativeWebKeyboardEvent(QKeyEvent*);
+#elif PLATFORM(GTK)
+ NativeWebKeyboardEvent(const NativeWebKeyboardEvent&);
+ NativeWebKeyboardEvent(GdkEvent*);
#endif
#if PLATFORM(MAC)
@@ -53,6 +61,8 @@ public:
const MSG* nativeEvent() const { return &m_nativeEvent; }
#elif PLATFORM(QT)
const QKeyEvent* nativeEvent() const { return &m_nativeEvent; }
+#elif PLATFORM(GTK)
+ const GdkEvent* nativeEvent() const { return m_nativeEvent.get(); }
#endif
private:
@@ -62,6 +72,8 @@ private:
MSG m_nativeEvent;
#elif PLATFORM(QT)
QKeyEvent m_nativeEvent;
+#elif PLATFORM(GTK)
+ GOwnPtr<GdkEvent> m_nativeEvent;
#endif
};
diff --git a/Source/WebKit2/Shared/PlatformPopupMenuData.cpp b/Source/WebKit2/Shared/PlatformPopupMenuData.cpp
index 51e0e6c..a5ebb45 100644
--- a/Source/WebKit2/Shared/PlatformPopupMenuData.cpp
+++ b/Source/WebKit2/Shared/PlatformPopupMenuData.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
@@ -60,40 +60,43 @@ void PlatformPopupMenuData::encode(CoreIPC::ArgumentEncoder* encoder) const
SharedMemory::Handle selectedBackingStoreHandle;
m_selectedBackingStore->createHandle(selectedBackingStoreHandle);
encoder->encode(selectedBackingStoreHandle);
+#elif PLATFORM(MAC)
+ encoder->encode(fontInfo);
#endif
}
bool PlatformPopupMenuData::decode(CoreIPC::ArgumentDecoder* decoder, PlatformPopupMenuData& data)
{
#if PLATFORM(WIN)
- PlatformPopupMenuData d;
- if (!decoder->decode(d.m_clientPaddingLeft))
+ if (!decoder->decode(data.m_clientPaddingLeft))
return false;
- if (!decoder->decode(d.m_clientPaddingRight))
+ if (!decoder->decode(data.m_clientPaddingRight))
return false;
- if (!decoder->decode(d.m_clientInsetLeft))
+ if (!decoder->decode(data.m_clientInsetLeft))
return false;
- if (!decoder->decode(d.m_clientInsetRight))
+ if (!decoder->decode(data.m_clientInsetRight))
return false;
- if (!decoder->decode(d.m_popupWidth))
+ if (!decoder->decode(data.m_popupWidth))
return false;
- if (!decoder->decode(d.m_itemHeight))
+ if (!decoder->decode(data.m_itemHeight))
return false;
- if (!decoder->decode(d.m_backingStoreSize))
+ if (!decoder->decode(data.m_backingStoreSize))
return false;
SharedMemory::Handle notSelectedBackingStoreHandle;
if (!decoder->decode(notSelectedBackingStoreHandle))
return false;
- d.m_notSelectedBackingStore = ShareableBitmap::create(d.m_backingStoreSize, notSelectedBackingStoreHandle);
+ data.m_notSelectedBackingStore = ShareableBitmap::create(data.m_backingStoreSize, notSelectedBackingStoreHandle);
SharedMemory::Handle selectedBackingStoreHandle;
if (!decoder->decode(selectedBackingStoreHandle))
return false;
- d.m_selectedBackingStore = ShareableBitmap::create(d.m_backingStoreSize, selectedBackingStoreHandle);
-
- data = d;
+ data.m_selectedBackingStore = ShareableBitmap::create(data.m_backingStoreSize, selectedBackingStoreHandle);
+#elif PLATFORM(MAC)
+ if (!decoder->decode(data.fontInfo))
+ return false;
#endif
+
return true;
}
diff --git a/Source/WebKit2/Shared/PlatformPopupMenuData.h b/Source/WebKit2/Shared/PlatformPopupMenuData.h
index 88e03fc..f79b4b2 100644
--- a/Source/WebKit2/Shared/PlatformPopupMenuData.h
+++ b/Source/WebKit2/Shared/PlatformPopupMenuData.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,6 +26,7 @@
#ifndef PlatformPopupMenuData_h
#define PlatformPopupMenuData_h
+#include "FontInfo.h"
#include "ShareableBitmap.h"
#include <wtf/text/WTFString.h>
@@ -38,7 +39,7 @@ namespace WebKit {
struct PlatformPopupMenuData {
PlatformPopupMenuData();
-
+
void encode(CoreIPC::ArgumentEncoder*) const;
static bool decode(CoreIPC::ArgumentDecoder*, PlatformPopupMenuData&);
@@ -52,6 +53,8 @@ struct PlatformPopupMenuData {
WebCore::IntSize m_backingStoreSize;
RefPtr<ShareableBitmap> m_notSelectedBackingStore;
RefPtr<ShareableBitmap> m_selectedBackingStore;
+#elif PLATFORM(MAC)
+ FontInfo fontInfo;
#endif
};
diff --git a/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp b/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp
index eeb8914..6edf5a5 100644
--- a/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp
+++ b/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp
@@ -30,9 +30,9 @@
#include "ArgumentDecoder.h"
#include "ArgumentEncoder.h"
-#include "NotImplemented.h"
#include "WebCoreArgumentCoders.h"
#include <WebCore/IdentifierRep.h>
+#include <WebCore/NotImplemented.h>
using namespace WebCore;
diff --git a/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp b/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
index bcf2a7c..0e164f1 100644
--- a/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
+++ b/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
@@ -32,7 +32,7 @@
#include "NPObjectProxy.h"
#include "NPRuntimeUtilities.h"
#include "NPVariantData.h"
-#include "NotImplemented.h"
+#include <WebCore/NotImplemented.h>
#include <wtf/OwnPtr.h>
namespace WebKit {
diff --git a/Source/WebKit2/Shared/Plugins/NPVariantData.cpp b/Source/WebKit2/Shared/Plugins/NPVariantData.cpp
index 5e4392b..f06d776 100644
--- a/Source/WebKit2/Shared/Plugins/NPVariantData.cpp
+++ b/Source/WebKit2/Shared/Plugins/NPVariantData.cpp
@@ -30,8 +30,8 @@
#include "ArgumentDecoder.h"
#include "ArgumentEncoder.h"
-#include "NotImplemented.h"
#include "WebCoreArgumentCoders.h"
+#include <WebCore/NotImplemented.h>
namespace WebKit {
diff --git a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp
index a1f0833..7bbdaa8 100644
--- a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp
+++ b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp
@@ -27,8 +27,14 @@
#include "NetscapePluginModule.h"
#include "Module.h"
+#include "NPRuntimeUtilities.h"
#include "NetscapeBrowserFuncs.h"
#include <wtf/PassOwnPtr.h>
+#include <wtf/text/CString.h>
+
+#if !PLUGIN_ARCHITECTURE(MAC) && !PLUGIN_ARCHITECTURE(WIN) && !PLUGIN_ARCHITECTURE(X11)
+#error Unknown plug-in architecture
+#endif
namespace WebKit {
@@ -41,7 +47,7 @@ static Vector<NetscapePluginModule*>& initializedNetscapePluginModules()
NetscapePluginModule::NetscapePluginModule(const String& pluginPath)
: m_pluginPath(pluginPath)
, m_isInitialized(false)
- , m_pluginCount(0)
+ , m_loadCount(0)
, m_shutdownProcPtr(0)
, m_pluginFuncs()
{
@@ -54,23 +60,72 @@ NetscapePluginModule::~NetscapePluginModule()
void NetscapePluginModule::pluginCreated()
{
- if (!m_pluginCount) {
- // Load the plug-in module if necessary.
- load();
- }
-
- m_pluginCount++;
+ incrementLoadCount();
}
void NetscapePluginModule::pluginDestroyed()
{
- ASSERT(m_pluginCount > 0);
- m_pluginCount--;
-
- if (!m_pluginCount) {
- shutdown();
- unload();
+ decrementLoadCount();
+}
+
+Vector<String> NetscapePluginModule::sitesWithData()
+{
+ Vector<String> sites;
+
+ incrementLoadCount();
+ tryGetSitesWithData(sites);
+ decrementLoadCount();
+
+ return sites;
+}
+
+bool NetscapePluginModule::clearSiteData(const String& site, uint64_t flags, uint64_t maxAge)
+{
+ incrementLoadCount();
+ bool result = tryClearSiteData(site, flags, maxAge);
+ decrementLoadCount();
+
+ return result;
+}
+
+bool NetscapePluginModule::tryGetSitesWithData(Vector<String>& sites)
+{
+ if (!m_isInitialized)
+ return false;
+
+ // Check if the plug-in supports NPP_GetSitesWithData.
+ if (!m_pluginFuncs.getsiteswithdata)
+ return false;
+
+ char** siteArray = m_pluginFuncs.getsiteswithdata();
+ for (int i = 0; siteArray[i]; ++i) {
+ char* site = siteArray[i];
+
+ String siteString = String::fromUTF8(site);
+ if (!siteString.isNull())
+ sites.append(siteString);
+
+ npnMemFree(site);
}
+
+ npnMemFree(siteArray);
+ return true;
+}
+
+bool NetscapePluginModule::tryClearSiteData(const String& site, uint64_t flags, uint64_t maxAge)
+{
+ if (!m_isInitialized)
+ return false;
+
+ // Check if the plug-in supports NPP_ClearSiteData.
+ if (!m_pluginFuncs.clearsitedata)
+ return false;
+
+ CString siteString;
+ if (!site.isNull())
+ siteString = site.utf8();
+
+ return m_pluginFuncs.clearsitedata(siteString.data(), flags, maxAge) == NPERR_NO_ERROR;
}
void NetscapePluginModule::shutdown()
@@ -106,6 +161,27 @@ PassRefPtr<NetscapePluginModule> NetscapePluginModule::getOrCreate(const String&
return pluginModule.release();
}
+void NetscapePluginModule::incrementLoadCount()
+{
+ if (!m_loadCount) {
+ // Load the plug-in module if necessary.
+ load();
+ }
+
+ m_loadCount++;
+}
+
+void NetscapePluginModule::decrementLoadCount()
+{
+ ASSERT(m_loadCount > 0);
+ m_loadCount--;
+
+ if (!m_loadCount) {
+ shutdown();
+ unload();
+ }
+}
+
bool NetscapePluginModule::load()
{
if (m_isInitialized) {
@@ -130,6 +206,10 @@ bool NetscapePluginModule::load()
bool NetscapePluginModule::tryLoad()
{
+#if PLUGIN_ARCHITECTURE(X11)
+ applyX11QuirksBeforeLoad();
+#endif
+
m_module = adoptPtr(new Module(m_pluginPath));
if (!m_module->load())
return false;
@@ -138,9 +218,11 @@ bool NetscapePluginModule::tryLoad()
if (!initializeFuncPtr)
return false;
+#if !PLUGIN_ARCHITECTURE(X11)
NP_GetEntryPointsFuncPtr getEntryPointsFuncPtr = m_module->functionPointer<NP_GetEntryPointsFuncPtr>("NP_GetEntryPoints");
if (!getEntryPointsFuncPtr)
return false;
+#endif
m_shutdownProcPtr = m_module->functionPointer<NPP_ShutdownProcPtr>("NP_Shutdown");
if (!m_shutdownProcPtr)
@@ -152,12 +234,15 @@ bool NetscapePluginModule::tryLoad()
// On Mac, NP_Initialize must be called first, then NP_GetEntryPoints. On Windows, the order is
// reversed. Failing to follow this order results in crashes (e.g., in Silverlight on Mac and
// in Flash and QuickTime on Windows).
-#if PLATFORM(MAC)
+#if PLUGIN_ARCHITECTURE(MAC)
if (initializeFuncPtr(netscapeBrowserFuncs()) != NPERR_NO_ERROR || getEntryPointsFuncPtr(&m_pluginFuncs) != NPERR_NO_ERROR)
return false;
-#elif PLATFORM(WIN)
+#elif PLUGIN_ARCHITECTURE(WIN)
if (getEntryPointsFuncPtr(&m_pluginFuncs) != NPERR_NO_ERROR || initializeFuncPtr(netscapeBrowserFuncs()) != NPERR_NO_ERROR)
return false;
+#elif PLUGIN_ARCHITECTURE(X11)
+ if (initializeFuncPtr(netscapeBrowserFuncs(), &m_pluginFuncs) != NPERR_NO_ERROR)
+ return false;
#endif
return true;
diff --git a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h
index a245b11..aee26bb 100644
--- a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h
+++ b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h
@@ -28,7 +28,7 @@
#include "Module.h"
#include "PluginQuirks.h"
-#include <WebCore/npfunctions.h>
+#include <WebCore/npruntime_internal.h>
#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
@@ -53,11 +53,27 @@ public:
const PluginQuirks& pluginQuirks() const { return m_pluginQuirks; }
+ // Return a list of domains for which the plug-in has data stored.
+ Vector<String> sitesWithData();
+
+ // Request that the plug-in clear the site data.
+ bool clearSiteData(const String& site, uint64_t flags, uint64_t maxAge);
+
private:
explicit NetscapePluginModule(const String& pluginPath);
void determineQuirks();
+#if PLUGIN_ARCHITECTURE(X11)
+ void applyX11QuirksBeforeLoad();
+#endif
+
+ void incrementLoadCount();
+ void decrementLoadCount();
+
+ bool tryGetSitesWithData(Vector<String>&);
+ bool tryClearSiteData(const String& site, uint64_t flags, uint64_t maxAge);
+
bool tryLoad();
bool load();
void unload();
@@ -66,7 +82,7 @@ private:
String m_pluginPath;
bool m_isInitialized;
- unsigned m_pluginCount;
+ unsigned m_loadCount;
PluginQuirks m_pluginQuirks;
diff --git a/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
index 544def3..accab46 100644
--- a/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
+++ b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
@@ -333,6 +333,7 @@ void NetscapePluginModule::determineQuirks()
if (plugin.bundleIdentifier == "com.macromedia.Flash Player.plugin") {
// Flash requires that the return value of getprogname() be "WebKitPluginHost".
m_pluginQuirks.add(PluginQuirks::PrognameShouldBeWebKitPluginHost);
+ m_pluginQuirks.add(PluginQuirks::SupportsSnapshotting);
}
}
diff --git a/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp b/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp
index a651d3b..b5e3aad 100644
--- a/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp
+++ b/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp
@@ -29,10 +29,38 @@
#include "PluginDatabase.h"
#include "PluginPackage.h"
+#if PLATFORM(QT)
+#include <QLibrary>
+#endif
+
using namespace WebCore;
namespace WebKit {
+#if PLATFORM(QT)
+static void initializeGTK()
+{
+ QLibrary library("libgtk-x11-2.0.so.0");
+ if (library.load()) {
+ typedef void *(*gtk_init_check_ptr)(int*, char***);
+ gtk_init_check_ptr gtkInitCheck = reinterpret_cast<gtk_init_check_ptr>(library.resolve("gtk_init_check"));
+ // NOTE: We're using gtk_init_check() since gtk_init() calls exit() on failure.
+ if (gtkInitCheck)
+ (void) gtkInitCheck(0, 0);
+ }
+}
+#endif
+
+void NetscapePluginModule::applyX11QuirksBeforeLoad()
+{
+#if PLATFORM(QT)
+ if (m_pluginPath.contains("npwrapper") || m_pluginPath.contains("flashplayer")) {
+ initializeGTK();
+ m_pluginQuirks.add(PluginQuirks::RequiresGTKToolKit);
+ }
+#endif
+}
+
bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginInfoStore::Plugin& plugin)
{
// We are loading the plugin here since it does not seem to be a standardized way to
diff --git a/Source/WebKit2/Shared/Plugins/PluginQuirks.h b/Source/WebKit2/Shared/Plugins/PluginQuirks.h
index 8dd3a74..9f8c1c4 100644
--- a/Source/WebKit2/Shared/Plugins/PluginQuirks.h
+++ b/Source/WebKit2/Shared/Plugins/PluginQuirks.h
@@ -32,12 +32,18 @@ class PluginQuirks {
public:
enum PluginQuirk {
// Mac specific quirks:
-#if PLATFORM(MAC)
+#if PLUGIN_ARCHITECTURE(MAC)
// The plug-in wants the call to getprogame() to return "WebKitPluginHost".
// Adobe Flash Will not handle key down events otherwise.
PrognameShouldBeWebKitPluginHost,
+ // Supports receiving a paint event, even when using CoreAnimation rendering.
+ SupportsSnapshotting,
+#elif PLUGIN_ARCHITECTURE(X11)
+ // Flash and npwrapper ask the browser about which GTK version does it use
+ // and refuse to load and work if it is not GTK 2 so we need to fake it in
+ // NPN_GetValue even when it is a lie.
+ RequiresGTKToolKit,
#endif
-
NumPluginQuirks
};
diff --git a/Source/WebKit2/Shared/SecurityOriginData.cpp b/Source/WebKit2/Shared/SecurityOriginData.cpp
new file mode 100644
index 0000000..24f8c1a
--- /dev/null
+++ b/Source/WebKit2/Shared/SecurityOriginData.cpp
@@ -0,0 +1,70 @@
+/*
+ * 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 "SecurityOriginData.h"
+
+#include "APIObject.h"
+#include "ImmutableArray.h"
+#include "WebCoreArgumentCoders.h"
+#include "WebSecurityOrigin.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void SecurityOriginData::encode(CoreIPC::ArgumentEncoder* encoder) const
+{
+ encoder->encode(CoreIPC::In(protocol, host, port));
+}
+
+bool SecurityOriginData::decode(CoreIPC::ArgumentDecoder* decoder, SecurityOriginData& securityOriginData)
+{
+ return decoder->decode(CoreIPC::Out(securityOriginData.protocol, securityOriginData.host, securityOriginData.port));
+}
+
+void performAPICallbackWithSecurityOriginDataVector(const Vector<SecurityOriginData>& originDatas, ArrayCallback* callback)
+{
+ if (!callback) {
+ // FIXME: Log error or assert.
+ return;
+ }
+
+ size_t originDataCount = originDatas.size();
+ Vector<RefPtr<APIObject> > securityOrigins;
+ securityOrigins.reserveCapacity(originDataCount);
+
+ for (size_t i = 0; i < originDataCount; ++i) {
+ SecurityOriginData originData = originDatas[i];
+ RefPtr<APIObject> origin = WebSecurityOrigin::create(originData.protocol, originData.host, originData.port);
+ if (!origin)
+ continue;
+ securityOrigins.uncheckedAppend(origin);
+ }
+
+ callback->performCallbackWithReturnValue(ImmutableArray::adopt(securityOrigins).get());
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/SecurityOriginData.h b/Source/WebKit2/Shared/SecurityOriginData.h
new file mode 100644
index 0000000..692a96e
--- /dev/null
+++ b/Source/WebKit2/Shared/SecurityOriginData.h
@@ -0,0 +1,58 @@
+/*
+ * 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 SecurityOriginData_h
+#define SecurityOriginData_h
+
+#include "APIObject.h"
+#include "GenericCallback.h"
+#include <wtf/text/WTFString.h>
+
+namespace CoreIPC {
+ class ArgumentDecoder;
+ class ArgumentEncoder;
+}
+
+namespace WebKit {
+
+typedef GenericCallback<WKArrayRef> ArrayCallback;
+
+struct SecurityOriginData {
+ void encode(CoreIPC::ArgumentEncoder*) const;
+ static bool decode(CoreIPC::ArgumentDecoder*, SecurityOriginData&);
+
+ // FIXME <rdar://9018386>: We should be sending more state across the wire than just the protocol,
+ // host, and port.
+
+ String protocol;
+ String host;
+ int port;
+};
+
+void performAPICallbackWithSecurityOriginDataVector(const Vector<SecurityOriginData>&, ArrayCallback*);
+
+} // namespace WebKit
+
+#endif // SecurityOriginData_h
diff --git a/Source/WebKit2/Shared/SelectionState.h b/Source/WebKit2/Shared/SelectionState.h
index 2ce0e9c..9931a10 100644
--- a/Source/WebKit2/Shared/SelectionState.h
+++ b/Source/WebKit2/Shared/SelectionState.h
@@ -35,6 +35,7 @@ struct SelectionState {
SelectionState()
: isNone(true)
, isContentEditable(false)
+ , isContentRichlyEditable(false)
, isInPasswordField(false)
, hasComposition(false)
, selectedRangeStart(notFound)
@@ -47,6 +48,9 @@ struct SelectionState {
// Whether the selection is in a content editable area.
bool isContentEditable;
+
+ // Whether the selection is in a rich content editable area.
+ bool isContentRichlyEditable;
// Whether the selection is in a password field.
bool isInPasswordField;
diff --git a/Source/WebKit2/Shared/ShareableBitmap.cpp b/Source/WebKit2/Shared/ShareableBitmap.cpp
index e89cdb7..ab1991f 100644
--- a/Source/WebKit2/Shared/ShareableBitmap.cpp
+++ b/Source/WebKit2/Shared/ShareableBitmap.cpp
@@ -47,10 +47,20 @@ PassRefPtr<ShareableBitmap> ShareableBitmap::create(const WebCore::IntSize& size
PassRefPtr<ShareableBitmap> ShareableBitmap::createShareable(const IntSize& size)
{
size_t numBytes = numBytesForSize(size);
-
+
RefPtr<SharedMemory> sharedMemory = SharedMemory::create(numBytes);
if (!sharedMemory)
return 0;
+
+ return adoptRef(new ShareableBitmap(size, sharedMemory));
+}
+
+PassRefPtr<ShareableBitmap> ShareableBitmap::create(const WebCore::IntSize& size, PassRefPtr<SharedMemory> sharedMemory)
+{
+ ASSERT(sharedMemory);
+
+ size_t numBytes = numBytesForSize(size);
+ ASSERT_UNUSED(numBytes, sharedMemory->size() >= numBytes);
return adoptRef(new ShareableBitmap(size, sharedMemory));
}
@@ -62,10 +72,7 @@ PassRefPtr<ShareableBitmap> ShareableBitmap::create(const WebCore::IntSize& size
if (!sharedMemory)
return 0;
- size_t numBytes = numBytesForSize(size);
- ASSERT_UNUSED(numBytes, sharedMemory->size() >= numBytes);
-
- return adoptRef(new ShareableBitmap(size, sharedMemory));
+ return create(size, sharedMemory.release());
}
bool ShareableBitmap::createHandle(SharedMemory::Handle& handle)
diff --git a/Source/WebKit2/Shared/ShareableBitmap.h b/Source/WebKit2/Shared/ShareableBitmap.h
index e44f4ad..f9a3af0 100644
--- a/Source/WebKit2/Shared/ShareableBitmap.h
+++ b/Source/WebKit2/Shared/ShareableBitmap.h
@@ -47,6 +47,9 @@ public:
// Create a shareable bitmap whose backing memory can be shared with another process.
static PassRefPtr<ShareableBitmap> createShareable(const WebCore::IntSize&);
+ // Create a shareable bitmap from an already existing shared memory block.
+ static PassRefPtr<ShareableBitmap> create(const WebCore::IntSize&, PassRefPtr<SharedMemory>);
+
// Create a shareable bitmap from a shared memory handle.
static PassRefPtr<ShareableBitmap> create(const WebCore::IntSize&, const SharedMemory::Handle&);
@@ -74,6 +77,8 @@ private:
static size_t numBytesForSize(const WebCore::IntSize& size) { return size.width() * size.height() * 4; }
+ static void releaseData(void* typelessBitmap, void* typelessData);
+
void* data() const;
size_t sizeInBytes() const { return numBytesForSize(m_size); }
diff --git a/Source/WebKit2/Shared/WebContextMenuItem.cpp b/Source/WebKit2/Shared/WebContextMenuItem.cpp
index a3322bb..f312997 100644
--- a/Source/WebKit2/Shared/WebContextMenuItem.cpp
+++ b/Source/WebKit2/Shared/WebContextMenuItem.cpp
@@ -54,8 +54,8 @@ PassRefPtr<WebContextMenuItem> WebContextMenuItem::create(const String& title, b
WebContextMenuItem* WebContextMenuItem::separatorItem()
{
- static RefPtr<WebContextMenuItem> separatorItem = adoptRef(new WebContextMenuItem(WebContextMenuItemData(WebCore::SeparatorType, WebCore::ContextMenuItemTagNoAction, String(), true, false)));
- return separatorItem.get();
+ DEFINE_STATIC_LOCAL(WebContextMenuItem*, separatorItem, (adoptRef(new WebContextMenuItem(WebContextMenuItemData(WebCore::SeparatorType, WebCore::ContextMenuItemTagNoAction, String(), true, false))).leakRef()));
+ return separatorItem;
}
PassRefPtr<ImmutableArray> WebContextMenuItem::submenuItemsAsImmutableArray() const
diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
new file mode 100644
index 0000000..e97c7fd
--- /dev/null
+++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
@@ -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.
+ */
+
+#include "config.h"
+#include "WebCoreArgumentCoders.h"
+
+using namespace WebCore;
+using namespace WebKit;
+
+namespace CoreIPC {
+
+// For now, these are CG-only. Once other platforms have createImage functions,
+// we can compile these for non-CG builds.
+#if PLATFORM(CG)
+
+void encodeImage(ArgumentEncoder* encoder, Image* image)
+{
+ RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(image->size());
+ bitmap->createGraphicsContext()->drawImage(image, ColorSpaceDeviceRGB, IntPoint());
+ SharedMemory::Handle handle;
+ bitmap->createHandle(handle);
+
+ encoder->encode(image->size());
+ encoder->encode(handle);
+}
+
+bool decodeImage(ArgumentDecoder* decoder, RefPtr<Image>& image)
+{
+ IntSize imageSize;
+ if (!decoder->decode(imageSize))
+ return false;
+ SharedMemory::Handle handle;
+ if (!decoder->decode(handle))
+ return false;
+
+ RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(imageSize, handle);
+ if (!bitmap)
+ return false;
+ image = createImage(bitmap.get());
+ if (!image)
+ return false;
+ return true;
+}
+
+#endif
+
+}
diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.h b/Source/WebKit2/Shared/WebCoreArgumentCoders.h
index 62c68c7..1679bb6 100644
--- a/Source/WebKit2/Shared/WebCoreArgumentCoders.h
+++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.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
@@ -30,19 +30,23 @@
#include "ArgumentDecoder.h"
#include "ArgumentEncoder.h"
#include "Arguments.h"
+#include "ShareableBitmap.h"
#include <WebCore/AuthenticationChallenge.h>
+#include <WebCore/BitmapImage.h>
#include <WebCore/Credential.h>
#include <WebCore/Cursor.h>
#include <WebCore/DatabaseDetails.h>
#include <WebCore/Editor.h>
#include <WebCore/EditorClient.h>
#include <WebCore/FloatRect.h>
+#include <WebCore/GraphicsContext.h>
#include <WebCore/IntRect.h>
#include <WebCore/KeyboardEvent.h>
#include <WebCore/PluginData.h>
#include <WebCore/ProtectionSpace.h>
#include <WebCore/ResourceError.h>
#include <WebCore/ResourceRequest.h>
+#include <WebCore/TextCheckerClient.h>
#include <WebCore/ViewportArguments.h>
#include <WebCore/WindowFeatures.h>
#include <limits>
@@ -181,14 +185,30 @@ template<> struct ArgumentCoder<WebCore::Credential> {
};
#if USE(LAZY_NATIVE_CURSOR)
+
+void encodeImage(ArgumentEncoder*, WebCore::Image*);
+bool decodeImage(ArgumentDecoder*, RefPtr<WebCore::Image>&);
+RefPtr<WebCore::Image> createImage(WebKit::ShareableBitmap*);
+
template<> struct ArgumentCoder<WebCore::Cursor> {
static void encode(ArgumentEncoder* encoder, const WebCore::Cursor& cursor)
{
- // FIXME: Support custom cursors.
- if (cursor.type() == WebCore::Cursor::Custom)
- encoder->encode(static_cast<uint32_t>(WebCore::Cursor::Pointer));
- else
- encoder->encode(static_cast<uint32_t>(cursor.type()));
+ WebCore::Cursor::Type type = cursor.type();
+#if !PLATFORM(CG)
+ // FIXME: Currently we only have the createImage function implemented for CG.
+ // Once we implement it for other platforms we can remove this conditional,
+ // and the other conditionals below and in WebCoreArgumentCoders.cpp.
+ if (type == WebCore::Cursor::Custom)
+ type = WebCore::Cursor::Pointer;
+#endif
+ encoder->encode(static_cast<uint32_t>(type));
+#if PLATFORM(CG)
+ if (type != WebCore::Cursor::Custom)
+ return;
+
+ encodeImage(encoder, cursor.image());
+ encoder->encode(cursor.hotSpot());
+#endif
}
static bool decode(ArgumentDecoder* decoder, WebCore::Cursor& cursor)
@@ -196,14 +216,33 @@ template<> struct ArgumentCoder<WebCore::Cursor> {
uint32_t typeInt;
if (!decoder->decode(typeInt))
return false;
-
+ if (typeInt > WebCore::Cursor::Custom)
+ return false;
WebCore::Cursor::Type type = static_cast<WebCore::Cursor::Type>(typeInt);
- ASSERT(type != WebCore::Cursor::Custom);
- cursor = WebCore::Cursor::fromType(type);
+ if (type != WebCore::Cursor::Custom) {
+ cursor = WebCore::Cursor::fromType(type);
+ return true;
+ }
+
+#if !PLATFORM(CG)
+ return false;
+#else
+ RefPtr<WebCore::Image> image;
+ if (!decodeImage(decoder, image))
+ return false;
+ WebCore::IntPoint hotSpot;
+ if (!decoder->decode(hotSpot))
+ return false;
+ if (!image->rect().contains(WebCore::IntRect(hotSpot, WebCore::IntSize())))
+ return false;
+
+ cursor = WebCore::Cursor(image.get(), hotSpot);
return true;
+#endif
}
};
+
#endif
// These two functions are implemented in a platform specific manner.
diff --git a/Source/WebKit2/Shared/WebEvent.h b/Source/WebKit2/Shared/WebEvent.h
index 361aa46..6d2e60b 100644
--- a/Source/WebKit2/Shared/WebEvent.h
+++ b/Source/WebKit2/Shared/WebEvent.h
@@ -173,7 +173,7 @@ public:
WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, Modifiers, double timestamp);
#if PLATFORM(MAC)
- WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, Phase, bool hasPreciseScrollingDeltas, Modifiers, double timestamp);
+ WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, Phase phase, Phase momentumPhase,bool hasPreciseScrollingDeltas, Modifiers, double timestamp);
#endif
const WebCore::IntPoint position() const { return m_position; }
@@ -183,6 +183,7 @@ public:
Granularity granularity() const { return static_cast<Granularity>(m_granularity); }
#if PLATFORM(MAC)
Phase phase() const { return static_cast<Phase>(m_phase); }
+ Phase momentumPhase() const { return static_cast<Phase>(m_momentumPhase); }
bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; }
#endif
@@ -199,6 +200,7 @@ private:
uint32_t m_granularity; // Granularity
#if PLATFORM(MAC)
uint32_t m_phase; // Phase
+ uint32_t m_momentumPhase; // Phase
bool m_hasPreciseScrollingDeltas;
#endif
};
diff --git a/Source/WebKit2/Shared/WebEventConversion.cpp b/Source/WebKit2/Shared/WebEventConversion.cpp
index 62147d0..9c2fad1 100644
--- a/Source/WebKit2/Shared/WebEventConversion.cpp
+++ b/Source/WebKit2/Shared/WebEventConversion.cpp
@@ -112,6 +112,7 @@ public:
m_metaKey = webEvent.metaKey();
#if PLATFORM(MAC)
m_phase = static_cast<WebCore::PlatformWheelEventPhase>(webEvent.phase());
+ m_momentumPhase = static_cast<WebCore::PlatformWheelEventPhase>(webEvent.momentumPhase());
m_hasPreciseScrollingDeltas = webEvent.hasPreciseScrollingDeltas();
m_timestamp = webEvent.timestamp();
#endif
diff --git a/Source/WebKit2/Shared/WebPageCreationParameters.cpp b/Source/WebKit2/Shared/WebPageCreationParameters.cpp
index 45fa5a4..33b53e3 100644
--- a/Source/WebKit2/Shared/WebPageCreationParameters.cpp
+++ b/Source/WebKit2/Shared/WebPageCreationParameters.cpp
@@ -39,15 +39,18 @@ void WebPageCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const
encoder->encode(isInWindow);
encoder->encode(store);
- encoder->encode(drawingAreaInfo);
+ encoder->encodeEnum(drawingAreaType);
encoder->encode(pageGroupData);
encoder->encode(drawsBackground);
encoder->encode(drawsTransparentBackground);
+ encoder->encode(areMemoryCacheClientCallsEnabled);
encoder->encode(useFixedLayout);
encoder->encode(fixedLayoutSize);
encoder->encode(userAgent);
encoder->encode(sessionState);
encoder->encode(highestUsedBackForwardItemID);
+ encoder->encode(canRunBeforeUnloadConfirmPanel);
+ encoder->encode(canRunModal);
#if PLATFORM(MAC)
encoder->encode(isSmartInsertDeleteEnabled);
@@ -72,7 +75,7 @@ bool WebPageCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, WebPag
return false;
if (!decoder->decode(parameters.store))
return false;
- if (!decoder->decode(parameters.drawingAreaInfo))
+ if (!decoder->decodeEnum(parameters.drawingAreaType))
return false;
if (!decoder->decode(parameters.pageGroupData))
return false;
@@ -80,6 +83,8 @@ bool WebPageCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, WebPag
return false;
if (!decoder->decode(parameters.drawsTransparentBackground))
return false;
+ if (!decoder->decode(parameters.areMemoryCacheClientCallsEnabled))
+ return false;
if (!decoder->decode(parameters.useFixedLayout))
return false;
if (!decoder->decode(parameters.fixedLayoutSize))
@@ -90,6 +95,10 @@ bool WebPageCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, WebPag
return false;
if (!decoder->decode(parameters.highestUsedBackForwardItemID))
return false;
+ if (!decoder->decode(parameters.canRunBeforeUnloadConfirmPanel))
+ return false;
+ if (!decoder->decode(parameters.canRunModal))
+ return false;
#if PLATFORM(MAC)
if (!decoder->decode(parameters.isSmartInsertDeleteEnabled))
diff --git a/Source/WebKit2/Shared/WebPageCreationParameters.h b/Source/WebKit2/Shared/WebPageCreationParameters.h
index 8c76f68..31759e1 100644
--- a/Source/WebKit2/Shared/WebPageCreationParameters.h
+++ b/Source/WebKit2/Shared/WebPageCreationParameters.h
@@ -52,12 +52,14 @@ struct WebPageCreationParameters {
bool isInWindow;
WebPreferencesStore store;
- DrawingAreaInfo drawingAreaInfo;
+ DrawingAreaType drawingAreaType;
WebPageGroupData pageGroupData;
bool drawsBackground;
bool drawsTransparentBackground;
+ bool areMemoryCacheClientCallsEnabled;
+
bool useFixedLayout;
WebCore::IntSize fixedLayoutSize;
@@ -66,6 +68,7 @@ struct WebPageCreationParameters {
SessionState sessionState;
uint64_t highestUsedBackForwardItemID;
+ bool canRunBeforeUnloadConfirmPanel;
bool canRunModal;
#if PLATFORM(MAC)
diff --git a/Source/WebKit2/Shared/WebPreferencesStore.h b/Source/WebKit2/Shared/WebPreferencesStore.h
index c9624df..f00a90e 100644
--- a/Source/WebKit2/Shared/WebPreferencesStore.h
+++ b/Source/WebKit2/Shared/WebPreferencesStore.h
@@ -53,6 +53,7 @@ namespace WebKit {
macro(HyperlinkAuditingEnabled, hyperlinkAuditingEnabled, Bool, bool, true) \
macro(NeedsSiteSpecificQuirks, needsSiteSpecificQuirks, Bool, bool, false) \
macro(AcceleratedCompositingEnabled, acceleratedCompositingEnabled, Bool, bool, true) \
+ macro(AcceleratedDrawingEnabled, acceleratedDrawingEnabled, Bool, bool, false) \
macro(CompositingBordersVisible, compositingBordersVisible, Bool, bool, false) \
macro(CompositingRepaintCountersVisible, compositingRepaintCountersVisible, Bool, bool, false) \
macro(WebGLEnabled, webGLEnabled, Bool, bool, false) \
diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp
index 89b1009..360c6d7 100644
--- a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp
+++ b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp
@@ -32,7 +32,10 @@ namespace WebKit {
WebProcessCreationParameters::WebProcessCreationParameters()
: shouldTrackVisitedLinks(false)
+ , clearResourceCaches(false)
+ , clearApplicationCache(false)
, shouldAlwaysUseComplexTextCodePath(false)
+ , defaultRequestTimeoutInterval(INT_MAX)
#if PLATFORM(MAC)
, nsURLCacheMemoryCapacity(0)
, nsURLCacheDiskCapacity(0)
@@ -54,9 +57,15 @@ void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) con
encoder->encode(mimeTypesWithCustomRepresentation);
encoder->encodeEnum(cacheModel);
encoder->encode(shouldTrackVisitedLinks);
+ encoder->encode(clearResourceCaches);
+ encoder->encode(clearApplicationCache);
encoder->encode(shouldAlwaysUseComplexTextCodePath);
encoder->encode(languageCode);
encoder->encode(textCheckerState);
+ encoder->encode(defaultRequestTimeoutInterval);
+#if USE(CFURLSTORAGESESSIONS)
+ encoder->encode(uiProcessBundleIdentifier);
+#endif
#if PLATFORM(MAC)
encoder->encode(parentProcessName);
encoder->encode(presenterApplicationPid);
@@ -67,6 +76,9 @@ void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) con
encoder->encode(uiProcessBundleResourcePath);
#elif PLATFORM(WIN)
encoder->encode(shouldPaintNativeControls);
+ encoder->encode(cfURLCachePath);
+ encoder->encode(cfURLCacheDiskCapacity);
+ encoder->encode(cfURLCacheMemoryCapacity);
#endif
}
@@ -92,12 +104,22 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web
return false;
if (!decoder->decode(parameters.shouldTrackVisitedLinks))
return false;
+ if (!decoder->decode(parameters.clearResourceCaches))
+ return false;
+ if (!decoder->decode(parameters.clearApplicationCache))
+ return false;
if (!decoder->decode(parameters.shouldAlwaysUseComplexTextCodePath))
return false;
if (!decoder->decode(parameters.languageCode))
return false;
if (!decoder->decode(parameters.textCheckerState))
return false;
+ if (!decoder->decode(parameters.defaultRequestTimeoutInterval))
+ return false;
+#if USE(CFURLSTORAGESESSIONS)
+ if (!decoder->decode(parameters.uiProcessBundleIdentifier))
+ return false;
+#endif
#if PLATFORM(MAC)
if (!decoder->decode(parameters.parentProcessName))
@@ -117,6 +139,12 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web
#elif PLATFORM(WIN)
if (!decoder->decode(parameters.shouldPaintNativeControls))
return false;
+ if (!decoder->decode(parameters.cfURLCachePath))
+ return false;
+ if (!decoder->decode(parameters.cfURLCacheDiskCapacity))
+ return false;
+ if (!decoder->decode(parameters.cfURLCacheMemoryCapacity))
+ return false;
#endif
return true;
diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.h b/Source/WebKit2/Shared/WebProcessCreationParameters.h
index b157c94..a57be99 100644
--- a/Source/WebKit2/Shared/WebProcessCreationParameters.h
+++ b/Source/WebKit2/Shared/WebProcessCreationParameters.h
@@ -73,18 +73,30 @@ struct WebProcessCreationParameters {
TextCheckerState textCheckerState;
+ double defaultRequestTimeoutInterval;
+
+#if USE(CFURLSTORAGESESSIONS)
+ String uiProcessBundleIdentifier;
+#endif
+
#if PLATFORM(MAC)
String parentProcessName;
pid_t presenterApplicationPid;
- CString nsURLCachePath;
+ // FIXME: These should be merged with CFURLCache counterparts below.
+ CString nsURLCachePath;
uint64_t nsURLCacheMemoryCapacity;
uint64_t nsURLCacheDiskCapacity;
+
CoreIPC::MachPort acceleratedCompositingPort;
CString uiProcessBundleResourcePath;
#elif PLATFORM(WIN)
+ String cfURLCachePath;
+ uint64_t cfURLCacheDiskCapacity;
+ uint64_t cfURLCacheMemoryCapacity;
+
bool shouldPaintNativeControls;
#endif
};
diff --git a/Source/WebKit2/Shared/WebURLRequest.cpp b/Source/WebKit2/Shared/WebURLRequest.cpp
index 586bbb4..48acf37 100644
--- a/Source/WebKit2/Shared/WebURLRequest.cpp
+++ b/Source/WebKit2/Shared/WebURLRequest.cpp
@@ -10,6 +10,8 @@
#include "config.h"
#include "WebURLRequest.h"
+#include "WebContext.h"
+
using namespace WebCore;
namespace WebKit {
@@ -24,4 +26,19 @@ WebURLRequest::WebURLRequest(const ResourceRequest& request)
{
}
+double WebURLRequest::defaultTimeoutInterval()
+{
+ return ResourceRequest::defaultTimeoutInterval();
+}
+
+// FIXME: This function should really be on WebContext.
+void WebURLRequest::setDefaultTimeoutInterval(double timeoutInterval)
+{
+ ResourceRequest::setDefaultTimeoutInterval(timeoutInterval);
+
+ const Vector<WebContext*>& contexts = WebContext::allContexts();
+ for (size_t i = 0; i < contexts.size(); ++i)
+ contexts[i]->setDefaultRequestTimeoutInterval(timeoutInterval);
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/Shared/WebURLRequest.h b/Source/WebKit2/Shared/WebURLRequest.h
index ab167b8..a3a5931 100644
--- a/Source/WebKit2/Shared/WebURLRequest.h
+++ b/Source/WebKit2/Shared/WebURLRequest.h
@@ -61,6 +61,9 @@ public:
const String& url() const { return m_request.url(); }
+ static double defaultTimeoutInterval(); // May return 0 when using platform default.
+ static void setDefaultTimeoutInterval(double);
+
private:
explicit WebURLRequest(const WebCore::ResourceRequest&);
explicit WebURLRequest(PlatformRequest);
diff --git a/Source/WebKit2/Shared/WebWheelEvent.cpp b/Source/WebKit2/Shared/WebWheelEvent.cpp
index 26f2337..5940bcc 100644
--- a/Source/WebKit2/Shared/WebWheelEvent.cpp
+++ b/Source/WebKit2/Shared/WebWheelEvent.cpp
@@ -49,7 +49,7 @@ WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint
}
#if PLATFORM(MAC)
-WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Granularity granularity, Phase phase, bool hasPreciseScrollingDeltas, Modifiers modifiers, double timestamp)
+WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Granularity granularity, Phase phase, Phase momentumPhase, bool hasPreciseScrollingDeltas, Modifiers modifiers, double timestamp)
: WebEvent(type, modifiers, timestamp)
, m_position(position)
, m_globalPosition(globalPosition)
@@ -57,6 +57,7 @@ WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint
, m_wheelTicks(wheelTicks)
, m_granularity(granularity)
, m_phase(phase)
+ , m_momentumPhase(momentumPhase)
, m_hasPreciseScrollingDeltas(hasPreciseScrollingDeltas)
{
ASSERT(isWheelEventType(type));
@@ -74,6 +75,7 @@ void WebWheelEvent::encode(CoreIPC::ArgumentEncoder* encoder) const
encoder->encode(m_granularity);
#if PLATFORM(MAC)
encoder->encode(m_phase);
+ encoder->encode(m_momentumPhase);
encoder->encode(m_hasPreciseScrollingDeltas);
#endif
}
@@ -95,6 +97,8 @@ bool WebWheelEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebWheelEvent& t)
#if PLATFORM(MAC)
if (!decoder->decode(t.m_phase))
return false;
+ if (!decoder->decode(t.m_momentumPhase))
+ return false;
if (!decoder->decode(t.m_hasPreciseScrollingDeltas))
return false;
#endif
diff --git a/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp b/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp
index 555eab5..a4e8e55 100644
--- a/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp
+++ b/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp
@@ -26,8 +26,8 @@
#include "config.h"
#include "ShareableBitmap.h"
-#include "NotImplemented.h"
#include <WebCore/GraphicsContext.h>
+#include <WebCore/NotImplemented.h>
using namespace WebCore;
diff --git a/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp b/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp
index e9ca723..28ba7ea 100644
--- a/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp
+++ b/Source/WebKit2/Shared/cg/ShareableBitmapCG.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
@@ -37,10 +37,13 @@ namespace WebKit {
PassOwnPtr<GraphicsContext> ShareableBitmap::createGraphicsContext()
{
RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
- RetainPtr<CGContextRef> bitmapContext(AdoptCF, CGBitmapContextCreate(data(), m_size.width(), m_size.height(), 8, m_size.width() * 4, colorSpace.get(),
- kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
- // We want the origin to be in the top left corner so flip the backing store context.
+ ref(); // Balanced by deref in releaseData.
+ RetainPtr<CGContextRef> bitmapContext(AdoptCF, CGBitmapContextCreateWithData(data(),
+ m_size.width(), m_size.height(), 8, m_size.width() * 4, colorSpace.get(),
+ kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, releaseData, this));
+
+ // We want the origin to be in the top left corner so we flip the backing store context.
CGContextTranslateCTM(bitmapContext.get(), 0, m_size.height());
CGContextScaleCTM(bitmapContext.get(), 1, -1);
@@ -49,9 +52,14 @@ PassOwnPtr<GraphicsContext> ShareableBitmap::createGraphicsContext()
void ShareableBitmap::paint(WebCore::GraphicsContext& context, const IntPoint& dstPoint, const IntRect& srcRect)
{
- OwnPtr<GraphicsContext> sourceContext(createGraphicsContext());
+ paintBitmapContext(context.platformContext(), createGraphicsContext()->platformContext(), dstPoint, srcRect);
+}
- paintBitmapContext(context.platformContext(), sourceContext->platformContext(), dstPoint, srcRect);
+void ShareableBitmap::releaseData(void* typelessBitmap, void* typelessData)
+{
+ ShareableBitmap* bitmap = static_cast<ShareableBitmap*>(typelessBitmap);
+ ASSERT_UNUSED(typelessData, bitmap->data() == typelessData);
+ bitmap->deref(); // Balanced by ref in createGraphicsContext.
}
-
+
} // namespace WebKit
diff --git a/Source/WebKit2/Shared/cg/WebCoreArgumentCodersCG.cpp b/Source/WebKit2/Shared/cg/WebCoreArgumentCodersCG.cpp
new file mode 100644
index 0000000..058cf51
--- /dev/null
+++ b/Source/WebKit2/Shared/cg/WebCoreArgumentCodersCG.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebCoreArgumentCoders.h"
+
+#include "ShareableBitmap.h"
+#include <WebCore/BitmapImage.h>
+
+using namespace WebCore;
+using namespace WebKit;
+
+namespace CoreIPC {
+
+RefPtr<Image> createImage(ShareableBitmap* bitmap)
+{
+ RetainPtr<CGImageRef> platformImage(AdoptCF, CGBitmapContextCreateImage(bitmap->createGraphicsContext()->platformContext()));
+ if (!platformImage)
+ return 0;
+ // BitmapImage::create adopts the CGImageRef that's passed in, which is why we need to leakRef here.
+ return BitmapImage::create(platformImage.leakRef());
+}
+
+}
diff --git a/Source/WebKit2/Shared/gtk/NativeWebKeyboardEventGtk.cpp b/Source/WebKit2/Shared/gtk/NativeWebKeyboardEventGtk.cpp
new file mode 100644
index 0000000..4ff853c
--- /dev/null
+++ b/Source/WebKit2/Shared/gtk/NativeWebKeyboardEventGtk.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ * Copyright (C) 2011 Igalia S.L
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "NativeWebKeyboardEvent.h"
+
+#include "WebEventFactory.h"
+#include <gdk/gdk.h>
+
+namespace WebKit {
+
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(GdkEvent* event)
+ : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(&event->key))
+ , m_nativeEvent(gdk_event_copy(event))
+{
+}
+
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(const NativeWebKeyboardEvent& event)
+ : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(&event.nativeEvent()->key))
+ , m_nativeEvent(gdk_event_copy(event.nativeEvent()))
+{
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/gtk/ShareableBitmapGtk.cpp b/Source/WebKit2/Shared/gtk/ShareableBitmapGtk.cpp
index 50c7b57..ed75875 100644
--- a/Source/WebKit2/Shared/gtk/ShareableBitmapGtk.cpp
+++ b/Source/WebKit2/Shared/gtk/ShareableBitmapGtk.cpp
@@ -27,8 +27,8 @@
#include "config.h"
#include "ShareableBitmap.h"
-#include "NotImplemented.h"
#include <WebCore/GraphicsContext.h>
+#include <WebCore/NotImplemented.h>
using namespace WebCore;
diff --git a/Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp b/Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp
index 515966c..2770a3f 100644
--- a/Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp
+++ b/Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp
@@ -27,7 +27,7 @@
#include "config.h"
#include "WebCoreArgumentCoders.h"
-#include "NotImplemented.h"
+#include <WebCore/NotImplemented.h>
namespace CoreIPC {
diff --git a/Source/WebKit2/Shared/gtk/WebEventFactory.cpp b/Source/WebKit2/Shared/gtk/WebEventFactory.cpp
new file mode 100644
index 0000000..a9acbb3
--- /dev/null
+++ b/Source/WebKit2/Shared/gtk/WebEventFactory.cpp
@@ -0,0 +1,189 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebEventFactory.h"
+
+#include "PlatformKeyboardEvent.h"
+#include "Scrollbar.h"
+#include "WindowsKeyboardCodes.h"
+#include <gdk/gdk.h>
+#include <gdk/gdkkeysyms.h>
+#include <wtf/ASCIICType.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static inline bool isGdkKeyCodeFromKeyPad(unsigned keyval)
+{
+ return keyval >= GDK_KEY_KP_Space && keyval <= GDK_KEY_KP_9;
+}
+
+static inline WebEvent::Modifiers modifiersForEvent(const GdkEvent* event)
+{
+ unsigned modifiers = 0;
+ GdkModifierType state;
+
+ ASSERT(gdk_event_get_state(event, &state));
+
+ if (state & GDK_CONTROL_MASK)
+ modifiers |= WebEvent::ControlKey;
+ if (state & GDK_SHIFT_MASK)
+ modifiers |= WebEvent::ShiftKey;
+ if (state & GDK_MOD1_MASK)
+ modifiers |= WebEvent::AltKey;
+ if (state & GDK_META_MASK)
+ modifiers |= WebEvent::MetaKey;
+
+ return static_cast<WebEvent::Modifiers>(modifiers);
+}
+
+static inline WebMouseEvent::Button buttonForEvent(GdkEvent* event)
+{
+ unsigned button = 0;
+
+ switch (event->type) {
+ case GDK_MOTION_NOTIFY:
+ button = WebMouseEvent::NoButton;
+ if (event->motion.state & GDK_BUTTON1_MASK)
+ button = WebMouseEvent::LeftButton;
+ else if (event->motion.state & GDK_BUTTON2_MASK)
+ button = WebMouseEvent::MiddleButton;
+ else if (event->motion.state & GDK_BUTTON3_MASK)
+ button = WebMouseEvent::RightButton;
+ break;
+ case GDK_BUTTON_PRESS:
+ case GDK_2BUTTON_PRESS:
+ case GDK_3BUTTON_PRESS:
+ case GDK_BUTTON_RELEASE:
+ if (event->button.button == 1)
+ button = WebMouseEvent::LeftButton;
+ else if (event->button.button == 2)
+ button = WebMouseEvent::MiddleButton;
+ else if (event->button.button == 3)
+ button = WebMouseEvent::RightButton;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ return static_cast<WebMouseEvent::Button>(button);
+}
+
+WebMouseEvent WebEventFactory::createWebMouseEvent(GdkEvent *event, int currentClickCount)
+{
+ double x, y, xRoot, yRoot;
+ gdk_event_get_coords(event, &x, &y);
+ gdk_event_get_root_coords(event, &xRoot, &yRoot);
+
+ WebEvent::Type type = static_cast<WebEvent::Type>(0);
+ switch (event->type) {
+ case GDK_MOTION_NOTIFY:
+ type = WebEvent::MouseMove;
+ break;
+ case GDK_BUTTON_PRESS:
+ case GDK_2BUTTON_PRESS:
+ case GDK_3BUTTON_PRESS:
+ type = WebEvent::MouseDown;
+ break;
+ case GDK_BUTTON_RELEASE:
+ type = WebEvent::MouseUp;
+ break;
+ default :
+ ASSERT_NOT_REACHED();
+ }
+
+ return WebMouseEvent(type,
+ buttonForEvent(event),
+ IntPoint(x, y),
+ IntPoint(xRoot, yRoot),
+ 0 /* deltaX */,
+ 0 /* deltaY */,
+ 0 /* deltaZ */,
+ currentClickCount,
+ static_cast<WebEvent::Modifiers>(0),
+ gdk_event_get_time(event));
+}
+
+WebWheelEvent WebEventFactory::createWebWheelEvent(GdkEventScroll* scrollEvent)
+{
+ GdkEvent* event(reinterpret_cast<GdkEvent*>(scrollEvent));
+ double x, y, xRoot, yRoot;
+ gdk_event_get_coords(event, &x, &y);
+ gdk_event_get_root_coords(event, &xRoot, &yRoot);
+
+ FloatSize wheelTicks;
+ switch (scrollEvent->direction) {
+ case GDK_SCROLL_UP:
+ wheelTicks = FloatSize(0, 1);
+ break;
+ case GDK_SCROLL_DOWN:
+ wheelTicks = FloatSize(0, -1);
+ break;
+ case GDK_SCROLL_LEFT:
+ wheelTicks = FloatSize(1, 0);
+ break;
+ case GDK_SCROLL_RIGHT:
+ wheelTicks = FloatSize(-1, 0);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ // FIXME: [GTK] Add a setting to change the pixels per line used for scrolling
+ // https://bugs.webkit.org/show_bug.cgi?id=54826
+ float step = static_cast<float>(Scrollbar::pixelsPerLineStep());
+ FloatSize delta(wheelTicks.width() * step, wheelTicks.height() * step);
+
+ return WebWheelEvent(WebEvent::Wheel,
+ IntPoint(x, y),
+ IntPoint(xRoot, yRoot),
+ delta,
+ wheelTicks,
+ WebWheelEvent::ScrollByPixelWheelEvent,
+ modifiersForEvent(event),
+ gdk_event_get_time(event));
+}
+
+WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(const GdkEventKey* event)
+{
+ return WebKeyboardEvent((event->type == GDK_KEY_RELEASE) ? WebEvent::KeyUp : WebEvent::KeyDown,
+ PlatformKeyboardEvent::singleCharacterString(event->keyval),
+ PlatformKeyboardEvent::singleCharacterString(event->keyval),
+ PlatformKeyboardEvent::keyIdentifierForGdkKeyCode(event->keyval),
+ PlatformKeyboardEvent::windowsKeyCodeForGdkKeyCode(event->keyval),
+ static_cast<int>(event->keyval),
+ 0 /* macCharCode */,
+ false /* isAutoRepeat */,
+ isGdkKeyCodeFromKeyPad(event->keyval),
+ false /* isSystemKey */,
+ modifiersForEvent(reinterpret_cast<const GdkEvent*>(event)),
+ gdk_event_get_time(reinterpret_cast<const GdkEvent*>(event)));
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/qt/CleanupHandler.h b/Source/WebKit2/Shared/gtk/WebEventFactory.h
index afd7723..f13890b 100644
--- a/Source/WebKit2/Shared/qt/CleanupHandler.h
+++ b/Source/WebKit2/Shared/gtk/WebEventFactory.h
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2010 University of Szeged. All rights reserved.
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,54 +24,24 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef CleanupHandler_h
-#define CleanupHandler_h
+#ifndef WebEventFactory_h
+#define WebEventFactory_h
-#include <QCoreApplication>
-#include <QList>
-#include <QObject>
-#include <wtf/HashSet.h>
-#include <wtf/StdLibExtras.h>
+#include "WebEvent.h"
+
+typedef union _GdkEvent GdkEvent;
+typedef struct _GdkEventScroll GdkEventScroll;
+typedef struct _GdkEventKey GdkEventKey;
namespace WebKit {
-class CleanupHandler : private QObject {
- Q_OBJECT
+class WebEventFactory {
public:
- static CleanupHandler* instance()
- {
- if (!theInstance)
- theInstance = new CleanupHandler();
- return theInstance;
- }
-
- void markForCleanup(QObject* object)
- {
- m_objects.append(object);
- }
-
- void unmark(QObject* object)
- {
- if (m_hasStartedDeleting)
- return;
- m_objects.removeOne(object);
- }
-
- bool hasStartedDeleting() const { return m_hasStartedDeleting; }
-
-private slots:
- void deleteObjects();
-
-private:
- static void sigTermHandler(int);
- static CleanupHandler* theInstance;
-
- CleanupHandler();
-
- QList<QObject*> m_objects;
- bool m_hasStartedDeleting;
+ static WebMouseEvent createWebMouseEvent(GdkEvent*, int);
+ static WebWheelEvent createWebWheelEvent(GdkEventScroll*);
+ static WebKeyboardEvent createWebKeyboardEvent(const GdkEventKey*);
};
} // namespace WebKit
-#endif // CleanupHandler_h
+#endif // WebEventFactory_h
diff --git a/Source/WebKit2/Shared/mac/PasteboardTypes.h b/Source/WebKit2/Shared/mac/PasteboardTypes.h
index 712c4c0..81aef29 100644
--- a/Source/WebKit2/Shared/mac/PasteboardTypes.h
+++ b/Source/WebKit2/Shared/mac/PasteboardTypes.h
@@ -39,6 +39,7 @@ public:
static NSArray *forURL();
static NSArray *forImages();
static NSArray *forImagesWithArchive();
+ static NSArray *forSelection();
};
} // namespace WebKit
diff --git a/Source/WebKit2/Shared/mac/PasteboardTypes.mm b/Source/WebKit2/Shared/mac/PasteboardTypes.mm
index 0d48464..28df29b 100644
--- a/Source/WebKit2/Shared/mac/PasteboardTypes.mm
+++ b/Source/WebKit2/Shared/mac/PasteboardTypes.mm
@@ -68,5 +68,11 @@ NSArray* PasteboardTypes::forImagesWithArchive()
static NSArray *types = retain([NSArray arrayWithObjects:NSTIFFPboardType, WebURLsWithTitlesPboardType, NSURLPboardType, WebURLPboardType, WebURLNamePboardType, NSStringPboardType, NSRTFDPboardType, WebArchivePboardType, nil]);
return types;
}
+
+NSArray* PasteboardTypes::forSelection()
+{
+ static NSArray *types = retain([NSArray arrayWithObjects:WebArchivePboardType, NSRTFDPboardType, NSRTFPboardType, NSStringPboardType, nil]);
+ return types;
+}
} // namespace WebKit
diff --git a/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm b/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm
index 63dd20d..a12e566 100644
--- a/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm
+++ b/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm
@@ -33,12 +33,27 @@ namespace CoreIPC {
void encodeResourceRequest(ArgumentEncoder* encoder, const WebCore::ResourceRequest& resourceRequest)
{
+ bool requestIsPresent = resourceRequest.nsURLRequest();
+ encoder->encode(requestIsPresent);
+
+ if (!requestIsPresent)
+ return;
+
RetainPtr<CFDictionaryRef> dictionary(AdoptCF, WKNSURLRequestCreateSerializableRepresentation(resourceRequest.nsURLRequest(), CoreIPC::tokenNullTypeRef()));
encode(encoder, dictionary.get());
}
bool decodeResourceRequest(ArgumentDecoder* decoder, WebCore::ResourceRequest& resourceRequest)
{
+ bool requestIsPresent;
+ if (!decoder->decode(requestIsPresent))
+ return false;
+
+ if (!requestIsPresent) {
+ resourceRequest = WebCore::ResourceRequest();
+ return true;
+ }
+
RetainPtr<CFDictionaryRef> dictionary;
if (!decode(decoder, dictionary))
return false;
@@ -66,7 +81,8 @@ void encodeResourceResponse(ArgumentEncoder* encoder, const WebCore::ResourceRes
bool decodeResourceResponse(ArgumentDecoder* decoder, WebCore::ResourceResponse& resourceResponse)
{
bool responseIsPresent;
- decoder->decode(responseIsPresent);
+ if (!decoder->decode(responseIsPresent))
+ return false;
if (!responseIsPresent) {
resourceResponse = WebCore::ResourceResponse();
@@ -85,5 +101,4 @@ bool decodeResourceResponse(ArgumentDecoder* decoder, WebCore::ResourceResponse&
return true;
}
-
} // namespace CoreIPC
diff --git a/Source/WebKit2/Shared/mac/WebEventFactory.mm b/Source/WebKit2/Shared/mac/WebEventFactory.mm
index e31c62e..8f02f6b 100644
--- a/Source/WebKit2/Shared/mac/WebEventFactory.mm
+++ b/Source/WebKit2/Shared/mac/WebEventFactory.mm
@@ -174,6 +174,26 @@ static WebWheelEvent::Phase phaseForEvent(NSEvent *event)
{
#if !defined(BUILDING_ON_SNOW_LEOPARD)
uint32_t phase = WebWheelEvent::PhaseNone;
+ if ([event phase] & NSEventPhaseBegan)
+ phase |= WebWheelEvent::PhaseBegan;
+ if ([event phase] & NSEventPhaseStationary)
+ phase |= WebWheelEvent::PhaseStationary;
+ if ([event phase] & NSEventPhaseChanged)
+ phase |= WebWheelEvent::PhaseChanged;
+ if ([event phase] & NSEventPhaseEnded)
+ phase |= WebWheelEvent::PhaseEnded;
+ if ([event phase] & NSEventPhaseCancelled)
+ phase |= WebWheelEvent::PhaseCancelled;
+ return static_cast<WebWheelEvent::Phase>(phase);
+#else
+ return WebWheelEvent::PhaseNone;
+#endif
+}
+
+static WebWheelEvent::Phase momentumPhaseForEvent(NSEvent *event)
+{
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ uint32_t phase = WebWheelEvent::PhaseNone;
if ([event momentumPhase] & NSEventPhaseBegan)
phase |= WebWheelEvent::PhaseBegan;
if ([event momentumPhase] & NSEventPhaseStationary)
@@ -1036,11 +1056,12 @@ WebWheelEvent WebEventFactory::createWebWheelEvent(NSEvent *event, NSView *windo
}
WebWheelEvent::Phase phase = phaseForEvent(event);
+ WebWheelEvent::Phase momentumPhase = momentumPhaseForEvent(event);
bool hasPreciseScrollingDeltas = continuous;
WebEvent::Modifiers modifiers = modifiersForEvent(event);
double timestamp = [event timestamp];
- return WebWheelEvent(WebEvent::Wheel, IntPoint(position), IntPoint(globalPosition), FloatSize(deltaX, deltaY), FloatSize(wheelTicksX, wheelTicksY), granularity, phase, hasPreciseScrollingDeltas, modifiers, timestamp);
+ return WebWheelEvent(WebEvent::Wheel, IntPoint(position), IntPoint(globalPosition), FloatSize(deltaX, deltaY), FloatSize(wheelTicksX, wheelTicksY), granularity, phase, momentumPhase, hasPreciseScrollingDeltas, modifiers, timestamp);
}
WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(NSEvent *event, NSView *)
diff --git a/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp b/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp
index 44cdbea..a5d5f12 100644
--- a/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp
+++ b/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp
@@ -25,7 +25,9 @@
#include "config.h"
#include "WebCoreArgumentCoders.h"
-#include "NotImplemented.h"
+
+#include <WebCore/NotImplemented.h>
+#include <WebCore/ResourceResponse.h>
namespace CoreIPC {
@@ -37,7 +39,11 @@ void encodeResourceRequest(ArgumentEncoder* encoder, const WebCore::ResourceRequ
bool decodeResourceRequest(ArgumentDecoder* decoder, WebCore::ResourceRequest& resourceRequest)
{
notImplemented();
- return false;
+
+ // FIXME: Add real implementation when we want to implement something that
+ // depends on this like the policy client.
+ resourceRequest = WebCore::ResourceRequest();
+ return true;
}
void encodeResourceResponse(ArgumentEncoder* encoder, const WebCore::ResourceResponse& resourceResponse)
@@ -48,7 +54,10 @@ void encodeResourceResponse(ArgumentEncoder* encoder, const WebCore::ResourceRes
bool decodeResourceResponse(ArgumentDecoder* decoder, WebCore::ResourceResponse& resourceResponse)
{
notImplemented();
- return false;
+
+ // FIXME: Ditto.
+ resourceResponse = WebCore::ResourceResponse();
+ return true;
}
} // namespace CoreIPC
diff --git a/Source/WebKit2/Shared/win/LayerTreeContextWin.cpp b/Source/WebKit2/Shared/win/LayerTreeContextWin.cpp
index f1bf1b4..9159976 100644
--- a/Source/WebKit2/Shared/win/LayerTreeContextWin.cpp
+++ b/Source/WebKit2/Shared/win/LayerTreeContextWin.cpp
@@ -26,7 +26,7 @@
#include "config.h"
#include "LayerTreeContext.h"
-#include "NotImplemented.h"
+#include <WebCore/NotImplemented.h>
namespace WebKit {
diff --git a/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp b/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp
index 684378a..9513e90 100644
--- a/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp
+++ b/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp
@@ -38,6 +38,12 @@ namespace CoreIPC {
void encodeResourceRequest(ArgumentEncoder* encoder, const WebCore::ResourceRequest& resourceRequest)
{
#if USE(CFNETWORK)
+ bool requestIsPresent = resourceRequest.cfURLRequest();
+ encoder->encode(requestIsPresent);
+
+ if (!requestIsPresent)
+ return;
+
RetainPtr<CFDictionaryRef> dictionary(AdoptCF, wkCFURLRequestCreateSerializableRepresentation(resourceRequest.cfURLRequest(), CoreIPC::tokenNullTypeRef()));
encode(encoder, dictionary.get());
#endif
@@ -46,6 +52,15 @@ void encodeResourceRequest(ArgumentEncoder* encoder, const WebCore::ResourceRequ
bool decodeResourceRequest(ArgumentDecoder* decoder, WebCore::ResourceRequest& resourceRequest)
{
#if USE(CFNETWORK)
+ bool requestIsPresent;
+ if (!decoder->decode(requestIsPresent))
+ return false;
+
+ if (!requestIsPresent) {
+ resourceRequest = WebCore::ResourceRequest();
+ return true;
+ }
+
RetainPtr<CFDictionaryRef> dictionary;
if (!decode(decoder, dictionary))
return false;
@@ -79,7 +94,8 @@ bool decodeResourceResponse(ArgumentDecoder* decoder, WebCore::ResourceResponse&
{
#if USE(CFNETWORK)
bool responseIsPresent;
- decoder->decode(responseIsPresent);
+ if (!decoder->decode(responseIsPresent))
+ return false;
if (!responseIsPresent) {
resourceResponse = WebCore::ResourceResponse();
diff --git a/Source/WebKit2/Shared/win/WebKitBundle.cpp b/Source/WebKit2/Shared/win/WebKitBundle.cpp
new file mode 100644
index 0000000..b90f3d4
--- /dev/null
+++ b/Source/WebKit2/Shared/win/WebKitBundle.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitBundle.h"
+
+#include <CoreFoundation/CFBundle.h>
+#include <wtf/RetainPtr.h>
+#include <wtf/StdLibExtras.h>
+
+extern "C" HINSTANCE gInstance;
+
+namespace WebKit {
+
+static CFBundleRef createWebKitBundle()
+{
+ if (CFBundleRef existingBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit"))) {
+ CFRetain(existingBundle);
+ return existingBundle;
+ }
+
+ wchar_t dllPathBuffer[MAX_PATH];
+ DWORD length = ::GetModuleFileNameW(gInstance, dllPathBuffer, WTF_ARRAY_LENGTH(dllPathBuffer));
+ ASSERT(length && length < WTF_ARRAY_LENGTH(dllPathBuffer));
+
+ RetainPtr<CFStringRef> dllPath(AdoptCF, CFStringCreateWithCharactersNoCopy(0, reinterpret_cast<const UniChar*>(dllPathBuffer), length, kCFAllocatorNull));
+ RetainPtr<CFURLRef> dllURL(AdoptCF, CFURLCreateWithFileSystemPath(0, dllPath.get(), kCFURLWindowsPathStyle, false));
+ RetainPtr<CFURLRef> dllDirectoryURL(AdoptCF, CFURLCreateCopyDeletingLastPathComponent(0, dllURL.get()));
+ RetainPtr<CFURLRef> resourcesDirectoryURL(AdoptCF, CFURLCreateCopyAppendingPathComponent(0, dllDirectoryURL.get(), CFSTR("WebKit.resources"), true));
+
+ return CFBundleCreate(0, resourcesDirectoryURL.get());
+}
+
+CFBundleRef webKitBundle()
+{
+ static CFBundleRef bundle = createWebKitBundle();
+ ASSERT(bundle);
+ return bundle;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/NotImplemented.h b/Source/WebKit2/Shared/win/WebKitBundle.h
index d93da50..140cf21 100644
--- a/Source/WebKit2/Shared/NotImplemented.h
+++ b/Source/WebKit2/Shared/win/WebKitBundle.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007, 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,24 +23,15 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef NotImplemented_h
-#define NotImplemented_h
+#ifndef WebKitBundle_h
+#define WebKitBundle_h
-#include <stdio.h>
-#include <wtf/Assertions.h>
+typedef struct __CFBundle* CFBundleRef;
-#if defined(NDEBUG) || (defined(DISABLE_NOT_IMPLEMENTED_WARNINGS) && DISABLE_NOT_IMPLEMENTED_WARNINGS)
-#define notImplemented() ((void)0)
-#else
+namespace WebKit {
-#define notImplemented() do { \
-static bool havePrinted = false; \
-if (!havePrinted) { \
-printf("UNIMPLEMENTED: %s: %d - %s\n", __FILE__, __LINE__, WTF_PRETTY_FUNCTION); \
-havePrinted = true; \
-} \
-} while (0)
+CFBundleRef webKitBundle();
-#endif // NDEBUG
+} // namespace WebKit
-#endif // NotImplemented_h
+#endif // WebKitBundle_h