summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/plugins')
-rw-r--r--Source/WebCore/plugins/PluginView.cpp4
-rw-r--r--Source/WebCore/plugins/PluginView.h4
-rw-r--r--Source/WebCore/plugins/gtk/PluginPackageGtk.cpp17
-rw-r--r--Source/WebCore/plugins/gtk/PluginViewGtk.cpp48
-rw-r--r--Source/WebCore/plugins/npapi.cpp6
-rw-r--r--Source/WebCore/plugins/qt/PluginViewQt.cpp8
-rw-r--r--Source/WebCore/plugins/symbian/PluginViewSymbian.cpp7
-rw-r--r--Source/WebCore/plugins/win/PluginViewWin.cpp4
8 files changed, 64 insertions, 34 deletions
diff --git a/Source/WebCore/plugins/PluginView.cpp b/Source/WebCore/plugins/PluginView.cpp
index 59d01fa..c39ceac 100644
--- a/Source/WebCore/plugins/PluginView.cpp
+++ b/Source/WebCore/plugins/PluginView.cpp
@@ -365,7 +365,7 @@ void PluginView::stop()
#endif
#if ENABLE(NETSCAPE_PLUGIN_API)
-#ifdef XP_WIN
+#if defined(XP_WIN) && !PLATFORM(GTK)
// Unsubclass the window
if (m_isWindowed) {
#if OS(WINCE)
@@ -380,7 +380,7 @@ void PluginView::stop()
SetWindowLongPtr(platformPluginWidget(), GWLP_WNDPROC, (LONG_PTR)m_pluginWndProc);
#endif
}
-#endif // XP_WIN
+#endif // !defined(XP_WIN) || PLATFORM(GTK)
#endif // ENABLE(NETSCAPE_PLUGIN_API)
#if !defined(XP_MACOSX)
diff --git a/Source/WebCore/plugins/PluginView.h b/Source/WebCore/plugins/PluginView.h
index 9321a86..e2dbb49 100644
--- a/Source/WebCore/plugins/PluginView.h
+++ b/Source/WebCore/plugins/PluginView.h
@@ -438,7 +438,11 @@ public:
private:
+<<<<<<< HEAD
#if defined(XP_UNIX) || OS(SYMBIAN) || defined(ANDROID_PLUGINS)
+=======
+#if defined(XP_UNIX) || OS(SYMBIAN) || PLATFORM(GTK)
+>>>>>>> WebKit.org at r84325
void setNPWindowIfNeeded();
#elif defined(XP_MACOSX)
NP_CGContext m_npCgContext;
diff --git a/Source/WebCore/plugins/gtk/PluginPackageGtk.cpp b/Source/WebCore/plugins/gtk/PluginPackageGtk.cpp
index 21d3c9e..ab8eb57 100644
--- a/Source/WebCore/plugins/gtk/PluginPackageGtk.cpp
+++ b/Source/WebCore/plugins/gtk/PluginPackageGtk.cpp
@@ -119,6 +119,17 @@ static int webkitgtkXError(Display* xdisplay, XErrorEvent* error)
}
#endif
+static bool moduleMixesGtkSymbols(GModule* module)
+{
+ gpointer symbol;
+#ifdef GTK_API_VERSION_2
+ return g_module_symbol(module, "gtk_application_get_type", &symbol);
+#else
+ return g_module_symbol(module, "gtk_object_get_type", &symbol);
+#endif
+}
+
+
bool PluginPackage::load()
{
if (m_isLoaded) {
@@ -150,6 +161,12 @@ bool PluginPackage::load()
return false;
}
+ if (moduleMixesGtkSymbols(m_module)) {
+ LOG(Plugins, "Module '%s' mixes GTK+ 2 and GTK+ 3 symbols, ignoring plugin.\n", m_path.utf8().data());
+ g_module_close(m_module);
+ return false;
+ }
+
m_isLoaded = true;
#if defined(XP_UNIX)
diff --git a/Source/WebCore/plugins/gtk/PluginViewGtk.cpp b/Source/WebCore/plugins/gtk/PluginViewGtk.cpp
index 58a4f2c..8d48800 100644
--- a/Source/WebCore/plugins/gtk/PluginViewGtk.cpp
+++ b/Source/WebCore/plugins/gtk/PluginViewGtk.cpp
@@ -47,6 +47,7 @@
#include "Image.h"
#include "KeyboardEvent.h"
#include "MouseEvent.h"
+#include "NotImplemented.h"
#include "Page.h"
#include "PlatformContextCairo.h"
#include "PlatformKeyboardEvent.h"
@@ -560,30 +561,32 @@ void PluginView::setParentVisible(bool visible)
}
}
-NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32_t len, const char* buf)
+NPError PluginView::handlePostReadFile(Vector<char>& outputBuffer, uint32_t filenameLength, const char* filenameBuffer)
{
- WTF::String filename(buf, len);
+ // There doesn't seem to be any documentation about what encoding the filename
+ // is in, but most ports seem to assume UTF-8 here and the test plugin is definitely
+ // sending the path in UTF-8 encoding.
+ CString filename(filenameBuffer, filenameLength);
- if (filename.startsWith("file:///"))
- filename = filename.substring(8);
-
- // Get file info
- if (!g_file_test ((filename.utf8()).data(), (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)))
+ GRefPtr<GFile> file = adoptGRef(g_file_new_for_commandline_arg(filename.data()));
+ if (g_file_query_file_type(file.get(), G_FILE_QUERY_INFO_NONE, 0) != G_FILE_TYPE_REGULAR)
return NPERR_FILE_NOT_FOUND;
- //FIXME - read the file data into buffer
- FILE* fileHandle = fopen((filename.utf8()).data(), "r");
-
- if (fileHandle == 0)
+ GRefPtr<GFileInfo> fileInfo = adoptGRef(g_file_query_info(file.get(),
+ G_FILE_ATTRIBUTE_STANDARD_SIZE,
+ G_FILE_QUERY_INFO_NONE,
+ 0, 0));
+ if (!fileInfo)
return NPERR_FILE_NOT_FOUND;
- //buffer.resize();
-
- int bytesRead = fread(buffer.data(), 1, 0, fileHandle);
-
- fclose(fileHandle);
+ GRefPtr<GFileInputStream> inputStream = adoptGRef(g_file_read(file.get(), 0, 0));
+ if (!inputStream)
+ return NPERR_FILE_NOT_FOUND;
- if (bytesRead <= 0)
+ outputBuffer.resize(g_file_info_get_size(fileInfo.get()));
+ gsize bytesRead = 0;
+ if (!g_input_stream_read_all(G_INPUT_STREAM(inputStream.get()),
+ outputBuffer.data(), outputBuffer.size(), &bytesRead, 0, 0))
return NPERR_FILE_NOT_FOUND;
return NPERR_NO_ERROR;
@@ -660,7 +663,7 @@ bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* re
#if defined(XP_UNIX)
*static_cast<Window*>(value) = GDK_WINDOW_XWINDOW(gdk_window_get_toplevel(gdkWindow));
#elif defined(GDK_WINDOWING_WIN32)
- *static_cast<HGIOBJ*>(value) = GDK_WINDOW_HWND(gdkWindow);
+ *static_cast<HGDIOBJ*>(value) = GDK_WINDOW_HWND(gdkWindow);
#endif
*result = NPERR_NO_ERROR;
return true;
@@ -706,6 +709,7 @@ void PluginView::forceRedraw()
gtk_widget_queue_draw(m_parentFrame->view()->hostWindow()->platformPageClient());
}
+#ifndef GDK_WINDOWING_WIN32
static Display* getPluginDisplay()
{
// The plugin toolkit might have a different X connection open. Since we're
@@ -719,6 +723,7 @@ static Display* getPluginDisplay()
return 0;
#endif
}
+#endif
#if defined(XP_UNIX)
static void getVisualAndColormap(int depth, Visual** visual, Colormap* colormap)
@@ -783,6 +788,7 @@ bool PluginView::platformStart()
ASSERT(m_isStarted);
ASSERT(m_status == PluginStatusLoadedSuccessfully);
+#if defined(XP_UNIX)
if (m_plugin->pluginFuncs()->getvalue) {
PluginView::setCurrentPluginView(this);
JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly);
@@ -791,11 +797,11 @@ bool PluginView::platformStart()
setCallingPlugin(false);
PluginView::setCurrentPluginView(0);
}
+#endif
if (m_isWindowed) {
-#if defined(XP_UNIX)
GtkWidget* pageClient = m_parentFrame->view()->hostWindow()->platformPageClient();
-
+#if defined(XP_UNIX)
if (m_needsXEmbed) {
// If our parent is not anchored the startup process will
// fail miserably for XEmbed plugins a bit later on when
@@ -817,7 +823,9 @@ bool PluginView::platformStart()
#endif
} else {
setPlatformWidget(0);
+#if defined(XP_UNIX)
m_pluginDisplay = getPluginDisplay();
+#endif
}
show();
diff --git a/Source/WebCore/plugins/npapi.cpp b/Source/WebCore/plugins/npapi.cpp
index bc64901..fe27d0f 100644
--- a/Source/WebCore/plugins/npapi.cpp
+++ b/Source/WebCore/plugins/npapi.cpp
@@ -171,9 +171,11 @@ void NPN_PopPopupsEnabledState(NPP instance)
pluginViewForInstance(instance)->popPopupsEnabledState();
}
-void NPN_PluginThreadAsyncCall(NPP instance, void (*func) (void *), void *userData)
+extern "C" typedef void PluginThreadAsyncCallFunction(void*);
+void NPN_PluginThreadAsyncCall(NPP instance, PluginThreadAsyncCallFunction func, void* userData)
{
- PluginMainThreadScheduler::scheduler().scheduleCall(instance, func, userData);
+ // Callback function type only differs from MainThreadFunction by being extern "C", which doesn't affect calling convention on any compilers we use.
+ PluginMainThreadScheduler::scheduler().scheduleCall(instance, reinterpret_cast<PluginMainThreadScheduler::MainThreadFunction*>(func), userData);
}
NPError NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char* url, char** value, uint32_t* len)
diff --git a/Source/WebCore/plugins/qt/PluginViewQt.cpp b/Source/WebCore/plugins/qt/PluginViewQt.cpp
index dcb805a..f39da85 100644
--- a/Source/WebCore/plugins/qt/PluginViewQt.cpp
+++ b/Source/WebCore/plugins/qt/PluginViewQt.cpp
@@ -182,7 +182,7 @@ void PluginView::updatePluginWidget()
// Note that we don't invalidate the frameRect() here. This is because QWebFrame::renderRelativeCoords()
// imitates ScrollView and adds the scroll offset back on to the rect we damage here (making the co-ordinates absolute
// to the frame again) before passing it to FrameView.
- frameView->invalidateRect(m_windowRect);
+ invalidate();
}
}
@@ -812,8 +812,12 @@ void PluginView::invalidateRect(const IntRect& rect)
#endif
if (m_isWindowed) {
- if (platformWidget())
+ if (platformWidget()) {
+ // update() will schedule a repaint of the widget so ensure
+ // its knowledge of its position on the page is up to date.
+ platformWidget()->setGeometry(m_windowRect);
platformWidget()->update(rect);
+ }
return;
}
diff --git a/Source/WebCore/plugins/symbian/PluginViewSymbian.cpp b/Source/WebCore/plugins/symbian/PluginViewSymbian.cpp
index 1a9a9ca..13aa60f 100644
--- a/Source/WebCore/plugins/symbian/PluginViewSymbian.cpp
+++ b/Source/WebCore/plugins/symbian/PluginViewSymbian.cpp
@@ -102,12 +102,7 @@ void PluginView::updatePluginWidget()
if (m_windowRect == oldWindowRect && m_clipRect == oldClipRect)
return;
- // in order to move/resize the plugin window at the same time as the rest of frame
- // during e.g. scrolling, we set the mask and geometry in the paint() function, but
- // as paint() isn't called when the plugin window is outside the frame which can
- // be caused by a scroll, we need to move/resize immediately.
- if (!m_windowRect.intersects(frameView->frameRect()))
- setNPWindowIfNeeded();
+ setNPWindowIfNeeded();
}
void PluginView::setFocus(bool focused)
diff --git a/Source/WebCore/plugins/win/PluginViewWin.cpp b/Source/WebCore/plugins/win/PluginViewWin.cpp
index f575709..2723c2c 100644
--- a/Source/WebCore/plugins/win/PluginViewWin.cpp
+++ b/Source/WebCore/plugins/win/PluginViewWin.cpp
@@ -82,7 +82,7 @@
#define LOG_PLUGIN_NET_ERROR()
#endif
-#if PLATFORM(CAIRO)
+#if USE(CAIRO)
#include "PlatformContextCairo.h"
#include <cairo-win32.h>
#endif
@@ -569,7 +569,7 @@ void PluginView::paintWindowedPluginIntoContext(GraphicsContext* context, const
LocalWindowsContext windowsContext(context, frameRect(), false);
-#if PLATFORM(CAIRO)
+#if USE(CAIRO)
// Must flush drawings up to this point to the backing metafile, otherwise the
// plugin region will be overwritten with any clear regions specified in the
// cairo-controlled portions of the rendering.