diff options
Diffstat (limited to 'WebCore/plugins')
-rw-r--r-- | WebCore/plugins/PluginDataNone.cpp (renamed from WebCore/plugins/wx/PluginDataWx.cpp) | 0 | ||||
-rw-r--r-- | WebCore/plugins/PluginDatabase.cpp | 10 | ||||
-rw-r--r-- | WebCore/plugins/PluginDatabase.h | 7 | ||||
-rw-r--r-- | WebCore/plugins/PluginPackage.cpp | 3 | ||||
-rw-r--r-- | WebCore/plugins/PluginPackageNone.cpp (renamed from WebCore/plugins/wx/PluginPackageWx.cpp) | 6 | ||||
-rw-r--r-- | WebCore/plugins/PluginView.cpp | 65 | ||||
-rw-r--r-- | WebCore/plugins/PluginView.h | 20 | ||||
-rw-r--r-- | WebCore/plugins/PluginViewNone.cpp (renamed from WebCore/plugins/wx/PluginViewWx.cpp) | 18 | ||||
-rw-r--r-- | WebCore/plugins/android/PluginClient.h | 44 | ||||
-rw-r--r-- | WebCore/plugins/android/PluginViewAndroid.cpp | 99 | ||||
-rw-r--r-- | WebCore/plugins/gtk/PluginPackageGtk.cpp | 2 | ||||
-rw-r--r-- | WebCore/plugins/gtk/PluginViewGtk.cpp | 117 | ||||
-rw-r--r-- | WebCore/plugins/mac/PluginViewMac.cpp | 15 | ||||
-rw-r--r-- | WebCore/plugins/npfunctions.h | 7 | ||||
-rw-r--r-- | WebCore/plugins/qt/PluginViewQt.cpp | 7 | ||||
-rw-r--r-- | WebCore/plugins/win/PluginPackageWin.cpp | 5 |
16 files changed, 281 insertions, 144 deletions
diff --git a/WebCore/plugins/wx/PluginDataWx.cpp b/WebCore/plugins/PluginDataNone.cpp index 28e3967..28e3967 100644 --- a/WebCore/plugins/wx/PluginDataWx.cpp +++ b/WebCore/plugins/PluginDataNone.cpp diff --git a/WebCore/plugins/PluginDatabase.cpp b/WebCore/plugins/PluginDatabase.cpp index e3b86ae..155bd24 100644 --- a/WebCore/plugins/PluginDatabase.cpp +++ b/WebCore/plugins/PluginDatabase.cpp @@ -32,6 +32,11 @@ #include "PluginPackage.h" #include <stdlib.h> +#if PLATFORM(ANDROID) +#include "JavaSharedClient.h" +#include "PluginClient.h" +#endif + namespace WebCore { PluginDatabase* PluginDatabase::installedPlugins() @@ -327,6 +332,11 @@ Vector<String> PluginDatabase::defaultPluginDirectories() paths.append(qtPaths); #endif +#if PLATFORM(ANDROID) + if (android::JavaSharedClient::GetPluginClient()) + return android::JavaSharedClient::GetPluginClient()->getPluginDirectories(); +#endif + return paths; } diff --git a/WebCore/plugins/PluginDatabase.h b/WebCore/plugins/PluginDatabase.h index ccb3821..b05d334 100644 --- a/WebCore/plugins/PluginDatabase.h +++ b/WebCore/plugins/PluginDatabase.h @@ -63,9 +63,14 @@ namespace WebCore { PluginPackage* findPlugin(const KURL&, String& mimeType); - private: +#ifdef ANDROID_PLUGINS void setPluginDirectories(const Vector<String>& directories) { m_pluginDirectories = directories; } +#endif + private: +#ifndef ANDROID_PLUGINS + void setPluginDirectories(const Vector<String>& directories) { m_pluginDirectories = directories; } +#endif void getPluginPathsInDirectories(HashSet<String>&) const; void getDeletedPlugins(PluginSet&) const; diff --git a/WebCore/plugins/PluginPackage.cpp b/WebCore/plugins/PluginPackage.cpp index 82daca7..747d937 100644 --- a/WebCore/plugins/PluginPackage.cpp +++ b/WebCore/plugins/PluginPackage.cpp @@ -97,7 +97,8 @@ int PluginPackage::compare(const PluginPackage& compareTo) const if (diff) return diff; - if (diff = compareFileVersion(compareTo.version())) + diff = compareFileVersion(compareTo.version()); + if (diff) return diff; return strcmp(parentDirectory().utf8().data(), compareTo.parentDirectory().utf8().data()); diff --git a/WebCore/plugins/wx/PluginPackageWx.cpp b/WebCore/plugins/PluginPackageNone.cpp index b93ead2..3f43855 100644 --- a/WebCore/plugins/wx/PluginPackageWx.cpp +++ b/WebCore/plugins/PluginPackageNone.cpp @@ -35,7 +35,7 @@ namespace WebCore { -void PluginPackage::determineQuirks(const String& mimeType) +void PluginPackage::determineQuirks(const String&) { notImplemented(); } @@ -59,13 +59,13 @@ unsigned PluginPackage::hash() const return 0; } -bool PluginPackage::equal(const PluginPackage& a, const PluginPackage& b) +bool PluginPackage::equal(const PluginPackage&, const PluginPackage&) { notImplemented(); return false; } -int PluginPackage::compareFileVersion(const PlatformModuleVersion& compareVersion) const +int PluginPackage::compareFileVersion(const PlatformModuleVersion&) const { notImplemented(); return 0; diff --git a/WebCore/plugins/PluginView.cpp b/WebCore/plugins/PluginView.cpp index ed867fc..cdb8ca9 100644 --- a/WebCore/plugins/PluginView.cpp +++ b/WebCore/plugins/PluginView.cpp @@ -38,7 +38,6 @@ #include "Image.h" #include "HTMLNames.h" #include "HTMLPlugInElement.h" -#include "JSDOMWindow.h" #include "KeyboardEvent.h" #include "MIMETypeRegistry.h" #include "MouseEvent.h" @@ -50,7 +49,6 @@ #include "PluginMessageThrottlerWin.h" #endif #include "PluginPackage.h" -#include "JSDOMBinding.h" #include "ScriptController.h" #include "ScriptValue.h" #include "PluginDatabase.h" @@ -59,20 +57,28 @@ #include "PluginPackage.h" #include "RenderBox.h" #include "RenderObject.h" -#include "c_instance.h" #include "npruntime_impl.h" -#include "runtime_root.h" #include "Settings.h" + +#if USE(JSC) +#include "JSDOMWindow.h" +#include "JSDOMBinding.h" +#include "c_instance.h" +#include "runtime_root.h" #include "runtime.h" #include <runtime/JSLock.h> #include <runtime/JSValue.h> +#endif + #include <wtf/ASCIICType.h> +#if USE(JSC) using JSC::ExecState; using JSC::JSLock; using JSC::JSObject; using JSC::JSValuePtr; using JSC::UString; +#endif using std::min; @@ -169,7 +175,9 @@ bool PluginView::start() NPError npErr; { PluginView::setCurrentPluginView(this); +#if USE(JSC) JSC::JSLock::DropAllLocks dropAllLocks(false); +#endif setCallingPlugin(true); npErr = m_plugin->pluginFuncs()->newp((NPMIMEType)m_mimeType.data(), m_instance, m_mode, m_paramCount, m_paramNames, m_paramValues, NULL); setCallingPlugin(false); @@ -212,6 +220,7 @@ static char* createUTF8String(const String& str) return result; } +#if USE(JSC) static bool getString(ScriptController* proxy, JSValuePtr result, String& string) { if (!proxy || !result || result.isUndefined()) @@ -225,6 +234,7 @@ static bool getString(ScriptController* proxy, JSValuePtr result, String& string string = ustring; return true; } +#endif void PluginView::performRequest(PluginRequest* request) { @@ -251,7 +261,9 @@ void PluginView::performRequest(PluginRequest* request) // FIXME: <rdar://problem/4807469> This should be sent when the document has finished loading if (request->sendNotification()) { PluginView::setCurrentPluginView(this); +#if USE(JSC) JSC::JSLock::DropAllLocks dropAllLocks(false); +#endif setCallingPlugin(true); m_plugin->pluginFuncs()->urlnotify(m_instance, requestURL.string().utf8().data(), NPRES_DONE, request->notifyData()); setCallingPlugin(false); @@ -264,7 +276,8 @@ void PluginView::performRequest(PluginRequest* request) // Targeted JavaScript requests are only allowed on the frame that contains the JavaScript plugin // and this has been made sure in ::load. ASSERT(targetFrameName.isEmpty() || m_parentFrame->tree()->find(targetFrameName) == m_parentFrame); - + +#if USE(JSC) // Executing a script can cause the plugin view to be destroyed, so we keep a reference to the parent frame. RefPtr<Frame> parentFrame = m_parentFrame; JSValuePtr result = m_parentFrame->loader()->executeScript(jsString, request->shouldAllowPopups()).jsValue(); @@ -280,6 +293,7 @@ void PluginView::performRequest(PluginRequest* request) m_streams.add(stream); stream->sendJavaScriptStream(requestURL, cstr); } +#endif } void PluginView::requestTimerFired(Timer<PluginView>* timer) @@ -404,12 +418,12 @@ int32 PluginView::write(NPStream* stream, int32 len, void* buffer) NPError PluginView::destroyStream(NPStream* stream, NPReason reason) { - PluginStream* browserStream = static_cast<PluginStream*>(stream->ndata); - if (!stream || PluginStream::ownerForStream(stream) != m_instance) return NPERR_INVALID_INSTANCE_ERROR; + PluginStream* browserStream = static_cast<PluginStream*>(stream->ndata); browserStream->cancelAndDestroyStream(reason); + return NPERR_NO_ERROR; } @@ -484,6 +498,8 @@ void PluginView::setJavaScriptPaused(bool paused) m_requestTimer.startOneShot(0); } + +#if USE(JSC) PassRefPtr<JSC::Bindings::Instance> PluginView::bindingInstance() { #if ENABLE(NETSCAPE_PLUGIN_API) @@ -513,8 +529,38 @@ PassRefPtr<JSC::Bindings::Instance> PluginView::bindingInstance() return instance.release(); #else return 0; -#endif +#endif // NETSCAPE_PLUGIN_API +} +#endif // JSC + +#if USE(V8) +// This is really JS engine independent +NPObject* PluginView::getNPObject() { +#if ENABLE(NETSCAPE_PLUGIN_API) + if (!m_plugin || !m_plugin->pluginFuncs()->getvalue) + return 0; + + NPObject* object = 0; + + NPError npErr; + { + PluginView::setCurrentPluginView(this); + setCallingPlugin(true); + npErr = m_plugin->pluginFuncs()->getvalue(m_instance, NPPVpluginScriptableNPObject, &object); + setCallingPlugin(false); + PluginView::setCurrentPluginView(0); + } + + if (npErr != NPERR_NO_ERROR || !object) + return 0; + + _NPN_ReleaseObject(object); + return object; +#else + return 0; +#endif // NETSCAPE_PLUGIN_API } +#endif // V8 void PluginView::disconnectStream(PluginStream* stream) { @@ -569,9 +615,6 @@ PluginView::PluginView(Frame* parentFrame, const IntSize& size, PluginPackage* p #if PLATFORM(GTK) || defined(Q_WS_X11) , m_needsXEmbed(false) #endif -#if PLATFORM(QT) - , m_isNPAPIPlugin(false) -#endif #if PLATFORM(WIN_OS) && !PLATFORM(WX) && ENABLE(NETSCAPE_PLUGIN_API) , m_pluginWndProc(0) , m_lastMessage(0) diff --git a/WebCore/plugins/PluginView.h b/WebCore/plugins/PluginView.h index 5be7d1f..d007d64 100644 --- a/WebCore/plugins/PluginView.h +++ b/WebCore/plugins/PluginView.h @@ -58,11 +58,15 @@ typedef struct PluginWidgetAndroid* PlatformPluginWidget; typedef PlatformWidget PlatformPluginWidget; #endif +#if USE(JSC) namespace JSC { namespace Bindings { class Instance; } } +#endif + +class NPObject; namespace WebCore { class Element; @@ -124,7 +128,11 @@ namespace WebCore { void setNPWindowRect(const IntRect&); static PluginView* currentPluginView(); +#if USE(JSC) PassRefPtr<JSC::Bindings::Instance> bindingInstance(); +#elif USE(V8) + NPObject* getNPObject(); +#endif PluginStatus status() const { return m_status; } @@ -199,11 +207,6 @@ namespace WebCore { static bool isCallingPlugin(); -#if PLATFORM(QT) - bool isNPAPIPlugin() const { return m_isNPAPIPlugin; } - void setIsNPAPIPlugin(bool b) { m_isNPAPIPlugin = b; } -#endif - private: PluginView(Frame* parentFrame, const IntSize&, PluginPackage*, Element*, const KURL&, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually); @@ -284,10 +287,6 @@ namespace WebCore { bool m_isTransparent; bool m_haveInitialized; -#if PLATFORM(QT) - bool m_isNPAPIPlugin; -#endif - #if PLATFORM(GTK) || defined(Q_WS_X11) bool m_needsXEmbed; #endif @@ -330,6 +329,9 @@ private: void nullEventTimerFired(Timer<PluginView>*); Point globalMousePosForPlugin() const; #endif +#if PLATFORM(GTK) || defined(Q_WS_X11) + void setNPWindowIfNeeded(); +#endif IntRect m_clipRect; // The clip rect to apply to a windowed plug-in IntRect m_windowRect; // Our window rect. diff --git a/WebCore/plugins/wx/PluginViewWx.cpp b/WebCore/plugins/PluginViewNone.cpp index a95713a..2766a6b 100644 --- a/WebCore/plugins/wx/PluginViewWx.cpp +++ b/WebCore/plugins/PluginViewNone.cpp @@ -48,27 +48,27 @@ void PluginView::hide() notImplemented(); } -void PluginView::paint(GraphicsContext* context, const IntRect& rect) +void PluginView::paint(GraphicsContext*, const IntRect&) { notImplemented(); } -void PluginView::handleKeyboardEvent(KeyboardEvent* event) +void PluginView::handleKeyboardEvent(KeyboardEvent*) { notImplemented(); } -void PluginView::handleMouseEvent(MouseEvent* event) +void PluginView::handleMouseEvent(MouseEvent*) { notImplemented(); } -void PluginView::setParent(ScrollView* parent) +void PluginView::setParent(ScrollView*) { notImplemented(); } -void PluginView::setNPWindowRect(const IntRect& rect) +void PluginView::setNPWindowRect(const IntRect&) { notImplemented(); } @@ -84,20 +84,20 @@ const char* PluginView::userAgent() return 0; } -NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32 len, const char* buf) +NPError PluginView::handlePostReadFile(Vector<char>&, uint32, const char*) { notImplemented(); return 0; } -NPError PluginView::getValue(NPNVariable variable, void* value) +NPError PluginView::getValue(NPNVariable, void*) { notImplemented(); return 0; } -void PluginView::invalidateRect(NPRect* rect) +void PluginView::invalidateRect(NPRect*) { notImplemented(); } @@ -107,7 +107,7 @@ void PluginView::invalidateRect(const IntRect&) notImplemented(); } -void PluginView::invalidateRegion(NPRegion region) +void PluginView::invalidateRegion(NPRegion) { notImplemented(); } diff --git a/WebCore/plugins/android/PluginClient.h b/WebCore/plugins/android/PluginClient.h new file mode 100644 index 0000000..5dc300c --- /dev/null +++ b/WebCore/plugins/android/PluginClient.h @@ -0,0 +1,44 @@ +/* + * Copyright 2009, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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 THE COPYRIGHT HOLDERS ``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 COMPUTER, INC. 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. + */ + +#ifndef PLUGINCLIENT_H_ +#define PLUGINCLIENT_H_ + +#include "PlatformString.h" +#include <wtf/Vector.h> + +using namespace WebCore; + +namespace android { + + class PluginClient + { + public: + virtual ~PluginClient() {} + virtual Vector<String> getPluginDirectories() = 0; + }; +} + +#endif /* PLUGINCLIENT_H_ */ diff --git a/WebCore/plugins/android/PluginViewAndroid.cpp b/WebCore/plugins/android/PluginViewAndroid.cpp index 09117ae..f10ac45 100644 --- a/WebCore/plugins/android/PluginViewAndroid.cpp +++ b/WebCore/plugins/android/PluginViewAndroid.cpp @@ -50,19 +50,20 @@ #include "PlatformKeyboardEvent.h" #include "PluginMainThreadScheduler.h" #include "PluginPackage.h" -// #include "kjs_binding.h" -// #include "kjs_proxy.h" #include "android_graphics.h" #include "SkCanvas.h" #include "npruntime_impl.h" -#include "runtime_root.h" +// #include "runtime_root.h" #include "utils/SystemClock.h" #include "ScriptController.h" #include "Settings.h" + +#if USE(JSC) #include <runtime/JSLock.h> -// #include <kjs/value.h> +#endif + #include <wtf/ASCIICType.h> -#include "runtime.h" +// #include "runtime.h" #include "WebViewCore.h" #include "PluginDebug.h" @@ -77,11 +78,13 @@ /////////////////////////////////////////////////////////////////////////////// extern void ANPAudioTrackInterfaceV0_Init(ANPInterface* value); +extern void ANPBitmapInterfaceV0_Init(ANPInterface* value); extern void ANPCanvasInterfaceV0_Init(ANPInterface* value); extern void ANPLogInterfaceV0_Init(ANPInterface* value); extern void ANPMatrixInterfaceV0_Init(ANPInterface* value); extern void ANPOffscreenInterfaceV0_Init(ANPInterface* value); extern void ANPPaintInterfaceV0_Init(ANPInterface* value); +extern void ANPPathInterfaceV0_Init(ANPInterface* value); extern void ANPTypefaceInterfaceV0_Init(ANPInterface* value); extern void ANPWindowInterfaceV0_Init(ANPInterface* value); @@ -96,10 +99,12 @@ struct VarProcPair { static const VarProcPair gVarProcs[] = { { VARPROCLINE(AudioTrackInterfaceV0) }, - { VARPROCLINE(LogInterfaceV0) }, + { VARPROCLINE(BitmapInterfaceV0) }, { VARPROCLINE(CanvasInterfaceV0) }, + { VARPROCLINE(LogInterfaceV0) }, { VARPROCLINE(MatrixInterfaceV0) }, { VARPROCLINE(PaintInterfaceV0) }, + { VARPROCLINE(PathInterfaceV0) }, { VARPROCLINE(TypefaceInterfaceV0) }, { VARPROCLINE(WindowInterfaceV0) }, }; @@ -131,12 +136,6 @@ static bool anp_getInterface(NPNVariable var, void* value, NPError* error) { /////////////////////////////////////////////////////////////////////////////// -using JSC::ExecState; -using JSC::Interpreter; -using JSC::JSLock; -using JSC::JSObject; -using JSC::UString; - using std::min; using namespace WTF; @@ -152,22 +151,22 @@ void PluginView::platformInit() m_isWindowed = false; // we don't support windowed yet m_window = new PluginWidgetAndroid(this); - + m_npWindow.type = NPWindowTypeDrawable; m_npWindow.window = 0; } - + PluginView::~PluginView() { stop(); - + deleteAllValues(m_requests); - + freeStringArray(m_paramNames, m_paramCount); freeStringArray(m_paramValues, m_paramCount); - + m_parentFrame->script()->cleanupScriptObjectsForPlugin(this); - + // Since we have no legacy plugins to check, we ignore the quirks check // if (m_plugin && !m_plugin->quirks().contains(PluginQuirkDontUnloadPlugin)) if (m_plugin) { @@ -189,38 +188,47 @@ void PluginView::init() ASSERT(m_status == PluginStatusCanNotFindPlugin); return; } - + if (!m_plugin->load()) { m_plugin = 0; m_status = PluginStatusCanNotLoadPlugin; return; } - + if (!start()) { m_status = PluginStatusCanNotLoadPlugin; return; } - + m_status = PluginStatusLoadedSuccessfully; } - + void PluginView::handleMouseEvent(MouseEvent* event) { const AtomicString& type = event->type(); bool isDown = (eventNames().mousedownEvent == type); bool isUp = (eventNames().mouseupEvent == type); - if (!isDown && !isUp) { - return; - } - + bool isOver = (eventNames().mouseoverEvent == type); + bool isOut = (eventNames().mouseoutEvent == type); + ANPEvent evt; - SkANP::InitEvent(&evt, kTouch_ANPEventType); - evt.data.touch.action = isDown ? kDown_ANPTouchAction : kUp_ANPTouchAction; - evt.data.touch.modifiers = 0; // todo - // these are relative to plugin - evt.data.touch.x = event->pageX() - m_npWindow.x; - evt.data.touch.y = event->pageY() - m_npWindow.y; + if (isDown || isUp) { + SkANP::InitEvent(&evt, kTouch_ANPEventType); + evt.data.touch.action = isDown ? kDown_ANPTouchAction : kUp_ANPTouchAction; + evt.data.touch.modifiers = 0; // todo + // these are relative to plugin + evt.data.touch.x = event->pageX() - m_npWindow.x; + evt.data.touch.y = event->pageY() - m_npWindow.y; + } + else if (isOver || isOut) { + SkANP::InitEvent(&evt, kLifecycle_ANPEventType); + evt.data.lifecycle.action = isOver ? kGainFocus_ANPLifecycleAction : kLooseFocus_ANPLifecycleAction; + } + else { + return; + } + if (m_plugin->pluginFuncs()->event(m_instance, &evt)) { event->setDefaultHandled(); } @@ -275,7 +283,7 @@ void PluginView::handleKeyboardEvent(KeyboardEvent* event) evt.data.key.repeatCount = pke->repeatCount(); evt.data.key.modifiers = make_modifiers(pke->shiftKey(), pke->altKey()); evt.data.key.unichar = pke->unichar(); - + if (m_plugin->pluginFuncs()->event(m_instance, &evt)) { event->setDefaultHandled(); } @@ -312,7 +320,7 @@ void PluginView::setNPWindowRect(const IntRect& rect) { if (!m_isStarted) return; - + const int width = rect.width(); const int height = rect.height(); @@ -320,22 +328,24 @@ void PluginView::setNPWindowRect(const IntRect& rect) IntPoint p = parent()->convertToContainingWindow(rect.location()); m_npWindow.x = p.x(); m_npWindow.y = p.y(); - + m_npWindow.width = width; m_npWindow.height = height; - + m_npWindow.clipRect.left = 0; m_npWindow.clipRect.top = 0; m_npWindow.clipRect.right = width; m_npWindow.clipRect.bottom = height; if (m_plugin->pluginFuncs()->setwindow) { +#if USE(JSC) JSC::JSLock::DropAllLocks dropAllLocks(false); +#endif setCallingPlugin(true); m_plugin->pluginFuncs()->setwindow(m_instance, &m_npWindow); setCallingPlugin(false); } - + m_window->setWindow(m_npWindow.x, m_npWindow.y, width, height, m_isTransparent); } @@ -355,8 +365,9 @@ void PluginView::stop() ASSERT(m_streams.isEmpty()); m_isStarted = false; - +#if USE(JSC) JSC::JSLock::DropAllLocks dropAllLocks(false); +#endif PluginMainThreadScheduler::scheduler().unregisterPlugin(m_instance); @@ -446,13 +457,13 @@ NPError PluginView::getValue(NPNVariable variable, void* value) *retValue = !networkStateNotifier().onLine(); return NPERR_NO_ERROR; } - + case kSupportedDrawingModel_ANPGetValue: { uint32_t* bits = reinterpret_cast<uint32_t*>(value); *bits = (1 << kBitmap_ANPDrawingModel); return NPERR_NO_ERROR; } - + default: { NPError error = NPERR_GENERIC_ERROR; (void)anp_getInterface(variable, value, &error); @@ -538,12 +549,12 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) paintMissingPluginIcon(context, rect); return; } - + IntRect frame = frameRect(); if (!frame.width() || !frame.height()) { return; } - + m_window->inval(rect, false); m_window->draw(android_gc2canvas(context)); } @@ -559,8 +570,8 @@ void PluginView::updatePluginWidget() } // new as of SVN 38068, Nov 5 2008 -void PluginView::setParentVisible(bool) { - notImplemented(); +void PluginView::setParentVisible(bool) { + notImplemented(); } } // namespace WebCore diff --git a/WebCore/plugins/gtk/PluginPackageGtk.cpp b/WebCore/plugins/gtk/PluginPackageGtk.cpp index 997583e..1337c31 100644 --- a/WebCore/plugins/gtk/PluginPackageGtk.cpp +++ b/WebCore/plugins/gtk/PluginPackageGtk.cpp @@ -29,6 +29,8 @@ #include "config.h" #include "PluginPackage.h" +#include <stdio.h> + #include "CString.h" #include "MIMETypeRegistry.h" #include "NotImplemented.h" diff --git a/WebCore/plugins/gtk/PluginViewGtk.cpp b/WebCore/plugins/gtk/PluginViewGtk.cpp index 2b93e56..30be6b0 100644 --- a/WebCore/plugins/gtk/PluginViewGtk.cpp +++ b/WebCore/plugins/gtk/PluginViewGtk.cpp @@ -82,6 +82,23 @@ namespace WebCore { using namespace HTMLNames; +bool PluginView::dispatchNPEvent(NPEvent& event) +{ + // sanity check + if (!m_plugin->pluginFuncs()->event) + return false; + + PluginView::setCurrentPluginView(this); + JSC::JSLock::DropAllLocks dropAllLocks(false); + setCallingPlugin(true); + + bool accepted = m_plugin->pluginFuncs()->event(m_instance, &event); + + setCallingPlugin(false); + PluginView::setCurrentPluginView(0); + return accepted; +} + void PluginView::updatePluginWidget() { if (!parent() || !m_isWindowed) @@ -97,16 +114,8 @@ void PluginView::updatePluginWidget() m_clipRect = windowClipRect(); m_clipRect.move(-m_windowRect.x(), -m_windowRect.y()); - GtkAllocation allocation = { m_windowRect.x(), m_windowRect.y(), m_windowRect.width(), m_windowRect.height() }; - if (platformPluginWidget()) { - gtk_widget_size_allocate(platformPluginWidget(), &allocation); -#if PLATFORM(X11) - if (!m_needsXEmbed) { - gtk_xtbin_set_position(GTK_XTBIN(platformPluginWidget()), m_windowRect.x(), m_windowRect.y()); - gtk_xtbin_resize(platformPluginWidget(), m_windowRect.width(), m_windowRect.height()); - } -#endif - } + if (platformPluginWidget() && (m_windowRect != oldWindowRect || m_clipRect != oldClipRect)) + setNPWindowIfNeeded(); } void PluginView::setFocus() @@ -144,7 +153,12 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) return; } - if (m_isWindowed || context->paintingDisabled()) + if (context->paintingDisabled()) + return; + + setNPWindowIfNeeded(); + + if (m_isWindowed) return; NPEvent npEvent; @@ -154,12 +168,8 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) ASSERT(parent()->isFrameView()); - if (m_plugin->pluginFuncs()->event) { - JSC::JSLock::DropAllLocks dropAllLocks(false); - m_plugin->pluginFuncs()->event(m_instance, &npEvent); - } - - setNPWindowRect(frameRect()); + if (!dispatchNPEvent(npEvent)) + LOG(Events, "PluginView::paint(): Paint event not accepted"); } void PluginView::handleKeyboardEvent(KeyboardEvent* event) @@ -169,7 +179,7 @@ void PluginView::handleKeyboardEvent(KeyboardEvent* event) /* FIXME: Synthesize an XEvent to pass through */ JSC::JSLock::DropAllLocks dropAllLocks(false); - if (!m_plugin->pluginFuncs()->event(m_instance, &npEvent)) + if (!dispatchNPEvent(npEvent)) event->setDefaultHandled(); } @@ -184,7 +194,7 @@ void PluginView::handleMouseEvent(MouseEvent* event) IntPoint p = static_cast<FrameView*>(parent())->contentsToWindow(IntPoint(event->pageX(), event->pageY())); JSC::JSLock::DropAllLocks dropAllLocks(false); - if (!m_plugin->pluginFuncs()->event(m_instance, &npEvent)) + if (!dispatchNPEvent(npEvent)) event->setDefaultHandled(); } @@ -200,40 +210,41 @@ void PluginView::setParent(ScrollView* parent) } } -void PluginView::setNPWindowRect(const IntRect& rect) +void PluginView::setNPWindowRect(const IntRect&) { - if (!m_isStarted || !parent()) - return; - - IntPoint p = static_cast<FrameView*>(parent())->contentsToWindow(rect.location()); - m_npWindow.x = p.x(); - m_npWindow.y = p.y(); - - m_npWindow.width = rect.width(); - m_npWindow.height = rect.height(); - - m_npWindow.clipRect.left = 0; - m_npWindow.clipRect.top = 0; - m_npWindow.clipRect.right = rect.width(); - m_npWindow.clipRect.bottom = rect.height(); + setNPWindowIfNeeded(); +} - if (m_npWindow.x < 0 || m_npWindow.y < 0 || - m_npWindow.width <= 0 || m_npWindow.height <= 0) +void PluginView::setNPWindowIfNeeded() +{ + if (!m_isStarted || !parent() || !m_plugin->pluginFuncs()->setwindow) return; - if (m_plugin->pluginFuncs()->setwindow) { - PluginView::setCurrentPluginView(this); - JSC::JSLock::DropAllLocks dropAllLocks(false); - setCallingPlugin(true); - m_plugin->pluginFuncs()->setwindow(m_instance, &m_npWindow); - setCallingPlugin(false); - PluginView::setCurrentPluginView(0); + m_npWindow.x = m_windowRect.x(); + m_npWindow.y = m_windowRect.y(); + m_npWindow.width = m_windowRect.width(); + m_npWindow.height = m_windowRect.height(); - if (!m_isWindowed) - return; + m_npWindow.clipRect.left = m_clipRect.x(); + m_npWindow.clipRect.top = m_clipRect.y(); + m_npWindow.clipRect.right = m_clipRect.width(); + m_npWindow.clipRect.bottom = m_clipRect.height(); - ASSERT(platformPluginWidget()); + GtkAllocation allocation = { m_windowRect.x(), m_windowRect.y(), m_windowRect.width(), m_windowRect.height() }; + gtk_widget_size_allocate(platformPluginWidget(), &allocation); +#if PLATFORM(X11) + if (!m_needsXEmbed) { + gtk_xtbin_set_position(GTK_XTBIN(platformPluginWidget()), m_windowRect.x(), m_windowRect.y()); + gtk_xtbin_resize(platformPluginWidget(), m_windowRect.width(), m_windowRect.height()); } +#endif + + PluginView::setCurrentPluginView(this); + JSC::JSLock::DropAllLocks dropAllLocks(false); + setCallingPlugin(true); + m_plugin->pluginFuncs()->setwindow(m_instance, &m_npWindow); + setCallingPlugin(false); + PluginView::setCurrentPluginView(0); } void PluginView::setParentVisible(bool visible) @@ -349,22 +360,22 @@ NPError PluginView::getValueStatic(NPNVariable variable, void* value) switch (variable) { case NPNVToolkit: #if PLATFORM(GTK) - *((uint32 *)value) = 2; + *static_cast<uint32*>(value) = 2; #else - *((uint32 *)value) = 0; + *static_cast<uint32*>(value) = 0; #endif return NPERR_NO_ERROR; case NPNVSupportsXEmbedBool: #if PLATFORM(X11) - *((uint32 *)value) = true; + *static_cast<NPBool*>(value) = true; #else - *((uint32 *)value) = false; + *static_cast<NPBool*>(value) = false; #endif return NPERR_NO_ERROR; case NPNVjavascriptEnabledBool: - *((uint32 *)value) = true; + *static_cast<NPBool*>(value) = true; return NPERR_NO_ERROR; default: @@ -576,10 +587,12 @@ void PluginView::init() m_npWindow.window = 0; } + // TODO remove in favor of null events, like mac port? if (!(m_plugin->quirks().contains(PluginQuirkDeferFirstSetWindowCall))) - setNPWindowRect(frameRect()); + updatePluginWidget(); // was: setNPWindowIfNeeded(), but this doesn't produce 0x0 rects at first go m_status = PluginStatusLoadedSuccessfully; } } // namespace WebCore + diff --git a/WebCore/plugins/mac/PluginViewMac.cpp b/WebCore/plugins/mac/PluginViewMac.cpp index 9e58906..a46aca6 100644 --- a/WebCore/plugins/mac/PluginViewMac.cpp +++ b/WebCore/plugins/mac/PluginViewMac.cpp @@ -158,8 +158,6 @@ void PluginView::init() m_npWindow.clipRect.right = 0; m_npWindow.clipRect.bottom = 0; - setIsNPAPIPlugin(true); - show(); m_status = PluginStatusLoadedSuccessfully; @@ -222,11 +220,11 @@ NPError PluginView::getValueStatic(NPNVariable variable, void* value) switch (variable) { case NPNVToolkit: - *((uint32 *)value) = 0; + *static_cast<uint32*>(value) = 0; return NPERR_NO_ERROR; case NPNVjavascriptEnabledBool: - *((uint32 *)value) = true; + *static_cast<NPBool*>(value) = true; return NPERR_NO_ERROR; default: @@ -277,7 +275,7 @@ NPError PluginView::getValue(NPNVariable variable, void* value) } case NPNVsupportsCoreGraphicsBool: - *((uint32 *)value) = true; + *static_cast<NPBool*>(value) = true; return NPERR_NO_ERROR; default: @@ -445,11 +443,8 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) void PluginView::invalidateRect(const IntRect& rect) { - if (platformPluginWidget()) { - // TODO: optimize - platformPluginWidget()->update(); - return; - } + if (platformPluginWidget()) + platformPluginWidget()->update(convertToContainingWindow(rect)); } void PluginView::invalidateRect(NPRect* rect) diff --git a/WebCore/plugins/npfunctions.h b/WebCore/plugins/npfunctions.h index 21e2e15..beaa1fb 100644 --- a/WebCore/plugins/npfunctions.h +++ b/WebCore/plugins/npfunctions.h @@ -66,6 +66,10 @@ typedef void* (*NPN_GetJavaPeerProcPtr)(NPP instance); typedef void (*NPN_PushPopupsEnabledStateProcPtr)(NPP instance, NPBool enabled); typedef void (*NPN_PopPopupsEnabledStateProcPtr)(NPP instance); typedef void (*NPN_PluginThreadAsyncCallProcPtr)(NPP npp, void (*func)(void *), void *userData); +typedef NPError (*NPN_GetValueForURLProcPtr)(NPP npp, NPNURLVariable variable, const char* url, char** value, uint32_t* len); +typedef NPError (*NPN_SetValueForURLProcPtr)(NPP npp, NPNURLVariable variable, const char* url, const char* value, uint32_t* len); +typedef NPError (*NPN_GetAuthenticationInfoPtr)(NPP npp, 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); + typedef uint32 (*NPN_ScheduleTimerProcPtr)(NPP npp, uint32 interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32 timerID)); typedef void (*NPN_UnscheduleTimerProcPtr)(NPP npp, uint32 timerID); typedef NPError (*NPN_PopUpContextMenuProcPtr)(NPP instance, NPMenu* menu); @@ -161,6 +165,9 @@ typedef struct _NPNetscapeFuncs { NPN_EnumerateProcPtr enumerate; NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall; NPN_ConstructProcPtr construct; + NPN_GetValueForURLProcPtr getvalueforurl; + NPN_SetValueForURLProcPtr setvalueforurl; + NPN_GetAuthenticationInfoPtr getauthenticationinfo; NPN_ScheduleTimerProcPtr scheduletimer; NPN_UnscheduleTimerProcPtr unscheduletimer; NPN_PopUpContextMenuProcPtr popupcontextmenu; diff --git a/WebCore/plugins/qt/PluginViewQt.cpp b/WebCore/plugins/qt/PluginViewQt.cpp index 4982d08..c8dd0e5 100644 --- a/WebCore/plugins/qt/PluginViewQt.cpp +++ b/WebCore/plugins/qt/PluginViewQt.cpp @@ -301,15 +301,15 @@ NPError PluginView::getValueStatic(NPNVariable variable, void* value) { switch (variable) { case NPNVToolkit: - *((uint32 *)value) = 0; + *static_cast<uint32*>(value) = 0; return NPERR_NO_ERROR; case NPNVSupportsXEmbedBool: - *((uint32 *)value) = true; + *static_cast<NPBool*>(value) = true; return NPERR_NO_ERROR; case NPNVjavascriptEnabledBool: - *((uint32 *)value) = true; + *static_cast<NPBool*>(value) = true; return NPERR_NO_ERROR; default: @@ -459,7 +459,6 @@ void PluginView::init() if (m_needsXEmbed) { setPlatformWidget(new QX11EmbedContainer(m_parentFrame->view()->hostWindow()->platformWindow())); - setIsNPAPIPlugin(true); } else { notImplemented(); m_status = PluginStatusCanNotLoadPlugin; diff --git a/WebCore/plugins/win/PluginPackageWin.cpp b/WebCore/plugins/win/PluginPackageWin.cpp index fe9b544..0edcef3 100644 --- a/WebCore/plugins/win/PluginPackageWin.cpp +++ b/WebCore/plugins/win/PluginPackageWin.cpp @@ -68,6 +68,11 @@ int PluginPackage::compareFileVersion(const PlatformModuleVersion& compareVersio bool PluginPackage::isPluginBlacklisted() { + if (name() == "Citrix ICA Client") { + // The Citrix ICA Client plug-in requires a Mozilla-based browser; see <rdar://6418681>. + return true; + } + if (name() == "Silverlight Plug-In") { // workaround for <rdar://5557379> Crash in Silverlight when opening microsoft.com. // the latest 1.0 version of Silverlight does not reproduce this crash, so allow it |