summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/Shared
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-06-02 12:07:03 +0100
committerBen Murdoch <benm@google.com>2011-06-10 10:47:21 +0100
commit2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch)
treee4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebKit2/Shared
parent87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff)
downloadexternal_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip
external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz
external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebKit2/Shared')
-rw-r--r--Source/WebKit2/Shared/API/c/WKSerializedScriptValue.h2
-rw-r--r--Source/WebKit2/Shared/API/c/WKString.cpp11
-rw-r--r--Source/WebKit2/Shared/API/c/WKString.h10
-rw-r--r--Source/WebKit2/Shared/API/c/gtk/WKBaseGtk.h2
-rw-r--r--Source/WebKit2/Shared/API/c/win/WKBaseWin.h2
-rw-r--r--Source/WebKit2/Shared/APIObject.h6
-rw-r--r--Source/WebKit2/Shared/ChildProcess.cpp42
-rw-r--r--Source/WebKit2/Shared/ChildProcess.h43
-rw-r--r--Source/WebKit2/Shared/DictionaryPopupInfo.cpp4
-rw-r--r--Source/WebKit2/Shared/DictionaryPopupInfo.h2
-rw-r--r--Source/WebKit2/Shared/EditorState.h (renamed from Source/WebKit2/Shared/SelectionState.h)39
-rw-r--r--Source/WebKit2/Shared/NativeWebMouseEvent.h78
-rw-r--r--Source/WebKit2/Shared/PlatformPopupMenuData.cpp3
-rw-r--r--Source/WebKit2/Shared/PlatformPopupMenuData.h1
-rw-r--r--Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp9
-rw-r--r--Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModuleNone.cpp47
-rw-r--r--Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm9
-rw-r--r--Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp4
-rw-r--r--Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp2
-rw-r--r--Source/WebKit2/Shared/Plugins/PluginQuirks.h2
-rw-r--r--Source/WebKit2/Shared/ShareableBitmap.h6
-rw-r--r--Source/WebKit2/Shared/WebCoreArgumentCoders.cpp2
-rw-r--r--Source/WebKit2/Shared/WebCoreArgumentCoders.h8
-rw-r--r--Source/WebKit2/Shared/WebEvent.cpp7
-rw-r--r--Source/WebKit2/Shared/WebEvent.h8
-rw-r--r--Source/WebKit2/Shared/WebGraphicsContext.cpp8
-rw-r--r--Source/WebKit2/Shared/WebGraphicsContext.h6
-rw-r--r--Source/WebKit2/Shared/WebMouseEvent.cpp13
-rw-r--r--Source/WebKit2/Shared/WebPageGroupData.cpp4
-rw-r--r--Source/WebKit2/Shared/WebPageGroupData.h1
-rw-r--r--Source/WebKit2/Shared/WebPopupItem.h4
-rw-r--r--Source/WebKit2/Shared/WebPreferencesStore.cpp12
-rw-r--r--Source/WebKit2/Shared/WebPreferencesStore.h3
-rw-r--r--Source/WebKit2/Shared/WebProcessCreationParameters.cpp8
-rw-r--r--Source/WebKit2/Shared/WebProcessCreationParameters.h8
-rw-r--r--Source/WebKit2/Shared/WebString.h10
-rw-r--r--Source/WebKit2/Shared/gtk/NativeWebMouseEventGtk.cpp39
-rw-r--r--Source/WebKit2/Shared/mac/ArgumentCodersMac.h62
-rw-r--r--Source/WebKit2/Shared/mac/ArgumentCodersMac.mm343
-rw-r--r--Source/WebKit2/Shared/mac/AttributedString.h49
-rw-r--r--Source/WebKit2/Shared/mac/AttributedString.mm53
-rw-r--r--Source/WebKit2/Shared/mac/NativeWebMouseEventMac.mm39
-rw-r--r--Source/WebKit2/Shared/mac/SandboxExtensionMac.mm48
-rw-r--r--Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm1
-rw-r--r--Source/WebKit2/Shared/mac/WebEventFactory.mm23
-rw-r--r--Source/WebKit2/Shared/qt/NativeWebMouseEventQt.cpp (renamed from Source/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h)30
-rw-r--r--Source/WebKit2/Shared/win/NativeWebMouseEventWin.cpp43
-rw-r--r--Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp4
48 files changed, 1053 insertions, 107 deletions
diff --git a/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.h b/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.h
index 95fc048..3f73d7a 100644
--- a/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.h
+++ b/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.h
@@ -36,7 +36,7 @@ extern "C" {
WK_EXPORT WKTypeID WKSerializedScriptValueGetTypeID();
WK_EXPORT WKSerializedScriptValueRef WKSerializedScriptValueCreate(JSContextRef context, JSValueRef value, JSValueRef* exception);
-WK_EXPORT JSValueRef WKSerializedScriptValueDeserialize(WKSerializedScriptValueRef scriptValue, JSContextRef constext, JSValueRef* exception);
+WK_EXPORT JSValueRef WKSerializedScriptValueDeserialize(WKSerializedScriptValueRef scriptValue, JSContextRef context, JSValueRef* exception);
#ifdef __cplusplus
}
diff --git a/Source/WebKit2/Shared/API/c/WKString.cpp b/Source/WebKit2/Shared/API/c/WKString.cpp
index 0c388c6..cbac67d 100644
--- a/Source/WebKit2/Shared/API/c/WKString.cpp
+++ b/Source/WebKit2/Shared/API/c/WKString.cpp
@@ -47,6 +47,17 @@ bool WKStringIsEmpty(WKStringRef stringRef)
return toImpl(stringRef)->isEmpty();
}
+size_t WKStringGetLength(WKStringRef stringRef)
+{
+ return toImpl(stringRef)->length();
+}
+
+size_t WKStringGetCharacters(WKStringRef stringRef, WKChar* buffer, size_t bufferLength)
+{
+ COMPILE_ASSERT(sizeof(WKChar) == sizeof(UChar), WKStringGetCharacters_sizeof_WKChar_matches_UChar);
+ return (toImpl(stringRef)->getCharacters(static_cast<UChar*>(buffer), bufferLength));
+}
+
size_t WKStringGetMaximumUTF8CStringSize(WKStringRef stringRef)
{
return toImpl(stringRef)->maximumUTF8CStringSize();
diff --git a/Source/WebKit2/Shared/API/c/WKString.h b/Source/WebKit2/Shared/API/c/WKString.h
index dffcab2..d1bc1ef 100644
--- a/Source/WebKit2/Shared/API/c/WKString.h
+++ b/Source/WebKit2/Shared/API/c/WKString.h
@@ -36,12 +36,22 @@
extern "C" {
#endif
+#if !defined(WIN32) && !defined(_WIN32) && !defined(__WINSCW__) \
+ && !((defined(__CC_ARM) || defined(__ARMCC__)) && !defined(__linux__)) /* RVCT */
+ typedef unsigned short WKChar;
+#else
+ typedef wchar_t WKChar;
+#endif
+
WK_EXPORT WKTypeID WKStringGetTypeID();
WK_EXPORT WKStringRef WKStringCreateWithUTF8CString(const char* string);
WK_EXPORT bool WKStringIsEmpty(WKStringRef string);
+WK_EXPORT size_t WKStringGetLength(WKStringRef string);
+WK_EXPORT size_t WKStringGetCharacters(WKStringRef string, WKChar* buffer, size_t bufferLength);
+
WK_EXPORT size_t WKStringGetMaximumUTF8CStringSize(WKStringRef string);
WK_EXPORT size_t WKStringGetUTF8CString(WKStringRef string, char* buffer, size_t bufferSize);
diff --git a/Source/WebKit2/Shared/API/c/gtk/WKBaseGtk.h b/Source/WebKit2/Shared/API/c/gtk/WKBaseGtk.h
index 8f34ed3..eb88f70 100644
--- a/Source/WebKit2/Shared/API/c/gtk/WKBaseGtk.h
+++ b/Source/WebKit2/Shared/API/c/gtk/WKBaseGtk.h
@@ -32,6 +32,8 @@
#error "Please #include \"WKBase.h\" instead of this file directly."
#endif
+#include <stdbool.h>
+
typedef const struct OpaqueWKView* WKViewRef;
#endif /* WKBaseGtk_h */
diff --git a/Source/WebKit2/Shared/API/c/win/WKBaseWin.h b/Source/WebKit2/Shared/API/c/win/WKBaseWin.h
index fdd4607..d9c13e3 100644
--- a/Source/WebKit2/Shared/API/c/win/WKBaseWin.h
+++ b/Source/WebKit2/Shared/API/c/win/WKBaseWin.h
@@ -32,5 +32,7 @@
typedef const struct OpaqueWKView* WKViewRef;
typedef const struct OpaqueWKEditCommand* WKEditCommandRef;
+typedef const struct OpaqueWKTextChecker* WKTextCheckerRef;
+typedef const struct OpaqueWKGrammarDetail* WKGrammarDetailRef;
#endif /* WKBaseWin_h */
diff --git a/Source/WebKit2/Shared/APIObject.h b/Source/WebKit2/Shared/APIObject.h
index 7f50b51..e5a7eed 100644
--- a/Source/WebKit2/Shared/APIObject.h
+++ b/Source/WebKit2/Shared/APIObject.h
@@ -104,8 +104,10 @@ public:
TypeBundleScriptWorld,
// Platform specific
- TypeView,
- TypeEditCommandProxy
+ TypeEditCommandProxy,
+ TypeGrammarDetail,
+ TypeTextChecker,
+ TypeView
};
virtual ~APIObject()
diff --git a/Source/WebKit2/Shared/ChildProcess.cpp b/Source/WebKit2/Shared/ChildProcess.cpp
index d45f4f2..e700caa 100644
--- a/Source/WebKit2/Shared/ChildProcess.cpp
+++ b/Source/WebKit2/Shared/ChildProcess.cpp
@@ -32,14 +32,54 @@
namespace WebKit {
-ChildProcess::ChildProcess()
+void ChildProcess::disableTermination()
{
+ m_terminationCounter++;
+ m_terminationTimer.stop();
+}
+
+void ChildProcess::enableTermination()
+{
+ ASSERT(m_terminationCounter > 0);
+ m_terminationCounter--;
+
+ if (m_terminationCounter)
+ return;
+
+ if (!m_terminationTimeout) {
+ terminationTimerFired();
+ return;
+ }
+
+ m_terminationTimer.startOneShot(m_terminationTimeout);
+}
+
+ChildProcess::ChildProcess(double terminationTimeout)
+ : m_terminationTimeout(terminationTimeout)
+ , m_terminationCounter(0)
+ , m_terminationTimer(RunLoop::main(), this, &ChildProcess::terminationTimerFired)
+{
+ // FIXME: The termination timer should not be scheduled on the main run loop.
+ // It won't work with the threaded mode, but it's not really useful anyway as is.
}
ChildProcess::~ChildProcess()
{
}
+void ChildProcess::terminationTimerFired()
+{
+ if (!shouldTerminate())
+ return;
+
+ terminate();
+}
+
+void ChildProcess::terminate()
+{
+ RunLoop::main()->stop();
+}
+
NO_RETURN static void watchdogCallback()
{
// We use _exit here since the watchdog callback is called from another thread and we don't want
diff --git a/Source/WebKit2/Shared/ChildProcess.h b/Source/WebKit2/Shared/ChildProcess.h
index 7286d52..0c66a9d 100644
--- a/Source/WebKit2/Shared/ChildProcess.h
+++ b/Source/WebKit2/Shared/ChildProcess.h
@@ -27,16 +27,57 @@
#define ChildProcess_h
#include "Connection.h"
+#include "RunLoop.h"
namespace WebKit {
class ChildProcess : protected CoreIPC::Connection::Client {
WTF_MAKE_NONCOPYABLE(ChildProcess);
+
+public:
+ // disable and enable termination of the process. when disableTermination is called, the
+ // process won't terminate unless a corresponding disableTermination call is made.
+ void disableTermination();
+ void enableTermination();
+
+ class LocalTerminationDisabler {
+ public:
+ explicit LocalTerminationDisabler(ChildProcess& childProcess)
+ : m_childProcess(childProcess)
+ {
+ m_childProcess.disableTermination();
+ }
+
+ ~LocalTerminationDisabler()
+ {
+ m_childProcess.enableTermination();
+ }
+
+ private:
+ ChildProcess& m_childProcess;
+ };
+
protected:
- ChildProcess();
+ explicit ChildProcess(double terminationTimeout);
~ChildProcess();
static void didCloseOnConnectionWorkQueue(WorkQueue&, CoreIPC::Connection*);
+
+private:
+ void terminationTimerFired();
+
+ virtual bool shouldTerminate() = 0;
+ virtual void terminate();
+
+ // The timeout, in seconds, before this process will be terminated if termination
+ // has been enabled. If the timeout is 0 seconds, the process will be terminated immediately.
+ double m_terminationTimeout;
+
+ // A termination counter; when the counter reaches zero, the process will be terminated
+ // after a given period of time.
+ unsigned m_terminationCounter;
+
+ RunLoop::Timer<ChildProcess> m_terminationTimer;
};
} // namespace WebKit
diff --git a/Source/WebKit2/Shared/DictionaryPopupInfo.cpp b/Source/WebKit2/Shared/DictionaryPopupInfo.cpp
index 45bf91d..e24a138 100644
--- a/Source/WebKit2/Shared/DictionaryPopupInfo.cpp
+++ b/Source/WebKit2/Shared/DictionaryPopupInfo.cpp
@@ -40,7 +40,7 @@ void DictionaryPopupInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
encoder->encode(fontInfo);
encoder->encodeEnum(type);
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
CoreIPC::encode(encoder, options.get());
#endif
}
@@ -53,7 +53,7 @@ bool DictionaryPopupInfo::decode(CoreIPC::ArgumentDecoder* decoder, DictionaryPo
return false;
if (!decoder->decodeEnum(result.type))
return false;
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
if (!CoreIPC::decode(decoder, result.options))
return false;
#endif
diff --git a/Source/WebKit2/Shared/DictionaryPopupInfo.h b/Source/WebKit2/Shared/DictionaryPopupInfo.h
index 68c81a7..3814ece 100644
--- a/Source/WebKit2/Shared/DictionaryPopupInfo.h
+++ b/Source/WebKit2/Shared/DictionaryPopupInfo.h
@@ -52,7 +52,7 @@ struct DictionaryPopupInfo {
WebCore::FloatPoint origin;
FontInfo fontInfo;
Type type;
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
RetainPtr<CFDictionaryRef> options;
#endif
};
diff --git a/Source/WebKit2/Shared/SelectionState.h b/Source/WebKit2/Shared/EditorState.h
index 9931a10..1e8bcb8 100644
--- a/Source/WebKit2/Shared/SelectionState.h
+++ b/Source/WebKit2/Shared/EditorState.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
@@ -23,52 +23,37 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SelectionState_h
-#define SelectionState_h
+#ifndef EditorState_h
+#define EditorState_h
#include "ArgumentCoders.h"
#include <wtf/NotFound.h>
namespace WebKit {
-struct SelectionState {
- SelectionState()
- : isNone(true)
+struct EditorState {
+ EditorState()
+ : selectionIsNone(true)
+ , selectionIsRange(false)
, isContentEditable(false)
, isContentRichlyEditable(false)
, isInPasswordField(false)
, hasComposition(false)
- , selectedRangeStart(notFound)
- , selectedRangeLength(0)
{
}
- // Whether there is a selection at all. This will be false when there is a caret selection.
- bool isNone;
-
- // Whether the selection is in a content editable area.
+ bool selectionIsNone; // This will be false when there is a caret selection.
+ bool selectionIsRange;
bool isContentEditable;
-
- // Whether the selection is in a rich content editable area.
bool isContentRichlyEditable;
-
- // Whether the selection is in a password field.
bool isInPasswordField;
-
- // Whether the selection has a composition.
bool hasComposition;
-
- // The start of the selected range.
- uint64_t selectedRangeStart;
-
- // The length of the selected range.
- uint64_t selectedRangeLength;
};
-} // namespace WebKit
+}
namespace CoreIPC {
-template<> struct ArgumentCoder<WebKit::SelectionState> : SimpleArgumentCoder<WebKit::SelectionState> { };
+template<> struct ArgumentCoder<WebKit::EditorState> : SimpleArgumentCoder<WebKit::EditorState> { };
};
-#endif // SelectionState_h
+#endif // EditorState_h
diff --git a/Source/WebKit2/Shared/NativeWebMouseEvent.h b/Source/WebKit2/Shared/NativeWebMouseEvent.h
new file mode 100644
index 0000000..01b8502
--- /dev/null
+++ b/Source/WebKit2/Shared/NativeWebMouseEvent.h
@@ -0,0 +1,78 @@
+/*
+ * 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 NativeWebMouseEvent_h
+#define NativeWebMouseEvent_h
+
+#include "WebEvent.h"
+
+#if PLATFORM(MAC)
+#include <wtf/RetainPtr.h>
+OBJC_CLASS NSView;
+#elif PLATFORM(QT)
+#include <qgraphicssceneevent.h>
+#elif PLATFORM(GTK)
+typedef union _GdkEvent GdkEvent;
+#endif
+
+namespace WebKit {
+
+class NativeWebMouseEvent : public WebMouseEvent {
+public:
+#if PLATFORM(MAC)
+ NativeWebMouseEvent(NSEvent *, NSView *);
+#elif PLATFORM(WIN)
+ NativeWebMouseEvent(HWND, UINT message, WPARAM, LPARAM, bool);
+#elif PLATFORM(QT)
+ explicit NativeWebMouseEvent(QGraphicsSceneMouseEvent*, int);
+#elif PLATFORM(GTK)
+ NativeWebMouseEvent(GdkEvent*, int);
+#endif
+
+#if PLATFORM(MAC)
+ NSEvent* nativeEvent() const { return m_nativeEvent.get(); }
+#elif PLATFORM(WIN)
+ const MSG* nativeEvent() const { return &m_nativeEvent; }
+#elif PLATFORM(QT)
+ const QGraphicsSceneMouseEvent* nativeEvent() const { return m_nativeEvent; }
+#elif PLATFORM(GTK)
+ GdkEvent* nativeEvent() const { return m_nativeEvent; }
+#endif
+
+private:
+#if PLATFORM(MAC)
+ RetainPtr<NSEvent> m_nativeEvent;
+#elif PLATFORM(WIN)
+ MSG m_nativeEvent;
+#elif PLATFORM(QT)
+ QGraphicsSceneMouseEvent* m_nativeEvent;
+#elif PLATFORM(GTK)
+ GdkEvent* m_nativeEvent;
+#endif
+};
+
+} // namespace WebKit
+
+#endif // NativeWebMouseEvent_h
diff --git a/Source/WebKit2/Shared/PlatformPopupMenuData.cpp b/Source/WebKit2/Shared/PlatformPopupMenuData.cpp
index 1f56daf..6c4d20e 100644
--- a/Source/WebKit2/Shared/PlatformPopupMenuData.cpp
+++ b/Source/WebKit2/Shared/PlatformPopupMenuData.cpp
@@ -61,6 +61,7 @@ void PlatformPopupMenuData::encode(CoreIPC::ArgumentEncoder* encoder) const
encoder->encode(selectedBackingStoreHandle);
#elif PLATFORM(MAC)
encoder->encode(fontInfo);
+ encoder->encode(shouldPopOver);
#endif
}
@@ -92,6 +93,8 @@ bool PlatformPopupMenuData::decode(CoreIPC::ArgumentDecoder* decoder, PlatformPo
#elif PLATFORM(MAC)
if (!decoder->decode(data.fontInfo))
return false;
+ if (!decoder->decode(data.shouldPopOver))
+ return false;
#endif
return true;
diff --git a/Source/WebKit2/Shared/PlatformPopupMenuData.h b/Source/WebKit2/Shared/PlatformPopupMenuData.h
index 5b3f58d..f85008a 100644
--- a/Source/WebKit2/Shared/PlatformPopupMenuData.h
+++ b/Source/WebKit2/Shared/PlatformPopupMenuData.h
@@ -54,6 +54,7 @@ struct PlatformPopupMenuData {
RefPtr<ShareableBitmap> m_selectedBackingStore;
#elif PLATFORM(MAC)
FontInfo fontInfo;
+ bool shouldPopOver;
#endif
};
diff --git a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp
index 54af967..c5c0a90 100644
--- a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp
+++ b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp
@@ -32,10 +32,6 @@
#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 {
static Vector<NetscapePluginModule*>& initializedNetscapePluginModules()
@@ -88,6 +84,11 @@ bool NetscapePluginModule::tryGetSitesWithData(Vector<String>& sites)
return false;
char** siteArray = m_pluginFuncs.getsiteswithdata();
+
+ // There were no sites with data.
+ if (!siteArray)
+ return true;
+
for (int i = 0; siteArray[i]; ++i) {
char* site = siteArray[i];
diff --git a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModuleNone.cpp b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModuleNone.cpp
new file mode 100644
index 0000000..dc4a37c
--- /dev/null
+++ b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModuleNone.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * 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"
+#if PLUGIN_ARCHITECTURE(UNSUPPORTED)
+
+#include "NetscapePluginModule.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+bool NetscapePluginModule::getPluginInfo(const String&, PluginInfoStore::Plugin&)
+{
+ return false;
+}
+
+void NetscapePluginModule::determineQuirks()
+{
+}
+
+} // namespace WebKit
+
+#endif
diff --git a/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
index d290f5b..6a867a0 100644
--- a/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
+++ b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
@@ -273,22 +273,19 @@ static bool getPluginInfoFromCarbonResources(CFBundleRef bundle, PluginInfo& plu
if (mimeTypesAndExtensions.size() % 2)
return false;
- size_t numMimeTypes = mimeTypesAndExtensions.size() / 2;
-
// Now get the MIME type descriptions string list. This string list needs to be the same length as the number of MIME types.
Vector<String> mimeTypeDescriptions;
if (!getStringListResource(MIMEDescriptionStringNumber, mimeTypeDescriptions))
return false;
- if (mimeTypeDescriptions.size() != numMimeTypes)
- return false;
-
// Add all MIME types.
for (size_t i = 0; i < mimeTypesAndExtensions.size() / 2; ++i) {
MimeClassInfo mimeClassInfo;
const String& mimeType = mimeTypesAndExtensions[i * 2];
- const String& description = mimeTypeDescriptions[i];
+ String description;
+ if (i < mimeTypeDescriptions.size())
+ description = mimeTypeDescriptions[i];
mimeClassInfo.type = mimeType.lower();
mimeClassInfo.desc = description;
diff --git a/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp b/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp
index 76ecda7..2c9b465 100644
--- a/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp
+++ b/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp
@@ -24,6 +24,8 @@
*/
#include "config.h"
+#if PLUGIN_ARCHITECTURE(X11)
+
#include "NetscapePluginModule.h"
#include "PluginDatabase.h"
@@ -98,3 +100,5 @@ void NetscapePluginModule::determineQuirks()
}
} // namespace WebKit
+
+#endif // PLUGIN_ARCHITECTURE(X11)
diff --git a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp
index 06014a9..c6c87a6 100644
--- a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp
+++ b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp
@@ -46,7 +46,7 @@ void PluginProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder)
#endif
}
-bool PluginProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, PluginProcessCreationParameters::PluginProcessCreationParameters& result)
+bool PluginProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, PluginProcessCreationParameters& result)
{
if (!decoder->decode(result.pluginPath))
return false;
diff --git a/Source/WebKit2/Shared/Plugins/PluginQuirks.h b/Source/WebKit2/Shared/Plugins/PluginQuirks.h
index ea4643b..1ea38cd 100644
--- a/Source/WebKit2/Shared/Plugins/PluginQuirks.h
+++ b/Source/WebKit2/Shared/Plugins/PluginQuirks.h
@@ -49,7 +49,7 @@ public:
MakeTransparentIfBackgroundAttributeExists,
#ifndef NP_NO_QUICKDRAW
- // Allow the plug-in to use the QuickDraw drawing model, since wek now that the plug-in
+ // Allow the plug-in to use the QuickDraw drawing model, since we know that the plug-in
// will never paint or receive events. Used by the AppleConnect plug-in.
AllowHalfBakedQuickDrawSupport,
#endif
diff --git a/Source/WebKit2/Shared/ShareableBitmap.h b/Source/WebKit2/Shared/ShareableBitmap.h
index fe7fa0a..d647a12 100644
--- a/Source/WebKit2/Shared/ShareableBitmap.h
+++ b/Source/WebKit2/Shared/ShareableBitmap.h
@@ -33,7 +33,7 @@
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
-#if PLATFORM(CG)
+#if USE(CG)
#include <wtf/RetainPtr.h>
#endif
@@ -98,7 +98,7 @@ public:
bool isBackedBySharedMemory() const { return m_sharedMemory; }
-#if PLATFORM(CG)
+#if USE(CG)
// This creates a copied CGImageRef (most likely a copy-on-write) of the shareable bitmap.
RetainPtr<CGImageRef> makeCGImageCopy();
@@ -113,7 +113,7 @@ private:
static size_t numBytesForSize(const WebCore::IntSize& size) { return size.width() * size.height() * 4; }
-#if PLATFORM(CG)
+#if USE(CG)
static void releaseBitmapContextData(void* typelessBitmap, void* typelessData);
static void releaseDataProviderData(void* typelessBitmap, const void* typelessData, size_t);
#endif
diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
index 99b3c00..e015d64 100644
--- a/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
+++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
@@ -33,7 +33,7 @@ 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)
+#if USE(CG)
void encodeImage(ArgumentEncoder* encoder, Image* image)
{
diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.h b/Source/WebKit2/Shared/WebCoreArgumentCoders.h
index e12b9be..1b9b4f5 100644
--- a/Source/WebKit2/Shared/WebCoreArgumentCoders.h
+++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.h
@@ -194,7 +194,7 @@ template<> struct ArgumentCoder<WebCore::Cursor> {
static void encode(ArgumentEncoder* encoder, const WebCore::Cursor& cursor)
{
WebCore::Cursor::Type type = cursor.type();
-#if !PLATFORM(CG)
+#if !USE(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.
@@ -202,7 +202,7 @@ template<> struct ArgumentCoder<WebCore::Cursor> {
type = WebCore::Cursor::Pointer;
#endif
encoder->encode(static_cast<uint32_t>(type));
-#if PLATFORM(CG)
+#if USE(CG)
if (type != WebCore::Cursor::Custom)
return;
@@ -225,7 +225,7 @@ template<> struct ArgumentCoder<WebCore::Cursor> {
return true;
}
-#if !PLATFORM(CG)
+#if !USE(CG)
return false;
#else
RefPtr<WebCore::Image> image;
@@ -401,7 +401,7 @@ template<> struct ArgumentCoder<WebCore::KeypressCommand> {
template<> struct ArgumentCoder<WebCore::CompositionUnderline> {
static void encode(ArgumentEncoder* encoder, const WebCore::CompositionUnderline& underline)
{
- encoder->encode(CoreIPC::In(underline.startOffset, underline.endOffset, underline.thick, underline.color.rgb()));
+ encoder->encode(CoreIPC::In(underline.startOffset, underline.endOffset, underline.thick, underline.color));
}
static bool decode(ArgumentDecoder* decoder, WebCore::CompositionUnderline& underline)
diff --git a/Source/WebKit2/Shared/WebEvent.cpp b/Source/WebKit2/Shared/WebEvent.cpp
index f6738fa..8edc3fd 100644
--- a/Source/WebKit2/Shared/WebEvent.cpp
+++ b/Source/WebKit2/Shared/WebEvent.cpp
@@ -32,6 +32,13 @@
namespace WebKit {
+WebEvent::WebEvent()
+ : m_type(static_cast<uint32_t>(NoType))
+ , m_modifiers(0)
+ , m_timestamp(0)
+{
+}
+
WebEvent::WebEvent(Type type, Modifiers modifiers, double timestamp)
: m_type(type)
, m_modifiers(modifiers)
diff --git a/Source/WebKit2/Shared/WebEvent.h b/Source/WebKit2/Shared/WebEvent.h
index 6d2e60b..169c1a9 100644
--- a/Source/WebKit2/Shared/WebEvent.h
+++ b/Source/WebKit2/Shared/WebEvent.h
@@ -43,6 +43,8 @@ namespace WebKit {
class WebEvent {
public:
enum Type {
+ NoType = -1,
+
// WebMouseEvent
MouseDown,
MouseUp,
@@ -77,6 +79,7 @@ public:
ControlKey = 1 << 1,
AltKey = 1 << 2,
MetaKey = 1 << 3,
+ CapsLockKey = 1 << 4,
};
Type type() const { return static_cast<Type>(m_type); }
@@ -85,13 +88,14 @@ public:
bool controlKey() const { return m_modifiers & ControlKey; }
bool altKey() const { return m_modifiers & AltKey; }
bool metaKey() const { return m_modifiers & MetaKey; }
+ bool capsLockKey() const { return m_modifiers & CapsLockKey; }
Modifiers modifiers() const { return static_cast<Modifiers>(m_modifiers); }
double timestamp() const { return m_timestamp; }
protected:
- WebEvent() { }
+ WebEvent();
WebEvent(Type, Modifiers, double timestamp);
@@ -114,7 +118,7 @@ public:
RightButton
};
- WebMouseEvent() { }
+ WebMouseEvent();
WebMouseEvent(Type, Button, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, double timestamp);
#if PLATFORM(WIN)
diff --git a/Source/WebKit2/Shared/WebGraphicsContext.cpp b/Source/WebKit2/Shared/WebGraphicsContext.cpp
index 3d319e4..72220b3 100644
--- a/Source/WebKit2/Shared/WebGraphicsContext.cpp
+++ b/Source/WebKit2/Shared/WebGraphicsContext.cpp
@@ -26,15 +26,19 @@
#include "config.h"
#include "WebGraphicsContext.h"
+#if PLATFORM(GTK)
+#include <WebCore/PlatformContextCairo.h>
+#endif
+
using namespace WebCore;
namespace WebKit {
WebGraphicsContext::WebGraphicsContext(GraphicsContext* graphicsContext)
-#if PLATFORM(CG)
+#if USE(CG)
: m_platformContext(graphicsContext->platformContext())
#elif PLATFORM(GTK)
- : m_platformContext(graphicsContext->platformContext())
+ : m_platformContext(graphicsContext->platformContext()->cr())
#endif
{
}
diff --git a/Source/WebKit2/Shared/WebGraphicsContext.h b/Source/WebKit2/Shared/WebGraphicsContext.h
index ddb2e34..5f72aae 100644
--- a/Source/WebKit2/Shared/WebGraphicsContext.h
+++ b/Source/WebKit2/Shared/WebGraphicsContext.h
@@ -30,7 +30,7 @@
#include <WebCore/GraphicsContext.h>
#include <wtf/PassRefPtr.h>
-#if PLATFORM(CG)
+#if USE(CG)
#include <wtf/RetainPtr.h>
#elif PLATFORM(GTK)
#include "RefPtrCairo.h"
@@ -47,7 +47,7 @@ public:
return adoptRef(new WebGraphicsContext(graphicsContext));
}
-#if PLATFORM(CG)
+#if USE(CG)
CGContextRef platformContext() { return m_platformContext.get(); }
#elif PLATFORM(GTK)
cairo_t* platformContext() { return m_platformContext.get(); }
@@ -59,7 +59,7 @@ private:
virtual Type type() const { return APIType; }
-#if PLATFORM(CG)
+#if USE(CG)
RetainPtr<CGContextRef> m_platformContext;
#elif PLATFORM(GTK)
RefPtr<cairo_t> m_platformContext;
diff --git a/Source/WebKit2/Shared/WebMouseEvent.cpp b/Source/WebKit2/Shared/WebMouseEvent.cpp
index 16e5057..7aa7dff 100644
--- a/Source/WebKit2/Shared/WebMouseEvent.cpp
+++ b/Source/WebKit2/Shared/WebMouseEvent.cpp
@@ -33,6 +33,19 @@ using namespace WebCore;
namespace WebKit {
+WebMouseEvent::WebMouseEvent()
+ : WebEvent()
+ , m_button(static_cast<uint32_t>(NoButton))
+ , m_deltaX(0)
+ , m_deltaY(0)
+ , m_deltaZ(0)
+ , m_clickCount(0)
+#if PLATFORM(WIN)
+ , m_didActivateWebView(false)
+#endif
+{
+}
+
WebMouseEvent::WebMouseEvent(Type type, Button button, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, double timestamp)
: WebEvent(type, modifiers, timestamp)
, m_button(button)
diff --git a/Source/WebKit2/Shared/WebPageGroupData.cpp b/Source/WebKit2/Shared/WebPageGroupData.cpp
index e8df62f..107df1d 100644
--- a/Source/WebKit2/Shared/WebPageGroupData.cpp
+++ b/Source/WebKit2/Shared/WebPageGroupData.cpp
@@ -33,12 +33,12 @@ namespace WebKit {
void WebPageGroupData::encode(CoreIPC::ArgumentEncoder* encoder) const
{
- return encoder->encode(CoreIPC::In(identifer, pageGroupID, visibleToInjectedBundle));
+ return encoder->encode(CoreIPC::In(identifer, pageGroupID, visibleToInjectedBundle, visibleToHistoryClient));
}
bool WebPageGroupData::decode(CoreIPC::ArgumentDecoder* decoder, WebPageGroupData& data)
{
- return decoder->decode(CoreIPC::Out(data.identifer, data.pageGroupID, data.visibleToInjectedBundle));
+ return decoder->decode(CoreIPC::Out(data.identifer, data.pageGroupID, data.visibleToInjectedBundle, data.visibleToHistoryClient));
}
} // namespace WebKit
diff --git a/Source/WebKit2/Shared/WebPageGroupData.h b/Source/WebKit2/Shared/WebPageGroupData.h
index fedb5de..36f6fe1 100644
--- a/Source/WebKit2/Shared/WebPageGroupData.h
+++ b/Source/WebKit2/Shared/WebPageGroupData.h
@@ -42,6 +42,7 @@ struct WebPageGroupData {
String identifer;
uint64_t pageGroupID;
bool visibleToInjectedBundle;
+ bool visibleToHistoryClient;
};
} // namespace WebKit
diff --git a/Source/WebKit2/Shared/WebPopupItem.h b/Source/WebKit2/Shared/WebPopupItem.h
index 85495a3..3dc61d7 100644
--- a/Source/WebKit2/Shared/WebPopupItem.h
+++ b/Source/WebKit2/Shared/WebPopupItem.h
@@ -38,13 +38,13 @@ namespace WebKit {
struct WebPopupItem {
enum Type {
- Seperator,
+ Separator,
Item
};
WebPopupItem();
WebPopupItem(Type);
- WebPopupItem(Type, const String& text, WebCore::TextDirection, bool hasTextDirectionOverride, const String& toolTip, const String& accessibilityText, bool isEnabled, bool m_isLabel);
+ WebPopupItem(Type, const String& text, WebCore::TextDirection, bool hasTextDirectionOverride, const String& toolTip, const String& accessibilityText, bool isEnabled, bool isLabel);
void encode(CoreIPC::ArgumentEncoder*) const;
static bool decode(CoreIPC::ArgumentDecoder*, WebPopupItem&);
diff --git a/Source/WebKit2/Shared/WebPreferencesStore.cpp b/Source/WebKit2/Shared/WebPreferencesStore.cpp
index c072740..e0bbd4e 100644
--- a/Source/WebKit2/Shared/WebPreferencesStore.cpp
+++ b/Source/WebKit2/Shared/WebPreferencesStore.cpp
@@ -28,6 +28,7 @@
#include "FontSmoothingLevel.h"
#include "WebCoreArgumentCoders.h"
+#include <WebCore/Settings.h>
namespace WebKit {
@@ -51,6 +52,8 @@ static bool hasXSSAuditorEnabledTestRunnerOverride;
static bool xssAuditorEnabledTestRunnerOverride;
static bool hasAllowUniversalAccessFromFileURLsTestRunnerOverride;
static bool allowUniversalAccessFromFileURLsTestRunnerOverride;
+static bool hasAllowFileAccessFromFileURLsTestRunnerOverride;
+static bool allowFileAccessFromFileURLsTestRunnerOverride;
WebPreferencesStore::WebPreferencesStore()
{
@@ -72,6 +75,9 @@ bool WebPreferencesStore::decode(CoreIPC::ArgumentDecoder* decoder, WebPreferenc
if (hasAllowUniversalAccessFromFileURLsTestRunnerOverride)
s.m_boolValues.set(WebPreferencesKey::allowUniversalAccessFromFileURLsKey(), allowUniversalAccessFromFileURLsTestRunnerOverride);
+ if (hasAllowFileAccessFromFileURLsTestRunnerOverride)
+ s.m_boolValues.set(WebPreferencesKey::allowFileAccessFromFileURLsKey(), allowFileAccessFromFileURLsTestRunnerOverride);
+
return true;
}
@@ -87,6 +93,12 @@ void WebPreferencesStore::overrideAllowUniversalAccessFromFileURLsForTestRunner(
allowUniversalAccessFromFileURLsTestRunnerOverride = enabled;
}
+void WebPreferencesStore::overrideAllowFileAccessFromFileURLsForTestRunner(bool enabled)
+{
+ hasAllowFileAccessFromFileURLsTestRunnerOverride = true;
+ allowFileAccessFromFileURLsTestRunnerOverride = enabled;
+}
+
void WebPreferencesStore::removeTestRunnerOverrides()
{
hasXSSAuditorEnabledTestRunnerOverride = false;
diff --git a/Source/WebKit2/Shared/WebPreferencesStore.h b/Source/WebKit2/Shared/WebPreferencesStore.h
index 43ef487..8bef2b4 100644
--- a/Source/WebKit2/Shared/WebPreferencesStore.h
+++ b/Source/WebKit2/Shared/WebPreferencesStore.h
@@ -39,6 +39,7 @@ namespace WebKit {
#define FOR_EACH_WEBKIT_BOOL_PREFERENCE(macro) \
macro(JavaScriptEnabled, javaScriptEnabled, Bool, bool, true) \
macro(LoadsImagesAutomatically, loadsImagesAutomatically, Bool, bool, true) \
+ macro(LoadsSiteIconsIgnoringImageLoadingPreference, loadsSiteIconsIgnoringImageLoadingPreference, Bool, bool, false) \
macro(PluginsEnabled, pluginsEnabled, Bool, bool, true) \
macro(JavaEnabled, javaEnabled, Bool, bool, true) \
macro(OfflineWebApplicationCacheEnabled, offlineWebApplicationCacheEnabled, Bool, bool, false) \
@@ -86,6 +87,7 @@ namespace WebKit {
macro(DefaultFontSize, defaultFontSize, UInt32, uint32_t, 16) \
macro(DefaultFixedFontSize, defaultFixedFontSize, UInt32, uint32_t, 13) \
macro(PDFDisplayMode, pdfDisplayMode, UInt32, uint32_t, 1) \
+ macro(EditableLinkBehavior, editableLinkBehavior, UInt32, uint32_t, WebCore::EditableLinkNeverLive) \
\
#if PLATFORM(WIN)
@@ -169,6 +171,7 @@ struct WebPreferencesStore {
static void overrideXSSAuditorEnabledForTestRunner(bool);
static void overrideAllowUniversalAccessFromFileURLsForTestRunner(bool);
+ static void overrideAllowFileAccessFromFileURLsForTestRunner(bool);
static void removeTestRunnerOverrides();
HashMap<String, String> m_stringValues;
diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp
index db3cd4c..651aaf1 100644
--- a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp
+++ b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp
@@ -32,8 +32,6 @@ namespace WebKit {
WebProcessCreationParameters::WebProcessCreationParameters()
: shouldTrackVisitedLinks(false)
- , clearResourceCaches(false)
- , clearApplicationCache(false)
, shouldAlwaysUseComplexTextCodePath(false)
, defaultRequestTimeoutInterval(INT_MAX)
#if PLATFORM(MAC)
@@ -58,8 +56,6 @@ 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(iconDatabaseEnabled);
encoder->encode(languageCode);
@@ -109,10 +105,6 @@ 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.iconDatabaseEnabled))
diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.h b/Source/WebKit2/Shared/WebProcessCreationParameters.h
index 112d6eb..faac556 100644
--- a/Source/WebKit2/Shared/WebProcessCreationParameters.h
+++ b/Source/WebKit2/Shared/WebProcessCreationParameters.h
@@ -64,9 +64,6 @@ struct WebProcessCreationParameters {
CacheModel cacheModel;
bool shouldTrackVisitedLinks;
-
- bool clearResourceCaches;
- bool clearApplicationCache;
bool shouldAlwaysUseComplexTextCodePath;
@@ -88,13 +85,14 @@ struct WebProcessCreationParameters {
pid_t presenterApplicationPid;
// FIXME: These should be merged with CFURLCache counterparts below.
- CString nsURLCachePath;
+ String nsURLCachePath;
uint64_t nsURLCacheMemoryCapacity;
uint64_t nsURLCacheDiskCapacity;
CoreIPC::MachPort acceleratedCompositingPort;
- CString uiProcessBundleResourcePath;
+ String uiProcessBundleResourcePath;
+
#elif PLATFORM(WIN)
String cfURLCachePath;
uint64_t cfURLCacheDiskCapacity;
diff --git a/Source/WebKit2/Shared/WebString.h b/Source/WebKit2/Shared/WebString.h
index 6827276..5935b4a 100644
--- a/Source/WebKit2/Shared/WebString.h
+++ b/Source/WebKit2/Shared/WebString.h
@@ -57,6 +57,16 @@ public:
bool isNull() const { return m_string.isNull(); }
bool isEmpty() const { return m_string.isEmpty(); }
+
+ size_t length() const { return m_string.length(); }
+ size_t getCharacters(UChar* buffer, size_t bufferLength) const
+ {
+ if (!bufferLength)
+ return 0;
+ bufferLength = std::min(bufferLength, static_cast<size_t>(m_string.length()));
+ memcpy(buffer, m_string.characters(), bufferLength * sizeof(UChar));
+ return bufferLength;
+ }
size_t maximumUTF8CStringSize() const { return m_string.length() * 3 + 1; }
size_t getUTF8CString(char* buffer, size_t bufferSize)
diff --git a/Source/WebKit2/Shared/gtk/NativeWebMouseEventGtk.cpp b/Source/WebKit2/Shared/gtk/NativeWebMouseEventGtk.cpp
new file mode 100644
index 0000000..c0bbbd6
--- /dev/null
+++ b/Source/WebKit2/Shared/gtk/NativeWebMouseEventGtk.cpp
@@ -0,0 +1,39 @@
+/*
+ * 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 "NativeWebMouseEvent.h"
+
+#include "WebEventFactory.h"
+
+namespace WebKit {
+
+NativeWebMouseEvent::NativeWebMouseEvent(GdkEvent* event, int eventClickCount)
+ : WebMouseEvent(WebEventFactory::createWebMouseEvent(event, eventClickCount))
+ , m_nativeEvent(event)
+{
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/mac/ArgumentCodersMac.h b/Source/WebKit2/Shared/mac/ArgumentCodersMac.h
new file mode 100644
index 0000000..e83a50f
--- /dev/null
+++ b/Source/WebKit2/Shared/mac/ArgumentCodersMac.h
@@ -0,0 +1,62 @@
+/*
+ * 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 ArgumentCodersMac_h
+#define ArgumentCodersMac_h
+
+#include <wtf/RetainPtr.h>
+
+namespace CoreIPC {
+
+class ArgumentEncoder;
+class ArgumentDecoder;
+
+// NSAttributedString
+void encode(ArgumentEncoder*, NSAttributedString *);
+bool decode(ArgumentDecoder*, RetainPtr<NSAttributedString>&);
+
+// NSColor
+void encode(ArgumentEncoder*, NSColor *);
+bool decode(ArgumentDecoder*, RetainPtr<NSColor>&);
+
+// NSDictionary
+void encode(ArgumentEncoder*, NSDictionary *);
+bool decode(ArgumentDecoder*, RetainPtr<NSDictionary>&);
+
+// NSFont
+void encode(ArgumentEncoder*, NSFont *);
+bool decode(ArgumentDecoder*, RetainPtr<NSFont>&);
+
+// NSNumber
+void encode(ArgumentEncoder*, NSNumber *);
+bool decode(ArgumentDecoder*, RetainPtr<NSNumber>&);
+
+// NSString
+void encode(ArgumentEncoder*, NSString *);
+bool decode(ArgumentDecoder*, RetainPtr<NSString>&);
+
+}
+
+#endif // ArgumentCodersMac_h
diff --git a/Source/WebKit2/Shared/mac/ArgumentCodersMac.mm b/Source/WebKit2/Shared/mac/ArgumentCodersMac.mm
new file mode 100644
index 0000000..394f56c
--- /dev/null
+++ b/Source/WebKit2/Shared/mac/ArgumentCodersMac.mm
@@ -0,0 +1,343 @@
+/*
+ * 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 "ArgumentCodersMac.h"
+
+#import "ArgumentCodersCF.h"
+#import "ArgumentDecoder.h"
+#import "ArgumentEncoder.h"
+#import "WebCoreArgumentCoders.h"
+#import <WebCore/ColorMac.h>
+
+using namespace WebCore;
+using namespace std;
+
+namespace CoreIPC {
+
+enum NSType {
+ NSAttributedStringType,
+ NSColorType,
+ NSDictionaryType,
+ NSFontType,
+ NSNumberType,
+ NSStringType,
+ Unknown,
+};
+
+static NSType typeFromObject(id object)
+{
+ ASSERT(object);
+
+ if ([object isKindOfClass:[NSAttributedString class]])
+ return NSAttributedStringType;
+ if ([object isKindOfClass:[NSColor class]])
+ return NSColorType;
+ if ([object isKindOfClass:[NSDictionary class]])
+ return NSDictionaryType;
+ if ([object isKindOfClass:[NSFont class]])
+ return NSFontType;
+ if ([object isKindOfClass:[NSNumber class]])
+ return NSNumberType;
+ if ([object isKindOfClass:[NSString class]])
+ return NSStringType;
+
+ ASSERT_NOT_REACHED();
+ return Unknown;
+}
+
+static void encode(ArgumentEncoder* encoder, id object)
+{
+ NSType type = typeFromObject(object);
+ encoder->encodeEnum(type);
+
+ switch (type) {
+ case NSAttributedStringType:
+ encode(encoder, static_cast<NSAttributedString *>(object));
+ return;
+ case NSColorType:
+ encode(encoder, static_cast<NSColor *>(object));
+ return;
+ case NSDictionaryType:
+ encode(encoder, static_cast<NSDictionary *>(object));
+ return;
+ case NSFontType:
+ encode(encoder, static_cast<NSFont *>(object));
+ return;
+ case NSNumberType:
+ encode(encoder, static_cast<NSNumber *>(object));
+ return;
+ case NSStringType:
+ encode(encoder, static_cast<NSString *>(object));
+ return;
+ case Unknown:
+ break;
+ }
+
+ ASSERT_NOT_REACHED();
+}
+
+static bool decode(ArgumentDecoder* decoder, RetainPtr<id>& result)
+{
+ NSType type;
+ if (!decoder->decodeEnum(type))
+ return false;
+
+ switch (type) {
+ case NSAttributedStringType: {
+ RetainPtr<NSAttributedString> string;
+ if (!decode(decoder, string))
+ return false;
+ result = string;
+ return true;
+ }
+ case NSColorType: {
+ RetainPtr<NSColor> color;
+ if (!decode(decoder, color))
+ return false;
+ result = color;
+ return true;
+ }
+ case NSDictionaryType: {
+ RetainPtr<NSDictionary> dictionary;
+ if (!decode(decoder, dictionary))
+ return false;
+ result = dictionary;
+ return true;
+ }
+ case NSFontType: {
+ RetainPtr<NSFont> font;
+ if (!decode(decoder, font))
+ return false;
+ result = font;
+ return true;
+ }
+ case NSNumberType: {
+ RetainPtr<NSNumber> number;
+ if (!decode(decoder, number))
+ return false;
+ result = number;
+ return true;
+ }
+ case NSStringType: {
+ RetainPtr<NSString> string;
+ if (!decode(decoder, string))
+ return false;
+ result = string;
+ return true;
+ }
+ case Unknown:
+ ASSERT_NOT_REACHED();
+ return false;
+ }
+
+ return false;
+}
+
+void encode(ArgumentEncoder* encoder, NSAttributedString *string)
+{
+ // Even though NSAttributedString is toll free bridged with CFAttributedStringRef, attributes' values may be not, so we should stay within this file's code.
+
+ NSString *plainString = [string string];
+ NSUInteger length = [plainString length];
+ CoreIPC::encode(encoder, plainString);
+
+ Vector<pair<NSRange, RetainPtr<NSDictionary> > > ranges;
+
+ NSUInteger position = 0;
+ while (position < length) {
+ // Collect ranges in a vector, becasue the total count should be encoded first.
+ NSRange effectiveRange;
+ RetainPtr<NSDictionary> attributesAtIndex = [string attributesAtIndex:position effectiveRange:&effectiveRange];
+ ASSERT(effectiveRange.location == position);
+ ASSERT(effectiveRange.length);
+ ASSERT(NSMaxRange(effectiveRange) <= length);
+
+ ranges.append(make_pair(effectiveRange, attributesAtIndex));
+
+ position = NSMaxRange(effectiveRange);
+ }
+
+ encoder->encodeUInt64(ranges.size());
+
+ for (size_t i = 0; i < ranges.size(); ++i) {
+ encoder->encodeUInt64(ranges[i].first.location);
+ encoder->encodeUInt64(ranges[i].first.length);
+ CoreIPC::encode(encoder, ranges[i].second.get());
+ }
+}
+
+bool decode(ArgumentDecoder* decoder, RetainPtr<NSAttributedString>& result)
+{
+ RetainPtr<NSString> plainString;
+ if (!CoreIPC::decode(decoder, plainString))
+ return false;
+
+ NSUInteger stringLength = [plainString.get() length];
+
+ RetainPtr<NSMutableAttributedString> resultString(AdoptNS, [[NSMutableAttributedString alloc] initWithString:plainString.get()]);
+
+ uint64_t rangeCount;
+ if (!decoder->decode(rangeCount))
+ return false;
+
+ while (rangeCount--) {
+ uint64_t rangeLocation;
+ uint64_t rangeLength;
+ RetainPtr<NSDictionary> attributes;
+ if (!decoder->decode(rangeLocation))
+ return false;
+ if (!decoder->decode(rangeLength))
+ return false;
+
+ ASSERT(rangeLocation + rangeLength > rangeLocation);
+ ASSERT(rangeLocation + rangeLength <= stringLength);
+ if (rangeLocation + rangeLength <= rangeLocation || rangeLocation + rangeLength > stringLength)
+ return false;
+
+ if (!CoreIPC::decode(decoder, attributes))
+ return false;
+ [resultString.get() addAttributes:attributes.get() range:NSMakeRange(rangeLocation, rangeLength)];
+ }
+
+ result.adoptCF(resultString.leakRef());
+ return true;
+}
+
+void encode(ArgumentEncoder* encoder, NSColor *color)
+{
+ encoder->encode(colorFromNSColor(color));
+}
+
+bool decode(ArgumentDecoder* decoder, RetainPtr<NSColor>& result)
+{
+ Color color;
+ if (!decoder->decode(color))
+ return false;
+
+ result = nsColor(color);
+ return true;
+}
+
+void encode(ArgumentEncoder* encoder, NSDictionary *dictionary)
+{
+ // Even though NSDictionary is toll free bridged with CFDictionaryRef, values may be not, so we should stay within this file's code.
+
+ NSUInteger size = [dictionary count];
+ NSArray *keys = [dictionary allKeys];
+ NSArray *values = [dictionary allValues];
+
+ encoder->encodeUInt64(size);
+
+ for (NSUInteger i = 0; i < size; ++i) {
+ id key = [keys objectAtIndex:i];
+ id value = [values objectAtIndex:i];
+ ASSERT(key);
+ ASSERT([key isKindOfClass:[NSString class]]);
+ ASSERT(value);
+
+ // Ignore values we don't recognize.
+ if (typeFromObject(value) == Unknown)
+ continue;
+
+ encode(encoder, (NSString *)key);
+ encode(encoder, value);
+ }
+}
+
+bool decode(ArgumentDecoder* decoder, RetainPtr<NSDictionary>& result)
+{
+ uint64_t size;
+ if (!decoder->decodeUInt64(size))
+ return false;
+
+ RetainPtr<NSMutableDictionary> dictionary(AdoptNS, [[NSMutableDictionary alloc] initWithCapacity:size]);
+ for (uint64_t i = 0; i < size; ++i) {
+ // Try to decode the key name.
+ RetainPtr<NSString> key;
+ if (!decode(decoder, key))
+ return false;
+
+ RetainPtr<id> value;
+ if (!decode(decoder, value))
+ return false;
+
+ [dictionary.get() setObject:value.get() forKey:key.get()];
+ }
+
+ result.adoptCF(dictionary.leakRef());
+ return true;
+}
+
+
+void encode(ArgumentEncoder* encoder, NSFont *font)
+{
+ // NSFont could use CTFontRef code if we had it in ArgumentCodersCF.
+ encode(encoder, [[font fontDescriptor] fontAttributes]);
+}
+
+bool decode(ArgumentDecoder* decoder, RetainPtr<NSFont>& result)
+{
+ RetainPtr<NSDictionary> fontAttributes;
+ if (!decode(decoder, fontAttributes))
+ return false;
+
+ NSFontDescriptor *fontDescriptor = [NSFontDescriptor fontDescriptorWithFontAttributes:fontAttributes.get()];
+ result = [NSFont fontWithDescriptor:fontDescriptor size:0];
+
+ return true;
+}
+
+void encode(ArgumentEncoder* encoder, NSNumber *number)
+{
+ encode(encoder, (CFNumberRef)number);
+}
+
+bool decode(ArgumentDecoder* decoder, RetainPtr<NSNumber>& result)
+{
+ RetainPtr<CFNumberRef> number;
+ if (!decode(decoder, number))
+ return false;
+
+ result.adoptCF((NSNumber *)number.leakRef());
+ return true;
+}
+
+void encode(ArgumentEncoder* encoder, NSString *string)
+{
+ encode(encoder, (CFStringRef)string);
+}
+
+bool decode(ArgumentDecoder* decoder, RetainPtr<NSString>& result)
+{
+ RetainPtr<CFStringRef> string;
+ if (!decode(decoder, string))
+ return false;
+
+ result.adoptCF((NSString *)string.leakRef());
+ return true;
+}
+
+}
diff --git a/Source/WebKit2/Shared/mac/AttributedString.h b/Source/WebKit2/Shared/mac/AttributedString.h
new file mode 100644
index 0000000..6c8a8ae
--- /dev/null
+++ b/Source/WebKit2/Shared/mac/AttributedString.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 AttributedString_h
+#define AttributedString_h
+
+#include <wtf/RetainPtr.h>
+
+OBJC_CLASS NSAttributedString;
+
+namespace CoreIPC {
+ class ArgumentDecoder;
+ class ArgumentEncoder;
+}
+
+namespace WebKit {
+
+struct AttributedString {
+ void encode(CoreIPC::ArgumentEncoder*) const;
+ static bool decode(CoreIPC::ArgumentDecoder*, AttributedString&);
+
+ RetainPtr<NSAttributedString> string;
+};
+
+}
+
+#endif // AttributedString_h
diff --git a/Source/WebKit2/Shared/mac/AttributedString.mm b/Source/WebKit2/Shared/mac/AttributedString.mm
new file mode 100644
index 0000000..bc7cfd0
--- /dev/null
+++ b/Source/WebKit2/Shared/mac/AttributedString.mm
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "AttributedString.h"
+
+#import "ArgumentCodersMac.h"
+#import "ArgumentDecoder.h"
+#import "ArgumentEncoder.h"
+
+namespace WebKit {
+
+void AttributedString::encode(CoreIPC::ArgumentEncoder* encoder) const
+{
+ encoder->encode(!string);
+ if (!string)
+ return;
+ CoreIPC::encode(encoder, string.get());
+}
+
+bool AttributedString::decode(CoreIPC::ArgumentDecoder* decoder, AttributedString& attributedString)
+{
+ bool isNull;
+ if (!decoder->decode(isNull))
+ return false;
+ if (isNull)
+ return true;
+ return CoreIPC::decode(decoder, attributedString.string);
+}
+
+}
diff --git a/Source/WebKit2/Shared/mac/NativeWebMouseEventMac.mm b/Source/WebKit2/Shared/mac/NativeWebMouseEventMac.mm
new file mode 100644
index 0000000..b7064a3
--- /dev/null
+++ b/Source/WebKit2/Shared/mac/NativeWebMouseEventMac.mm
@@ -0,0 +1,39 @@
+/*
+ * 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 "NativeWebMouseEvent.h"
+
+#import "WebEventFactory.h"
+
+namespace WebKit {
+
+NativeWebMouseEvent::NativeWebMouseEvent(NSEvent* event, NSView* view)
+ : WebMouseEvent(WebEventFactory::createWebMouseEvent(event, view))
+ , m_nativeEvent(event)
+{
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm b/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm
index 54cf5d3..60626d1 100644
--- a/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm
+++ b/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm
@@ -33,6 +33,7 @@
#import "DataReference.h"
#import "WebKitSystemInterface.h"
#import <WebCore/FileSystem.h>
+#import <sys/stat.h>
#import <wtf/text/CString.h>
using namespace WebCore;
@@ -108,12 +109,55 @@ static WKSandboxExtensionType wkSandboxExtensionType(SandboxExtension::Type type
return WKSandboxExtensionTypeReadOnly;
}
+static CString resolveSymlinksInPath(const CString& path)
+{
+ struct stat statBuf;
+
+ // Check if this file exists.
+ if (!stat(path.data(), &statBuf)) {
+ char resolvedName[PATH_MAX];
+
+ return realpath(path.data(), resolvedName);
+ }
+
+ char* slashPtr = strrchr(path.data(), '/');
+ if (slashPtr == path.data())
+ return path;
+
+ size_t parentDirectoryLength = slashPtr - path.data();
+ if (parentDirectoryLength >= PATH_MAX)
+ return CString();
+
+ // Get the parent directory.
+ char parentDirectory[PATH_MAX];
+ memcpy(parentDirectory, path.data(), parentDirectoryLength);
+ parentDirectory[parentDirectoryLength] = '\0';
+
+ // Resolve it.
+ CString resolvedParentDirectory = resolveSymlinksInPath(CString(parentDirectory));
+ if (resolvedParentDirectory.isNull())
+ return CString();
+
+ size_t lastPathComponentLength = path.length() - parentDirectoryLength;
+ size_t resolvedPathLength = resolvedParentDirectory.length() + lastPathComponentLength;
+ if (resolvedPathLength >= PATH_MAX)
+ return CString();
+
+ // Combine the resolved parent directory with the last path component.
+ char* resolvedPathBuffer;
+ CString resolvedPath = CString::newUninitialized(resolvedPathLength, resolvedPathBuffer);
+ memcpy(resolvedPathBuffer, resolvedParentDirectory.data(), resolvedParentDirectory.length());
+ memcpy(resolvedPathBuffer + resolvedParentDirectory.length(), slashPtr, lastPathComponentLength);
+
+ return resolvedPath;
+}
+
void SandboxExtension::createHandle(const String& path, Type type, Handle& handle)
{
ASSERT(!handle.m_sandboxExtension);
- NSString *standardizedPath = [(NSString *)path stringByStandardizingPath];
- handle.m_sandboxExtension = WKSandboxExtensionCreate([standardizedPath fileSystemRepresentation], wkSandboxExtensionType(type));
+ CString standardizedPath = resolveSymlinksInPath([[(NSString *)path stringByStandardizingPath] fileSystemRepresentation]);
+ handle.m_sandboxExtension = WKSandboxExtensionCreate(standardizedPath.data(), wkSandboxExtensionType(type));
}
String SandboxExtension::createHandleForTemporaryFile(const String& prefix, Type type, Handle& handle)
diff --git a/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm b/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm
index 321cb40..174daf9 100644
--- a/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm
+++ b/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm
@@ -188,6 +188,7 @@ bool decodeResourceError(ArgumentDecoder* decoder, ResourceError& resourceError)
NSError *nsError = [[NSError alloc] initWithDomain:nsString(domain) code:code userInfo:userInfo];
resourceError = ResourceError(nsError);
+ [nsError release];
return true;
}
diff --git a/Source/WebKit2/Shared/mac/WebEventFactory.mm b/Source/WebKit2/Shared/mac/WebEventFactory.mm
index 67ab1ba..4622080 100644
--- a/Source/WebKit2/Shared/mac/WebEventFactory.mm
+++ b/Source/WebKit2/Shared/mac/WebEventFactory.mm
@@ -207,8 +207,9 @@ static WebWheelEvent::Phase phaseForEvent(NSEvent *event)
static WebWheelEvent::Phase momentumPhaseForEvent(NSEvent *event)
{
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
uint32_t phase = WebWheelEvent::PhaseNone;
+
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
if ([event momentumPhase] & NSEventPhaseBegan)
phase |= WebWheelEvent::PhaseBegan;
if ([event momentumPhase] & NSEventPhaseStationary)
@@ -219,10 +220,24 @@ static WebWheelEvent::Phase momentumPhaseForEvent(NSEvent *event)
phase |= WebWheelEvent::PhaseEnded;
if ([event momentumPhase] & NSEventPhaseCancelled)
phase |= WebWheelEvent::PhaseCancelled;
- return static_cast<WebWheelEvent::Phase>(phase);
#else
- return WebWheelEvent::PhaseNone;
+ switch (WKGetNSEventMomentumPhase(event)) {
+ case WKEventPhaseNone:
+ phase = WebWheelEvent::PhaseNone;
+ break;
+ case WKEventPhaseBegan:
+ phase = WebWheelEvent::PhaseBegan;
+ break;
+ case WKEventPhaseChanged:
+ phase = WebWheelEvent::PhaseChanged;
+ break;
+ case WKEventPhaseEnded:
+ phase = WebWheelEvent::PhaseEnded;
+ break;
+ }
#endif
+
+ return static_cast<WebWheelEvent::Phase>(phase);
}
#if ENABLE(GESTURE_EVENTS)
@@ -1015,6 +1030,8 @@ static inline bool isKeyUpEvent(NSEvent *event)
static inline WebEvent::Modifiers modifiersForEvent(NSEvent *event)
{
unsigned modifiers = 0;
+ if ([event modifierFlags] & NSAlphaShiftKeyMask)
+ modifiers |= WebEvent::CapsLockKey;
if ([event modifierFlags] & NSShiftKeyMask)
modifiers |= WebEvent::ShiftKey;
if ([event modifierFlags] & NSControlKeyMask)
diff --git a/Source/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h b/Source/WebKit2/Shared/qt/NativeWebMouseEventQt.cpp
index 1f5a6be..a6f6e34 100644
--- a/Source/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h
+++ b/Source/WebKit2/Shared/qt/NativeWebMouseEventQt.cpp
@@ -23,29 +23,17 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebProcessProxyMessageKinds_h
-#define WebProcessProxyMessageKinds_h
+#include "config.h"
+#include "NativeWebMouseEvent.h"
-// Messages sent from the web process to the WebProcessProxy.
+#include "WebEventFactoryQt.h"
-#include "MessageID.h"
-
-namespace WebProcessProxyLegacyMessage {
-
-enum Kind {
-#if ENABLE(PLUGIN_PROCESS)
- GetPluginProcessConnection,
-#endif
-};
-
-}
-
-namespace CoreIPC {
-
-template<> struct MessageKindTraits<WebProcessProxyLegacyMessage::Kind> {
- static const MessageClass messageClass = MessageClassWebProcessProxyLegacy;
-};
+namespace WebKit {
+NativeWebMouseEvent::NativeWebMouseEvent(QGraphicsSceneMouseEvent* event, int eventClickCount)
+ : WebMouseEvent(WebEventFactory::createWebMouseEvent(event, eventClickCount))
+ , m_nativeEvent(event)
+{
}
-#endif // WebProcessProxyMessageKinds_h
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/win/NativeWebMouseEventWin.cpp b/Source/WebKit2/Shared/win/NativeWebMouseEventWin.cpp
new file mode 100644
index 0000000..5b83dc6
--- /dev/null
+++ b/Source/WebKit2/Shared/win/NativeWebMouseEventWin.cpp
@@ -0,0 +1,43 @@
+/*
+ * 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 "NativeWebMouseEvent.h"
+
+#include "WebEventFactory.h"
+
+namespace WebKit {
+
+NativeWebMouseEvent::NativeWebMouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, bool didActivateWebView)
+ : WebMouseEvent(WebEventFactory::createWebMouseEvent(hwnd, message, wParam, lParam, didActivateWebView))
+ , m_nativeEvent()
+{
+ m_nativeEvent.hwnd = hwnd;
+ m_nativeEvent.message = message;
+ m_nativeEvent.wParam = wParam;
+ m_nativeEvent.lParam = lParam;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp b/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp
index 0d1ca36..6770f21 100644
--- a/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp
+++ b/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp
@@ -30,7 +30,7 @@
#include "ArgumentEncoder.h"
#include <WebCore/ResourceResponse.h>
-#if PLATFORM(CG)
+#if USE(CG)
#include <WebKitSystemInterface/WebKitSystemInterface.h>
#endif
@@ -48,7 +48,7 @@ PlatformCertificateInfo::PlatformCertificateInfo(const ResourceResponse& respons
if (!cfResponse)
return;
-#if PLATFORM(CG)
+#if USE(CG)
CFDictionaryRef certificateInfo = wkGetSSLCertificateInfo(cfResponse);
if (!certificateInfo)
return;