diff options
| author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-09-13 12:51:20 +0200 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-19 20:50:05 +0200 |
| commit | d441d6f39bb846989d95bcf5caf387b42414718d (patch) | |
| tree | e367e64a75991c554930278175d403c072de6bb8 /Source/WebKit2/WebProcess/Plugins/Netscape | |
| parent | 0060b2994c07842f4c59de64b5e3e430525c4b90 (diff) | |
| download | qtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz | |
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit.
Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/WebKit2/WebProcess/Plugins/Netscape')
22 files changed, 270 insertions, 731 deletions
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp index 46eff09d6..71f4f6e09 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp @@ -51,9 +51,9 @@ JSNPMethod::JSNPMethod(JSGlobalObject* globalObject, Structure* structure, NPIde { } -void JSNPMethod::finishCreation(JSGlobalData& globalData, const String& name) +void JSNPMethod::finishCreation(VM& vm, const String& name) { - Base::finishCreation(globalData, name); + Base::finishCreation(vm, name); ASSERT(inherits(&s_info)); } diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.h b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.h index 93614d52d..eb2abb3ac 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.h +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.h @@ -43,9 +43,9 @@ public: static JSNPMethod* create(JSC::ExecState* exec, JSC::JSGlobalObject* globalObject, const String& name, NPIdentifier npIdent) { - JSC::Structure* structure = createStructure(exec->globalData(), globalObject, globalObject->functionPrototype()); + JSC::Structure* structure = createStructure(exec->vm(), globalObject, globalObject->functionPrototype()); JSNPMethod* method = new (JSC::allocateCell<JSNPMethod>(*exec->heap())) JSNPMethod(globalObject, structure, npIdent); - method->finishCreation(exec->globalData(), name); + method->finishCreation(exec->vm(), name); return method; } @@ -54,14 +54,14 @@ public: NPIdentifier npIdentifier() const { return m_npIdentifier; } protected: - void finishCreation(JSC::JSGlobalData&, const String& name); + void finishCreation(JSC::VM&, const String& name); private: JSNPMethod(JSC::JSGlobalObject*, JSC::Structure*, NPIdentifier); - static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) { - return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info); + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info); } static JSC::CallType getCallData(JSC::JSCell*, JSC::CallData&); diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp index 51fb15d8e..75bd923b0 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp @@ -57,7 +57,7 @@ static NPIdentifier npIdentifierFromIdentifier(PropertyName propertyName) const ClassInfo JSNPObject::s_info = { "NPObject", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSNPObject) }; JSNPObject::JSNPObject(JSGlobalObject* globalObject, Structure* structure, NPRuntimeObjectMap* objectMap, NPObject* npObject) - : JSDestructibleObject(globalObject->globalData(), structure) + : JSDestructibleObject(globalObject->vm(), structure) , m_objectMap(objectMap) , m_npObject(npObject) { @@ -66,7 +66,7 @@ JSNPObject::JSNPObject(JSGlobalObject* globalObject, Structure* structure, NPRun void JSNPObject::finishCreation(JSGlobalObject* globalObject) { - Base::finishCreation(globalObject->globalData()); + Base::finishCreation(globalObject->vm()); ASSERT(inherits(&s_info)); // We should never have an NPJSObject inside a JSNPObject. @@ -127,7 +127,7 @@ JSValue JSNPObject::callMethod(ExecState* exec, NPIdentifier methodName) VOID_TO_NPVARIANT(result); { - JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); returnValue = m_npObject->_class->invoke(m_npObject, methodName, arguments.data(), argumentCount, &result); NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec); } @@ -167,7 +167,7 @@ JSC::JSValue JSNPObject::callObject(JSC::ExecState* exec) VOID_TO_NPVARIANT(result); { - JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); returnValue = m_npObject->_class->invokeDefault(m_npObject, arguments.data(), argumentCount, &result); NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec); } @@ -207,7 +207,7 @@ JSValue JSNPObject::callConstructor(ExecState* exec) VOID_TO_NPVARIANT(result); { - JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); returnValue = m_npObject->_class->construct(m_npObject, arguments.data(), argumentCount, &result); NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec); } @@ -352,7 +352,7 @@ void JSNPObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName, J NPRuntimeObjectMap::PluginProtector protector(thisObject->m_objectMap); { - JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); thisObject->m_npObject->_class->setProperty(thisObject->m_npObject, npIdentifier, &variant); NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec); @@ -392,7 +392,7 @@ bool JSNPObject::deleteProperty(ExecState* exec, NPIdentifier propertyName) NPRuntimeObjectMap::PluginProtector protector(m_objectMap); { - JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); // FIXME: Should we throw an exception if removeProperty returns false? if (!m_npObject->_class->removeProperty(m_npObject, propertyName)) @@ -425,7 +425,7 @@ void JSNPObject::getOwnPropertyNames(JSObject* object, ExecState* exec, Property NPRuntimeObjectMap::PluginProtector protector(thisObject->m_objectMap); { - JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); // FIXME: Should we throw an exception if enumerate returns false? if (!thisObject->m_npObject->_class->enumerate(thisObject->m_npObject, &identifiers, &identifierCount)) @@ -473,7 +473,7 @@ JSValue JSNPObject::propertyGetter(ExecState* exec, JSValue slotBase, PropertyNa bool returnValue; { - JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); NPIdentifier npIdentifier = npIdentifierFromIdentifier(propertyName); returnValue = thisObj->m_npObject->_class->getProperty(thisObj->m_npObject, npIdentifier, &result); diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h index 662d6c637..e963e6775 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h @@ -47,8 +47,8 @@ public: static JSNPObject* create(JSC::JSGlobalObject* globalObject, NPRuntimeObjectMap* objectMap, NPObject* npObject) { - JSC::Structure* structure = createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()); - JSNPObject* object = new (JSC::allocateCell<JSNPObject>(globalObject->globalData().heap)) JSNPObject(globalObject, structure, objectMap, npObject); + JSC::Structure* structure = createStructure(globalObject->vm(), globalObject, globalObject->objectPrototype()); + JSNPObject* object = new (JSC::allocateCell<JSNPObject>(globalObject->vm().heap)) JSNPObject(globalObject, structure, objectMap, npObject); object->finishCreation(globalObject); return object; } @@ -77,9 +77,9 @@ private: static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | JSObject::StructureFlags; - static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) { - return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info); + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info); } static JSC::CallType getCallData(JSC::JSCell*, JSC::CallData&); diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp index d21f7e410..aa49fe39f 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp @@ -31,10 +31,13 @@ #include "JSNPObject.h" #include "NPRuntimeObjectMap.h" #include "NPRuntimeUtilities.h" +#include <JavaScriptCore/JSCJSValueInlines.h> +#include <JavaScriptCore/JSCellInlines.h> #include <JavaScriptCore/JSLock.h> #include <JavaScriptCore/JSObject.h> #include <JavaScriptCore/StrongInlines.h> -#include <WebCore/Frame.h> +#include <JavaScriptCore/StructureInlines.h> +#include <WebCore/Frame.h> #include <WebCore/IdentifierRep.h> #include <wtf/text/WTFString.h> @@ -43,13 +46,13 @@ using namespace WebCore; namespace WebKit { -NPJSObject* NPJSObject::create(JSGlobalData& globalData, NPRuntimeObjectMap* objectMap, JSObject* jsObject) +NPJSObject* NPJSObject::create(VM& vm, NPRuntimeObjectMap* objectMap, JSObject* jsObject) { // We should never have a JSNPObject inside an NPJSObject. ASSERT(!jsObject->inherits(&JSNPObject::s_info)); NPJSObject* npJSObject = toNPJSObject(createNPObject(0, npClass())); - npJSObject->initialize(globalData, objectMap, jsObject); + npJSObject->initialize(vm, objectMap, jsObject); return npJSObject; } @@ -69,13 +72,13 @@ bool NPJSObject::isNPJSObject(NPObject* npObject) return npObject->_class == npClass(); } -void NPJSObject::initialize(JSGlobalData& globalData, NPRuntimeObjectMap* objectMap, JSObject* jsObject) +void NPJSObject::initialize(VM& vm, NPRuntimeObjectMap* objectMap, JSObject* jsObject) { ASSERT(!m_objectMap); ASSERT(!m_jsObject); m_objectMap = objectMap; - m_jsObject.set(globalData, jsObject); + m_jsObject.set(vm, jsObject); } static Identifier identifierFromIdentifierRep(ExecState* exec, IdentifierRep* identifierRep) @@ -269,9 +272,7 @@ bool NPJSObject::construct(const NPVariant* arguments, uint32_t argumentCount, N for (uint32_t i = 0; i < argumentCount; ++i) argumentList.append(m_objectMap->convertNPVariantToJSValue(exec, m_objectMap->globalObject(), arguments[i])); - exec->globalData().timeoutChecker.start(); JSValue value = JSC::construct(exec, m_jsObject.get(), constructType, constructData, argumentList); - exec->globalData().timeoutChecker.stop(); // Convert and return the new object. m_objectMap->convertJSValueToNPVariant(exec, value, *result); @@ -292,9 +293,7 @@ bool NPJSObject::invoke(ExecState* exec, JSGlobalObject* globalObject, JSValue f for (uint32_t i = 0; i < argumentCount; ++i) argumentList.append(m_objectMap->convertNPVariantToJSValue(exec, globalObject, arguments[i])); - exec->globalData().timeoutChecker.start(); JSValue value = JSC::call(exec, function, callType, callData, m_jsObject->methodTable()->toThisObject(m_jsObject.get(), exec), argumentList); - exec->globalData().timeoutChecker.stop(); // Convert and return the result of the function call. m_objectMap->convertJSValueToNPVariant(exec, value, *result); diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.h index 9dc0824b0..4b65f7280 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.h +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.h @@ -34,7 +34,7 @@ namespace JSC { -class JSGlobalData; +class VM; class JSGlobalObject; class JSObject; @@ -48,7 +48,7 @@ class NPRuntimeObjectMap; class NPJSObject : public NPObject { WTF_MAKE_NONCOPYABLE(NPJSObject); public: - static NPJSObject* create(JSC::JSGlobalData&, NPRuntimeObjectMap*, JSC::JSObject*); + static NPJSObject* create(JSC::VM&, NPRuntimeObjectMap*, JSC::JSObject*); JSC::JSObject* jsObject() const { return m_jsObject.get(); } @@ -64,7 +64,7 @@ private: NPJSObject(); ~NPJSObject(); - void initialize(JSC::JSGlobalData&, NPRuntimeObjectMap*, JSC::JSObject*); + void initialize(JSC::VM&, NPRuntimeObjectMap*, JSC::JSObject*); bool hasMethod(NPIdentifier methodName); bool invoke(NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result); diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp index fca8909d6..9956f1f80 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp @@ -39,7 +39,11 @@ #include <JavaScriptCore/SourceCode.h> #include <JavaScriptCore/Strong.h> #include <JavaScriptCore/StrongInlines.h> +#include <WebCore/DOMWrapperWorld.h> #include <WebCore/Frame.h> +#include <WebCore/Page.h> +#include <WebCore/PageThrottler.h> +#include <WebCore/ScriptController.h> using namespace JSC; using namespace WebCore; @@ -49,7 +53,7 @@ namespace WebKit { NPRuntimeObjectMap::NPRuntimeObjectMap(PluginView* pluginView) : m_pluginView(pluginView) - , m_finalizationTimer(WebProcess::shared().runLoop(), this, &NPRuntimeObjectMap::invalidateQueuedObjects) + , m_finalizationTimer(RunLoop::main(), this, &NPRuntimeObjectMap::invalidateQueuedObjects) { } @@ -64,7 +68,7 @@ NPRuntimeObjectMap::PluginProtector::~PluginProtector() { } -NPObject* NPRuntimeObjectMap::getOrCreateNPObject(JSGlobalData& globalData, JSObject* jsObject) +NPObject* NPRuntimeObjectMap::getOrCreateNPObject(VM& vm, JSObject* jsObject) { // If this is a JSNPObject, we can just get its underlying NPObject. if (jsObject->classInfo() == &JSNPObject::s_info) { @@ -81,7 +85,7 @@ NPObject* NPRuntimeObjectMap::getOrCreateNPObject(JSGlobalData& globalData, JSOb return npJSObject; } - NPJSObject* npJSObject = NPJSObject::create(globalData, this, jsObject); + NPJSObject* npJSObject = NPJSObject::create(vm, this, jsObject); m_npJSObjects.set(jsObject, npJSObject); return npJSObject; @@ -170,7 +174,7 @@ void NPRuntimeObjectMap::convertJSValueToNPVariant(ExecState* exec, JSValue valu } if (value.isObject()) { - NPObject* npObject = getOrCreateNPObject(exec->globalData(), asObject(value)); + NPObject* npObject = getOrCreateNPObject(exec->vm(), asObject(value)); OBJECT_TO_NPVARIANT(npObject, variant); return; } @@ -180,18 +184,21 @@ void NPRuntimeObjectMap::convertJSValueToNPVariant(ExecState* exec, JSValue valu bool NPRuntimeObjectMap::evaluate(NPObject* npObject, const String& scriptString, NPVariant* result) { - Strong<JSGlobalObject> globalObject(this->globalObject()->globalData(), this->globalObject()); + Strong<JSGlobalObject> globalObject(this->globalObject()->vm(), this->globalObject()); if (!globalObject) return false; + if (m_pluginView && !m_pluginView->isBeingDestroyed()) { + if (Page* page = m_pluginView->frame()->page()) + page->pageThrottler()->reportInterestingEvent(); + } + ExecState* exec = globalObject->globalExec(); JSLockHolder lock(exec); JSValue thisValue = getOrCreateJSObject(globalObject.get(), npObject); - globalObject->globalData().timeoutChecker.start(); JSValue resultValue = JSC::evaluate(exec, makeSource(scriptString), thisValue); - globalObject->globalData().timeoutChecker.stop(); convertJSValueToNPVariant(exec, resultValue, *result); return true; @@ -211,7 +218,7 @@ void NPRuntimeObjectMap::invalidate() Vector<NPObject*> objects; - for (HashMap<NPObject*, JSC::Weak<JSNPObject> >::iterator ptr = m_jsNPObjects.begin(), end = m_jsNPObjects.end(); ptr != end; ++ptr) { + for (HashMap<NPObject*, JSC::Weak<JSNPObject>>::iterator ptr = m_jsNPObjects.begin(), end = m_jsNPObjects.end(); ptr != end; ++ptr) { JSNPObject* jsNPObject = ptr->value.get(); if (!jsNPObject) // Skip zombies. continue; diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h index d9c002e4f..e5178ad17 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h @@ -30,6 +30,7 @@ #include <WebCore/RunLoop.h> #include <heap/Weak.h> +#include <heap/WeakInlines.h> #include <wtf/Forward.h> #include <wtf/HashMap.h> @@ -38,7 +39,7 @@ typedef struct _NPVariant NPVariant; namespace JSC { class ExecState; - class JSGlobalData; + class VM; class JSGlobalObject; class JSObject; class JSValue; @@ -66,7 +67,7 @@ public: // Returns an NPObject that wraps the given JSObject object. If there is already an NPObject that wraps this JSObject, it will // retain it and return it. - NPObject* getOrCreateNPObject(JSC::JSGlobalData&, JSC::JSObject*); + NPObject* getOrCreateNPObject(JSC::VM&, JSC::JSObject*); void npJSObjectDestroyed(NPJSObject*); // Returns a JSObject object that wraps the given NPObject. @@ -94,9 +95,8 @@ private: void invalidateQueuedObjects(); PluginView* m_pluginView; - HashMap<JSC::JSObject*, NPJSObject*> m_npJSObjects; - HashMap<NPObject*, JSC::Weak<JSNPObject> > m_jsNPObjects; + HashMap<NPObject*, JSC::Weak<JSNPObject>> m_jsNPObjects; Vector<NPObject*> m_npObjectsToFinalize; WebCore::RunLoop::Timer<NPRuntimeObjectMap> m_finalizationTimer; }; diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp index 5da43a7e4..f1f3d1878 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp @@ -39,12 +39,7 @@ #include <utility> #include <wtf/text/StringBuilder.h> -#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 -#include "NetscapeSandboxFunctions.h" -#endif - using namespace WebCore; -using namespace std; namespace WebKit { @@ -252,7 +247,7 @@ static NPError parsePostBuffer(bool isFile, const char *buffer, uint32_t length, String contentLength = headerFields.get("Content-Length"); if (!contentLength.isNull()) - dataLength = min(contentLength.toInt(), (int)dataLength); + dataLength = std::min(contentLength.toInt(), (int)dataLength); headerFields.remove("Content-Length"); postBuffer += location; @@ -412,10 +407,9 @@ static const unsigned WKNVSupportsCompositingCoreAnimationPluginsBool = 74656; // Whether the browser expects a non-retained Core Animation layer. static const unsigned WKNVExpectsNonretainedLayer = 74657; -// Whether plug-in code is allowed to enter (arbitrary) sandbox for the process. -static const unsigned WKNVAllowedToEnterSandbox = 74658; +// 74658 and 74659 are no longer implemented. -// WKNVSandboxFunctions = 74659 is defined in NetscapeSandboxFunctions.h +static const unsigned WKNVPlugInContainer = 74660; #endif @@ -501,17 +495,11 @@ static NPError NPN_GetValue(NPP npp, NPNVariable variable, void *value) break; } - case WKNVAllowedToEnterSandbox: - *(NPBool*)value = true; - break; - -#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 && ENABLE(PLUGIN_PROCESS) - case WKNVSandboxFunctions: - { - *(WKNSandboxFunctions **)value = netscapeSandboxFunctions(); + case WKNVPlugInContainer: { + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + *reinterpret_cast<void**>(value) = plugin->plugInContainer(); break; } -#endif #ifndef NP_NO_QUICKDRAW case NPNVsupportsQuickDrawBool: @@ -524,15 +512,6 @@ static NPError NPN_GetValue(NPP npp, NPNVariable variable, void *value) *(NPBool*)value = true; break; #endif -#elif PLATFORM(WIN) - case NPNVnetscapeWindow: { - RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); - *reinterpret_cast<HWND*>(value) = plugin->containingWindow(); - break; - } - case NPNVSupportsWindowless: - *(NPBool*)value = true; - break; #elif PLUGIN_ARCHITECTURE(X11) case NPNVxDisplay: { if (!npp) diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp index f1e0e5b10..efcf193dc 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp @@ -37,12 +37,12 @@ #include <WebCore/HTTPHeaderMap.h> #include <WebCore/IntRect.h> #include <WebCore/KURL.h> +#include <WebCore/SharedBuffer.h> #include <runtime/JSObject.h> #include <utility> #include <wtf/text/CString.h> using namespace WebCore; -using namespace std; namespace WebKit { @@ -187,7 +187,7 @@ void NetscapePlugin::loadURL(const String& method, const String& urlString, cons // Eventually we are going to get a frameDidFinishLoading or frameDidFail call for this request. // Keep track of the notification data so we can call NPP_URLNotify. ASSERT(!m_pendingURLNotifications.contains(requestID)); - m_pendingURLNotifications.set(requestID, make_pair(urlString, notificationData)); + m_pendingURLNotifications.set(requestID, std::make_pair(urlString, notificationData)); } } @@ -528,12 +528,12 @@ bool NetscapePlugin::shouldLoadSrcURL() NetscapePluginStream* NetscapePlugin::streamFromID(uint64_t streamID) { - return m_streams.get(streamID).get(); + return m_streams.get(streamID); } void NetscapePlugin::stopAllStreams() { - Vector<RefPtr<NetscapePluginStream> > streams; + Vector<RefPtr<NetscapePluginStream>> streams; copyValuesToVector(m_streams, streams); for (size_t i = 0; i < streams.size(); ++i) @@ -630,6 +630,8 @@ bool NetscapePlugin::initialize(const Parameters& parameters) m_layerHostingMode = parameters.layerHostingMode; #endif + platformPreInitialize(); + NetscapePlugin* previousNPPNewPlugin = currentNPPNewPlugin; m_inNPPNew = true; @@ -926,6 +928,11 @@ bool NetscapePlugin::shouldAllowScripting() return true; } +bool NetscapePlugin::shouldAllowNavigationFromDrags() +{ + return false; +} + bool NetscapePlugin::handlesPageScaleFactor() { return false; @@ -953,6 +960,16 @@ NPObject* NetscapePlugin::pluginScriptableNPObject() return scriptableNPObject; } + +unsigned NetscapePlugin::countFindMatches(const String&, WebCore::FindOptions, unsigned) +{ + return 0; +} + +bool NetscapePlugin::findString(const String&, WebCore::FindOptions, unsigned) +{ + return false; +} void NetscapePlugin::contentsScaleFactorChanged(float scaleFactor) { @@ -1033,6 +1050,11 @@ bool NetscapePlugin::supportsSnapshotting() const return false; } +PassRefPtr<WebCore::SharedBuffer> NetscapePlugin::liveResourceData() const +{ + return 0; +} + IntPoint NetscapePlugin::convertToRootView(const IntPoint& pointInPluginCoordinates) const { return m_pluginToRootViewTransform.mapPoint(pointInPluginCoordinates); diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h index 2063ccee6..651dc4d0e 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h @@ -41,8 +41,11 @@ namespace WebCore { class HTTPHeaderMap; class ProtectionSpace; + class SharedBuffer; } +OBJC_CLASS WKNPAPIPlugInContainer; + namespace WebKit { class NetscapePluginStream; @@ -69,10 +72,13 @@ public: bool hasHandledAKeyDownEvent() const { return m_hasHandledAKeyDownEvent; } mach_port_t compositingRenderServerPort(); + void openPluginPreferencePane(); // Computes an affine transform from the given coordinate space to the screen coordinate space. bool getScreenTransform(NPCoordinateSpace sourceSpace, WebCore::AffineTransform&); + WKNPAPIPlugInContainer* plugInContainer(); + #ifndef NP_NO_CARBON WindowRef windowRef() const; bool isWindowActive() const { return m_windowHasFocus; } @@ -82,8 +88,6 @@ public: static unsigned buttonState(); #endif -#elif PLATFORM(WIN) - HWND containingWindow(); #endif PluginQuirks quirks() const { return m_pluginModule->pluginQuirks(); } @@ -154,6 +158,7 @@ private: const char* userAgent(); + void platformPreInitialize(); bool platformPostInitialize(); void platformDestroy(); bool platformInvalidate(const WebCore::IntRect&); @@ -208,10 +213,14 @@ private: virtual bool isEditingCommandEnabled(const String&) OVERRIDE; virtual bool shouldAllowScripting() OVERRIDE; + virtual bool shouldAllowNavigationFromDrags() OVERRIDE; virtual bool handlesPageScaleFactor() OVERRIDE; virtual NPObject* pluginScriptableNPObject(); + + virtual unsigned countFindMatches(const String&, WebCore::FindOptions, unsigned maxMatchCount) OVERRIDE; + virtual bool findString(const String&, WebCore::FindOptions, unsigned maxMatchCount) OVERRIDE; #if PLATFORM(MAC) virtual void windowFocusChanged(bool); @@ -236,7 +245,7 @@ private: virtual WebCore::Scrollbar* horizontalScrollbar(); virtual WebCore::Scrollbar* verticalScrollbar(); - bool supportsSnapshotting() const; + virtual bool supportsSnapshotting() const; // Convert the given point from plug-in coordinates to root view coordinates. virtual WebCore::IntPoint convertToRootView(const WebCore::IntPoint&) const OVERRIDE; @@ -245,6 +254,12 @@ private: // converted (if the transformation matrix isn't invertible). bool convertFromRootView(const WebCore::IntPoint& pointInRootViewCoordinates, WebCore::IntPoint& pointInPluginCoordinates); + virtual PassRefPtr<WebCore::SharedBuffer> liveResourceData() const OVERRIDE; + + virtual bool performDictionaryLookupAtLocation(const WebCore::FloatPoint&) OVERRIDE { return false; } + + virtual String getSelectionString() const OVERRIDE { return String(); } + void updateNPNPrivateMode(); #if PLUGIN_ARCHITECTURE(WIN) @@ -259,10 +274,10 @@ private: uint64_t m_nextRequestID; - typedef HashMap<uint64_t, std::pair<String, void*> > PendingURLNotifyMap; + typedef HashMap<uint64_t, std::pair<String, void*>> PendingURLNotifyMap; PendingURLNotifyMap m_pendingURLNotifications; - typedef HashMap<uint64_t, RefPtr<NetscapePluginStream> > StreamsMap; + typedef HashMap<uint64_t, RefPtr<NetscapePluginStream>> StreamsMap; StreamsMap m_streams; RefPtr<NetscapePluginModule> m_pluginModule; @@ -319,7 +334,7 @@ private: WebCore::RunLoop::Timer<Timer> m_timer; }; - typedef HashMap<unsigned, OwnPtr<Timer> > TimerMap; + typedef HashMap<unsigned, OwnPtr<Timer>> TimerMap; TimerMap m_timers; unsigned m_nextTimerID; @@ -357,6 +372,8 @@ private: WebCore::IntRect m_windowFrameInScreenCoordinates; WebCore::IntRect m_viewFrameInWindowCoordinates; + RetainPtr<WKNPAPIPlugInContainer> m_plugInContainer; + #ifndef NP_NO_CARBON void nullEventTimerFired(); diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginNone.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginNone.cpp index 88cc4e7e3..02cda26fa 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginNone.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginNone.cpp @@ -33,6 +33,10 @@ using namespace WebCore; namespace WebKit { +void NetscapePlugin::platformPreInitialize() +{ +} + bool NetscapePlugin::platformPostInitialize() { return false; diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp index 65ab2e5ea..9cb1a6dee 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp @@ -34,7 +34,6 @@ #include <wtf/Vector.h> using namespace WebCore; -using namespace std; namespace WebKit { @@ -221,7 +220,7 @@ void NetscapePluginStream::deliverDataToPlugin() } // Figure out how much data to send to the plug-in. - int32_t dataLength = min(numBytesPluginCanHandle, numBytesToDeliver - numBytesDelivered); + int32_t dataLength = std::min(numBytesPluginCanHandle, numBytesToDeliver - numBytesDelivered); uint8_t* data = m_deliveryData->data() + numBytesDelivered; int32_t numBytesWritten = m_plugin->NPP_Write(&m_npStream, m_offset, dataLength, data); @@ -235,7 +234,7 @@ void NetscapePluginStream::deliverDataToPlugin() if (!m_isStarted) return; - numBytesWritten = min(numBytesWritten, dataLength); + numBytesWritten = std::min(numBytesWritten, dataLength); m_offset += numBytesWritten; numBytesDelivered += numBytesWritten; } diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.h index b95b23517..ffa55cb25 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.h +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.h @@ -106,7 +106,7 @@ private: CString m_headers; WebCore::RunLoop::Timer<NetscapePluginStream> m_deliveryDataTimer; - OwnPtr< Vector<uint8_t> > m_deliveryData; + OwnPtr< Vector<uint8_t>> m_deliveryData; bool m_stopStreamWhenDoneDelivering; }; diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm index 4edc32ff4..a86949c0f 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm @@ -30,6 +30,7 @@ #import "NetscapeBrowserFuncs.h" #import "PluginController.h" +#import "WKNPAPIPlugInContainerInternal.h" #import "WebEvent.h" #import <Carbon/Carbon.h> #import <WebCore/GraphicsContext.h> @@ -178,6 +179,19 @@ mach_port_t NetscapePlugin::compositingRenderServerPort() return controller()->compositingRenderServerPort(); } +void NetscapePlugin::openPluginPreferencePane() +{ + controller()->openPluginPreferencePane(); +} + +WKNPAPIPlugInContainer* NetscapePlugin::plugInContainer() +{ + if (!m_plugInContainer) + m_plugInContainer = adoptNS([[WKNPAPIPlugInContainer alloc] _initWithNetscapePlugin:this]); + + return m_plugInContainer.get(); +} + #ifndef NP_NO_CARBON typedef HashMap<WindowRef, NetscapePlugin*> WindowMap; @@ -189,6 +203,24 @@ static WindowMap& windowMap() } #endif +static void NSException_release(id, SEL) +{ + // Do nothing. +} + +void NetscapePlugin::platformPreInitialize() +{ + if (m_pluginModule->pluginQuirks().contains(PluginQuirks::LeakAllThrownNSExceptions)) { + // Patch -[NSException release] to not release the object. + static dispatch_once_t once; + dispatch_once(&once, ^{ + Class exceptionClass = [NSException class]; + Method exceptionReleaseMethod = class_getInstanceMethod(exceptionClass, @selector(release)); + class_replaceMethod(exceptionClass, @selector(release), reinterpret_cast<IMP>(NSException_release), method_getTypeEncoding(exceptionReleaseMethod)); + }); + } +} + bool NetscapePlugin::platformPostInitialize() { if (m_drawingModel == static_cast<NPDrawingModel>(-1)) { @@ -254,6 +286,8 @@ bool NetscapePlugin::platformPostInitialize() void NetscapePlugin::platformDestroy() { + [m_plugInContainer _invalidate]; + #ifndef NP_NO_CARBON if (m_eventModel == NPEventModelCarbon) { if (WindowRef window = windowRef()) { @@ -1109,7 +1143,7 @@ void NetscapePlugin::updatePluginLayer() if (m_pluginReturnsNonretainedLayer) m_pluginLayer = reinterpret_cast<CALayer *>(value); else - m_pluginLayer.adoptNS(reinterpret_cast<CALayer *>(value)); + m_pluginLayer = adoptNS(reinterpret_cast<CALayer *>(value)); if (m_pluginModule->pluginQuirks().contains(PluginQuirks::MakeOpaqueUnlessTransparentSilverlightBackgroundAttributeExists) && !m_isTransparent) diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm deleted file mode 100644 index e9474495a..000000000 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (C) 2012 Apple Inc. All rights reserved. - * - * 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. - */ - -#import "config.h" -#import "NetscapeSandboxFunctions.h" - -#if ENABLE(NETSCAPE_PLUGIN_API) && ENABLE(PLUGIN_PROCESS) - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - -#import "PluginProcess.h" -#import "NetscapePluginModule.h" -#import "WebKitSystemInterface.h" -#import <WebCore/FileSystem.h> -#import <WebCore/SoftLinking.h> -#import <sys/stat.h> -#import <sysexits.h> -#import <wtf/RetainPtr.h> -#import <wtf/Vector.h> -#import <wtf/text/CString.h> - -SOFT_LINK_FRAMEWORK(CoreServices) -SOFT_LINK_OPTIONAL(CoreServices, CFURLStopAccessingSecurityScopedResource, void, unused, (CFURLRef)) - -using namespace WebKit; -using namespace WebCore; - -WKNSandboxFunctions* netscapeSandboxFunctions() -{ - static WKNSandboxFunctions functions = { - sizeof(WKNSandboxFunctions), - WKNVSandboxFunctionsVersionCurrent, - WKN_EnterSandbox, - WKN_FileStopAccessing - }; - return &functions; -} - -static bool enteredSandbox; - -static CString readSandboxProfile() -{ - RetainPtr<CFURLRef> profileURL(AdoptCF, CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("com.apple.WebKit.PluginProcess"), CFSTR("sb"), 0)); - char profilePath[PATH_MAX]; - if (!CFURLGetFileSystemRepresentation(profileURL.get(), false, reinterpret_cast<UInt8*>(profilePath), sizeof(profilePath))) { - WTFLogAlways("Could not get file system representation of plug-in sandbox URL\n"); - return CString(); - } - - FILE *file = fopen(profilePath, "r"); - if (!file) { - WTFLogAlways("Could not open plug-in sandbox file '%s'\n", profilePath); - return CString(); - } - - struct stat fileInfo; - if (stat(profilePath, &fileInfo)) { - WTFLogAlways("Could not get plug-in sandbox file size '%s'\n", profilePath); - return CString(); - } - - char* characterBuffer; - CString result = CString::newUninitialized(fileInfo.st_size, characterBuffer); - - if (1 != fread(characterBuffer, fileInfo.st_size, 1, file)) { - WTFLogAlways("Could not read plug-in sandbox file '%s'\n", profilePath); - return CString(); - } - - fclose(file); - - return result; -} - -NPError enterSandbox(const char* sandboxProfile, const char* readOnlyPaths[], const char* readWritePaths[]) -{ - if (enteredSandbox) - return NPERR_GENERIC_ERROR; - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 - // Use private temporary and cache directories. - String systemDirectorySuffix = "com.apple.WebKit.PluginProcess+" + PluginProcess::shared().netscapePluginModule()->module()->bundleIdentifier(); - setenv("DIRHELPER_USER_DIR_SUFFIX", fileSystemRepresentation(systemDirectorySuffix).data(), 0); - char temporaryDirectory[PATH_MAX]; - if (!confstr(_CS_DARWIN_USER_TEMP_DIR, temporaryDirectory, sizeof(temporaryDirectory))) { - WTFLogAlways("PluginProcess: couldn't retrieve private temporary directory path: %d\n", errno); - exit(EX_NOPERM); - } - setenv("TMPDIR", temporaryDirectory, 1); - if (chdir(temporaryDirectory) == -1) { - WTFLogAlways("PluginProcess: couldn't change working directory to temporary path: %s, errno %d\n", temporaryDirectory, errno); - exit(EX_OSERR); - } -#endif - - - Vector<const char*> extendedReadOnlyPaths; - if (readOnlyPaths) { - for (unsigned i = 0; readOnlyPaths[i]; ++i) - extendedReadOnlyPaths.append(readOnlyPaths[i]); - } - - CString pluginModulePath = fileSystemRepresentation(PluginProcess::shared().pluginPath()); - extendedReadOnlyPaths.append(pluginModulePath.data()); - - // On-disk WebKit framework locations, to account for debug installations. - // Allowing the whole directory containing WebKit2.framework for the sake of APIs that implicitly load other WebKit frameworks. - // We don't want to load them now, and thus don't have any better idea of where they are located on disk. - extendedReadOnlyPaths.append([[[[[NSBundle bundleWithIdentifier:@"com.apple.WebKit2"] bundleURL] URLByDeletingLastPathComponent] path] fileSystemRepresentation]); - - extendedReadOnlyPaths.append(static_cast<const char*>(0)); - - Vector<const char*> extendedReadWritePaths; - if (readWritePaths) { - for (unsigned i = 0; readWritePaths[i]; ++i) - extendedReadWritePaths.append(readWritePaths[i]); - } - - char darwinUserTempDirectory[PATH_MAX]; - if (confstr(_CS_DARWIN_USER_TEMP_DIR, darwinUserTempDirectory, PATH_MAX) > 0) - extendedReadWritePaths.append(darwinUserTempDirectory); - - char darwinUserCacheDirectory[PATH_MAX]; - if (confstr(_CS_DARWIN_USER_CACHE_DIR, darwinUserCacheDirectory, PATH_MAX) > 0) - extendedReadWritePaths.append(darwinUserCacheDirectory); - - RetainPtr<CFStringRef> cachePath(AdoptCF, WKCopyFoundationCacheDirectory()); - extendedReadWritePaths.append([(NSString *)cachePath.get() fileSystemRepresentation]); - - extendedReadWritePaths.append(static_cast<const char*>(0)); - - // WKEnterPluginSandbox canonicalizes path arrays, but not parameters (because it cannot know if one is a path). - char* homeDirectory = realpath([NSHomeDirectory() fileSystemRepresentation], 0); - if (!homeDirectory) - exit(EX_NOPERM); - const char* sandboxParameters[] = { "HOME_DIR", homeDirectory, 0, 0 }; - - if (!WKEnterPluginSandbox(sandboxProfile, sandboxParameters, extendedReadOnlyPaths.data(), extendedReadWritePaths.data())) { - WTFLogAlways("Couldn't initialize sandbox profile\n"); - exit(EX_NOPERM); - } - - if (noErr != WKEnableSandboxStyleFileQuarantine()) { - WTFLogAlways("Couldn't enable file quarantine\n"); - exit(EX_NOPERM); - } - - free(homeDirectory); - enteredSandbox = true; - - RetainPtr<NSDictionary> defaults = adoptNS([[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"NSUseRemoteSavePanel", nil]); - [[NSUserDefaults standardUserDefaults] registerDefaults:defaults.get()]; - - return NPERR_NO_ERROR; -} - -NPError WKN_EnterSandbox(const char* readOnlyPaths[], const char* readWritePaths[]) -{ - CString profile = readSandboxProfile(); - if (profile.isNull()) - exit(EX_NOPERM); - - return enterSandbox(profile.data(), readOnlyPaths, readWritePaths); -} - -NPError WKN_FileStopAccessing(const char* path) -{ - if (!enteredSandbox) - return NPERR_GENERIC_ERROR; - - if (!CFURLStopAccessingSecurityScopedResourcePtr()) - return NPERR_NO_ERROR; - - RetainPtr<CFStringRef> urlString(AdoptCF, CFStringCreateWithFileSystemRepresentation(0, path)); - if (!urlString) - return NPERR_INVALID_PARAM; - RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithFileSystemPath(0, urlString.get(), kCFURLPOSIXPathStyle, false)); - - CFURLStopAccessingSecurityScopedResourcePtr()(url.get()); - - return NPERR_NO_ERROR; -} - -#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - -#endif // ENABLE(NETSCAPE_PLUGIN_API) && ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm index 416065698..d20330511 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm @@ -31,8 +31,11 @@ #import "PluginController.h" #import "PluginControllerProxyMessages.h" #import "PluginProcessConnection.h" +#import <QuartzCore/QuartzCore.h> #import <WebKitSystemInterface.h> +const static double fadeInDuration = 0.5; + namespace WebKit { static void makeRenderLayer(CALayer *pluginLayer, uint32_t layerHostingContextID) @@ -48,9 +51,18 @@ PlatformLayer* PluginProxy::pluginLayer() if (!m_pluginLayer && 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 = adoptNS([[CALayer alloc] init]); [m_pluginLayer.get() setGeometryFlipped:YES]; + if (m_isRestartedProcess) { + CABasicAnimation *fadeInAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; + fadeInAnimation.fromValue = [NSNumber numberWithFloat:0]; + fadeInAnimation.toValue = [NSNumber numberWithFloat:1]; + fadeInAnimation.duration = fadeInDuration; + fadeInAnimation.removedOnCompletion = NO; + [m_pluginLayer.get() addAnimation:fadeInAnimation forKey:@"restarted-plugin-fade-in"]; + } + makeRenderLayer(m_pluginLayer.get(), m_remoteLayerClientID); } @@ -85,7 +97,6 @@ void PluginProxy::setLayerHostingContextID(uint32_t layerHostingContextID) makeRenderLayer(m_pluginLayer.get(), m_remoteLayerClientID); } - } // namespace WebKit #endif // ENABLE(PLUGIN_PROCESS) && ENABLE(NETSCAPE_PLUGIN_API) diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainer.h b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainer.h new file mode 100644 index 000000000..e682459cf --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainer.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2013 Apple Inc. All rights reserved. + * + * 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. + */ + +@protocol WKNPAPIPlugInContainer <NSObject> +- (BOOL)openPlugInPreferencePane; +@end diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.h b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainer.mm index 0956cc636..f6b2a7c71 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.h +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainer.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Apple Inc. All rights reserved. + * Copyright (C) 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,43 +23,50 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef NetscapeSandboxFunctions_h -#define NetscapeSandboxFunctions_h +#import "config.h" +#import "WKNPAPIPluginContainerInternal.h" -#if ENABLE(NETSCAPE_PLUGIN_API) && ENABLE(PLUGIN_PROCESS) +#import "NetscapePlugin.h" -#include <WebCore/npapi.h> +using namespace WebKit; -#ifdef __cplusplus -extern "C" { -#endif - -#define WKNVSandboxFunctions 74659 -#define WKNVSandboxFunctionsVersionCurrent 1 +@implementation WKNPAPIPlugInContainer -typedef NPError (*WKN_EnterSandboxProcPtr)(const char *readOnlyPaths[], const char *readWritePaths[]); -typedef NPError (*WKN_FileStopAccessingProcPtr)(const char* path); +- (id)_initWithNetscapePlugin:(NetscapePlugin *)plugin +{ + self = [super init]; + if (!self) + return nil; -NPError WKN_EnterSandbox(const char *readOnlyPaths[], const char *readWritePaths[]); -NPError WKN_FileStopAccessing(const char* path); + _plugin = plugin; -typedef struct _WKNSandboxFunctions { - uint16_t size; - uint16_t version; - - WKN_EnterSandboxProcPtr enterSandbox; - WKN_FileStopAccessingProcPtr fileStopAccessing; -} WKNSandboxFunctions; + return self; +} -// FIXME: This header is mostly "API", except for the following two functions. We should -// move the declarations to a seperate header. -WKNSandboxFunctions* netscapeSandboxFunctions(); -NPError enterSandbox(const char* sandboxProfile, const char* readOnlyPaths[], const char* readWritePaths[]); +#if !ASSERT_DISABLED +- (void)dealloc +{ + ASSERT(!_plugin); -#ifdef __cplusplus + [super dealloc]; } #endif -#endif // ENABLE(NETSCAPE_PLUGIN_API) && ENABLE(PLUGIN_PROCESS) +- (void)_invalidate +{ + ASSERT(_plugin); + + _plugin = nullptr; +} + +- (BOOL)openPlugInPreferencePane +{ + if (!_plugin) + return NO; + + _plugin->openPluginPreferencePane(); + return YES; +} + +@end -#endif diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainerInternal.h b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainerInternal.h new file mode 100644 index 000000000..85fd3c335 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/WKNPAPIPlugInContainerInternal.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2013 Apple Inc. All rights reserved. + * + * 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. + */ + +#import "WKNPAPIPlugInContainer.h" + +namespace WebKit { +class NetscapePlugin; +}; + +@interface WKNPAPIPlugInContainer : NSObject <WKNPAPIPlugInContainer> { + WebKit::NetscapePlugin* _plugin; +} + +- (id)_initWithNetscapePlugin:(WebKit::NetscapePlugin*)plugin; +- (void)_invalidate; + +@end diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp deleted file mode 100644 index 9d0deb27c..000000000 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp +++ /dev/null @@ -1,402 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * - * 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" -#include "NetscapePlugin.h" - -#if ENABLE(NETSCAPE_PLUGIN_API) - -#include "PluginController.h" -#include "WebEvent.h" -#include "WindowGeometry.h" -#include <WebCore/DefWndProcWindowClass.h> -#include <WebCore/GraphicsContext.h> -#include <WebCore/LocalWindowsContext.h> -#include <WebCore/NotImplemented.h> -#include <WebCore/WebCoreInstanceHandle.h> - -using namespace WebCore; - -namespace WebKit { - -static NetscapePlugin* currentPlugin; - -class CurrentPluginSetter { - WTF_MAKE_NONCOPYABLE(CurrentPluginSetter); -public: - explicit CurrentPluginSetter(NetscapePlugin* plugin) - : m_plugin(plugin) - , m_formerCurrentPlugin(currentPlugin) - { - currentPlugin = m_plugin; - } - - ~CurrentPluginSetter() - { - ASSERT(currentPlugin == m_plugin); - currentPlugin = m_formerCurrentPlugin; - } - -private: - NetscapePlugin* m_plugin; - NetscapePlugin* m_formerCurrentPlugin; -}; - -static LPCWSTR windowClassName = L"org.webkit.NetscapePluginWindow"; - -static void registerPluginView() -{ - static bool didRegister; - if (didRegister) - return; - didRegister = true; - - WNDCLASSW windowClass = {0}; - windowClass.style = CS_DBLCLKS; - windowClass.lpfnWndProc = ::DefWindowProcW; - windowClass.hInstance = instanceHandle(); - windowClass.hCursor = ::LoadCursorW(0, IDC_ARROW); - windowClass.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1); - windowClass.lpszClassName = windowClassName; - - ::RegisterClassW(&windowClass); -} - -HWND NetscapePlugin::containingWindow() -{ - return controller()->nativeParentWindow(); -} - -bool NetscapePlugin::platformPostInitialize() -{ - if (!m_isWindowed) { - m_window = 0; - - // Windowless plugins need a little help showing context menus since our containingWindow() - // is in a different process. See <http://webkit.org/b/51063>. - m_pluginModule->module()->installIATHook("user32.dll", "TrackPopupMenu", hookedTrackPopupMenu); - m_contextMenuOwnerWindow = ::CreateWindowExW(0, defWndProcWindowClassName(), 0, WS_CHILD, 0, 0, 0, 0, containingWindow(), 0, instanceHandle(), 0); - - return true; - } - - registerPluginView(); - - // Start out with the window hidden. The UI process will take care of showing it once it's correctly positioned the window. - m_window = ::CreateWindowExW(0, windowClassName, 0, WS_CHILD, 0, 0, 0, 0, containingWindow(), 0, instanceHandle(), 0); - if (!m_window) - return false; - - // FIXME: Do we need to pass our window to setPlatformWidget? - // FIXME: WebCore::PluginView sets the window proc to DefWindowProcA here for Shockwave Director. - - m_npWindow.type = NPWindowTypeWindow; - m_npWindow.window = m_window; - - return true; -} - -void NetscapePlugin::platformDestroy() -{ - if (!m_isWindowed) { - ASSERT(m_contextMenuOwnerWindow); - ::DestroyWindow(m_contextMenuOwnerWindow); - ASSERT(!m_window); - return; - } - - if (!::IsWindow(m_window)) - return; - ::DestroyWindow(m_window); -} - -bool NetscapePlugin::platformInvalidate(const IntRect& invalidRect) -{ - if (!m_isWindowed) - return false; - - RECT rect = invalidRect; - ::InvalidateRect(m_window, &rect, FALSE); - return true; -} - -void NetscapePlugin::platformGeometryDidChange() -{ - if (!m_isWindowed) - return; - - scheduleWindowedGeometryUpdate(); -} - -void NetscapePlugin::platformVisibilityDidChange() -{ - if (!m_isWindowed) - return; - - scheduleWindowedGeometryUpdate(); -} - -void NetscapePlugin::scheduleWindowedGeometryUpdate() -{ - // We only update the size here and let the UI process update our position and clip rect so - // that we can keep our position in sync when scrolling, etc. See <http://webkit.org/b/60210>. - ::SetWindowPos(m_window, 0, 0, 0, m_pluginSize.width(), m_pluginSize.height(), SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER); - - WindowGeometry geometry; - geometry.window = m_window; - geometry.visible = controller()->isPluginVisible(); - geometry.frame = IntRect(convertToRootView(IntPoint()), m_pluginSize); - geometry.clipRect = m_clipRect; - - controller()->scheduleWindowedPluginGeometryUpdate(geometry); -} - -void NetscapePlugin::platformPaint(GraphicsContext* context, const IntRect& dirtyRect, bool) -{ - CurrentPluginSetter setCurrentPlugin(this); - - // FIXME: Call SetWindow here if we haven't called it yet (see r59904). - - if (m_isWindowed) { - // FIXME: Paint windowed plugins into context if context->shouldIncludeChildWindows() is true. - return; - } - - controller()->willSendEventToPlugin(); - - LocalWindowsContext windowsContext(context, dirtyRect, m_isTransparent); - - m_npWindow.type = NPWindowTypeDrawable; - m_npWindow.window = windowsContext.hdc(); - - WINDOWPOS windowpos = { 0, 0, 0, 0, 0, 0, 0 }; - - IntPoint pluginLocationInRootViewCoordinates = convertToRootView(IntPoint()); - - windowpos.x = pluginLocationInRootViewCoordinates.x(); - windowpos.y = pluginLocationInRootViewCoordinates.y(); - windowpos.cx = m_pluginSize.width(); - windowpos.cy = m_pluginSize.height(); - - NPEvent npEvent; - npEvent.event = WM_WINDOWPOSCHANGED; - npEvent.wParam = 0; - npEvent.lParam = reinterpret_cast<uintptr_t>(&windowpos); - - NPP_HandleEvent(&npEvent); - - callSetWindow(); - - RECT dirtyWinRect = dirtyRect; - - npEvent.event = WM_PAINT; - npEvent.wParam = reinterpret_cast<uintptr_t>(windowsContext.hdc()); - npEvent.lParam = reinterpret_cast<uintptr_t>(&dirtyWinRect); - - NPP_HandleEvent(&npEvent); -} - -NPEvent toNP(const WebMouseEvent& event) -{ - NPEvent npEvent; - - npEvent.wParam = 0; - if (event.controlKey()) - npEvent.wParam |= MK_CONTROL; - if (event.shiftKey()) - npEvent.wParam |= MK_SHIFT; - - npEvent.lParam = MAKELPARAM(event.position().x(), event.position().y()); - - switch (event.type()) { - case WebEvent::MouseMove: - npEvent.event = WM_MOUSEMOVE; - switch (event.button()) { - case WebMouseEvent::LeftButton: - npEvent.wParam |= MK_LBUTTON; - break; - case WebMouseEvent::MiddleButton: - npEvent.wParam |= MK_MBUTTON; - break; - case WebMouseEvent::RightButton: - npEvent.wParam |= MK_RBUTTON; - break; - case WebMouseEvent::NoButton: - break; - } - break; - case WebEvent::MouseDown: - switch (event.button()) { - case WebMouseEvent::LeftButton: - npEvent.event = WM_LBUTTONDOWN; - break; - case WebMouseEvent::MiddleButton: - npEvent.event = WM_MBUTTONDOWN; - break; - case WebMouseEvent::RightButton: - npEvent.event = WM_RBUTTONDOWN; - break; - case WebMouseEvent::NoButton: - ASSERT_NOT_REACHED(); - break; - } - break; - case WebEvent::MouseUp: - switch (event.button()) { - case WebMouseEvent::LeftButton: - npEvent.event = WM_LBUTTONUP; - break; - case WebMouseEvent::MiddleButton: - npEvent.event = WM_MBUTTONUP; - break; - case WebMouseEvent::RightButton: - npEvent.event = WM_RBUTTONUP; - break; - case WebMouseEvent::NoButton: - ASSERT_NOT_REACHED(); - break; - } - break; - default: - ASSERT_NOT_REACHED(); - break; - } - - return npEvent; -} - -bool NetscapePlugin::platformHandleMouseEvent(const WebMouseEvent& event) -{ - CurrentPluginSetter setCurrentPlugin(this); - - if (m_isWindowed) - return false; - - controller()->willSendEventToPlugin(); - - NPEvent npEvent = toNP(event); - NPP_HandleEvent(&npEvent); - return true; -} - -bool NetscapePlugin::platformHandleWheelEvent(const WebWheelEvent&) -{ - CurrentPluginSetter setCurrentPlugin(this); - - notImplemented(); - return false; -} - -void NetscapePlugin::platformSetFocus(bool hasFocus) -{ - CurrentPluginSetter setCurrentPlugin(this); - - if (m_isWindowed) - return; - - controller()->willSendEventToPlugin(); - - NPEvent npEvent; - npEvent.event = hasFocus ? WM_SETFOCUS : WM_KILLFOCUS; - npEvent.wParam = 0; - npEvent.lParam = 0; - - NPP_HandleEvent(&npEvent); -} - -bool NetscapePlugin::wantsPluginRelativeNPWindowCoordinates() -{ - return false; -} - -bool NetscapePlugin::platformHandleMouseEnterEvent(const WebMouseEvent& event) -{ - CurrentPluginSetter setCurrentPlugin(this); - - if (m_isWindowed) - return false; - - controller()->willSendEventToPlugin(); - - NPEvent npEvent = toNP(event); - NPP_HandleEvent(&npEvent); - return true; -} - -bool NetscapePlugin::platformHandleMouseLeaveEvent(const WebMouseEvent& event) -{ - CurrentPluginSetter setCurrentPlugin(this); - - if (m_isWindowed) - return false; - - controller()->willSendEventToPlugin(); - - NPEvent npEvent = toNP(event); - NPP_HandleEvent(&npEvent); - return true; -} - -bool NetscapePlugin::platformHandleKeyboardEvent(const WebKeyboardEvent&) -{ - CurrentPluginSetter setCurrentPlugin(this); - - notImplemented(); - return false; -} - -BOOL NetscapePlugin::hookedTrackPopupMenu(HMENU hMenu, UINT uFlags, int x, int y, int nReserved, HWND hWnd, const RECT* prcRect) -{ - // ::TrackPopupMenu fails when it is passed a window that is owned by another thread. If this - // happens, we substitute a dummy window that is owned by this thread. - - if (::GetWindowThreadProcessId(hWnd, 0) == ::GetCurrentThreadId()) - return ::TrackPopupMenu(hMenu, uFlags, x, y, nReserved, hWnd, prcRect); - - HWND originalFocusWindow = 0; - - ASSERT(currentPlugin); - if (currentPlugin) { - ASSERT(!currentPlugin->m_isWindowed); - ASSERT(currentPlugin->m_contextMenuOwnerWindow); - ASSERT(::GetWindowThreadProcessId(currentPlugin->m_contextMenuOwnerWindow, 0) == ::GetCurrentThreadId()); - hWnd = currentPlugin->m_contextMenuOwnerWindow; - - // If we don't focus the dummy window, the user will be able to scroll the page while the - // context menu is up, e.g. - originalFocusWindow = ::SetFocus(hWnd); - } - - BOOL result = ::TrackPopupMenu(hMenu, uFlags, x, y, nReserved, hWnd, prcRect); - - if (originalFocusWindow) - ::SetFocus(originalFocusWindow); - - return result; -} - -} // namespace WebKit - -#endif // ENABLE(NETSCAPE_PLUGIN_API) diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp index 30a0e86cd..d734ff684 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp @@ -47,7 +47,7 @@ #include <Ecore_X.h> #endif -#if USE(CAIRO) && !PLATFORM(WIN_CAIRO) +#if USE(CAIRO) #include "PlatformContextCairo.h" #include "RefPtrCairo.h" #include <cairo/cairo-xlib.h> @@ -248,6 +248,10 @@ bool NetscapePlugin::platformPostInitializeWindowless() return true; } +void NetscapePlugin::platformPreInitialize() +{ +} + bool NetscapePlugin::platformPostInitialize() { #if PLATFORM(GTK) @@ -308,9 +312,7 @@ void NetscapePlugin::platformGeometryDidChange() #if PLATFORM(GTK) windowID = static_cast<uint64_t>(GDK_WINDOW_XID(gtk_plug_get_socket_window(GTK_PLUG(m_platformPluginWidget)))); #endif - IntRect clipRect(m_clipRect); - clipRect.move(-m_frameRectInWindowCoordinates.x(), -m_frameRectInWindowCoordinates.y()); - controller()->windowedPluginGeometryDidChange(m_frameRectInWindowCoordinates, clipRect, windowID); + controller()->windowedPluginGeometryDidChange(m_frameRectInWindowCoordinates, m_clipRect, windowID); return; } @@ -529,6 +531,7 @@ bool NetscapePlugin::platformHandleMouseEvent(const WebMouseEvent& event) #if ENABLE(GESTURE_EVENTS) case WebEvent::GestureScrollBegin: case WebEvent::GestureScrollEnd: + case WebEvent::GestureSingleTap: #endif #if ENABLE(TOUCH_EVENTS) case WebEvent::TouchStart: |
