summaryrefslogtreecommitdiff
path: root/Source/WebKit2/Shared
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
commit2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (patch)
tree988e8c5b116dd0466244ae2fe5af8ee9be926d76 /Source/WebKit2/Shared
parentdd91e772430dc294e3bf478c119ef8d43c0a3358 (diff)
downloadqtwebkit-2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47.tar.gz
Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286)
Diffstat (limited to 'Source/WebKit2/Shared')
-rw-r--r--Source/WebKit2/Shared/API/c/WKBase.h5
-rw-r--r--Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp50
-rw-r--r--Source/WebKit2/Shared/API/c/soup/WKBaseSoup.h35
-rw-r--r--Source/WebKit2/Shared/APIClientTraits.cpp11
-rw-r--r--Source/WebKit2/Shared/APIClientTraits.h8
-rw-r--r--Source/WebKit2/Shared/APIObject.h6
-rw-r--r--Source/WebKit2/Shared/DrawingAreaInfo.h2
-rw-r--r--Source/WebKit2/Shared/MutableDictionary.cpp8
-rw-r--r--Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp19
-rw-r--r--Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp4
-rw-r--r--Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h10
-rw-r--r--Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm3
-rw-r--r--Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp142
-rw-r--r--Source/WebKit2/Shared/Plugins/PluginQuirks.h6
-rw-r--r--Source/WebKit2/Shared/ProcessExecutablePath.h38
-rw-r--r--Source/WebKit2/Shared/SandboxExtension.h31
-rw-r--r--Source/WebKit2/Shared/ShareableSurface.cpp207
-rw-r--r--Source/WebKit2/Shared/ShareableSurface.h121
-rw-r--r--Source/WebKit2/Shared/SurfaceUpdateInfo.cpp49
-rw-r--r--Source/WebKit2/Shared/SurfaceUpdateInfo.h58
-rw-r--r--Source/WebKit2/Shared/UpdateInfo.cpp3
-rw-r--r--Source/WebKit2/Shared/UpdateInfo.h3
-rw-r--r--Source/WebKit2/Shared/UserMessageCoders.h4
-rw-r--r--Source/WebKit2/Shared/WebContextMenuItem.cpp4
-rw-r--r--Source/WebKit2/Shared/WebContextMenuItem.h3
-rw-r--r--Source/WebKit2/Shared/WebContextMenuItemData.cpp4
-rw-r--r--Source/WebKit2/Shared/WebContextMenuItemData.h3
-rw-r--r--Source/WebKit2/Shared/WebCoreArgumentCoders.cpp121
-rw-r--r--Source/WebKit2/Shared/WebCoreArgumentCoders.h21
-rw-r--r--Source/WebKit2/Shared/WebLayerTreeInfo.cpp61
-rw-r--r--Source/WebKit2/Shared/WebLayerTreeInfo.h66
-rw-r--r--Source/WebKit2/Shared/WebPreferencesStore.h8
-rw-r--r--Source/WebKit2/Shared/WebProcessCreationParameters.cpp11
-rw-r--r--Source/WebKit2/Shared/WebProcessCreationParameters.h5
-rw-r--r--Source/WebKit2/Shared/WebRenderObject.cpp2
-rw-r--r--Source/WebKit2/Shared/efl/PlatformCertificateInfo.h51
-rw-r--r--Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp5
-rw-r--r--Source/WebKit2/Shared/gtk/ProcessExecutablePathGtk.cpp79
-rw-r--r--Source/WebKit2/Shared/mac/CommandLineMac.cpp2
-rw-r--r--Source/WebKit2/Shared/mac/PDFKitImports.h38
-rw-r--r--Source/WebKit2/Shared/mac/PDFKitImports.mm58
-rw-r--r--Source/WebKit2/Shared/mac/SandboxExtensionMac.mm60
-rw-r--r--Source/WebKit2/Shared/qt/ProcessExecutablePathQt.cpp54
-rw-r--r--Source/WebKit2/Shared/qt/QtNetworkReplyData.cpp2
-rw-r--r--Source/WebKit2/Shared/qt/QtNetworkReplyData.h4
-rw-r--r--Source/WebKit2/Shared/qt/QtNetworkRequestData.cpp2
-rw-r--r--Source/WebKit2/Shared/qt/QtNetworkRequestData.h2
-rw-r--r--Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp12
-rw-r--r--Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp10
-rw-r--r--Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp27
50 files changed, 1285 insertions, 253 deletions
diff --git a/Source/WebKit2/Shared/API/c/WKBase.h b/Source/WebKit2/Shared/API/c/WKBase.h
index c8656e4a3..28e7aed62 100644
--- a/Source/WebKit2/Shared/API/c/WKBase.h
+++ b/Source/WebKit2/Shared/API/c/WKBase.h
@@ -37,6 +37,10 @@
#include <WebKit2/WKBaseGtk.h>
#endif
+#if defined(BUILDING_SOUP__)
+#include <WebKit2/WKBaseSoup.h>
+#endif
+
/* WebKit2 shared types */
typedef uint32_t WKTypeID;
@@ -116,6 +120,7 @@ typedef const struct OpaqueWKBundle* WKBundleRef;
typedef const struct OpaqueWKBundleBackForwardList* WKBundleBackForwardListRef;
typedef const struct OpaqueWKBundleBackForwardListItem* WKBundleBackForwardListItemRef;
typedef const struct OpaqueWKBundleDOMCSSStyleDeclaration* WKBundleCSSStyleDeclarationRef;
+typedef const struct OpaqueWKBundleDOMWindowExtension* WKBundleDOMWindowExtensionRef;
typedef const struct OpaqueWKBundleFrame* WKBundleFrameRef;
typedef const struct OpaqueWKBundleHitTestResult* WKBundleHitTestResultRef;
typedef const struct OpaqueWKBundleInspector* WKBundleInspectorRef;
diff --git a/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp b/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp
index c04aab18f..f38368611 100644
--- a/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp
+++ b/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp
@@ -37,65 +37,115 @@ using namespace WebKit;
WKTypeID WKContextMenuItemGetTypeID()
{
+#if ENABLE(CONTEXT_MENUS)
return toAPI(WebContextMenuItem::APIType);
+#else
+ return toAPI(APIObject::TypeNull);
+#endif
}
WKContextMenuItemRef WKContextMenuItemCreateAsAction(WKContextMenuItemTag tag, WKStringRef title, bool enabled)
{
+#if ENABLE(CONTEXT_MENUS)
return toAPI(WebContextMenuItem::create(WebContextMenuItemData(ActionType, toImpl(tag), toImpl(title)->string(), enabled, false)).leakRef());
+#else
+ return 0;
+#endif
}
WKContextMenuItemRef WKContextMenuItemCreateAsCheckableAction(WKContextMenuItemTag tag, WKStringRef title, bool enabled, bool checked)
{
+#if ENABLE(CONTEXT_MENUS)
return toAPI(WebContextMenuItem::create(WebContextMenuItemData(CheckableActionType, toImpl(tag), toImpl(title)->string(), enabled, checked)).leakRef());
+#else
+ return 0;
+#endif
}
WKContextMenuItemRef WKContextMenuItemCreateAsSubmenu(WKStringRef title, bool enabled, WKArrayRef submenuItems)
{
+#if ENABLE(CONTEXT_MENUS)
return toAPI(WebContextMenuItem::create(toImpl(title)->string(), enabled, toImpl(submenuItems)).leakRef());
+#else
+ return 0;
+#endif
}
WKContextMenuItemRef WKContextMenuItemSeparatorItem()
{
+#if ENABLE(CONTEXT_MENUS)
return toAPI(WebContextMenuItem::separatorItem());
+#else
+ return 0;
+#endif
}
WKContextMenuItemTag WKContextMenuItemGetTag(WKContextMenuItemRef itemRef)
{
+#if ENABLE(CONTEXT_MENUS)
return toAPI(toImpl(itemRef)->data()->action());
+#else
+ return toAPI(ContextMenuItemTagNoAction);
+#endif
}
WKContextMenuItemType WKContextMenuItemGetType(WKContextMenuItemRef itemRef)
{
+#if ENABLE(CONTEXT_MENUS)
return toAPI(toImpl(itemRef)->data()->type());
+#else
+ return toAPI(ActionType);
+#endif
}
WKStringRef WKContextMenuItemCopyTitle(WKContextMenuItemRef itemRef)
{
+#if ENABLE(CONTEXT_MENUS)
return toCopiedAPI(toImpl(itemRef)->data()->title().impl());
+#else
+ return 0;
+#endif
}
bool WKContextMenuItemGetEnabled(WKContextMenuItemRef itemRef)
{
+#if ENABLE(CONTEXT_MENUS)
return toImpl(itemRef)->data()->enabled();
+#else
+ return false;
+#endif
}
bool WKContextMenuItemGetChecked(WKContextMenuItemRef itemRef)
{
+#if ENABLE(CONTEXT_MENUS)
return toImpl(itemRef)->data()->checked();
+#else
+ return false;
+#endif
}
WKArrayRef WKContextMenuCopySubmenuItems(WKContextMenuItemRef itemRef)
{
+#if ENABLE(CONTEXT_MENUS)
return toAPI(toImpl(itemRef)->submenuItemsAsImmutableArray().leakRef());
+#else
+ return 0;
+#endif
}
WKTypeRef WKContextMenuItemGetUserData(WKContextMenuItemRef itemRef)
{
+#if ENABLE(CONTEXT_MENUS)
return toAPI(toImpl(itemRef)->userData());
+#else
+ return 0;
+#endif
}
void WKContextMenuItemSetUserData(WKContextMenuItemRef itemRef, WKTypeRef userDataRef)
{
+#if ENABLE(CONTEXT_MENUS)
toImpl(itemRef)->setUserData(toImpl(userDataRef));
+#endif
}
diff --git a/Source/WebKit2/Shared/API/c/soup/WKBaseSoup.h b/Source/WebKit2/Shared/API/c/soup/WKBaseSoup.h
new file mode 100644
index 000000000..6189e4c97
--- /dev/null
+++ b/Source/WebKit2/Shared/API/c/soup/WKBaseSoup.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKBaseSoup_h
+#define WKBaseSoup_h
+
+#ifndef WKBase_h
+#error "Please #include \"WKBase.h\" instead of this file directly."
+#endif
+
+typedef const struct OpaqueWKSoupRequestManager* WKSoupRequestManagerRef;
+
+#endif /* WKBaseSoup_h */
diff --git a/Source/WebKit2/Shared/APIClientTraits.cpp b/Source/WebKit2/Shared/APIClientTraits.cpp
index 4c50bd273..f18d26358 100644
--- a/Source/WebKit2/Shared/APIClientTraits.cpp
+++ b/Source/WebKit2/Shared/APIClientTraits.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "APIClientTraits.h"
+#include "WKBundle.h"
#include "WKBundlePage.h"
namespace WebKit {
@@ -39,6 +40,11 @@ const size_t APIClientTraits<WKBundlePageResourceLoadClient>::interfaceSizesByVe
offsetof(WKBundlePageResourceLoadClient, shouldCacheResponse),
sizeof(WKBundlePageResourceLoadClient)
};
+
+const size_t APIClientTraits<WKBundlePageFullScreenClient>::interfaceSizesByVersion[] = {
+ offsetof(WKBundlePageFullScreenClient, beganEnterFullScreen),
+ sizeof(WKBundlePageFullScreenClient)
+};
const size_t APIClientTraits<WKPageContextMenuClient>::interfaceSizesByVersion[] = {
offsetof(WKPageContextMenuClient, contextMenuDismissed),
@@ -55,4 +61,9 @@ const size_t APIClientTraits<WKPageUIClient>::interfaceSizesByVersion[] = {
sizeof(WKPageUIClient)
};
+const size_t APIClientTraits<WKBundlePageFormClient>::interfaceSizesByVersion[] = {
+ offsetof(WKBundlePageFormClient, willSendSubmitEvent),
+ sizeof(WKBundlePageFormClient)
+};
+
} // namespace WebKit
diff --git a/Source/WebKit2/Shared/APIClientTraits.h b/Source/WebKit2/Shared/APIClientTraits.h
index 0f60fb1d5..c9f286d16 100644
--- a/Source/WebKit2/Shared/APIClientTraits.h
+++ b/Source/WebKit2/Shared/APIClientTraits.h
@@ -44,6 +44,10 @@ template<> struct APIClientTraits<WKBundlePageResourceLoadClient> {
static const size_t interfaceSizesByVersion[2];
};
+template<> struct APIClientTraits<WKBundlePageFullScreenClient> {
+ static const size_t interfaceSizesByVersion[2];
+};
+
template<> struct APIClientTraits<WKPageContextMenuClient> {
static const size_t interfaceSizesByVersion[3];
};
@@ -56,6 +60,10 @@ template<> struct APIClientTraits<WKPageUIClient> {
static const size_t interfaceSizesByVersion[2];
};
+template<> struct APIClientTraits<WKBundlePageFormClient> {
+ static const size_t interfaceSizesByVersion[2];
+};
+
} // namespace WebKit
#endif // APIClientTraits_h
diff --git a/Source/WebKit2/Shared/APIObject.h b/Source/WebKit2/Shared/APIObject.h
index d6cc03043..2ab33047c 100644
--- a/Source/WebKit2/Shared/APIObject.h
+++ b/Source/WebKit2/Shared/APIObject.h
@@ -106,6 +106,7 @@ public:
TypeBundle,
TypeBundleBackForwardList,
TypeBundleBackForwardListItem,
+ TypeBundleDOMWindowExtension,
TypeBundleFrame,
TypeBundleHitTestResult,
TypeBundleInspector,
@@ -119,7 +120,10 @@ public:
// Platform specific
TypeEditCommandProxy,
- TypeView
+ TypeView,
+#if USE(SOUP)
+ TypeSoupRequestManager,
+#endif
};
virtual ~APIObject()
diff --git a/Source/WebKit2/Shared/DrawingAreaInfo.h b/Source/WebKit2/Shared/DrawingAreaInfo.h
index 33c4993e6..c0e11658f 100644
--- a/Source/WebKit2/Shared/DrawingAreaInfo.h
+++ b/Source/WebKit2/Shared/DrawingAreaInfo.h
@@ -30,7 +30,7 @@ namespace WebKit {
enum DrawingAreaType {
DrawingAreaTypeImpl,
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) && ENABLE(THREADED_SCROLLING)
DrawingAreaTypeTiledCoreAnimation,
#endif
};
diff --git a/Source/WebKit2/Shared/MutableDictionary.cpp b/Source/WebKit2/Shared/MutableDictionary.cpp
index 2f905ec6a..ac69b76a3 100644
--- a/Source/WebKit2/Shared/MutableDictionary.cpp
+++ b/Source/WebKit2/Shared/MutableDictionary.cpp
@@ -38,14 +38,14 @@ MutableDictionary::~MutableDictionary()
bool MutableDictionary::add(const String& key, APIObject* item)
{
- std::pair<MapType::iterator, bool> result = m_map.add(key, item);
- return result.second;
+ MapType::AddResult result = m_map.add(key, item);
+ return result.isNewEntry;
}
bool MutableDictionary::set(const String& key, APIObject* item)
{
- std::pair<MapType::iterator, bool> result = m_map.set(key, item);
- return result.second;
+ MapType::AddResult result = m_map.set(key, item);
+ return result.isNewEntry;
}
void MutableDictionary::remove(const String& key)
diff --git a/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp b/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
index 3f584ae74..7641af5e8 100644
--- a/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
+++ b/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
@@ -88,6 +88,18 @@ void NPRemoteObjectMap::unregisterNPObject(uint64_t npObjectID)
m_registeredNPObjects.remove(npObjectID);
}
+static uint64_t remoteNPObjectID(Plugin* plugin, NPObject* npObject)
+{
+ if (!NPObjectProxy::isNPObjectProxy(npObject))
+ return 0;
+
+ NPObjectProxy* npObjectProxy = NPObjectProxy::toNPObjectProxy(npObject);
+ if (npObjectProxy->plugin() != plugin)
+ return 0;
+
+ return npObjectProxy->npObjectID();
+}
+
NPVariantData NPRemoteObjectMap::npVariantToNPVariantData(const NPVariant& variant, Plugin* plugin)
{
switch (variant.type) {
@@ -111,14 +123,11 @@ NPVariantData NPRemoteObjectMap::npVariantToNPVariantData(const NPVariant& varia
case NPVariantType_Object: {
NPObject* npObject = variant.value.objectValue;
- if (NPObjectProxy::isNPObjectProxy(npObject)) {
- NPObjectProxy* npObjectProxy = NPObjectProxy::toNPObjectProxy(npObject);
-
- uint64_t npObjectID = npObjectProxy->npObjectID();
+ if (uint64_t npObjectID = remoteNPObjectID(plugin, npObject)) {
// FIXME: Under some circumstances, this might leak the NPObjectProxy object.
// Figure out how to avoid that.
- retainNPObject(npObjectProxy);
+ retainNPObject(npObject);
return NPVariantData::makeRemoteNPObjectID(npObjectID);
}
diff --git a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp
index e5f8dc2a3..c1874d996 100644
--- a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp
+++ b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp
@@ -197,10 +197,6 @@ 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;
diff --git a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h
index f80a0a1a0..e96bd2d04 100644
--- a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h
+++ b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h
@@ -35,6 +35,8 @@
namespace WebKit {
+class RawPluginMetaData;
+
class NetscapePluginModule : public RefCounted<NetscapePluginModule> {
public:
static PassRefPtr<NetscapePluginModule> getOrCreate(const String& pluginPath);
@@ -61,15 +63,17 @@ public:
static bool createPluginMIMETypesPreferences(const String& pluginPath);
#endif
+#if PLUGIN_ARCHITECTURE(X11)
+ static bool scanPlugin(const String& pluginPath);
+#endif
+
private:
explicit NetscapePluginModule(const String& pluginPath);
void determineQuirks();
#if PLUGIN_ARCHITECTURE(X11)
- void applyX11QuirksBeforeLoad();
- static void setMIMEDescription(const String& mimeDescription, PluginModuleInfo&);
- bool getPluginInfoForLoadedPlugin(PluginModuleInfo&);
+ bool getPluginInfoForLoadedPlugin(RawPluginMetaData&);
#endif
bool tryGetSitesWithData(Vector<String>&);
diff --git a/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
index 980c98881..41d938979 100644
--- a/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
+++ b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
@@ -469,9 +469,6 @@ void NetscapePluginModule::determineQuirks()
// Flash supports snapshotting.
m_pluginQuirks.add(PluginQuirks::SupportsSnapshotting);
- // We can short circuit some NPRuntime calls during initialization.
- m_pluginQuirks.add(PluginQuirks::CanShortCircuitSomeNPRuntimeCallsDuringInitialization);
-
// Flash returns a retained Core Animation layer.
m_pluginQuirks.add(PluginQuirks::ReturnsRetainedCoreAnimationLayer);
}
diff --git a/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp b/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp
index 866833c64..ea59e3d5c 100644
--- a/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp
+++ b/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp
@@ -28,13 +28,10 @@
#include "NetscapePluginModule.h"
+#include "PluginProcessProxy.h"
#include "NetscapeBrowserFuncs.h"
#include <WebCore/FileSystem.h>
-
-#if PLATFORM(QT)
-#include <QLibrary>
-#endif
-
+#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -69,35 +66,14 @@ StdoutDevNullRedirector::~StdoutDevNullRedirector()
dup2(m_savedStdout, STDOUT_FILENO);
}
-#if PLATFORM(QT)
-static void initializeGTK()
-{
- QLibrary library(QLatin1String("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()
+static void parseMIMEDescription(const String& mimeDescription, Vector<MimeClassInfo>& result)
{
-#if PLATFORM(QT)
- if (m_pluginPath.contains("npwrapper") || m_pluginPath.contains("flashplayer")) {
- initializeGTK();
- m_pluginQuirks.add(PluginQuirks::RequiresGTKToolKit);
- }
-#endif
-}
+ ASSERT_ARG(result, result.isEmpty());
-void NetscapePluginModule::setMIMEDescription(const String& mimeDescription, PluginModuleInfo& plugin)
-{
Vector<String> types;
mimeDescription.lower().split(UChar(';'), false, types);
- plugin.info.mimes.reserveCapacity(types.size());
+ result.reserveInitialCapacity(types.size());
size_t mimeInfoCount = 0;
for (size_t i = 0; i < types.size(); ++i) {
@@ -106,8 +82,8 @@ void NetscapePluginModule::setMIMEDescription(const String& mimeDescription, Plu
if (mimeTypeParts.size() <= 0)
continue;
- plugin.info.mimes.uncheckedAppend(MimeClassInfo());
- MimeClassInfo& mimeInfo = plugin.info.mimes[mimeInfoCount++];
+ result.uncheckedAppend(MimeClassInfo());
+ MimeClassInfo& mimeInfo = result[mimeInfoCount++];
mimeInfo.type = mimeTypeParts[0];
if (mimeTypeParts.size() > 1)
@@ -118,13 +94,10 @@ void NetscapePluginModule::setMIMEDescription(const String& mimeDescription, Plu
}
}
-bool NetscapePluginModule::getPluginInfoForLoadedPlugin(PluginModuleInfo& plugin)
+bool NetscapePluginModule::getPluginInfoForLoadedPlugin(RawPluginMetaData& metaData)
{
ASSERT(m_isInitialized);
- plugin.path = m_pluginPath;
- plugin.info.file = pathGetFileName(m_pluginPath);
-
Module* module = m_module.get();
NPP_GetValueProcPtr NPP_GetValue = module->functionPointer<NPP_GetValueProcPtr>("NP_GetValue");
if (!NPP_GetValue)
@@ -137,47 +110,45 @@ bool NetscapePluginModule::getPluginInfoForLoadedPlugin(PluginModuleInfo& plugin
char* buffer;
NPError error = NPP_GetValue(0, NPPVpluginNameString, &buffer);
if (error == NPERR_NO_ERROR)
- plugin.info.name = String::fromUTF8(buffer);
+ metaData.name = String::fromUTF8(buffer);
error = NPP_GetValue(0, NPPVpluginDescriptionString, &buffer);
if (error == NPERR_NO_ERROR)
- plugin.info.desc = String::fromUTF8(buffer);
+ metaData.description = String::fromUTF8(buffer);
String mimeDescription = String::fromUTF8(NP_GetMIMEDescription());
if (mimeDescription.isNull())
return false;
- setMIMEDescription(mimeDescription, plugin);
+ metaData.mimeDescription = mimeDescription;
return true;
}
+
bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginModuleInfo& plugin)
{
- // Tempararily suppress stdout in this function as plugins will be loaded and shutdown and debug info
- // is leaked to layout test output.
- StdoutDevNullRedirector stdoutDevNullRedirector;
-
- // We are loading the plugin here since it does not seem to be a standardized way to
- // get the needed informations from a UNIX plugin without loading it.
- RefPtr<NetscapePluginModule> pluginModule = NetscapePluginModule::getOrCreate(pluginPath);
- if (!pluginModule)
+ RawPluginMetaData metaData;
+ if (!PluginProcessProxy::scanPlugin(pluginPath, metaData))
return false;
- pluginModule->incrementLoadCount();
- bool returnValue = pluginModule->getPluginInfoForLoadedPlugin(plugin);
- pluginModule->decrementLoadCount();
+ plugin.path = pluginPath;
+ plugin.info.file = pathGetFileName(pluginPath);
+ plugin.info.name = metaData.name;
+ plugin.info.desc = metaData.description;
+ parseMIMEDescription(metaData.mimeDescription, plugin.info.mimes);
- return returnValue;
+ return true;
}
void NetscapePluginModule::determineQuirks()
{
#if CPU(X86_64)
- PluginModuleInfo plugin;
- if (!getPluginInfoForLoadedPlugin(plugin))
+ RawPluginMetaData metaData;
+ if (!getPluginInfoForLoadedPlugin(metaData))
return;
- Vector<MimeClassInfo> mimeTypes = plugin.info.mimes;
+ Vector<MimeClassInfo> mimeTypes;
+ parseMIMEDescription(metaData.mimeDescription, mimeTypes);
for (size_t i = 0; i < mimeTypes.size(); ++i) {
if (mimeTypes[i].type == "application/x-shockwave-flash") {
m_pluginQuirks.add(PluginQuirks::IgnoreRightClickInWindowlessMode);
@@ -187,6 +158,71 @@ void NetscapePluginModule::determineQuirks()
#endif
}
+static String truncateToSingleLine(const String& string)
+{
+ ASSERT_ARG(string, !string.is8Bit());
+
+ unsigned oldLength = string.length();
+ UChar* buffer;
+ String stringBuffer(StringImpl::createUninitialized(oldLength + 1, buffer));
+
+ unsigned newLength = 0;
+ for (const UChar* c = string.characters16(); c < string.characters16() + oldLength; ++c) {
+ if (*c != UChar('\n'))
+ buffer[newLength++] = *c;
+ }
+ buffer[newLength++] = UChar('\n');
+
+ if (newLength == oldLength + 1)
+ return stringBuffer;
+ return String(stringBuffer.characters16(), newLength);
+}
+
+bool NetscapePluginModule::scanPlugin(const String& pluginPath)
+{
+ RawPluginMetaData metaData;
+
+ {
+ // Don't allow the plugin to pollute the standard output.
+ StdoutDevNullRedirector stdOutRedirector;
+
+ // We are loading the plugin here since it does not seem to be a standardized way to
+ // get the needed informations from a UNIX plugin without loading it.
+ RefPtr<NetscapePluginModule> pluginModule = NetscapePluginModule::getOrCreate(pluginPath);
+ if (!pluginModule)
+ return false;
+
+ pluginModule->incrementLoadCount();
+ bool success = pluginModule->getPluginInfoForLoadedPlugin(metaData);
+ pluginModule->decrementLoadCount();
+
+ if (!success)
+ return false;
+ }
+
+ // Write data to standard output for the UI process.
+ String output[3] = {
+ truncateToSingleLine(metaData.name),
+ truncateToSingleLine(metaData.description),
+ truncateToSingleLine(metaData.mimeDescription)
+ };
+ for (unsigned i = 0; i < 3; ++i) {
+ const String& line = output[i];
+ const char* current = reinterpret_cast<const char*>(line.characters16());
+ const char* end = reinterpret_cast<const char*>(line.characters16()) + (line.length() * sizeof(UChar));
+ while (current < end) {
+ int result;
+ while ((result = fputc(*current, stdout)) == EOF && errno == EINTR) { }
+ ASSERT(result != EOF);
+ ++current;
+ }
+ }
+
+ fflush(stdout);
+
+ return true;
+}
+
} // namespace WebKit
#endif // PLUGIN_ARCHITECTURE(X11)
diff --git a/Source/WebKit2/Shared/Plugins/PluginQuirks.h b/Source/WebKit2/Shared/Plugins/PluginQuirks.h
index 049664ae0..1d11e489b 100644
--- a/Source/WebKit2/Shared/Plugins/PluginQuirks.h
+++ b/Source/WebKit2/Shared/Plugins/PluginQuirks.h
@@ -48,12 +48,6 @@ public:
// transparent.
MakeTransparentIfBackgroundAttributeExists,
- // Whether we can short circuit some NPRuntime calls during plug-in initialization.
- // The Flash plug-in uses NPRuntime to figure out the URL of the frame it is in, as well
- // as the URL of the main frame. Since we know the exact NPRuntime calls the plug-in makes,
- // we can return the right values without having to do sync IPC back into the web process.
- CanShortCircuitSomeNPRuntimeCallsDuringInitialization,
-
// Whether calling NPP_GetValue with NPPVpluginCoreAnimationLayer returns a retained Core Animation
// layer or not. According to the NPAPI specifications, plug-in shouldn't return a retained layer but
// WebKit1 expects a retained plug-in layer. We use this for Flash to avoid leaking OpenGL layers.
diff --git a/Source/WebKit2/Shared/ProcessExecutablePath.h b/Source/WebKit2/Shared/ProcessExecutablePath.h
new file mode 100644
index 000000000..5fbf32018
--- /dev/null
+++ b/Source/WebKit2/Shared/ProcessExecutablePath.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2012 University of Szeged. 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 UNIVERSITY OF SZEGED ``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 UNIVERSITY OF SZEGED OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <wtf/text/WTFString.h>
+
+#ifndef ProcessExecutablePath_h
+#define ProcessExecutablePath_h
+
+namespace WebKit {
+
+String executablePathOfWebProcess();
+String executablePathOfPluginProcess();
+
+}
+
+#endif
diff --git a/Source/WebKit2/Shared/SandboxExtension.h b/Source/WebKit2/Shared/SandboxExtension.h
index 0dfcab087..6f8aa7877 100644
--- a/Source/WebKit2/Shared/SandboxExtension.h
+++ b/Source/WebKit2/Shared/SandboxExtension.h
@@ -68,6 +68,28 @@ public:
#endif
};
+ class HandleArray {
+ WTF_MAKE_NONCOPYABLE(HandleArray);
+
+ public:
+ HandleArray();
+ ~HandleArray();
+ void allocate(size_t);
+ Handle& operator[](size_t i);
+ const Handle& operator[](size_t i) const;
+ size_t size() const;
+ void encode(CoreIPC::ArgumentEncoder*) const;
+ static bool decode(CoreIPC::ArgumentDecoder*, HandleArray&);
+
+ private:
+#if ENABLE(WEB_PROCESS_SANDBOX)
+ Handle* m_data;
+#else
+ Handle m_emptyHandle;
+#endif
+ size_t m_size;
+ };
+
static PassRefPtr<SandboxExtension> create(const Handle&);
static void createHandle(const String& path, Type type, Handle&);
static String createHandleForTemporaryFile(const String& prefix, Type type, Handle&);
@@ -85,11 +107,20 @@ private:
#endif
};
+
#if !ENABLE(WEB_PROCESS_SANDBOX)
inline SandboxExtension::Handle::Handle() { }
inline SandboxExtension::Handle::~Handle() { }
inline void SandboxExtension::Handle::encode(CoreIPC::ArgumentEncoder*) const { }
inline bool SandboxExtension::Handle::decode(CoreIPC::ArgumentDecoder*, Handle&) { return true; }
+inline SandboxExtension::HandleArray::HandleArray() { }
+inline SandboxExtension::HandleArray::~HandleArray() { }
+inline void SandboxExtension::HandleArray::allocate(size_t) { }
+inline size_t SandboxExtension::HandleArray::size() const { return 0; }
+inline const SandboxExtension::Handle& SandboxExtension::HandleArray::operator[](size_t) const { return m_emptyHandle; }
+inline SandboxExtension::Handle& SandboxExtension::HandleArray::operator[](size_t) { return m_emptyHandle; }
+inline void SandboxExtension::HandleArray::encode(CoreIPC::ArgumentEncoder*) const { }
+inline bool SandboxExtension::HandleArray::decode(CoreIPC::ArgumentDecoder*, HandleArray&) { return true; }
inline PassRefPtr<SandboxExtension> SandboxExtension::create(const Handle&) { return 0; }
inline void SandboxExtension::createHandle(const String& path, Type type, Handle&) { }
inline String SandboxExtension::createHandleForTemporaryFile(const String& prefix, Type type, Handle&) {return String();}
diff --git a/Source/WebKit2/Shared/ShareableSurface.cpp b/Source/WebKit2/Shared/ShareableSurface.cpp
new file mode 100644
index 000000000..cf10e163f
--- /dev/null
+++ b/Source/WebKit2/Shared/ShareableSurface.cpp
@@ -0,0 +1,207 @@
+/*
+ Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "ShareableSurface.h"
+
+#include "WebCoreArgumentCoders.h"
+
+#if USE(TEXTURE_MAPPER)
+#include "TextureMapperGL.h"
+#endif
+
+using namespace WebCore;
+
+namespace WebKit {
+
+ShareableSurface::Handle::Handle()
+#if USE(GRAPHICS_SURFACE)
+ : m_graphicsSurfaceToken(0)
+#endif
+{
+}
+
+void ShareableSurface::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const
+{
+ encoder->encode(m_size);
+ encoder->encode(m_flags);
+#if USE(GRAPHICS_SURFACE)
+ encoder->encode(m_graphicsSurfaceToken);
+ if (m_graphicsSurfaceToken)
+ return;
+#endif
+ encoder->encode(m_bitmapHandle);
+}
+
+bool ShareableSurface::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& handle)
+{
+ if (!decoder->decode(handle.m_size))
+ return false;
+ if (!decoder->decode(handle.m_flags))
+ return false;
+#if USE(GRAPHICS_SURFACE)
+ if (!decoder->decode(handle.m_graphicsSurfaceToken))
+ return false;
+ if (handle.m_graphicsSurfaceToken)
+ return true;
+#endif
+ if (!decoder->decode(handle.m_bitmapHandle))
+ return false;
+
+ return true;
+}
+
+PassRefPtr<ShareableSurface> ShareableSurface::create(const IntSize& size, ShareableBitmap::Flags flags, Hints hints)
+{
+#if USE(GRAPHICS_SURFACE)
+ if (hints & SupportsGraphicsSurface) {
+ RefPtr<ShareableSurface> surface = createWithSurface(size, flags);
+ if (surface)
+ return surface.release();
+ }
+#endif
+
+ return create(size, flags, ShareableBitmap::createShareable(size, flags));
+}
+
+#if USE(GRAPHICS_SURFACE)
+PassRefPtr<ShareableSurface> ShareableSurface::createWithSurface(const IntSize& size, ShareableBitmap::Flags flags)
+{
+ GraphicsSurface::Flags surfaceFlags =
+ GraphicsSurface::SupportsSoftwareWrite
+ | GraphicsSurface::SupportsCopyToTexture
+ | GraphicsSurface::SupportsSharing;
+
+ if (flags & ShareableBitmap::SupportsAlpha)
+ surfaceFlags |= GraphicsSurface::SupportsAlpha;
+
+ // This might return null, if the system is unable to provide a new graphics surface.
+ // In that case, this function would return null and allow falling back to ShareableBitmap.
+ RefPtr<GraphicsSurface> surface = GraphicsSurface::create(size, surfaceFlags);
+ if (!surface)
+ return 0;
+
+ ASSERT(surface);
+ return adoptRef(new ShareableSurface(size, flags, surface.release()));
+}
+#endif
+
+PassOwnPtr<WebCore::GraphicsContext> ShareableSurface::createGraphicsContext(const IntRect& rect)
+{
+#if USE(GRAPHICS_SURFACE)
+ if (isBackedByGraphicsSurface())
+ return m_graphicsSurface->beginPaint(rect, 0 /* Write without retaining pixels*/);
+#endif
+
+ ASSERT(m_bitmap);
+ OwnPtr<GraphicsContext> graphicsContext = m_bitmap->createGraphicsContext();
+ graphicsContext->clip(rect);
+ graphicsContext->translate(rect.x(), rect.y());
+ return graphicsContext.release();
+}
+
+PassRefPtr<ShareableSurface> ShareableSurface::create(const IntSize& size, ShareableBitmap::Flags flags, PassRefPtr<ShareableBitmap> bitmap)
+{
+ return adoptRef(new ShareableSurface(size, flags, bitmap));
+}
+
+ShareableSurface::ShareableSurface(const IntSize& size, ShareableBitmap::Flags flags, PassRefPtr<ShareableBitmap> bitmap)
+ : m_size(size)
+ , m_flags(flags)
+ , m_bitmap(bitmap)
+{
+}
+
+#if USE(GRAPHICS_SURFACE)
+ShareableSurface::ShareableSurface(const WebCore::IntSize& size, ShareableBitmap::Flags flags, PassRefPtr<WebCore::GraphicsSurface> surface)
+ : m_size(size)
+ , m_flags(flags)
+ , m_graphicsSurface(surface)
+{
+}
+
+PassRefPtr<ShareableSurface> ShareableSurface::create(const IntSize& size, ShareableBitmap::Flags flags, PassRefPtr<GraphicsSurface> surface)
+{
+ return adoptRef(new ShareableSurface(size, flags, surface));
+}
+#endif
+
+ShareableSurface::~ShareableSurface()
+{
+}
+
+PassRefPtr<ShareableSurface> ShareableSurface::create(const Handle& handle)
+{
+#if USE(GRAPHICS_SURFACE)
+ RefPtr<GraphicsSurface> surface = GraphicsSurface::create(handle.m_size, handle.m_flags, handle.m_graphicsSurfaceToken);
+ if (surface)
+ return adoptRef(new ShareableSurface(handle.m_size, handle.m_flags, PassRefPtr<GraphicsSurface>(surface)));
+#endif
+
+ RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(handle.m_bitmapHandle);
+ if (!bitmap)
+ return 0;
+
+ return create(handle.m_size, handle.m_flags, bitmap.release());
+}
+
+bool ShareableSurface::createHandle(Handle& handle)
+{
+ handle.m_size = m_size;
+ handle.m_flags = m_flags;
+
+#if USE(GRAPHICS_SURFACE)
+ handle.m_graphicsSurfaceToken = m_graphicsSurface ? m_graphicsSurface->exportToken() : 0;
+ if (handle.m_graphicsSurfaceToken)
+ return true;
+#endif
+ if (!m_bitmap->createHandle(handle.m_bitmapHandle))
+ return false;
+
+ return true;
+}
+
+#if USE(TEXTURE_MAPPER)
+void ShareableSurface::copyToTexture(PassRefPtr<WebCore::BitmapTexture> passTexture, const IntRect& target, const IntPoint& sourceOffset)
+{
+ RefPtr<BitmapTexture> texture(passTexture);
+
+#if USE(GRAPHICS_SURFACE)
+ if (isBackedByGraphicsSurface()) {
+ RefPtr<BitmapTextureGL> textureGL = toBitmapTextureGL(texture.get());
+ if (textureGL) {
+ uint32_t textureID = textureGL->id();
+ uint32_t textureTarget = textureGL->textureTarget();
+ m_graphicsSurface->copyToGLTexture(textureTarget, textureID, target, sourceOffset);
+ return;
+ }
+
+ RefPtr<Image> image = m_graphicsSurface->createReadOnlyImage(IntRect(sourceOffset, target.size()));
+ texture->updateContents(image.get(), target, IntPoint::zero());
+ }
+#endif
+
+ ASSERT(m_bitmap);
+ RefPtr<Image> image = m_bitmap->createImage();
+ texture->updateContents(image.get(), target, sourceOffset);
+ return;
+}
+#endif // USE(TEXTURE_MAPPER)
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/ShareableSurface.h b/Source/WebKit2/Shared/ShareableSurface.h
new file mode 100644
index 000000000..fb74b61be
--- /dev/null
+++ b/Source/WebKit2/Shared/ShareableSurface.h
@@ -0,0 +1,121 @@
+/*
+ Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#ifndef ShareableSurface_h
+#define ShareableSurface_h
+
+#include "ShareableBitmap.h"
+
+#include <wtf/ThreadSafeRefCounted.h>
+
+#if USE(GRAPHICS_SURFACE)
+#include "GraphicsSurface.h"
+#endif
+
+namespace WebCore {
+class BitmapTexture;
+class Image;
+class GraphicsContext;
+}
+
+namespace WebKit {
+
+class ShareableSurface : public ThreadSafeRefCounted<ShareableSurface> {
+public:
+ enum Hint {
+ SupportsGraphicsSurface = 0x01
+ };
+
+ typedef unsigned Hints;
+
+ class Handle {
+ WTF_MAKE_NONCOPYABLE(Handle);
+ public:
+ Handle();
+
+ bool isNull() const;
+
+ void encode(CoreIPC::ArgumentEncoder*) const;
+ static bool decode(CoreIPC::ArgumentDecoder*, Handle&);
+
+#if USE(GRAPHICS_SURFACE)
+ uint32_t graphicsSurfaceToken() const { return m_graphicsSurfaceToken; }
+#endif
+
+ private:
+ friend class ShareableSurface;
+ mutable ShareableBitmap::Handle m_bitmapHandle;
+#if USE(GRAPHICS_SURFACE)
+ uint32_t m_graphicsSurfaceToken;
+#endif
+ WebCore::IntSize m_size;
+ ShareableBitmap::Flags m_flags;
+ };
+
+ // Create a new ShareableSurface, and allocate either a GraphicsSurface or a ShareableBitmap as backing.
+ static PassRefPtr<ShareableSurface> create(const WebCore::IntSize&, ShareableBitmap::Flags, Hints);
+
+ // Create a shareable surface from a handle.
+ static PassRefPtr<ShareableSurface> create(const Handle&);
+
+ ShareableBitmap::Flags flags() const { return m_flags; }
+
+ // Create a handle.
+ bool createHandle(Handle&);
+
+ ~ShareableSurface();
+
+ const WebCore::IntSize& size() const { return m_size; }
+ WebCore::IntRect bounds() const { return WebCore::IntRect(WebCore::IntPoint(), size()); }
+
+ // Create a graphics context that can be used to paint into the backing store.
+ PassOwnPtr<WebCore::GraphicsContext> createGraphicsContext(const WebCore::IntRect&);
+
+#if USE(TEXTURE_MAPPER)
+ void copyToTexture(PassRefPtr<WebCore::BitmapTexture>, const WebCore::IntRect& target, const WebCore::IntPoint& sourceOffset);
+#endif
+
+private:
+ ShareableSurface(const WebCore::IntSize&, ShareableBitmap::Flags, PassRefPtr<ShareableBitmap>);
+
+ // Create a ShareableSurface referencing an existing ShareableBitmap.
+ static PassRefPtr<ShareableSurface> create(const WebCore::IntSize&, ShareableBitmap::Flags, PassRefPtr<ShareableBitmap>);
+
+#if USE(GRAPHICS_SURFACE)
+ ShareableSurface(const WebCore::IntSize&, ShareableBitmap::Flags, PassRefPtr<WebCore::GraphicsSurface>);
+ // Create a shareable bitmap backed by a graphics surface.
+ static PassRefPtr<ShareableSurface> createWithSurface(const WebCore::IntSize&, ShareableBitmap::Flags);
+ // Create a ShareableSurface referencing an existing GraphicsSurface.
+ static PassRefPtr<ShareableSurface> create(const WebCore::IntSize&, ShareableBitmap::Flags, PassRefPtr<WebCore::GraphicsSurface>);
+
+ bool isBackedByGraphicsSurface() const { return !!m_graphicsSurface; }
+#endif
+
+ WebCore::IntSize m_size;
+ ShareableBitmap::Flags m_flags;
+ RefPtr<ShareableBitmap> m_bitmap;
+
+#if USE(GRAPHICS_SURFACE)
+ RefPtr<WebCore::GraphicsSurface> m_graphicsSurface;
+#endif
+};
+
+} // namespace WebKit
+
+#endif // ShareableSurface_h
diff --git a/Source/WebKit2/Shared/SurfaceUpdateInfo.cpp b/Source/WebKit2/Shared/SurfaceUpdateInfo.cpp
new file mode 100644
index 000000000..15333793c
--- /dev/null
+++ b/Source/WebKit2/Shared/SurfaceUpdateInfo.cpp
@@ -0,0 +1,49 @@
+/*
+ Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "SurfaceUpdateInfo.h"
+
+#include "WebCoreArgumentCoders.h"
+
+namespace WebKit {
+
+void SurfaceUpdateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
+{
+ encoder->encode(updateRect);
+ encoder->encode(scaleFactor);
+ encoder->encode(surfaceHandle);
+ encoder->encode(surfaceOffset);
+}
+
+bool SurfaceUpdateInfo::decode(CoreIPC::ArgumentDecoder* decoder, SurfaceUpdateInfo& result)
+{
+ if (!decoder->decode(result.updateRect))
+ return false;
+ if (!decoder->decode(result.scaleFactor))
+ return false;
+ if (!decoder->decode(result.surfaceHandle))
+ return false;
+ if (!decoder->decode(result.surfaceOffset))
+ return false;
+
+ return true;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/SurfaceUpdateInfo.h b/Source/WebKit2/Shared/SurfaceUpdateInfo.h
new file mode 100644
index 000000000..01d60d242
--- /dev/null
+++ b/Source/WebKit2/Shared/SurfaceUpdateInfo.h
@@ -0,0 +1,58 @@
+/*
+ Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SurfaceUpdateInfo_h
+#define SurfaceUpdateInfo_h
+
+#include "ShareableSurface.h"
+#include <WebCore/IntRect.h>
+#include <wtf/Noncopyable.h>
+
+namespace CoreIPC {
+class ArgumentDecoder;
+class ArgumentEncoder;
+}
+
+namespace WebKit {
+
+class SurfaceUpdateInfo {
+ WTF_MAKE_NONCOPYABLE(SurfaceUpdateInfo);
+
+public:
+ SurfaceUpdateInfo() { }
+
+ void encode(CoreIPC::ArgumentEncoder*) const;
+ static bool decode(CoreIPC::ArgumentDecoder*, SurfaceUpdateInfo&);
+
+ // The rect to be updated.
+ WebCore::IntRect updateRect;
+
+ // The page scale factor used to render this update.
+ float scaleFactor;
+
+ // The handle of the shareable bitmap containing the updates. Will be null if there are no updates.
+ ShareableSurface::Handle surfaceHandle;
+
+ // The offset in the bitmap where the rendered contents are.
+ WebCore::IntPoint surfaceOffset;
+};
+
+} // namespace WebKit
+
+#endif // UpdateInfo_h
diff --git a/Source/WebKit2/Shared/UpdateInfo.cpp b/Source/WebKit2/Shared/UpdateInfo.cpp
index a15d716b1..5bb189597 100644
--- a/Source/WebKit2/Shared/UpdateInfo.cpp
+++ b/Source/WebKit2/Shared/UpdateInfo.cpp
@@ -40,6 +40,7 @@ void UpdateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
encoder->encode(updateRects);
encoder->encode(updateScaleFactor);
encoder->encode(bitmapHandle);
+ encoder->encode(bitmapOffset);
}
bool UpdateInfo::decode(CoreIPC::ArgumentDecoder* decoder, UpdateInfo& result)
@@ -60,6 +61,8 @@ bool UpdateInfo::decode(CoreIPC::ArgumentDecoder* decoder, UpdateInfo& result)
return false;
if (!decoder->decode(result.bitmapHandle))
return false;
+ if (!decoder->decode(result.bitmapOffset))
+ return false;
return true;
}
diff --git a/Source/WebKit2/Shared/UpdateInfo.h b/Source/WebKit2/Shared/UpdateInfo.h
index 40c86dc5d..e3a8de278 100644
--- a/Source/WebKit2/Shared/UpdateInfo.h
+++ b/Source/WebKit2/Shared/UpdateInfo.h
@@ -65,6 +65,9 @@ public:
// The handle of the shareable bitmap containing the updates. Will be null if there are no updates.
ShareableBitmap::Handle bitmapHandle;
+
+ // The offset in the bitmap where the rendered contents are.
+ WebCore::IntPoint bitmapOffset;
};
} // namespace WebKit
diff --git a/Source/WebKit2/Shared/UserMessageCoders.h b/Source/WebKit2/Shared/UserMessageCoders.h
index 9672f28df..ace72fd2e 100644
--- a/Source/WebKit2/Shared/UserMessageCoders.h
+++ b/Source/WebKit2/Shared/UserMessageCoders.h
@@ -285,8 +285,8 @@ public:
if (!decoder->decode(messageCoder))
return false;
- std::pair<ImmutableDictionary::MapType::iterator, bool> result = map.set(key, element.release());
- if (!result.second)
+ ImmutableDictionary::MapType::AddResult result = map.set(key, element.release());
+ if (!result.isNewEntry)
return false;
}
diff --git a/Source/WebKit2/Shared/WebContextMenuItem.cpp b/Source/WebKit2/Shared/WebContextMenuItem.cpp
index f3129975b..4c6b4643a 100644
--- a/Source/WebKit2/Shared/WebContextMenuItem.cpp
+++ b/Source/WebKit2/Shared/WebContextMenuItem.cpp
@@ -24,6 +24,9 @@
*/
#include "config.h"
+
+#if ENABLE(CONTEXT_MENUS)
+
#include "WebContextMenuItem.h"
#include "ImmutableArray.h"
@@ -87,3 +90,4 @@ void WebContextMenuItem::setUserData(APIObject* userData)
} // namespace WebKit
+#endif // ENABLE(CONTEXT_MENUS)
diff --git a/Source/WebKit2/Shared/WebContextMenuItem.h b/Source/WebKit2/Shared/WebContextMenuItem.h
index 142b81134..893dd5b8d 100644
--- a/Source/WebKit2/Shared/WebContextMenuItem.h
+++ b/Source/WebKit2/Shared/WebContextMenuItem.h
@@ -26,6 +26,8 @@
#ifndef WebContextMenuItem_h
#define WebContextMenuItem_h
+#if ENABLE(CONTEXT_MENUS)
+
#include "APIObject.h"
#include "WebContextMenuItemData.h"
@@ -61,4 +63,5 @@ private:
} // namespace WebKit
+#endif // ENABLE(CONTEXT_MENUS)
#endif // WebContextMenuItem_h
diff --git a/Source/WebKit2/Shared/WebContextMenuItemData.cpp b/Source/WebKit2/Shared/WebContextMenuItemData.cpp
index e87204769..1eb1c495b 100644
--- a/Source/WebKit2/Shared/WebContextMenuItemData.cpp
+++ b/Source/WebKit2/Shared/WebContextMenuItemData.cpp
@@ -24,6 +24,9 @@
*/
#include "config.h"
+
+#if ENABLE(CONTEXT_MENUS)
+
#include "WebContextMenuItemData.h"
#include "APIObject.h"
@@ -156,3 +159,4 @@ Vector<ContextMenuItem> coreItems(const Vector<WebContextMenuItemData>& kitItemV
}
} // namespace WebKit
+#endif // ENABLE(CONTEXT_MENUS)
diff --git a/Source/WebKit2/Shared/WebContextMenuItemData.h b/Source/WebKit2/Shared/WebContextMenuItemData.h
index 24af28858..106bdf016 100644
--- a/Source/WebKit2/Shared/WebContextMenuItemData.h
+++ b/Source/WebKit2/Shared/WebContextMenuItemData.h
@@ -26,6 +26,8 @@
#ifndef WebContextMenuItemData_h
#define WebContextMenuItemData_h
+#if ENABLE(CONTEXT_MENUS)
+
#include <WebCore/ContextMenuItem.h>
#include <wtf/text/WTFString.h>
@@ -79,4 +81,5 @@ Vector<WebCore::ContextMenuItem> coreItems(const Vector<WebContextMenuItemData>&
} // namespace WebKit
+#endif // ENABLE(CONTEXT_MENUS)
#endif // WebContextMenuItemData_h
diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
index 505466c6b..804568c2d 100644
--- a/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
+++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
@@ -61,6 +61,10 @@
#include <WebCore/TranslateTransformOperation.h>
#endif
+#if USE(UI_SIDE_COMPOSITING) && ENABLE(CSS_FILTERS)
+#include <WebCore/FilterOperations.h>
+#endif
+
using namespace WebCore;
using namespace WebKit;
@@ -142,15 +146,14 @@ bool ArgumentCoder<IntSize>::decode(ArgumentDecoder* decoder, IntSize& intSize)
return SimpleArgumentCoder<IntSize>::decode(decoder, intSize);
}
-
-void ArgumentCoder<ViewportArguments>::encode(ArgumentEncoder* encoder, const ViewportArguments& viewportArguments)
+void ArgumentCoder<ViewportAttributes>::encode(ArgumentEncoder* encoder, const ViewportAttributes& viewportAttributes)
{
- SimpleArgumentCoder<ViewportArguments>::encode(encoder, viewportArguments);
+ SimpleArgumentCoder<ViewportAttributes>::encode(encoder, viewportAttributes);
}
-bool ArgumentCoder<ViewportArguments>::decode(ArgumentDecoder* decoder, ViewportArguments& viewportArguments)
+bool ArgumentCoder<ViewportAttributes>::decode(ArgumentDecoder* decoder, ViewportAttributes& viewportAttributes)
{
- return SimpleArgumentCoder<ViewportArguments>::decode(decoder, viewportArguments);
+ return SimpleArgumentCoder<ViewportAttributes>::decode(decoder, viewportAttributes);
}
void ArgumentCoder<MimeClassInfo>::encode(ArgumentEncoder* encoder, const MimeClassInfo& mimeClassInfo)
@@ -1085,7 +1088,7 @@ void ArgumentCoder<RefPtr<Animation> >::encode(ArgumentEncoder* encoder, const R
encodeBoolAndValue(encoder, animation->isIterationCountSet(), animation->iterationCount());
encodeBoolAndValue(encoder, animation->isNameSet(), animation->name());
encodeBoolAndEnumValue(encoder, animation->isPlayStateSet(), animation->playState());
- encodeBoolAndValue(encoder, animation->isPropertySet(), animation->property());
+ encodeBoolAndValue(encoder, animation->isPropertySet(), static_cast<int>(animation->property()));
encodeBoolAndValue<RefPtr<TimingFunction> >(encoder, animation->isTimingFunctionSet(), animation->timingFunction());
encoder->encodeBool(animation->isNoneAnimation());
}
@@ -1163,7 +1166,7 @@ bool ArgumentCoder<RefPtr<Animation> >::decode(ArgumentDecoder* decoder, RefPtr<
if (isPlayStateSet)
animation->setPlayState(playState);
if (isPropertySet)
- animation->setProperty(property);
+ animation->setProperty(static_cast<CSSPropertyID>(property));
if (isTimingFunctionSet)
animation->setTimingFunction(timingFunction);
@@ -1242,6 +1245,110 @@ bool ArgumentCoder<KeyframeValueList>::decode(ArgumentDecoder* decoder, WebCore:
#endif
+#if USE(UI_SIDE_COMPOSITING) && ENABLE(CSS_FILTERS)
+void ArgumentCoder<WebCore::FilterOperations>::encode(ArgumentEncoder* encoder, const WebCore::FilterOperations& filters)
+{
+ encoder->encodeUInt32(filters.size());
+ for (size_t i = 0; i < filters.size(); ++i) {
+ const FilterOperation* filter = filters.at(i);
+ FilterOperation::OperationType type = filter->getOperationType();
+ encoder->encodeEnum(type);
+ switch (type) {
+ case FilterOperation::GRAYSCALE:
+ case FilterOperation::SEPIA:
+ case FilterOperation::SATURATE:
+ case FilterOperation::HUE_ROTATE:
+ encoder->encodeDouble(static_cast<const BasicColorMatrixFilterOperation*>(filter)->amount());
+ break;
+ case FilterOperation::INVERT:
+ case FilterOperation::BRIGHTNESS:
+ case FilterOperation::CONTRAST:
+ case FilterOperation::OPACITY:
+ encoder->encodeDouble(static_cast<const BasicComponentTransferFilterOperation*>(filter)->amount());
+ break;
+ case FilterOperation::BLUR:
+ ArgumentCoder<Length>::encode(encoder, static_cast<const BlurFilterOperation*>(filter)->stdDeviation());
+ break;
+ case FilterOperation::DROP_SHADOW: {
+ const DropShadowFilterOperation* shadow = static_cast<const DropShadowFilterOperation*>(filter);
+ ArgumentCoder<IntPoint>::encode(encoder, shadow->location());
+ encoder->encodeInt32(shadow->stdDeviation());
+ ArgumentCoder<Color>::encode(encoder, shadow->color());
+ break;
+ }
+ default:
+ break;
+ }
+ }
+}
+
+bool ArgumentCoder<WebCore::FilterOperations>::decode(ArgumentDecoder* decoder, WebCore::FilterOperations& filters)
+{
+ uint32_t size;
+ if (!decoder->decodeUInt32(size))
+ return false;
+
+ Vector<RefPtr<FilterOperation> >& operations = filters.operations();
+
+ for (size_t i = 0; i < size; ++i) {
+ FilterOperation::OperationType type;
+ RefPtr<FilterOperation> filter;
+ if (!decoder->decodeEnum(type))
+ return false;
+
+ switch (type) {
+ case FilterOperation::GRAYSCALE:
+ case FilterOperation::SEPIA:
+ case FilterOperation::SATURATE:
+ case FilterOperation::HUE_ROTATE: {
+ double value;
+ if (!decoder->decodeDouble(value))
+ return false;
+ filter = BasicColorMatrixFilterOperation::create(value, type);
+ break;
+ }
+ case FilterOperation::INVERT:
+ case FilterOperation::BRIGHTNESS:
+ case FilterOperation::CONTRAST:
+ case FilterOperation::OPACITY: {
+ double value;
+ if (!decoder->decodeDouble(value))
+ return false;
+ filter = BasicComponentTransferFilterOperation::create(value, type);
+ break;
+ }
+ case FilterOperation::BLUR: {
+ Length length;
+ if (!ArgumentCoder<Length>::decode(decoder, length))
+ return false;
+ filter = BlurFilterOperation::create(length, type);
+ break;
+ }
+ case FilterOperation::DROP_SHADOW: {
+ IntPoint location;
+ int32_t stdDeviation;
+ Color color;
+ if (!ArgumentCoder<IntPoint>::decode(decoder, location))
+ return false;
+ if (!decoder->decodeInt32(stdDeviation))
+ return false;
+ if (!ArgumentCoder<Color>::decode(decoder, color))
+ return false;
+ filter = DropShadowFilterOperation::create(location, stdDeviation, color, type);
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (filter)
+ operations.append(filter);
+ }
+
+ return true;
+}
+#endif
+
#endif
} // namespace CoreIPC
diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.h b/Source/WebKit2/Shared/WebCoreArgumentCoders.h
index 6f9700cc5..d02f5fc17 100644
--- a/Source/WebKit2/Shared/WebCoreArgumentCoders.h
+++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.h
@@ -56,7 +56,7 @@ namespace WebCore {
struct MimeClassInfo;
struct PluginInfo;
struct TextCheckingResult;
- struct ViewportArguments;
+ struct ViewportAttributes;
struct WindowFeatures;
}
@@ -85,6 +85,12 @@ namespace WebCore {
}
#endif
+#if USE(UI_SIDE_COMPOSITING) && ENABLE(CSS_FILTERS)
+namespace WebCore {
+ class FilterOperations;
+}
+#endif
+
namespace CoreIPC {
template<> struct ArgumentCoder<WebCore::AffineTransform> {
@@ -122,9 +128,9 @@ template<> struct ArgumentCoder<WebCore::IntSize> {
static bool decode(ArgumentDecoder*, WebCore::IntSize&);
};
-template<> struct ArgumentCoder<WebCore::ViewportArguments> {
- static void encode(ArgumentEncoder*, const WebCore::ViewportArguments&);
- static bool decode(ArgumentDecoder*, WebCore::ViewportArguments&);
+template<> struct ArgumentCoder<WebCore::ViewportAttributes> {
+ static void encode(ArgumentEncoder*, const WebCore::ViewportAttributes&);
+ static bool decode(ArgumentDecoder*, WebCore::ViewportAttributes&);
};
template<> struct ArgumentCoder<WebCore::MimeClassInfo> {
@@ -301,6 +307,13 @@ template<> struct ArgumentCoder<RefPtr<WebCore::Animation> > {
};
#endif
+#if USE(UI_SIDE_COMPOSITING) && ENABLE(CSS_FILTERS)
+template<> struct ArgumentCoder<WebCore::FilterOperations> {
+ static void encode(ArgumentEncoder*, const WebCore::FilterOperations&);
+ static bool decode(ArgumentDecoder*, WebCore::FilterOperations&);
+};
+#endif
+
#if USE(ACCELERATED_COMPOSITING)
template<> struct ArgumentCoder<WebCore::KeyframeValueList> {
static void encode(ArgumentEncoder*, const WebCore::KeyframeValueList& keyframes);
diff --git a/Source/WebKit2/Shared/WebLayerTreeInfo.cpp b/Source/WebKit2/Shared/WebLayerTreeInfo.cpp
index bbf26cd75..ffdea522b 100644
--- a/Source/WebKit2/Shared/WebLayerTreeInfo.cpp
+++ b/Source/WebKit2/Shared/WebLayerTreeInfo.cpp
@@ -22,9 +22,9 @@
#if USE(UI_SIDE_COMPOSITING)
#include "WebLayerTreeInfo.h"
+#include "ArgumentCoders.h"
#include "Arguments.h"
#include "SharedMemory.h"
-#include "WebCoreArgumentCoders.h"
using namespace CoreIPC;
@@ -32,67 +32,12 @@ namespace WebKit {
void WebLayerInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
{
- // We have to divide it to several lines, because CoreIPC::In/Out takes a maximum of 10 arguments.
- encoder->encode(CoreIPC::In(id, name, parent, children, flags, replica, mask, imageBackingStoreID));
- encoder->encode(CoreIPC::In(pos, size, transform, opacity, anchorPoint, childrenTransform, contentsRect, animations));
+ SimpleArgumentCoder<WebLayerInfo>::encode(encoder, *this);
}
bool WebLayerInfo::decode(CoreIPC::ArgumentDecoder* decoder, WebLayerInfo& info)
{
- // We have to divide it to several lines, because CoreIPC::In/Out takes a maximum of 10 arguments.
- if (!decoder->decode(CoreIPC::Out(info.id, info.name, info.parent, info.children, info.flags, info.replica, info.mask, info.imageBackingStoreID)))
- return false;
- if (!decoder->decode(CoreIPC::Out(info.pos, info.size, info.transform, info.opacity, info.anchorPoint, info.childrenTransform, info.contentsRect, info.animations)))
- return false;
-
- return true;
-}
-
-void WebLayerTreeInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
-{
- encoder->encode(CoreIPC::In(layers, rootLayerID, deletedLayerIDs, contentScale));
-}
-
-bool WebLayerTreeInfo::decode(CoreIPC::ArgumentDecoder* decoder, WebLayerTreeInfo& info)
-{
- return decoder->decode(CoreIPC::Out(info.layers, info.rootLayerID, info.deletedLayerIDs, info.contentScale));
-}
-
-void WebLayerUpdateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
-{
- encoder->encode(CoreIPC::In(layerID, rect, bitmapHandle));
+ return SimpleArgumentCoder<WebLayerInfo>::decode(decoder, info);
}
-
-bool WebLayerUpdateInfo::decode(CoreIPC::ArgumentDecoder* decoder, WebLayerUpdateInfo& info)
-{
- return decoder->decode(CoreIPC::Out(info.layerID, info.rect, info.bitmapHandle));
-}
-
-void WebLayerAnimation::encode(CoreIPC::ArgumentEncoder* encoder) const
-{
- encoder->encodeEnum(operation);
- encoder->encode(keyframeList);
- encoder->encode(CoreIPC::In(name, startTime, boxSize));
-
- if (operation == WebLayerAnimation::AddAnimation)
- encoder->encode(animation);
-}
-
-bool WebLayerAnimation::decode(CoreIPC::ArgumentDecoder* decoder, WebLayerAnimation& info)
-{
- if (!decoder->decodeEnum(info.operation))
- return false;
- if (!decoder->decode(info.keyframeList))
- return false;
- if (!decoder->decode(CoreIPC::Out(info.name, info.startTime, info.boxSize)))
- return false;
-
- if (info.operation == WebLayerAnimation::AddAnimation)
- if (!decoder->decode(info.animation))
- return false;
-
- return true;
-}
-
}
#endif
diff --git a/Source/WebKit2/Shared/WebLayerTreeInfo.h b/Source/WebKit2/Shared/WebLayerTreeInfo.h
index 723cafd4e..7600633c8 100644
--- a/Source/WebKit2/Shared/WebLayerTreeInfo.h
+++ b/Source/WebKit2/Shared/WebLayerTreeInfo.h
@@ -34,58 +34,16 @@ namespace WebKit {
typedef uint32_t WebLayerID;
enum { InvalidWebLayerID = 0 };
-struct WebLayerUpdateInfo {
- WebLayerUpdateInfo() { }
- WebLayerUpdateInfo(const WebCore::IntRect& r)
- : layerID(InvalidWebLayerID)
- , rect(r) { }
-
- WebLayerID layerID;
- WebCore::IntRect rect;
- ShareableBitmap::Handle bitmapHandle;
-
- void encode(CoreIPC::ArgumentEncoder*) const;
- static bool decode(CoreIPC::ArgumentDecoder*, WebLayerUpdateInfo&);
-};
-
-struct WebLayerAnimation {
- WebLayerAnimation()
- : operation(InvalidAnimation)
- , keyframeList(WebCore::AnimatedPropertyInvalid)
- , startTime(0) { }
- WebLayerAnimation(const WebCore::KeyframeValueList& valueList)
- : operation(InvalidAnimation)
- , keyframeList(valueList)
- , startTime(0) { }
-
- String name;
- enum Operation {
- AddAnimation,
- RemoveAnimation,
- PauseAnimation,
- InvalidAnimation
- } operation;
- WebCore::IntSize boxSize;
- RefPtr<WebCore::Animation> animation;
- WebCore::KeyframeValueList keyframeList;
- double startTime;
-
- void encode(CoreIPC::ArgumentEncoder*) const;
- static bool decode(CoreIPC::ArgumentDecoder*, WebLayerAnimation&);
-};
-
+// NOTE: WebLayerInfo should only use POD types, as to make serialization faster.
struct WebLayerInfo {
WebLayerInfo()
- : id(InvalidWebLayerID)
- , parent(InvalidWebLayerID)
+ : parent(InvalidWebLayerID)
, replica(InvalidWebLayerID)
, mask(InvalidWebLayerID)
, imageBackingStoreID(0)
, opacity(0)
, flags(0) { }
- String name;
- WebLayerID id;
WebLayerID parent;
WebLayerID replica;
WebLayerID mask;
@@ -106,34 +64,16 @@ struct WebLayerInfo {
bool backfaceVisible : 1;
bool masksToBounds : 1;
bool preserves3D : 1;
- bool contentNeedsDisplay : 1;
- bool imageIsUpdated: 1;
bool isRootLayer: 1;
+ bool fixedToViewport : 1;
};
unsigned int flags;
};
- Vector<WebLayerID> children;
- Vector<WebLayerAnimation> animations;
- RefPtr<ShareableBitmap> imageBackingStore;
void encode(CoreIPC::ArgumentEncoder*) const;
static bool decode(CoreIPC::ArgumentDecoder*, WebLayerInfo&);
};
-struct WebLayerTreeInfo {
- WebLayerTreeInfo()
- : rootLayerID(InvalidWebLayerID)
- , contentScale(0) { }
-
- Vector<WebLayerInfo> layers;
- Vector<WebLayerID> deletedLayerIDs;
- WebLayerID rootLayerID;
- float contentScale;
-
- void encode(CoreIPC::ArgumentEncoder*) const;
- static bool decode(CoreIPC::ArgumentDecoder*, WebLayerTreeInfo&);
-};
-
}
#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebKit2/Shared/WebPreferencesStore.h b/Source/WebKit2/Shared/WebPreferencesStore.h
index cb7030940..ebb80f066 100644
--- a/Source/WebKit2/Shared/WebPreferencesStore.h
+++ b/Source/WebKit2/Shared/WebPreferencesStore.h
@@ -54,6 +54,7 @@ namespace WebKit {
macro(LoadsSiteIconsIgnoringImageLoadingPreference, loadsSiteIconsIgnoringImageLoadingPreference, Bool, bool, false) \
macro(PluginsEnabled, pluginsEnabled, Bool, bool, true) \
macro(JavaEnabled, javaEnabled, Bool, bool, true) \
+ macro(JavaEnabledForLocalFiles, javaEnabledForLocalFiles, Bool, bool, true) \
macro(OfflineWebApplicationCacheEnabled, offlineWebApplicationCacheEnabled, Bool, bool, false) \
macro(LocalStorageEnabled, localStorageEnabled, Bool, bool, true) \
macro(DatabasesEnabled, databasesEnabled, Bool, bool, true) \
@@ -74,6 +75,7 @@ namespace WebKit {
macro(CSSCustomFilterEnabled, cssCustomFilterEnabled, Bool, bool, true) \
macro(WebGLEnabled, webGLEnabled, Bool, bool, false) \
macro(CSSRegionsEnabled, cssRegionsEnabled, Bool, bool, true) \
+ macro(RegionBasedColumnsEnabled, regionBasedColumnsEnabled, Bool, bool, false) \
macro(ForceFTPDirectoryListings, forceFTPDirectoryListings, Bool, bool, false) \
macro(TabsToLinks, tabsToLinks, Bool, bool, DEFAULT_WEBKIT_TABSTOLINKS_ENABLED) \
macro(DNSPrefetchingEnabled, dnsPrefetchingEnabled, Bool, bool, false) \
@@ -95,6 +97,7 @@ namespace WebKit {
macro(MediaPlaybackRequiresUserGesture, mediaPlaybackRequiresUserGesture, Bool, bool, false) \
macro(MediaPlaybackAllowsInline, mediaPlaybackAllowsInline, Bool, bool, true) \
macro(InspectorStartsAttached, inspectorStartsAttached, Bool, bool, true) \
+ macro(InspectorUsesWebKitUserInterface, inspectorUsesWebKitUserInterface, Bool, bool, false) \
macro(ShowsToolTipOverTruncatedText, showsToolTipOverTruncatedText, Bool, bool, false) \
macro(MockScrollbarsEnabled, mockScrollbarsEnabled, Bool, bool, false) \
macro(WebAudioEnabled, webAudioEnabled, Bool, bool, false) \
@@ -106,6 +109,9 @@ namespace WebKit {
macro(ShouldDisplayCaptions, shouldDisplayCaptions, Bool, bool, false) \
macro(ShouldDisplayTextDescriptions, shouldDisplayTextDescriptions, Bool, bool, false) \
macro(NotificationsEnabled, notificationsEnabled, Bool, bool, true) \
+ macro(ShouldRespectImageOrientation, shouldRespectImageOrientation, Bool, bool, false) \
+ macro(WantsBalancedSetDefersLoadingBehavior, wantsBalancedSetDefersLoadingBehavior, Bool, bool, false) \
+ macro(RequestAnimationFrameEnabled, requestAnimationFrameEnabled, Bool, bool, true) \
\
#define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \
@@ -125,7 +131,7 @@ namespace WebKit {
macro(DefaultFontSize, defaultFontSize, UInt32, uint32_t, 16) \
macro(DefaultFixedFontSize, defaultFixedFontSize, UInt32, uint32_t, 13) \
macro(LayoutFallbackWidth, layoutFallbackWidth, UInt32, uint32_t, 980) \
- macro(DeviceDPI, deviceDPI, UInt32, uint32_t, 240) \
+ macro(DevicePixelRatio, devicePixelRatio, Double, double, 1.0) \
macro(DeviceWidth, deviceWidth, UInt32, uint32_t, 480) \
macro(DeviceHeight, deviceHeight, UInt32, uint32_t, 854) \
macro(PDFDisplayMode, pdfDisplayMode, UInt32, uint32_t, 1) \
diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp
index 8e1d16485..acbfb3e6d 100644
--- a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp
+++ b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp
@@ -54,7 +54,6 @@ void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) con
encoder->encode(applicationCacheDirectory);
encoder->encode(databaseDirectory);
encoder->encode(localStorageDirectory);
- encoder->encode(webInspectorLocalizedStringsPath);
encoder->encode(urlSchemesRegistererdAsEmptyDocument);
encoder->encode(urlSchemesRegisteredAsSecure);
encoder->encode(urlSchemesForWhichDomainRelaxationIsForbidden);
@@ -71,7 +70,7 @@ void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) con
encoder->encode(textCheckerState);
encoder->encode(fullKeyboardAccessEnabled);
encoder->encode(defaultRequestTimeoutInterval);
-#if USE(CFURLSTORAGESESSIONS)
+#if PLATFORM(MAC) || USE(CFURLSTORAGESESSIONS)
encoder->encode(uiProcessBundleIdentifier);
#endif
#if PLATFORM(MAC)
@@ -100,7 +99,7 @@ void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) con
encoder->encode(cookieStorageDirectory);
#endif
-#if ENABLE(NOTIFICATIONS)
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
encoder->encode(notificationPermissions);
#endif
}
@@ -117,8 +116,6 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web
return false;
if (!decoder->decode(parameters.localStorageDirectory))
return false;
- if (!decoder->decode(parameters.webInspectorLocalizedStringsPath))
- return false;
if (!decoder->decode(parameters.urlSchemesRegistererdAsEmptyDocument))
return false;
if (!decoder->decode(parameters.urlSchemesRegisteredAsSecure))
@@ -150,7 +147,7 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web
return false;
if (!decoder->decode(parameters.defaultRequestTimeoutInterval))
return false;
-#if USE(CFURLSTORAGESESSIONS)
+#if PLATFORM(MAC) || USE(CFURLSTORAGESESSIONS)
if (!decoder->decode(parameters.uiProcessBundleIdentifier))
return false;
#endif
@@ -197,7 +194,7 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web
return false;
#endif
-#if ENABLE(NOTIFICATIONS)
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
if (!decoder->decode(parameters.notificationPermissions))
return false;
#endif
diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.h b/Source/WebKit2/Shared/WebProcessCreationParameters.h
index 3a3764d44..68ff58c2b 100644
--- a/Source/WebKit2/Shared/WebProcessCreationParameters.h
+++ b/Source/WebKit2/Shared/WebProcessCreationParameters.h
@@ -57,7 +57,6 @@ struct WebProcessCreationParameters {
String applicationCacheDirectory;
String databaseDirectory;
String localStorageDirectory;
- String webInspectorLocalizedStringsPath;
Vector<String> urlSchemesRegistererdAsEmptyDocument;
Vector<String> urlSchemesRegisteredAsSecure;
@@ -86,7 +85,7 @@ struct WebProcessCreationParameters {
double defaultRequestTimeoutInterval;
-#if USE(CFURLSTORAGESESSIONS)
+#if PLATFORM(MAC) || USE(CFURLSTORAGESESSIONS)
String uiProcessBundleIdentifier;
#endif
@@ -123,7 +122,7 @@ struct WebProcessCreationParameters {
String cookieStorageDirectory;
#endif
-#if ENABLE(NOTIFICATIONS)
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
HashMap<String, bool> notificationPermissions;
#endif
};
diff --git a/Source/WebKit2/Shared/WebRenderObject.cpp b/Source/WebKit2/Shared/WebRenderObject.cpp
index 6f3bcffd3..2520d3dbd 100644
--- a/Source/WebKit2/Shared/WebRenderObject.cpp
+++ b/Source/WebKit2/Shared/WebRenderObject.cpp
@@ -61,7 +61,7 @@ WebRenderObject::WebRenderObject(RenderObject* renderer)
m_absolutePosition = flooredIntPoint(renderer->localToAbsolute(FloatPoint()));
if (renderer->isBox())
- m_frameRect = toRenderBox(renderer)->frameRect();
+ m_frameRect = toRenderBox(renderer)->pixelSnappedFrameRect();
else if (renderer->isText()) {
m_frameRect = toRenderText(renderer)->linesBoundingBox();
m_frameRect.setX(toRenderText(renderer)->firstRunX());
diff --git a/Source/WebKit2/Shared/efl/PlatformCertificateInfo.h b/Source/WebKit2/Shared/efl/PlatformCertificateInfo.h
new file mode 100644
index 000000000..34771b71e
--- /dev/null
+++ b/Source/WebKit2/Shared/efl/PlatformCertificateInfo.h
@@ -0,0 +1,51 @@
+/*
+ Copyright (C) 2012 Samsung Electronics
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef PlatformCertificateInfo_h
+#define PlatformCertificateInfo_h
+
+#include "ArgumentDecoder.h"
+#include "ArgumentEncoder.h"
+#include <WebCore/ResourceResponse.h>
+
+namespace WebKit {
+
+class PlatformCertificateInfo {
+public:
+ PlatformCertificateInfo()
+ {
+ }
+
+ explicit PlatformCertificateInfo(const WebCore::ResourceResponse&)
+ {
+ }
+
+ void encode(CoreIPC::ArgumentEncoder*) const
+ {
+ }
+
+ static bool decode(CoreIPC::ArgumentDecoder*, PlatformCertificateInfo&)
+ {
+ return true;
+ }
+};
+
+} // namespace WebKit
+
+#endif // PlatformCertificateInfo_h
diff --git a/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp b/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp
index 8b802e9f7..7bcd33f9c 100644
--- a/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp
+++ b/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp
@@ -71,10 +71,11 @@ static bool decodeImage(ArgumentDecoder* decoder, GRefPtr<GdkPixbuf>& pixbuf)
if (!image)
return false;
- cairo_surface_t* surface = image->nativeImageForCurrentFrame();
- if (!surface)
+ NativeImageCairo* nativeImage = image->nativeImageForCurrentFrame();
+ if (!nativeImage)
return false;
+ cairo_surface_t* surface = nativeImage->surface();
pixbuf = adoptGRef(gdk_pixbuf_get_from_surface(surface, 0, 0,
cairo_image_surface_get_width(surface),
cairo_image_surface_get_height(surface)));
diff --git a/Source/WebKit2/Shared/gtk/ProcessExecutablePathGtk.cpp b/Source/WebKit2/Shared/gtk/ProcessExecutablePathGtk.cpp
new file mode 100644
index 000000000..5e15029c3
--- /dev/null
+++ b/Source/WebKit2/Shared/gtk/ProcessExecutablePathGtk.cpp
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY MOTOROLA 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 MOTOROLA 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 "ProcessExecutablePath.h"
+
+#include <WebCore/FileSystem.h>
+#include <glib.h>
+#include <wtf/gobject/GlibUtilities.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+const char* gWebKitWebProcessName = "WebKitWebProcess";
+const char* gWebKitPluginProcessName = "WebKitPluginProcess";
+
+static String findWebKitProcess(const char* processName)
+{
+ const char* execDirectory = g_getenv("WEBKIT_EXEC_PATH");
+ if (execDirectory) {
+ String processPath = pathByAppendingComponent(filenameToString(execDirectory), processName);
+ if (fileExists(processPath))
+ return processPath;
+ }
+
+ static bool gotExecutablePath = false;
+ static String executablePath;
+ if (!gotExecutablePath) {
+ gotExecutablePath = true;
+
+ CString executableFile = getCurrentExecutablePath();
+ if (!executableFile.isNull())
+ executablePath = directoryName(filenameToString(executableFile.data()));
+ }
+
+ if (!executablePath.isNull()) {
+ String processPath = pathByAppendingComponent(executablePath, processName);
+ if (fileExists(processPath))
+ return processPath;
+ }
+
+ return pathByAppendingComponent(filenameToString(LIBEXECDIR), processName);
+}
+
+String executablePathOfWebProcess()
+{
+ return findWebKitProcess(gWebKitWebProcessName);
+}
+
+String executablePathOfPluginProcess()
+{
+ return findWebKitProcess(gWebKitPluginProcessName);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/mac/CommandLineMac.cpp b/Source/WebKit2/Shared/mac/CommandLineMac.cpp
index d48a40128..500198134 100644
--- a/Source/WebKit2/Shared/mac/CommandLineMac.cpp
+++ b/Source/WebKit2/Shared/mac/CommandLineMac.cpp
@@ -48,7 +48,7 @@ bool CommandLine::parse(int argc, char** argv)
if (value.isEmpty())
return false;
- if (!m_args.add(key, value).second)
+ if (!m_args.add(key, value).isNewEntry)
return false;
}
diff --git a/Source/WebKit2/Shared/mac/PDFKitImports.h b/Source/WebKit2/Shared/mac/PDFKitImports.h
new file mode 100644
index 000000000..44c375c6b
--- /dev/null
+++ b/Source/WebKit2/Shared/mac/PDFKitImports.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2012 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 PDFKitImports_h
+#define PDFKitImports_h
+
+namespace WebKit {
+
+NSString *pdfKitFrameworkPath();
+Class classFromPDFKit(NSString *className);
+Class pdfAnnotationLinkClass();
+Class pdfDocumentClass();
+
+}
+
+#endif // PDFKitImports_h
diff --git a/Source/WebKit2/Shared/mac/PDFKitImports.mm b/Source/WebKit2/Shared/mac/PDFKitImports.mm
new file mode 100644
index 000000000..6234a8395
--- /dev/null
+++ b/Source/WebKit2/Shared/mac/PDFKitImports.mm
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 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 "PDFKitImports.h"
+
+namespace WebKit {
+
+NSString *pdfKitFrameworkPath()
+{
+ NSString *systemLibraryPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSSystemDomainMask, NO) objectAtIndex:0];
+ return [systemLibraryPath stringByAppendingPathComponent:@"Frameworks/Quartz.framework/Frameworks/PDFKit.framework"];
+}
+
+Class classFromPDFKit(NSString *className)
+{
+ static NSBundle *pdfKitBundle = [NSBundle bundleWithPath:pdfKitFrameworkPath()];
+ [pdfKitBundle load];
+ return [pdfKitBundle classNamed:className];
+}
+
+Class pdfAnnotationLinkClass()
+{
+ static Class pdfAnnotationLinkClass = classFromPDFKit(@"PDFAnnotationLink");
+ ASSERT(pdfAnnotationLinkClass);
+ return pdfAnnotationLinkClass;
+}
+
+Class pdfDocumentClass()
+{
+ static Class pdfDocumentClass = classFromPDFKit(@"PDFDocument");
+ ASSERT(pdfDocumentClass);
+ return pdfDocumentClass;
+}
+
+}
diff --git a/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm b/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm
index 1fef4312d..a593b6742 100644
--- a/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm
+++ b/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm
@@ -86,6 +86,66 @@ bool SandboxExtension::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle&
return true;
}
+SandboxExtension::HandleArray::HandleArray()
+ : m_data(0)
+ , m_size(0)
+{
+}
+
+SandboxExtension::HandleArray::~HandleArray()
+{
+ if (m_data)
+ delete[] m_data;
+}
+
+void SandboxExtension::HandleArray::allocate(size_t size)
+{
+ if (!size)
+ return;
+
+ ASSERT(!m_data);
+
+ m_data = new SandboxExtension::Handle[size];
+ m_size = size;
+}
+
+SandboxExtension::Handle& SandboxExtension::HandleArray::operator[](size_t i)
+{
+ ASSERT(i < m_size);
+ return m_data[i];
+}
+
+const SandboxExtension::Handle& SandboxExtension::HandleArray::operator[](size_t i) const
+{
+ ASSERT(i < m_size);
+ return m_data[i];
+}
+
+size_t SandboxExtension::HandleArray::size() const
+{
+ return m_size;
+}
+
+void SandboxExtension::HandleArray::encode(CoreIPC::ArgumentEncoder* encoder) const
+{
+ encoder->encodeUInt64(size());
+ for (size_t i = 0; i < m_size; ++i)
+ encoder->encode(m_data[i]);
+
+}
+
+bool SandboxExtension::HandleArray::decode(CoreIPC::ArgumentDecoder* decoder, SandboxExtension::HandleArray& handles)
+{
+ uint64_t size;
+ if (!decoder->decodeUInt64(size))
+ return false;
+ handles.allocate(size);
+ for (size_t i = 0; i < size; i++)
+ if (!decoder->decode(handles[i]))
+ return false;
+ return true;
+}
+
PassRefPtr<SandboxExtension> SandboxExtension::create(const Handle& handle)
{
if (!handle.m_sandboxExtension)
diff --git a/Source/WebKit2/Shared/qt/ProcessExecutablePathQt.cpp b/Source/WebKit2/Shared/qt/ProcessExecutablePathQt.cpp
new file mode 100644
index 000000000..9cb29b3eb
--- /dev/null
+++ b/Source/WebKit2/Shared/qt/ProcessExecutablePathQt.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 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"
+#include "ProcessExecutablePath.h"
+
+#include <QCoreApplication>
+#include <QDir>
+#include <QFile>
+
+namespace WebKit {
+
+static String executablePath(QString baseName)
+{
+ QString expectedPath = QCoreApplication::applicationDirPath() + QDir::separator() + baseName;
+ if (QFile::exists(expectedPath))
+ return String(expectedPath);
+ return String(QString(baseName));
+}
+
+String executablePathOfWebProcess()
+{
+ return executablePath(QStringLiteral("QtWebProcess"));
+}
+
+String executablePathOfPluginProcess()
+{
+ return executablePath(QStringLiteral("QtWebPluginProcess"));
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/qt/QtNetworkReplyData.cpp b/Source/WebKit2/Shared/qt/QtNetworkReplyData.cpp
index abc43b168..f14042727 100644
--- a/Source/WebKit2/Shared/qt/QtNetworkReplyData.cpp
+++ b/Source/WebKit2/Shared/qt/QtNetworkReplyData.cpp
@@ -28,11 +28,11 @@
#include "ArgumentCodersQt.h"
#include "KURL.h"
-#include "Noncopyable.h"
#include "SharedMemory.h"
#include "WebCoreArgumentCoders.h"
#include <QNetworkAccessManager>
#include <QNetworkRequest>
+#include <wtf/Noncopyable.h>
#include <wtf/text/WTFString.h>
namespace WebKit {
diff --git a/Source/WebKit2/Shared/qt/QtNetworkReplyData.h b/Source/WebKit2/Shared/qt/QtNetworkReplyData.h
index d1565bec2..457d7be27 100644
--- a/Source/WebKit2/Shared/qt/QtNetworkReplyData.h
+++ b/Source/WebKit2/Shared/qt/QtNetworkReplyData.h
@@ -26,10 +26,10 @@
#ifndef QtNetworkReplyData_h
#define QtNetworkReplyData_h
-#include "Noncopyable.h"
-#include "RefCounted.h"
#include "SharedMemory.h"
#include <QNetworkAccessManager>
+#include <wtf/Noncopyable.h>
+#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
namespace CoreIPC {
diff --git a/Source/WebKit2/Shared/qt/QtNetworkRequestData.cpp b/Source/WebKit2/Shared/qt/QtNetworkRequestData.cpp
index f210660fd..8a80fb369 100644
--- a/Source/WebKit2/Shared/qt/QtNetworkRequestData.cpp
+++ b/Source/WebKit2/Shared/qt/QtNetworkRequestData.cpp
@@ -27,11 +27,11 @@
#include "QtNetworkRequestData.h"
#include "ArgumentCodersQt.h"
-#include "Platform.h"
#include "WebCoreArgumentCoders.h"
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QUuid>
+#include <wtf/Platform.h>
#include <wtf/text/WTFString.h>
namespace WebKit {
diff --git a/Source/WebKit2/Shared/qt/QtNetworkRequestData.h b/Source/WebKit2/Shared/qt/QtNetworkRequestData.h
index 082d499cc..940bf815f 100644
--- a/Source/WebKit2/Shared/qt/QtNetworkRequestData.h
+++ b/Source/WebKit2/Shared/qt/QtNetworkRequestData.h
@@ -26,7 +26,7 @@
#ifndef QtNetworkRequestData_h
#define QtNetworkRequestData_h
-#include "RefCounted.h"
+#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
namespace CoreIPC {
diff --git a/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp b/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp
index 0c8be072a..a7ab8d4b3 100644
--- a/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp
+++ b/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp
@@ -28,6 +28,7 @@
#include <QImage>
#include <QPainter>
+#include <QtGlobal>
#include <WebCore/BitmapImage.h>
#include <WebCore/GraphicsContext.h>
#include <WebCore/NotImplemented.h>
@@ -59,7 +60,9 @@ PassOwnPtr<GraphicsContext> ShareableBitmap::createGraphicsContext()
{
// FIXME: Should this be OwnPtr<QImage>?
QImage* image = new QImage(createQImage());
- OwnPtr<GraphicsContext> context = adoptPtr(new GraphicsContext(new QPainter(image)));
+ QPainter* painter = new QPainter(image);
+ painter->setRenderHint(QPainter::SmoothPixmapTransform, true);
+ OwnPtr<GraphicsContext> context = adoptPtr(new GraphicsContext(painter));
context->takeOwnershipOfPlatformContext();
return context.release();
}
@@ -71,8 +74,13 @@ void ShareableBitmap::paint(GraphicsContext& context, const IntPoint& dstPoint,
painter->drawImage(dstPoint, image, QRect(srcRect));
}
-void ShareableBitmap::paint(GraphicsContext& /*context*/, float /*scaleFactor*/, const IntPoint& /*dstPoint*/, const IntRect& /*srcRect*/)
+void ShareableBitmap::paint(GraphicsContext& context, float scaleFactor, const IntPoint& dstPoint, const IntRect& srcRect)
{
+ if (qFuzzyCompare(scaleFactor, 1)) {
+ paint(context, dstPoint, srcRect);
+ return;
+ }
+
// See <https://bugs.webkit.org/show_bug.cgi?id=64663>.
notImplemented();
}
diff --git a/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp b/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp
index 950d372d2..7a77ef30f 100644
--- a/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp
+++ b/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp
@@ -102,8 +102,9 @@ void ArgumentCoder<ResourceError>::encode(ArgumentEncoder* encoder, const Resour
{
encoder->encode(resourceError.domain());
encoder->encode(resourceError.errorCode());
- encoder->encode(resourceError.failingURL());
+ encoder->encode(resourceError.failingURL());
encoder->encode(resourceError.localizedDescription());
+ encoder->encode(resourceError.isCancellation());
}
bool ArgumentCoder<ResourceError>::decode(ArgumentDecoder* decoder, ResourceError& resourceError)
@@ -123,8 +124,13 @@ bool ArgumentCoder<ResourceError>::decode(ArgumentDecoder* decoder, ResourceErro
String localizedDescription;
if (!decoder->decode(localizedDescription))
return false;
-
+
+ bool isCancellation;
+ if (!decoder->decode(isCancellation))
+ return false;
+
resourceError = ResourceError(domain, errorCode, failingURL, localizedDescription);
+ resourceError.setIsCancellation(isCancellation);
return true;
}
diff --git a/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp b/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp
index 4812602f9..3091d64c9 100644
--- a/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp
+++ b/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp
@@ -26,7 +26,6 @@
#include "config.h"
#include "WebEventFactoryQt.h"
-#include <QApplication>
#include <QKeyEvent>
#include <QTransform>
#include <WebCore/IntPoint.h>
@@ -134,24 +133,21 @@ WebWheelEvent WebEventFactory::createWebWheelEvent(QWheelEvent* e, const QTransf
WebEvent::Modifiers modifiers = modifiersForEvent(e->modifiers());
double timestamp = currentTimeForEvent(e);
- // A delta that is not mod 120 indicates a device that is sending
- // fine-resolution scroll events, so use the delta as number of wheel ticks
- // and number of pixels to scroll.See also webkit.org/b/29601
- bool fullTick = !(e->delta() % 120);
-
if (e->orientation() == Qt::Horizontal) {
- deltaX = (fullTick) ? e->delta() / 120.0f : e->delta();
- wheelTicksX = deltaX;
+ deltaX = e->delta();
+ wheelTicksX = deltaX / 120.0f;
} else {
- deltaY = (fullTick) ? e->delta() / 120.0f : e->delta();
- wheelTicksY = deltaY;
+ deltaY = e->delta();
+ wheelTicksY = deltaY / 120.0f;
}
- // Use the same single scroll step as QTextEdit
- // (in QTextEditPrivate::init [h,v]bar->setSingleStep)
+ // Since we report the scroll by the pixel, convert the delta to pixel distance using standard scroll step.
+ // Use the same single scroll step as QTextEdit (in QTextEditPrivate::init [h,v]bar->setSingleStep)
static const float cDefaultQtScrollStep = 20.f;
- deltaX *= (fullTick) ? QApplication::wheelScrollLines() * cDefaultQtScrollStep : 1;
- deltaY *= (fullTick) ? QApplication::wheelScrollLines() * cDefaultQtScrollStep : 1;
+ // ### FIXME: Default from QtGui. Should use Qt platform theme API once configurable.
+ const int wheelScrollLines = 3;
+ deltaX = wheelTicksX * wheelScrollLines * cDefaultQtScrollStep;
+ deltaY = wheelTicksY * wheelScrollLines * cDefaultQtScrollStep;
return WebWheelEvent(WebEvent::Wheel, fromItemTransform.map(e->posF()).toPoint(), e->globalPosF().toPoint(), FloatSize(deltaX, deltaY), FloatSize(wheelTicksX, wheelTicksY), granularity, modifiers, timestamp);
}
@@ -213,7 +209,8 @@ WebTouchEvent WebEventFactory::createWebTouchEvent(const QTouchEvent* event, con
if (type == WebEvent::TouchCancel)
state = WebPlatformTouchPoint::TouchCancelled;
- m_touchPoints.append(WebPlatformTouchPoint(id, state, touchPoint.screenPos().toPoint(), fromItemTransform.map(touchPoint.pos()).toPoint()));
+ IntSize radius(touchPoint.rect().width()/ 2, touchPoint.rect().height() / 2);
+ m_touchPoints.append(WebPlatformTouchPoint(id, state, touchPoint.screenPos().toPoint(), fromItemTransform.map(touchPoint.pos()).toPoint(), radius, 0.0, touchPoint.pressure()));
}
return WebTouchEvent(type, m_touchPoints, modifiers, timestamp);