summaryrefslogtreecommitdiff
path: root/Source/WebKit2/WebProcess/Plugins
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/WebProcess/Plugins')
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp13
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp20
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp2
-rw-r--r--Source/WebKit2/WebProcess/Plugins/PluginView.cpp26
-rw-r--r--Source/WebKit2/WebProcess/Plugins/PluginView.h3
5 files changed, 38 insertions, 26 deletions
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp
index 5c6452739..d8c874621 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp
@@ -45,9 +45,12 @@ using namespace WebCore;
namespace WebKit {
-static NPIdentifier npIdentifierFromIdentifier(PropertyName identifier)
+static NPIdentifier npIdentifierFromIdentifier(PropertyName propertyName)
{
- return static_cast<NPIdentifier>(IdentifierRep::get(identifier.ustring().utf8().data()));
+ UString name(propertyName.publicName());
+ if (name.isNull())
+ return 0;
+ return static_cast<NPIdentifier>(IdentifierRep::get(name.utf8().data()));
}
const ClassInfo JSNPObject::s_info = { "NPObject", &JSNonFinalObject::s_info, 0, 0, CREATE_METHOD_TABLE(JSNPObject) };
@@ -474,7 +477,7 @@ JSValue JSNPObject::propertyGetter(ExecState* exec, JSValue slotBase, PropertyNa
return propertyValue;
}
-JSValue JSNPObject::methodGetter(ExecState* exec, JSValue slotBase, PropertyName methodName)
+JSValue JSNPObject::methodGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
{
JSNPObject* thisObj = static_cast<JSNPObject*>(asObject(slotBase));
ASSERT_GC_OBJECT_INHERITS(thisObj, &s_info);
@@ -482,8 +485,8 @@ JSValue JSNPObject::methodGetter(ExecState* exec, JSValue slotBase, PropertyName
if (!thisObj->m_npObject)
return throwInvalidAccessError(exec);
- NPIdentifier npIdentifier = npIdentifierFromIdentifier(methodName);
- return JSNPMethod::create(exec, thisObj->globalObject(), methodName.ustring(), npIdentifier);
+ NPIdentifier npIdentifier = npIdentifierFromIdentifier(propertyName);
+ return JSNPMethod::create(exec, thisObj->globalObject(), propertyName.publicName(), npIdentifier);
}
JSObject* JSNPObject::throwInvalidAccessError(ExecState* exec)
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp
index c883e3cd2..1a22d3837 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp
@@ -104,8 +104,7 @@ JSObject* NPRuntimeObjectMap::getOrCreateJSObject(JSGlobalObject* globalObject,
return jsNPObject;
JSNPObject* jsNPObject = JSNPObject::create(globalObject, this, npObject);
- m_jsNPObjects.set(npObject, JSC::PassWeak<JSNPObject>(jsNPObject, this, npObject));
-
+ weakAdd(m_jsNPObjects, npObject, JSC::PassWeak<JSNPObject>(jsNPObject, this, npObject));
return jsNPObject;
}
@@ -155,7 +154,7 @@ void NPRuntimeObjectMap::convertJSValueToNPVariant(ExecState* exec, JSValue valu
}
if (value.isBoolean()) {
- BOOLEAN_TO_NPVARIANT(value.toBoolean(exec), variant);
+ BOOLEAN_TO_NPVARIANT(value.toBoolean(), variant);
return;
}
@@ -212,8 +211,12 @@ void NPRuntimeObjectMap::invalidate()
Vector<NPObject*> objects;
- for (HashMap<NPObject*, JSC::Weak<JSNPObject> >::iterator ptr = m_jsNPObjects.begin(), end = m_jsNPObjects.end(); ptr != end; ++ptr)
- objects.append(ptr->second->leakNPObject());
+ for (HashMap<NPObject*, JSC::Weak<JSNPObject> >::iterator ptr = m_jsNPObjects.begin(), end = m_jsNPObjects.end(); ptr != end; ++ptr) {
+ JSNPObject* jsNPObject = ptr->second.get();
+ if (!jsNPObject) // Skip zombies.
+ continue;
+ objects.append(jsNPObject->leakNPObject());
+ }
m_jsNPObjects.clear();
@@ -293,12 +296,7 @@ void NPRuntimeObjectMap::addToInvalidationQueue(NPObject* npObject)
void NPRuntimeObjectMap::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
JSNPObject* object = jsCast<JSNPObject*>(asObject(handle.get()));
-
- HashMap<NPObject*, JSC::Weak<JSNPObject> >::iterator found = m_jsNPObjects.find(static_cast<NPObject*>(context));
- ASSERT(found != m_jsNPObjects.end());
- ASSERT(found->second.was(object));
- m_jsNPObjects.remove(found);
-
+ weakRemove(m_jsNPObjects, static_cast<NPObject*>(context), object);
addToInvalidationQueue(object->leakNPObject());
}
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
index d19198032..2b91038d9 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
@@ -310,7 +310,7 @@ void NetscapePlugin::popPopupsEnabledState()
void NetscapePlugin::pluginThreadAsyncCall(void (*function)(void*), void* userData)
{
- RunLoop::main()->dispatch(bind(&NetscapePlugin::handlePluginThreadAsyncCall, this, function, userData));
+ RunLoop::main()->dispatch(WTF::bind(&NetscapePlugin::handlePluginThreadAsyncCall, this, function, userData));
}
void NetscapePlugin::handlePluginThreadAsyncCall(void (*function)(void*), void* userData)
diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp
index de17915b0..2191688e1 100644
--- a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp
@@ -268,16 +268,13 @@ PluginView::PluginView(PassRefPtr<HTMLPlugInElement> pluginElement, PassRefPtr<P
#endif
, m_manualStreamState(StreamStateInitial)
{
-#if PLATFORM(MAC)
m_webPage->addPluginView(this);
-#endif
}
PluginView::~PluginView()
{
-#if PLATFORM(MAC)
- m_webPage->removePluginView(this);
-#endif
+ if (m_webPage)
+ m_webPage->removePluginView(this);
ASSERT(!m_isBeingDestroyed);
@@ -293,7 +290,8 @@ PluginView::~PluginView()
m_plugin->destroyPlugin();
m_isBeingDestroyed = false;
#if PLATFORM(MAC)
- pluginFocusOrWindowFocusChanged(false);
+ if (m_webPage)
+ pluginFocusOrWindowFocusChanged(false);
#endif
}
@@ -395,6 +393,16 @@ RenderBoxModelObject* PluginView::renderer() const
return toRenderBoxModelObject(m_pluginElement->renderer());
}
+void PluginView::pageScaleFactorDidChange()
+{
+ viewGeometryDidChange();
+}
+
+void PluginView::webPageDestroyed()
+{
+ m_webPage = 0;
+}
+
#if PLATFORM(MAC)
void PluginView::setWindowIsVisible(bool windowIsVisible)
{
@@ -748,15 +756,15 @@ void PluginView::viewGeometryDidChange()
return;
ASSERT(frame());
- float frameScaleFactor = frame()->frameScaleFactor();
+ float pageScaleFactor = frame()->page() ? frame()->page()->pageScaleFactor() : 1;
- IntPoint scaledFrameRectLocation(frameRect().location().x() * frameScaleFactor, frameRect().location().y() * frameScaleFactor);
+ IntPoint scaledFrameRectLocation(frameRect().location().x() * pageScaleFactor, frameRect().location().y() * pageScaleFactor);
IntPoint scaledLocationInRootViewCoordinates(parent()->contentsToRootView(scaledFrameRectLocation));
// FIXME: We still don't get the right coordinates for transformed plugins.
AffineTransform transform;
transform.translate(scaledLocationInRootViewCoordinates.x(), scaledLocationInRootViewCoordinates.y());
- transform.scale(frameScaleFactor);
+ transform.scale(pageScaleFactor);
// FIXME: The clip rect isn't correct.
IntRect clipRect = boundsRect();
diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.h b/Source/WebKit2/WebProcess/Plugins/PluginView.h
index 547109b2b..f101b2f4f 100644
--- a/Source/WebKit2/WebProcess/Plugins/PluginView.h
+++ b/Source/WebKit2/WebProcess/Plugins/PluginView.h
@@ -72,6 +72,9 @@ public:
// FIXME: Remove this; nobody should have to know about the plug-in view's renderer except the plug-in view itself.
WebCore::RenderBoxModelObject* renderer() const;
+ void pageScaleFactorDidChange();
+ void webPageDestroyed();
+
private:
PluginView(PassRefPtr<WebCore::HTMLPlugInElement>, PassRefPtr<Plugin>, const Plugin::Parameters& parameters);
virtual ~PluginView();