summaryrefslogtreecommitdiffstats
path: root/WebCore/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/plugins')
-rw-r--r--WebCore/plugins/DOMMimeType.cpp2
-rw-r--r--WebCore/plugins/PluginDebug.cpp8
-rw-r--r--WebCore/plugins/PluginDebug.h1
-rw-r--r--WebCore/plugins/PluginPackage.cpp12
-rw-r--r--WebCore/plugins/PluginQuirkSet.h3
-rw-r--r--WebCore/plugins/PluginStream.cpp4
-rw-r--r--WebCore/plugins/PluginView.cpp121
-rw-r--r--WebCore/plugins/PluginView.h29
-rw-r--r--WebCore/plugins/PluginViewBase.h3
-rw-r--r--WebCore/plugins/gtk/PluginViewGtk.cpp108
-rw-r--r--WebCore/plugins/gtk/gtk2xtbin.c24
-rw-r--r--WebCore/plugins/mac/PluginViewMac.mm8
-rw-r--r--WebCore/plugins/npapi.cpp17
-rw-r--r--WebCore/plugins/qt/PluginViewQt.cpp149
-rw-r--r--WebCore/plugins/symbian/PluginViewSymbian.cpp4
15 files changed, 355 insertions, 138 deletions
diff --git a/WebCore/plugins/DOMMimeType.cpp b/WebCore/plugins/DOMMimeType.cpp
index e1fa7f1..e799314 100644
--- a/WebCore/plugins/DOMMimeType.cpp
+++ b/WebCore/plugins/DOMMimeType.cpp
@@ -25,7 +25,7 @@
#include "Page.h"
#include "PluginData.h"
#include "Settings.h"
-#include "StringBuilder.h"
+#include <wtf/text/StringBuilder.h>
namespace WebCore {
diff --git a/WebCore/plugins/PluginDebug.cpp b/WebCore/plugins/PluginDebug.cpp
index ace8b21..8c3efcb 100644
--- a/WebCore/plugins/PluginDebug.cpp
+++ b/WebCore/plugins/PluginDebug.cpp
@@ -163,6 +163,14 @@ CString prettyNameForNPPVariable(NPPVariable variable, void* value)
}
}
+CString prettyNameForNPNURLVariable(NPNURLVariable variable)
+{
+ switch (variable) {
+ case NPNURLVCookie: return "NPNURLVCookie";
+ case NPNURLVProxy: return "NPNURLVProxy";
+ default: return "Unknown variable";
+ }
+}
} // namespace WebCore
#endif // !LOG_DISABLED
diff --git a/WebCore/plugins/PluginDebug.h b/WebCore/plugins/PluginDebug.h
index 254864f..017e686 100644
--- a/WebCore/plugins/PluginDebug.h
+++ b/WebCore/plugins/PluginDebug.h
@@ -41,6 +41,7 @@ const char* prettyNameForNPError(NPError error);
CString prettyNameForNPNVariable(NPNVariable variable);
CString prettyNameForNPPVariable(NPPVariable variable, void* value);
+CString prettyNameForNPNURLVariable(NPNURLVariable variable);
#ifdef XP_MACOSX
const char* prettyNameForDrawingModel(NPDrawingModel drawingModel);
diff --git a/WebCore/plugins/PluginPackage.cpp b/WebCore/plugins/PluginPackage.cpp
index bb25312..2e0308b 100644
--- a/WebCore/plugins/PluginPackage.cpp
+++ b/WebCore/plugins/PluginPackage.cpp
@@ -206,9 +206,14 @@ void PluginPackage::determineQuirks(const String& mimeType)
m_quirks.add(PluginQuirkWantsMozillaUserAgent);
}
-#if PLATFORM(QT) && CPU(X86)
- // 32-bit Flash will crash on repeated calls to SetWindow in windowed mode
+#if PLATFORM(QT)
+ // Flash will crash on repeated calls to SetWindow in windowed mode
m_quirks.add(PluginQuirkDontCallSetWindowMoreThanOnce);
+
+#if CPU(X86_64)
+ // 64-bit Flash freezes if right-click is sent in windowless mode
+ m_quirks.add(PluginQuirkIgnoreRightClickInWindowlessMode);
+#endif
#endif
m_quirks.add(PluginQuirkRequiresDefaultScreenDepth);
@@ -329,6 +334,9 @@ void PluginPackage::initializeBrowserFuncs()
m_browserFuncs.setexception = _NPN_SetException;
m_browserFuncs.enumerate = _NPN_Enumerate;
m_browserFuncs.construct = _NPN_Construct;
+ m_browserFuncs.getvalueforurl = NPN_GetValueForURL;
+ m_browserFuncs.setvalueforurl = NPN_SetValueForURL;
+ m_browserFuncs.getauthenticationinfo = NPN_GetAuthenticationInfo;
}
#endif
diff --git a/WebCore/plugins/PluginQuirkSet.h b/WebCore/plugins/PluginQuirkSet.h
index 7f52f6a..1a684fe 100644
--- a/WebCore/plugins/PluginQuirkSet.h
+++ b/WebCore/plugins/PluginQuirkSet.h
@@ -47,7 +47,8 @@ namespace WebCore {
PluginQuirkDontAllowMultipleInstances = 1 << 11,
PluginQuirkRequiresGtkToolKit = 1 << 12,
PluginQuirkRequiresDefaultScreenDepth = 1 << 13,
- PluginQuirkDontCallSetWindowMoreThanOnce = 1 << 14
+ PluginQuirkDontCallSetWindowMoreThanOnce = 1 << 14,
+ PluginQuirkIgnoreRightClickInWindowlessMode = 1 << 15
};
class PluginQuirkSet {
diff --git a/WebCore/plugins/PluginStream.cpp b/WebCore/plugins/PluginStream.cpp
index 8d7a561..a6486c9 100644
--- a/WebCore/plugins/PluginStream.cpp
+++ b/WebCore/plugins/PluginStream.cpp
@@ -35,6 +35,7 @@
#include "SubresourceLoader.h"
#include <StringExtras.h>
#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
// We use -2 here because some plugins like to return -1 to indicate error
// and this way we won't clash with them.
@@ -145,8 +146,7 @@ void PluginStream::startStream()
Vector<UChar> stringBuilder;
String separator(": ");
- String statusLine = String::format("HTTP %d OK\n", m_resourceResponse.httpStatusCode());
-
+ String statusLine = makeString("HTTP ", String::number(m_resourceResponse.httpStatusCode()), " OK\n");
stringBuilder.append(statusLine.characters(), statusLine.length());
HTTPHeaderMap::const_iterator end = m_resourceResponse.httpHeaderFields().end();
diff --git a/WebCore/plugins/PluginView.cpp b/WebCore/plugins/PluginView.cpp
index 2522e0f..ef35579 100644
--- a/WebCore/plugins/PluginView.cpp
+++ b/WebCore/plugins/PluginView.cpp
@@ -32,6 +32,7 @@
#include "Bridge.h"
#endif
#include "Chrome.h"
+#include "CookieJar.h"
#include "Document.h"
#include "DocumentLoader.h"
#include "Element.h"
@@ -55,6 +56,7 @@
#include "PluginDebug.h"
#include "PluginMainThreadScheduler.h"
#include "PluginPackage.h"
+#include "ProxyServer.h"
#include "RenderBox.h"
#include "RenderObject.h"
#include "ScriptController.h"
@@ -184,9 +186,9 @@ void PluginView::handleEvent(Event* event)
handleFocusEvent(true);
#endif
#if defined(XP_UNIX) && ENABLE(NETSCAPE_PLUGIN_API)
- else if (event->type() == eventNames().DOMFocusOutEvent || event->type() == eventNames().focusoutEvent)
+ else if (event->type() == eventNames().focusoutEvent)
handleFocusOutEvent();
- else if (event->type() == eventNames().DOMFocusInEvent || event->type() == eventNames().focusinEvent)
+ else if (event->type() == eventNames().focusinEvent)
handleFocusInEvent();
#endif
}
@@ -1337,7 +1339,7 @@ void PluginView::paintMissingPluginIcon(GraphicsContext* context, const IntRect&
context->save();
context->clip(windowClipRect());
- context->drawImage(nullPluginImage.get(), DeviceColorSpace, imageRect.location());
+ context->drawImage(nullPluginImage.get(), ColorSpaceDeviceRGB, imageRect.location());
context->restore();
}
@@ -1481,6 +1483,119 @@ NPError PluginView::getValue(NPNVariable variable, void* value)
return NPERR_GENERIC_ERROR;
}
}
+
+static Frame* getFrame(Frame* parentFrame, Element* element)
+{
+ if (parentFrame)
+ return parentFrame;
+
+ Document* document = element->document();
+ if (!document)
+ document = element->ownerDocument();
+ if (document)
+ return document->frame();
+
+ return 0;
+}
+
+NPError PluginView::getValueForURL(NPNURLVariable variable, const char* url, char** value, uint32_t* len)
+{
+ LOG(Plugins, "PluginView::getValueForURL(%s)", prettyNameForNPNURLVariable(variable).data());
+
+ NPError result = NPERR_NO_ERROR;
+
+ switch (variable) {
+ case NPNURLVCookie: {
+ KURL u(m_baseURL, url);
+ if (u.isValid()) {
+ Frame* frame = getFrame(parentFrame(), m_element);
+ if (frame) {
+ const CString cookieStr = cookies(frame->document(), u).utf8();
+ if (!cookieStr.isNull()) {
+ const int size = cookieStr.length();
+ *value = static_cast<char*>(NPN_MemAlloc(size+1));
+ if (*value) {
+ memset(*value, 0, size+1);
+ memcpy(*value, cookieStr.data(), size+1);
+ if (len)
+ *len = size;
+ } else
+ result = NPERR_OUT_OF_MEMORY_ERROR;
+ }
+ }
+ } else
+ result = NPERR_INVALID_URL;
+ break;
+ }
+ case NPNURLVProxy: {
+ KURL u(m_baseURL, url);
+ if (u.isValid()) {
+ Frame* frame = getFrame(parentFrame(), m_element);
+ const FrameLoader* frameLoader = frame ? frame->loader() : 0;
+ const NetworkingContext* context = frameLoader ? frameLoader->networkingContext() : 0;
+ const CString proxyStr = toString(proxyServersForURL(u, context)).utf8();
+ if (!proxyStr.isNull()) {
+ const int size = proxyStr.length();
+ *value = static_cast<char*>(NPN_MemAlloc(size+1));
+ if (*value) {
+ memset(*value, 0, size+1);
+ memcpy(*value, proxyStr.data(), size+1);
+ if (len)
+ *len = size;
+ } else
+ result = NPERR_OUT_OF_MEMORY_ERROR;
+ }
+ } else
+ result = NPERR_INVALID_URL;
+ break;
+ }
+ default:
+ result = NPERR_GENERIC_ERROR;
+ LOG(Plugins, "PluginView::getValueForURL: %s", prettyNameForNPNURLVariable(variable).data());
+ break;
+ }
+
+ return result;
+}
+
+
+NPError PluginView::setValueForURL(NPNURLVariable variable, const char* url, const char* value, uint32_t len)
+{
+ LOG(Plugins, "PluginView::setValueForURL(%s)", prettyNameForNPNURLVariable(variable).data());
+
+ NPError result = NPERR_NO_ERROR;
+
+ switch (variable) {
+ case NPNURLVCookie: {
+ KURL u(m_baseURL, url);
+ if (u.isValid()) {
+ const String cookieStr = String::fromUTF8(value, len);
+ Frame* frame = getFrame(parentFrame(), m_element);
+ if (frame && !cookieStr.isEmpty())
+ setCookies(frame->document(), u, cookieStr);
+ } else
+ result = NPERR_INVALID_URL;
+ break;
+ }
+ case NPNURLVProxy:
+ LOG(Plugins, "PluginView::setValueForURL(%s): Plugins are NOT allowed to set proxy information.", prettyNameForNPNURLVariable(variable).data());
+ result = NPERR_GENERIC_ERROR;
+ break;
+ default:
+ LOG(Plugins, "PluginView::setValueForURL: %s", prettyNameForNPNURLVariable(variable).data());
+ result = NPERR_GENERIC_ERROR;
+ break;
+ }
+
+ return result;
+}
+
+NPError PluginView::getAuthenticationInfo(const char* protocol, const char* host, int32_t port, const char* scheme, const char* realm, char** username, uint32_t* ulen, char** password, uint32_t* plen)
+{
+ LOG(Plugins, "PluginView::getAuthenticationInfo: protocol=%s, host=%s, port=%d", protocol, host, port);
+ notImplemented();
+ return NPERR_GENERIC_ERROR;
+}
#endif
void PluginView::privateBrowsingStateChanged(bool privateBrowsingEnabled)
diff --git a/WebCore/plugins/PluginView.h b/WebCore/plugins/PluginView.h
index 3d4e13e..68325cd 100644
--- a/WebCore/plugins/PluginView.h
+++ b/WebCore/plugins/PluginView.h
@@ -32,9 +32,9 @@
#include "HaltablePlugin.h"
#include "IntRect.h"
#include "MediaCanStartListener.h"
+#include "PluginViewBase.h"
#include "ResourceRequest.h"
#include "Timer.h"
-#include "Widget.h"
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#include <wtf/OwnPtr.h>
@@ -65,7 +65,8 @@ typedef PlatformWidget PlatformPluginWidget;
#include <QPixmap>
#endif
#endif
-#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5)
+#if PLATFORM(QT)
+#include <QGraphicsItem>
#include <QImage>
class QPainter;
#endif
@@ -133,7 +134,7 @@ namespace WebCore {
virtual void didFail(const ResourceError&) = 0;
};
- class PluginView : public Widget
+ class PluginView : public PluginViewBase
#if ENABLE(NETSCAPE_PLUGIN_API)
, private PluginStreamClient
#endif
@@ -181,6 +182,9 @@ namespace WebCore {
NPError getValue(NPNVariable variable, void* value);
static NPError getValueStatic(NPNVariable variable, void* value);
NPError setValue(NPPVariable variable, void* value);
+ NPError getValueForURL(NPNURLVariable variable, const char* url, char** value, uint32_t* len);
+ NPError setValueForURL(NPNURLVariable variable, const char* url, const char* value, uint32_t len);
+ NPError getAuthenticationInfo(const char* protocol, const char* host, int32_t port, const char* scheme, const char* realm, char** username, uint32_t* ulen, char** password, uint32_t* plen);
void invalidateRect(NPRect*);
void invalidateRegion(NPRegion);
#endif
@@ -269,6 +273,14 @@ namespace WebCore {
#endif
void keepAlive();
+#if USE(ACCELERATED_COMPOSITING)
+#if defined(XP_UNIX) && ENABLE(NETSCAPE_PLUGIN_API) && PLATFORM(QT)
+ virtual PlatformLayer* platformLayer() const;
+#else
+ virtual PlatformLayer* platformLayer() const { return 0; }
+#endif
+#endif
+
private:
PluginView(Frame* parentFrame, const IntSize&, PluginPackage*, Element*, const KURL&, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually);
@@ -448,11 +460,20 @@ private:
void initXEvent(XEvent* event);
#endif
-#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5)
+#if PLATFORM(QT)
+#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5)
QImage m_image;
bool m_renderToImage;
void paintUsingImageSurfaceExtension(QPainter* painter, const IntRect& exposedRect);
#endif
+#if defined(XP_UNIX) && ENABLE(NETSCAPE_PLUGIN_API)
+ void paintUsingXPixmap(QPainter* painter, const QRect &exposedRect);
+#if USE(ACCELERATED_COMPOSITING)
+ OwnPtr<PlatformLayer> m_platformLayer;
+ friend class PluginGraphicsLayerQt;
+#endif // USE(ACCELERATED_COMPOSITING)
+#endif
+#endif // PLATFORM(QT)
IntRect m_clipRect; // The clip rect to apply to a windowed plug-in
IntRect m_windowRect; // Our window rect.
diff --git a/WebCore/plugins/PluginViewBase.h b/WebCore/plugins/PluginViewBase.h
index 4e5fe1a..8dc667a 100644
--- a/WebCore/plugins/PluginViewBase.h
+++ b/WebCore/plugins/PluginViewBase.h
@@ -45,9 +45,10 @@ public:
#endif
virtual JSC::JSObject* scriptObject(JSC::JSGlobalObject*) { return 0; }
+ virtual void privateBrowsingStateChanged(bool) { }
protected:
- PluginViewBase(PlatformWidget widget) : Widget(widget) { }
+ PluginViewBase(PlatformWidget widget = 0) : Widget(widget) { }
private:
virtual bool isPluginViewBase() const { return true; }
diff --git a/WebCore/plugins/gtk/PluginViewGtk.cpp b/WebCore/plugins/gtk/PluginViewGtk.cpp
index bee7821..6954af3 100644
--- a/WebCore/plugins/gtk/PluginViewGtk.cpp
+++ b/WebCore/plugins/gtk/PluginViewGtk.cpp
@@ -137,13 +137,14 @@ void PluginView::updatePluginWidget()
#if defined(XP_UNIX)
if (!m_isWindowed) {
+ Display* display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
if (m_drawable)
- XFreePixmap(GDK_DISPLAY(), m_drawable);
+ XFreePixmap(display, m_drawable);
- m_drawable = XCreatePixmap(GDK_DISPLAY(), getRootWindow(m_parentFrame.get()),
+ m_drawable = XCreatePixmap(display, getRootWindow(m_parentFrame.get()),
m_windowRect.width(), m_windowRect.height(),
((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth);
- XSync(GDK_DISPLAY(), false); // make sure that the server knows about the Drawable
+ XSync(display, false); // make sure that the server knows about the Drawable
}
#endif
@@ -187,75 +188,48 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect)
if (!m_drawable)
return;
- const bool syncX = m_pluginDisplay && m_pluginDisplay != GDK_DISPLAY();
+ Display* display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
+ const bool syncX = m_pluginDisplay && m_pluginDisplay != display;
IntRect exposedRect(rect);
exposedRect.intersect(frameRect());
exposedRect.move(-frameRect().x(), -frameRect().y());
- Window dummyW;
- int dummyI;
- unsigned int dummyUI, actualDepth = 0;
- XGetGeometry(GDK_DISPLAY(), m_drawable, &dummyW, &dummyI, &dummyI,
- &dummyUI, &dummyUI, &dummyUI, &actualDepth);
-
- const unsigned int drawableDepth = ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth;
- ASSERT(drawableDepth == actualDepth);
-
- cairo_surface_t* drawableSurface = cairo_xlib_surface_create(GDK_DISPLAY(),
- m_drawable,
- m_visual,
- m_windowRect.width(),
- m_windowRect.height());
-
- if (m_isTransparent && drawableDepth != 32) {
- // Attempt to fake it when we don't have an alpha channel on our
- // pixmap. If that's not possible, at least clear the window to
- // avoid drawing artifacts.
- GtkWidget* widget = m_parentFrame->view()->hostWindow()->platformPageClient();
- GdkDrawable* gdkBackingStore = 0;
- gint xoff = 0, yoff = 0;
-
- gdk_window_get_internal_paint_info(gtk_widget_get_window(widget), &gdkBackingStore, &xoff, &yoff);
-
- GC gc = XDefaultGC(GDK_DISPLAY(), gdk_screen_get_number(gdk_screen_get_default()));
- if (gdkBackingStore) {
- XCopyArea(GDK_DISPLAY(), GDK_DRAWABLE_XID(gdkBackingStore), m_drawable, gc,
- m_windowRect.x() + exposedRect.x() - xoff,
- m_windowRect.y() + exposedRect.y() - yoff,
- exposedRect.width(), exposedRect.height(),
- exposedRect.x(), exposedRect.y());
- } else {
- // no valid backing store; clear to the background color
- XFillRectangle(GDK_DISPLAY(), m_drawable, gc,
- exposedRect.x(), exposedRect.y(),
- exposedRect.width(), exposedRect.height());
- }
- } else if (m_isTransparent) {
+ PlatformRefPtr<cairo_surface_t> drawableSurface = adoptPlatformRef(cairo_xlib_surface_create(display,
+ m_drawable,
+ m_visual,
+ m_windowRect.width(),
+ m_windowRect.height()));
+
+ if (m_isTransparent) {
// If we have a 32 bit drawable and the plugin wants transparency,
// we'll clear the exposed area to transparent first. Otherwise,
// we'd end up with junk in there from the last paint, or, worse,
// uninitialized data.
- cairo_t* crFill = cairo_create(drawableSurface);
+ PlatformRefPtr<cairo_t> cr = adoptPlatformRef(cairo_create(drawableSurface.get()));
- cairo_set_operator(crFill, CAIRO_OPERATOR_SOURCE);
- cairo_pattern_t* fill = cairo_pattern_create_rgba(0., 0., 0., 0.);
- cairo_set_source(crFill, fill);
+ if (!(cairo_surface_get_content(drawableSurface.get()) & CAIRO_CONTENT_ALPHA)) {
+ // Attempt to fake it when we don't have an alpha channel on our
+ // pixmap. If that's not possible, at least clear the window to
+ // avoid drawing artifacts.
- cairo_rectangle(crFill, exposedRect.x(), exposedRect.y(),
- exposedRect.width(), exposedRect.height());
- cairo_clip(crFill);
- cairo_paint(crFill);
+ // This Would not work without double buffering, but we always use it.
+ cairo_set_source_surface(cr.get(), cairo_get_group_target(context->platformContext()),
+ -m_windowRect.x(), -m_windowRect.y());
+ cairo_set_operator(cr.get(), CAIRO_OPERATOR_SOURCE);
+ } else
+ cairo_set_operator(cr.get(), CAIRO_OPERATOR_CLEAR);
- cairo_destroy(crFill);
- cairo_pattern_destroy(fill);
+ cairo_rectangle(cr.get(), exposedRect.x(), exposedRect.y(),
+ exposedRect.width(), exposedRect.height());
+ cairo_fill(cr.get());
}
XEvent xevent;
memset(&xevent, 0, sizeof(XEvent));
XGraphicsExposeEvent& exposeEvent = xevent.xgraphicsexpose;
exposeEvent.type = GraphicsExpose;
- exposeEvent.display = GDK_DISPLAY();
+ exposeEvent.display = display;
exposeEvent.drawable = m_drawable;
exposeEvent.x = exposedRect.x();
exposeEvent.y = exposedRect.y();
@@ -270,7 +244,7 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect)
cairo_t* cr = context->platformContext();
cairo_save(cr);
- cairo_set_source_surface(cr, drawableSurface, frameRect().x(), frameRect().y());
+ cairo_set_source_surface(cr, drawableSurface.get(), frameRect().x(), frameRect().y());
cairo_rectangle(cr,
frameRect().x() + exposedRect.x(), frameRect().y() + exposedRect.y(),
@@ -284,7 +258,6 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect)
cairo_paint(cr);
cairo_restore(cr);
- cairo_surface_destroy(drawableSurface);
#endif // defined(XP_UNIX)
}
@@ -346,7 +319,7 @@ void PluginView::initXEvent(XEvent* xEvent)
xEvent->xany.serial = 0; // we are unaware of the last request processed by X Server
xEvent->xany.send_event = false;
- xEvent->xany.display = GDK_DISPLAY();
+ xEvent->xany.display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
// NOTE: event->xany.window doesn't always correspond to the .window property of other XEvent's
// but does in the case of KeyPress, KeyRelease, ButtonPress, ButtonRelease, and MotionNotify
// events; thus, this is right:
@@ -637,7 +610,7 @@ bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* re
case NPNVxDisplay:
#if defined(XP_UNIX)
if (m_needsXEmbed)
- *(void **)value = (void *)GDK_DISPLAY();
+ *(void **)value = (void *)GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
else
*(void **)value = (void *)GTK_XTBIN(platformPluginWidget())->xtclient.xtdisplay;
*result = NPERR_NO_ERROR;
@@ -732,8 +705,9 @@ static void getVisualAndColormap(int depth, Visual** visual, Colormap* colormap)
*visual = 0;
*colormap = 0;
+ Display* display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
int rmaj, rmin;
- if (depth == 32 && (!XRenderQueryVersion(GDK_DISPLAY(), &rmaj, &rmin) || (rmaj == 0 && rmin < 5)))
+ if (depth == 32 && (!XRenderQueryVersion(display, &rmaj, &rmin) || (rmaj == 0 && rmin < 5)))
return;
XVisualInfo templ;
@@ -741,14 +715,14 @@ static void getVisualAndColormap(int depth, Visual** visual, Colormap* colormap)
templ.depth = depth;
templ.c_class = TrueColor;
int nVisuals;
- XVisualInfo* visualInfo = XGetVisualInfo(GDK_DISPLAY(), VisualScreenMask | VisualDepthMask | VisualClassMask, &templ, &nVisuals);
+ XVisualInfo* visualInfo = XGetVisualInfo(display, VisualScreenMask | VisualDepthMask | VisualClassMask, &templ, &nVisuals);
if (!nVisuals)
return;
if (depth == 32) {
for (int idx = 0; idx < nVisuals; ++idx) {
- XRenderPictFormat* format = XRenderFindVisualFormat(GDK_DISPLAY(), visualInfo[idx].visual);
+ XRenderPictFormat* format = XRenderFindVisualFormat(display, visualInfo[idx].visual);
if (format->type == PictTypeDirect && format->direct.alphaMask) {
*visual = visualInfo[idx].visual;
break;
@@ -760,7 +734,7 @@ static void getVisualAndColormap(int depth, Visual** visual, Colormap* colormap)
XFree(visualInfo);
if (*visual)
- *colormap = XCreateColormap(GDK_DISPLAY(), GDK_ROOT_WINDOW(), *visual, AllocNone);
+ *colormap = XCreateColormap(display, GDK_ROOT_WINDOW(), *visual, AllocNone);
}
#endif
@@ -842,9 +816,9 @@ bool PluginView::platformStart()
m_npWindow.window = (void*)gtk_socket_get_id(GTK_SOCKET(platformPluginWidget()));
GdkWindow* window = gtk_widget_get_window(widget);
ws->display = GDK_WINDOW_XDISPLAY(window);
- ws->visual = GDK_VISUAL_XVISUAL(gdk_drawable_get_visual(GDK_DRAWABLE(window)));
- ws->depth = gdk_visual_get_depth(gdk_drawable_get_visual(GDK_DRAWABLE(window)));
- ws->colormap = GDK_COLORMAP_XCOLORMAP(gdk_drawable_get_colormap(GDK_DRAWABLE(window)));
+ ws->visual = GDK_VISUAL_XVISUAL(gdk_window_get_visual(window));
+ ws->depth = gdk_visual_get_depth(gdk_window_get_visual(window));
+ ws->colormap = XCreateColormap(ws->display, GDK_ROOT_WINDOW(), ws->visual, AllocNone);
} else {
m_npWindow.window = (void*)GTK_XTBIN(platformPluginWidget())->xtwindow;
ws->display = GTK_XTBIN(platformPluginWidget())->xtdisplay;
@@ -874,7 +848,7 @@ bool PluginView::platformStart()
ws->depth = gdk_visual_get_depth(gvisual);
}
- ws->display = GDK_DISPLAY();
+ ws->display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
ws->visual = m_visual;
ws->colormap = m_colormap;
@@ -904,7 +878,7 @@ void PluginView::platformDestroy()
{
#if defined(XP_UNIX)
if (m_drawable) {
- XFreePixmap(GDK_DISPLAY(), m_drawable);
+ XFreePixmap(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), m_drawable);
m_drawable = 0;
}
#endif
diff --git a/WebCore/plugins/gtk/gtk2xtbin.c b/WebCore/plugins/gtk/gtk2xtbin.c
index a0808d9..31c564f 100644
--- a/WebCore/plugins/gtk/gtk2xtbin.c
+++ b/WebCore/plugins/gtk/gtk2xtbin.c
@@ -72,7 +72,7 @@ static void gtk_xtbin_class_init (GtkXtBinClass *klass);
static void gtk_xtbin_init (GtkXtBin *xtbin);
static void gtk_xtbin_realize (GtkWidget *widget);
static void gtk_xtbin_unrealize (GtkWidget *widget);
-static void gtk_xtbin_destroy (GtkObject *object);
+static void gtk_xtbin_dispose (GObject *object);
/* Xt aware XEmbed */
static void xt_client_init (XtClient * xtclient,
@@ -244,7 +244,7 @@ static void
gtk_xtbin_class_init (GtkXtBinClass *klass)
{
GtkWidgetClass *widget_class;
- GtkObjectClass *object_class;
+ GObjectClass *object_class;
parent_class = g_type_class_peek_parent (klass);
@@ -252,8 +252,8 @@ gtk_xtbin_class_init (GtkXtBinClass *klass)
widget_class->realize = gtk_xtbin_realize;
widget_class->unrealize = gtk_xtbin_unrealize;
- object_class = GTK_OBJECT_CLASS (klass);
- object_class->destroy = gtk_xtbin_destroy;
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->dispose = gtk_xtbin_dispose;
}
static void
@@ -326,8 +326,9 @@ gtk_xtbin_new (GdkWindow *parent_window, String * f)
{
GtkXtBin *xtbin;
gpointer user_data;
+ GdkScreen *screen;
GdkVisual* visual;
- GdkColormap* colormap;
+ Colormap colormap;
assert(parent_window != NULL);
xtbin = g_object_new (GTK_TYPE_XTBIN, NULL);
@@ -341,12 +342,15 @@ gtk_xtbin_new (GdkWindow *parent_window, String * f)
/* Initialize the Xt toolkit */
xtbin->parent_window = parent_window;
- visual = gtk_widget_get_default_visual();
- colormap = gtk_widget_get_default_colormap();
+ screen = gtk_widget_get_screen(GTK_WIDGET(parent_window));
+ visual = gdk_screen_get_system_visual(screen);
+ colormap = XCreateColormap(GDK_DISPLAY_XDISPLAY(gdk_screen_get_display(screen)),
+ GDK_WINDOW_XWINDOW(gdk_screen_get_root_window(screen)),
+ GDK_VISUAL_XVISUAL(visual), AllocNone);
xt_client_init(&(xtbin->xtclient),
GDK_VISUAL_XVISUAL(visual),
- GDK_COLORMAP_XCOLORMAP(colormap),
+ colormap,
gdk_visual_get_depth(visual));
if (!xtbin->xtclient.xtdisplay) {
@@ -480,7 +484,7 @@ gtk_xtbin_unrealize (GtkWidget *object)
}
static void
-gtk_xtbin_destroy (GtkObject *object)
+gtk_xtbin_dispose (GObject *object)
{
GtkXtBin *xtbin;
@@ -514,7 +518,7 @@ gtk_xtbin_destroy (GtkObject *object)
}
}
- GTK_OBJECT_CLASS(parent_class)->destroy(object);
+ G_OBJECT_CLASS(parent_class)->dispose(object);
}
/*
diff --git a/WebCore/plugins/mac/PluginViewMac.mm b/WebCore/plugins/mac/PluginViewMac.mm
index e0ad135..aef9420 100644
--- a/WebCore/plugins/mac/PluginViewMac.mm
+++ b/WebCore/plugins/mac/PluginViewMac.mm
@@ -359,7 +359,7 @@ void PluginView::setFocus(bool focused)
#ifndef NP_NO_CARBON
EventRecord record;
- record.what = getFocusEvent;
+ record.what = NPEventType_GetFocusEvent;
record.message = 0;
record.when = TickCount();
record.where = globalMousePosForPlugin();
@@ -576,9 +576,9 @@ void PluginView::handleMouseEvent(MouseEvent* event)
m_lastMousePos = mousePosForPlugin(event);
return;
} else if (event->type() == eventNames().mouseoverEvent) {
- record.what = adjustCursorEvent;
+ record.what = NPEventType_AdjustCursorEvent;
} else if (event->type() == eventNames().mouseoutEvent) {
- record.what = adjustCursorEvent;
+ record.what = NPEventType_AdjustCursorEvent;
} else if (event->type() == eventNames().mousedownEvent) {
record.what = mouseDown;
// The plugin needs focus to receive keyboard events
@@ -600,7 +600,7 @@ void PluginView::handleMouseEvent(MouseEvent* event)
record.modifiers |= controlKey;
if (!dispatchNPEvent(record)) {
- if (record.what == adjustCursorEvent)
+ if (record.what == NPEventType_AdjustCursorEvent)
return; // Signals that the plugin wants a normal cursor
LOG(Events, "PluginView::handleMouseEvent(): Mouse event type %d at %d,%d not accepted",
diff --git a/WebCore/plugins/npapi.cpp b/WebCore/plugins/npapi.cpp
index 070c3ce..9d404b1 100644
--- a/WebCore/plugins/npapi.cpp
+++ b/WebCore/plugins/npapi.cpp
@@ -176,6 +176,7 @@ void NPN_PluginThreadAsyncCall(NPP instance, void (*func) (void *), void *userDa
PluginMainThreadScheduler::scheduler().scheduleCall(instance, func, userData);
}
+<<<<<<< HEAD
#ifdef PLUGIN_SCHEDULE_TIMER
uint32_t NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat,
void (*timerFunc)(NPP npp, uint32_t timerID))
@@ -191,3 +192,19 @@ void NPN_UnscheduleTimer(NPP instance, uint32_t timerID)
#endif
+=======
+NPError NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char* url, char** value, uint32_t* len)
+{
+ return pluginViewForInstance(instance)->getValueForURL(variable, url, value, len);
+}
+
+NPError NPN_SetValueForURL(NPP instance, NPNURLVariable variable, const char* url, const char* value, uint32_t len)
+{
+ return pluginViewForInstance(instance)->setValueForURL(variable, url, value, len);
+}
+
+NPError NPN_GetAuthenticationInfo(NPP instance, const char* protocol, const char* host, int32_t port, const char* scheme, const char* realm, char** username, uint32_t* ulen, char** password, uint32_t* plen)
+{
+ return pluginViewForInstance(instance)->getAuthenticationInfo(protocol, host, port, scheme, realm, username, ulen, password, plen);
+}
+>>>>>>> webkit.org at r70209
diff --git a/WebCore/plugins/qt/PluginViewQt.cpp b/WebCore/plugins/qt/PluginViewQt.cpp
index b7e1268..9b4e595 100644
--- a/WebCore/plugins/qt/PluginViewQt.cpp
+++ b/WebCore/plugins/qt/PluginViewQt.cpp
@@ -31,6 +31,8 @@
#if USE(JSC)
#include "Bridge.h"
#endif
+#include "Chrome.h"
+#include "ChromeClient.h"
#include "Document.h"
#include "DocumentLoader.h"
#include "Element.h"
@@ -69,8 +71,10 @@
#include <QApplication>
#include <QDesktopWidget>
+#include <QGraphicsWidget>
#include <QKeyEvent>
#include <QPainter>
+#include <QStyleOptionGraphicsItem>
#include <QWidget>
#include <QX11Info>
#include <X11/X.h>
@@ -96,6 +100,24 @@ namespace WebCore {
using namespace HTMLNames;
+#if USE(ACCELERATED_COMPOSITING)
+// Qt's GraphicsLayer (GraphicsLayerQt) requires layers to be QGraphicsWidgets
+class PluginGraphicsLayerQt : public QGraphicsWidget {
+public:
+ PluginGraphicsLayerQt(PluginView* view) : m_view(view) { }
+ ~PluginGraphicsLayerQt() { }
+
+ void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0)
+ {
+ Q_UNUSED(widget);
+ m_view->paintUsingXPixmap(painter, option->exposedRect.toRect());
+ }
+
+private:
+ PluginView* m_view;
+};
+#endif
+
void PluginView::updatePluginWidget()
{
if (!parent())
@@ -145,9 +167,11 @@ void PluginView::updatePluginWidget()
|| (QWebPagePrivate::drtRun && platformPluginWidget() && (m_windowRect != oldWindowRect || m_clipRect != oldClipRect)))
setNPWindowIfNeeded();
- // Make sure we get repainted afterwards. This is necessary for downward
- // scrolling to move the plugin widget properly.
- invalidate();
+ if (!m_platformLayer) {
+ // Make sure we get repainted afterwards. This is necessary for downward
+ // scrolling to move the plugin widget properly.
+ invalidate();
+ }
}
void PluginView::setFocus(bool focused)
@@ -237,40 +261,8 @@ void PluginView::paintUsingImageSurfaceExtension(QPainter* painter, const IntRec
}
#endif
-void PluginView::paint(GraphicsContext* context, const IntRect& rect)
+void PluginView::paintUsingXPixmap(QPainter* painter, const QRect &exposedRect)
{
- if (!m_isStarted) {
- paintMissingPluginIcon(context, rect);
- return;
- }
-
- if (context->paintingDisabled())
- return;
-
- setNPWindowIfNeeded();
-
- if (m_isWindowed)
- return;
-
- if (!m_drawable
-#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5)
- && m_image.isNull()
-#endif
- )
- return;
-
- QPainter* painter = context->platformContext();
- IntRect exposedRect(rect);
- exposedRect.intersect(frameRect());
- exposedRect.move(-frameRect().x(), -frameRect().y());
-
-#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5)
- if (!m_image.isNull()) {
- paintUsingImageSurfaceExtension(painter, exposedRect);
- return;
- }
-#endif
-
QPixmap qtDrawable = QPixmap::fromX11Pixmap(m_drawable, QPixmap::ExplicitlyShared);
const int drawableDepth = ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth;
ASSERT(drawableDepth == qtDrawable.depth());
@@ -328,8 +320,51 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect)
if (syncX)
XSync(m_pluginDisplay, false); // sync changes by plugin
- painter->drawPixmap(QPoint(frameRect().x() + exposedRect.x(), frameRect().y() + exposedRect.y()), qtDrawable,
- exposedRect);
+ painter->drawPixmap(QPoint(exposedRect.x(), exposedRect.y()), qtDrawable, exposedRect);
+}
+
+void PluginView::paint(GraphicsContext* context, const IntRect& rect)
+{
+ if (!m_isStarted) {
+ paintMissingPluginIcon(context, rect);
+ return;
+ }
+
+ if (context->paintingDisabled())
+ return;
+
+ setNPWindowIfNeeded();
+
+ if (m_isWindowed)
+ return;
+
+#if USE(ACCELERATED_COMPOSITING)
+ if (m_platformLayer)
+ return;
+#endif
+
+ if (!m_drawable
+#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5)
+ && m_image.isNull()
+#endif
+ )
+ return;
+
+ QPainter* painter = context->platformContext();
+ IntRect exposedRect(rect);
+ exposedRect.intersect(frameRect());
+ exposedRect.move(-frameRect().x(), -frameRect().y());
+
+#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5)
+ if (!m_image.isNull()) {
+ paintUsingImageSurfaceExtension(painter, exposedRect);
+ return;
+ }
+#endif
+
+ painter->translate(frameRect().x(), frameRect().y());
+ paintUsingXPixmap(painter, exposedRect);
+ painter->translate(-frameRect().x(), -frameRect().y());
}
// TODO: Unify across ports.
@@ -372,19 +407,21 @@ void PluginView::initXEvent(XEvent* xEvent)
void setXKeyEventSpecificFields(XEvent* xEvent, KeyboardEvent* event)
{
- QKeyEvent* qKeyEvent = event->keyEvent()->qtEvent();
+ const PlatformKeyboardEvent* keyEvent = event->keyEvent();
xEvent->type = (event->type() == eventNames().keydownEvent) ? 2 : 3; // ints as Qt unsets KeyPress and KeyRelease
xEvent->xkey.root = QX11Info::appRootWindow();
xEvent->xkey.subwindow = 0; // we have no child window
xEvent->xkey.time = event->timeStamp();
- xEvent->xkey.state = qKeyEvent->nativeModifiers();
- xEvent->xkey.keycode = qKeyEvent->nativeScanCode();
+ xEvent->xkey.state = keyEvent->nativeModifiers();
+ xEvent->xkey.keycode = keyEvent->nativeScanCode();
// We may not have a nativeScanCode() if the key event is from DRT's eventsender. In that
// case just populate the XEvent's keycode with the Qt platform-independent keycode. The only
// place this keycode will be used is in webkit_test_plugin_handle_event().
if (QWebPagePrivate::drtRun && !xEvent->xkey.keycode) {
+ QKeyEvent* qKeyEvent = keyEvent->qtEvent();
+ ASSERT(qKeyEvent);
if (!qKeyEvent->text().isEmpty())
xEvent->xkey.keycode = int(qKeyEvent->text().at(0).unicode() + qKeyEvent->modifiers());
else if (qKeyEvent->key() && (qKeyEvent->key() != Qt::Key_unknown))
@@ -499,6 +536,9 @@ void PluginView::handleMouseEvent(MouseEvent* event)
if (m_isWindowed)
return;
+ if (event->button() == RightButton && m_plugin->quirks().contains(PluginQuirkIgnoreRightClickInWindowlessMode))
+ return;
+
if (event->type() == eventNames().mousedownEvent) {
// Give focus to the plugin on click
if (Page* page = m_parentFrame->page())
@@ -744,6 +784,13 @@ bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* re
void PluginView::invalidateRect(const IntRect& rect)
{
+#if USE(ACCELERATED_COMPOSITING)
+ if (m_platformLayer) {
+ m_platformLayer->update(QRectF(rect));
+ return;
+ }
+#endif
+
if (m_isWindowed) {
if (platformWidget())
platformWidget()->update(rect);
@@ -760,11 +807,12 @@ void PluginView::invalidateRect(NPRect* rect)
return;
}
IntRect r(rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top);
- invalidateWindowlessPluginRect(r);
+ invalidateRect(r);
}
void PluginView::invalidateRegion(NPRegion region)
{
+ Q_UNUSED(region);
invalidate();
}
@@ -869,6 +917,16 @@ bool PluginView::platformStart()
} else {
setPlatformWidget(0);
m_pluginDisplay = getPluginDisplay();
+
+#if USE(ACCELERATED_COMPOSITING)
+ if (m_parentFrame->page()->chrome()->client()->allowsAcceleratedCompositing()
+ && m_parentFrame->page()->settings()
+ && m_parentFrame->page()->settings()->acceleratedCompositingEnabled()) {
+ m_platformLayer = new PluginGraphicsLayerQt(this);
+ // Trigger layer computation in RenderLayerCompositor
+ m_element->setNeedsStyleRecalc(SyntheticStyleChange);
+ }
+#endif
}
show();
@@ -942,5 +1000,12 @@ void PluginView::halt()
void PluginView::restart()
{
}
+
+#if USE(ACCELERATED_COMPOSITING)
+PlatformLayer* PluginView::platformLayer() const
+{
+ return m_platformLayer.get();
+}
+#endif
} // namespace WebCore
diff --git a/WebCore/plugins/symbian/PluginViewSymbian.cpp b/WebCore/plugins/symbian/PluginViewSymbian.cpp
index b9f82ad..b8a72b1 100644
--- a/WebCore/plugins/symbian/PluginViewSymbian.cpp
+++ b/WebCore/plugins/symbian/PluginViewSymbian.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+ Copyright (C) 2009, 2010 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
@@ -180,6 +180,7 @@ void PluginView::handleKeyboardEvent(KeyboardEvent* event)
if (m_isWindowed)
return;
+ ASSERT(event->keyEvent()->qtEvent());
QEvent& npEvent = *(event->keyEvent()->qtEvent());
if (!dispatchNPEvent(npEvent))
event->setDefaultHandled();
@@ -412,6 +413,7 @@ bool PluginView::platformStart()
m_npWindow.type = NPWindowTypeDrawable;
m_npWindow.window = 0; // Not used?
}
+ updatePluginWidget();
setNPWindowIfNeeded();
return true;