summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp')
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp39
1 files changed, 35 insertions, 4 deletions
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
index 7e9b059..7d00219 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
@@ -64,6 +64,7 @@ NetscapePlugin::NetscapePlugin(PassRefPtr<NetscapePluginModule> pluginModule)
#else
, m_isWindowed(true)
#endif
+ , m_isTransparent(false)
, m_inNPPNew(false)
, m_loadManually(false)
#if PLATFORM(MAC)
@@ -75,20 +76,23 @@ NetscapePlugin::NetscapePlugin(PassRefPtr<NetscapePluginModule> pluginModule)
#ifndef NP_NO_CARBON
, m_nullEventTimer(RunLoop::main(), this, &NetscapePlugin::nullEventTimerFired)
, m_npCGContext()
-#endif
+#endif
+#elif PLUGIN_ARCHITECTURE(X11)
+ , m_drawable(0)
+ , m_pluginDisplay(0)
#endif
{
m_npp.ndata = this;
m_npp.pdata = 0;
- m_pluginModule->pluginCreated();
+ m_pluginModule->incrementLoadCount();
}
NetscapePlugin::~NetscapePlugin()
{
ASSERT(!m_isStarted);
- m_pluginModule->pluginDestroyed();
+ m_pluginModule->decrementLoadCount();
}
PassRefPtr<NetscapePlugin> NetscapePlugin::fromNPP(NPP npp)
@@ -189,6 +193,11 @@ void NetscapePlugin::setIsWindowed(bool isWindowed)
m_isWindowed = isWindowed;
}
+void NetscapePlugin::setIsTransparent(bool isTransparent)
+{
+ m_isTransparent = isTransparent;
+}
+
void NetscapePlugin::setStatusbarText(const String& statusbarText)
{
m_pluginController->setStatusbarText(statusbarText);
@@ -347,8 +356,14 @@ NPError NetscapePlugin::NPP_SetValue(NPNVariable variable, void *value)
void NetscapePlugin::callSetWindow()
{
+#if PLUGIN_ARCHITECTURE(X11)
+ // We use a backing store as the painting area for the plugin.
+ m_npWindow.x = 0;
+ m_npWindow.y = 0;
+#else
m_npWindow.x = m_frameRect.x();
m_npWindow.y = m_frameRect.y();
+#endif
m_npWindow.width = m_frameRect.width();
m_npWindow.height = m_frameRect.height();
m_npWindow.clipRect.top = m_clipRect.y();
@@ -427,6 +442,17 @@ bool NetscapePlugin::initialize(PluginController* pluginController, const Parame
values.append(paramValues[i].data());
}
+#if PLATFORM(MAC)
+ if (m_pluginModule->pluginQuirks().contains(PluginQuirks::MakeTransparentIfBackgroundAttributeExists)) {
+ for (size_t i = 0; i < parameters.names.size(); ++i) {
+ if (equalIgnoringCase(parameters.names[i], "background")) {
+ setIsTransparent(true);
+ break;
+ }
+ }
+ }
+#endif
+
NetscapePlugin* previousNPPNewPlugin = currentNPPNewPlugin;
m_inNPPNew = true;
@@ -487,7 +513,7 @@ PassRefPtr<ShareableBitmap> NetscapePlugin::snapshot()
ASSERT(m_isStarted);
- RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(m_frameRect.size());
+ RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(m_frameRect.size(), ShareableBitmap::SupportsAlpha);
OwnPtr<GraphicsContext> context = bitmap->createGraphicsContext();
context->translate(-m_frameRect.x(), -m_frameRect.y());
@@ -497,6 +523,11 @@ PassRefPtr<ShareableBitmap> NetscapePlugin::snapshot()
return bitmap.release();
}
+bool NetscapePlugin::isTransparent()
+{
+ return m_isTransparent;
+}
+
void NetscapePlugin::geometryDidChange(const IntRect& frameRect, const IntRect& clipRect)
{
ASSERT(m_isStarted);