diff options
author | Ben Murdoch <benm@google.com> | 2011-06-02 12:07:03 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-10 10:47:21 +0100 |
commit | 2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch) | |
tree | e4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebKit2/WebProcess/Plugins/Netscape | |
parent | 87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff) | |
download | external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2 |
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebKit2/WebProcess/Plugins/Netscape')
11 files changed, 169 insertions, 33 deletions
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.h b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.h index f0c2424..0fd01ea 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.h +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.h @@ -42,7 +42,7 @@ public: NPIdentifier npIdentifier() const { return m_npIdentifier; } private: - static PassRefPtr<JSC::Structure> createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype) + static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype) { return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h index e8a08da..ed124b9 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h @@ -55,7 +55,7 @@ public: private: static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | JSObject::StructureFlags; - static PassRefPtr<JSC::Structure> createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype) + static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype) { return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp index 4c687f4..7720e88 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp @@ -55,7 +55,6 @@ NPJSObject* NPJSObject::create(JSGlobalData& globalData, NPRuntimeObjectMap* obj NPJSObject::NPJSObject() : m_objectMap(0) - , m_jsObject(Global<JSObject>::EmptyValue) { } diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.h index 796f1c3..f0ee07a 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.h +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.h @@ -26,7 +26,7 @@ #ifndef NPJSObject_h #define NPJSObject_h -#include <JavaScriptCore/Global.h> +#include <JavaScriptCore/Strong.h> #include <WebCore/npruntime_internal.h> #include <wtf/Noncopyable.h> @@ -90,7 +90,7 @@ private: static bool NP_Construct(NPObject*, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result); NPRuntimeObjectMap* m_objectMap; - JSC::Global<JSC::JSObject> m_jsObject; + JSC::Strong<JSC::JSObject> m_jsObject; }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp index f6c0057..1cf60d2 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp @@ -33,6 +33,7 @@ #include <JavaScriptCore/Error.h> #include <JavaScriptCore/JSLock.h> #include <JavaScriptCore/SourceCode.h> +#include <JavaScriptCore/Strong.h> #include <WebCore/Frame.h> #include <WebCore/NotImplemented.h> @@ -182,7 +183,7 @@ void NPRuntimeObjectMap::convertJSValueToNPVariant(ExecState* exec, JSValue valu bool NPRuntimeObjectMap::evaluate(NPObject* npObject, const String&scriptString, NPVariant* result) { - Global<JSGlobalObject> globalObject(this->globalObject()->globalData(), this->globalObject()); + Strong<JSGlobalObject> globalObject(this->globalObject()->globalData(), this->globalObject()); if (!globalObject) return false; diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp index 7d00219..574df0d 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp @@ -491,6 +491,11 @@ void NetscapePlugin::destroy() // Stop all streams. stopAllStreams(); +#if !PLUGIN_ARCHITECTURE(MAC) + m_npWindow.window = 0; + callSetWindow(); +#endif + NPP_Destroy(0); m_isStarted = false; diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginNone.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginNone.cpp new file mode 100644 index 0000000..d4b2043 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginNone.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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 APPLE INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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. + */ + +#include "config.h" +#if PLUGIN_ARCHITECTURE(UNSUPPORTED) + +#include "NetscapePlugin.h" + +using namespace WebCore; + +namespace WebKit { + +bool NetscapePlugin::platformPostInitialize() +{ + return false; +} + +void NetscapePlugin::platformDestroy() +{ +} + +bool NetscapePlugin::platformInvalidate(const IntRect&) +{ + return false; +} + +void NetscapePlugin::platformGeometryDidChange() +{ +} + +void NetscapePlugin::platformPaint(GraphicsContext*, const IntRect&, bool) +{ +} + +bool NetscapePlugin::platformHandleMouseEvent(const WebMouseEvent&) +{ + return false; +} + +bool NetscapePlugin::platformHandleWheelEvent(const WebWheelEvent&) +{ + return false; +} + +void NetscapePlugin::platformSetFocus(bool) +{ +} + +bool NetscapePlugin::platformHandleMouseEnterEvent(const WebMouseEvent&) +{ + return false; +} + +bool NetscapePlugin::platformHandleMouseLeaveEvent(const WebMouseEvent&) +{ + return false; +} + +bool NetscapePlugin::platformHandleKeyboardEvent(const WebKeyboardEvent& event) +{ + return false; +} + +} // namespace WebKit + +#endif // PLUGIN_ARCHITECTURE(UNSUPPORTED) diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp index cf5affc..c5beb5f 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp @@ -221,6 +221,7 @@ void NetscapePluginStream::deliverDataToPlugin() int32_t numBytesWritten = m_plugin->NPP_Write(&m_npStream, m_offset, dataLength, data); if (numBytesWritten < 0) { + cancel(); stop(NPRES_NETWORK_ERR); return; } diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm index 14ac070..e1c193f 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm @@ -124,6 +124,7 @@ NPBool NetscapePlugin::convertPoint(double sourceX, double sourceY, NPCoordinate case NPCoordinateSpaceFlippedScreen: sourceXInScreenSpace = sourceX; sourceYInScreenSpace = flipScreenYCoordinate(sourceY); + break; default: return false; } @@ -231,17 +232,7 @@ bool NetscapePlugin::platformPostInitialize() // Get the Core Animation layer. if (NPP_GetValue(NPPVpluginCoreAnimationLayer, &value) == NPERR_NO_ERROR && value) { ASSERT(!m_pluginLayer); - - CALayer *realPluginLayer = reinterpret_cast<CALayer *>(value); - - // Create a layer with flipped geometry and add the real plug-in layer as a sublayer - // so the coordinate system will match the event coordinate system. - m_pluginLayer.adoptNS([[CALayer alloc] init]); - [m_pluginLayer.get() setBounds:[realPluginLayer bounds]]; - [m_pluginLayer.get() setGeometryFlipped:YES]; - - [realPluginLayer setAutoresizingMask:kCALayerWidthSizable | kCALayerHeightSizable]; - [m_pluginLayer.get() addSublayer:realPluginLayer]; + m_pluginLayer = reinterpret_cast<CALayer *>(value); } } @@ -517,11 +508,14 @@ bool NetscapePlugin::platformHandleMouseEvent(const WebMouseEvent& mouseEvent) // access m_currentMouseEvent afterwards. RefPtr<NetscapePlugin> protect(this); - bool returnValue = NPP_HandleEvent(&event); + NPP_HandleEvent(&event); m_currentMouseEvent = previousMouseEvent; - return returnValue; + // Some plug-ins return false even if the mouse event has been handled. + // This leads to bugs such as <rdar://problem/9167611>. Work around this + // by always returning true. + return true; } #ifndef NP_NO_CARBON @@ -549,7 +543,12 @@ bool NetscapePlugin::platformHandleMouseEvent(const WebMouseEvent& mouseEvent) event.where.h = mouseEvent.globalPosition().x(); event.where.v = mouseEvent.globalPosition().y(); - return NPP_HandleEvent(&event); + NPP_HandleEvent(&event); + + // Some plug-ins return false even if the mouse event has been handled. + // This leads to bugs such as <rdar://problem/9167611>. Work around this + // by always returning true. + return true; } #endif @@ -646,6 +645,8 @@ static unsigned modifierFlags(const WebKeyboardEvent& keyboardEvent) { unsigned modifierFlags = 0; + if (keyboardEvent.capsLockKey()) + modifierFlags |= NSAlphaShiftKeyMask; if (keyboardEvent.shiftKey()) modifierFlags |= NSShiftKeyMask; if (keyboardEvent.controlKey()) @@ -658,20 +659,46 @@ static unsigned modifierFlags(const WebKeyboardEvent& keyboardEvent) return modifierFlags; } +static bool isFlagsChangedEvent(const WebKeyboardEvent& keyboardEvent) +{ + switch (keyboardEvent.nativeVirtualKeyCode()) { + case 54: // Right Command + case 55: // Left Command + + case 57: // Capslock + + case 56: // Left Shift + case 60: // Right Shift + + case 58: // Left Alt + case 61: // Right Alt + + case 59: // Left Ctrl + case 62: // Right Ctrl + return true; + } + + return false; +} + static NPCocoaEvent initializeKeyboardEvent(const WebKeyboardEvent& keyboardEvent) { NPCocoaEventType eventType; - - switch (keyboardEvent.type()) { - case WebEvent::KeyDown: - eventType = NPCocoaEventKeyDown; - break; - case WebEvent::KeyUp: - eventType = NPCocoaEventKeyUp; - break; - default: - ASSERT_NOT_REACHED(); - return NPCocoaEvent(); + + if (isFlagsChangedEvent(keyboardEvent)) + eventType = NPCocoaEventFlagsChanged; + else { + switch (keyboardEvent.type()) { + case WebEvent::KeyDown: + eventType = NPCocoaEventKeyDown; + break; + case WebEvent::KeyUp: + eventType = NPCocoaEventKeyUp; + break; + default: + ASSERT_NOT_REACHED(); + return NPCocoaEvent(); + } } NPCocoaEvent event = initializeEvent(eventType); diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm index d331506..0b2917f 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm @@ -34,8 +34,17 @@ namespace WebKit { PlatformLayer* PluginProxy::pluginLayer() { - if (!m_pluginLayer && m_remoteLayerClientID) - m_pluginLayer = WKMakeRenderLayer(m_remoteLayerClientID); + if (!m_pluginLayer && m_remoteLayerClientID) { + CALayer *renderLayer = WKMakeRenderLayer(m_remoteLayerClientID); + + // Create a layer with flipped geometry and add the real plug-in layer as a sublayer + // so the coordinate system will match the event coordinate system. + m_pluginLayer.adoptNS([[CALayer alloc] init]); + [m_pluginLayer.get() setGeometryFlipped:YES]; + + [renderLayer setAutoresizingMask:kCALayerWidthSizable | kCALayerHeightSizable]; + [m_pluginLayer.get() addSublayer:renderLayer]; + } return m_pluginLayer.get(); } diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp index 27e694b..b8c8f2a 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp @@ -25,6 +25,8 @@ */ #include "config.h" +#if PLUGIN_ARCHITECTURE(X11) + #include "NetscapePlugin.h" #include "WebEvent.h" @@ -38,6 +40,7 @@ #include <QX11Info> #elif PLATFORM(GTK) #include <gdk/gdkx.h> +#include <WebCore/GtkVersioning.h> #endif using namespace WebCore; @@ -423,3 +426,5 @@ bool NetscapePlugin::platformHandleKeyboardEvent(const WebKeyboardEvent& event) } } // namespace WebKit + +#endif // PLUGIN_ARCHITECTURE(X11) |