diff options
Diffstat (limited to 'Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp')
-rw-r--r-- | Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp index e746d5a..7e9b059 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp @@ -29,6 +29,7 @@ #include "NPRuntimeObjectMap.h" #include "NetscapePluginStream.h" #include "PluginController.h" +#include "ShareableBitmap.h" #include <WebCore/GraphicsContext.h> #include <WebCore/HTTPHeaderMap.h> #include <WebCore/IntRect.h> @@ -479,6 +480,23 @@ void NetscapePlugin::paint(GraphicsContext* context, const IntRect& dirtyRect) platformPaint(context, dirtyRect); } +PassRefPtr<ShareableBitmap> NetscapePlugin::snapshot() +{ + if (!supportsSnapshotting() || m_frameRect.isEmpty()) + return 0; + + ASSERT(m_isStarted); + + RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(m_frameRect.size()); + OwnPtr<GraphicsContext> context = bitmap->createGraphicsContext(); + + context->translate(-m_frameRect.x(), -m_frameRect.y()); + + platformPaint(context.get(), m_frameRect, true); + + return bitmap.release(); +} + void NetscapePlugin::geometryDidChange(const IntRect& frameRect, const IntRect& clipRect) { ASSERT(m_isStarted); @@ -672,6 +690,14 @@ void NetscapePlugin::privateBrowsingStateChanged(bool privateBrowsingEnabled) NPP_SetValue(NPNVprivateModeBool, &value); } +bool NetscapePlugin::supportsSnapshotting() const +{ +#if PLATFORM(MAC) + return m_pluginModule && m_pluginModule->pluginQuirks().contains(PluginQuirks::SupportsSnapshotting); +#endif + return false; +} + PluginController* NetscapePlugin::controller() { return m_pluginController; |