Changeset 64093 in webkit
- Timestamp:
- Jul 26, 2010 5:09:07 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r64088 r64093 1 2010-07-26 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Plug-in views should be able to return JSObjects directly 6 https://bugs.webkit.org/show_bug.cgi?id=43019 7 8 * bindings/js/JSHTMLAppletElementCustom.cpp: 9 (WebCore::JSHTMLAppletElement::putDelegate): 10 (WebCore::JSHTMLAppletElement::getCallData): 11 * bindings/js/JSHTMLEmbedElementCustom.cpp: 12 (WebCore::JSHTMLEmbedElement::putDelegate): 13 (WebCore::JSHTMLEmbedElement::getCallData): 14 * bindings/js/JSHTMLObjectElementCustom.cpp: 15 (WebCore::JSHTMLObjectElement::putDelegate): 16 (WebCore::JSHTMLObjectElement::getCallData): 17 runtimeObjectCustomPut and runtimeObjectGetCallData now take a JSHTMLElement instead of a HTMLElement. 18 19 * bindings/js/JSPluginElementFunctions.cpp: 20 (WebCore::pluginScriptObject): 21 First, ask the PluginViewBase for a JSObject and fall back to getting the JSObject from the instance. 22 23 (WebCore::runtimeObjectPropertyGetter): 24 (WebCore::runtimeObjectCustomGetOwnPropertySlot): 25 (WebCore::runtimeObjectCustomGetOwnPropertyDescriptor): 26 Call pluginScriptObject. 27 28 (WebCore::runtimeObjectCustomPut): 29 Change to take a JSHTMLElement. Call pluginScriptObject. 30 31 (WebCore::runtimeObjectGetCallData): 32 Change to take a JSHTMLElement. 33 34 * bridge/jsc/BridgeJSC.cpp: 35 * bridge/jsc/BridgeJSC.h: 36 (JSC::Bindings::Instance::createRuntimeObject): 37 Change this to return a JSObject. 38 39 * html/HTMLPlugInElement.cpp: 40 (WebCore::HTMLPlugInElement::getInstance): 41 Call pluginWidget. 42 43 (WebCore::HTMLPlugInElement::pluginWidget): 44 Return the plug-in widget for this element. 45 46 * html/HTMLPlugInElement.h: 47 * plugins/PluginViewBase.h: 48 (WebCore::PluginViewBase::scriptObject): 49 Add default implementation of scriptObject. 50 1 51 2010-07-26 Chris Fleizach <cfleizach@apple.com> 2 52 -
trunk/WebCore/bindings/js/JSHTMLAppletElementCustom.cpp
r55104 r64093 46 46 bool JSHTMLAppletElement::putDelegate(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) 47 47 { 48 return runtimeObjectCustomPut(exec, propertyName, value, impl(), slot);48 return runtimeObjectCustomPut(exec, propertyName, value, this, slot); 49 49 } 50 50 51 51 CallType JSHTMLAppletElement::getCallData(CallData& callData) 52 52 { 53 return runtimeObjectGetCallData( impl(), callData);53 return runtimeObjectGetCallData(this, callData); 54 54 } 55 55 -
trunk/WebCore/bindings/js/JSHTMLEmbedElementCustom.cpp
r55104 r64093 46 46 bool JSHTMLEmbedElement::putDelegate(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) 47 47 { 48 return runtimeObjectCustomPut(exec, propertyName, value, impl(), slot);48 return runtimeObjectCustomPut(exec, propertyName, value, this, slot); 49 49 } 50 50 51 51 CallType JSHTMLEmbedElement::getCallData(CallData& callData) 52 52 { 53 return runtimeObjectGetCallData( impl(), callData);53 return runtimeObjectGetCallData(this, callData); 54 54 } 55 55 -
trunk/WebCore/bindings/js/JSHTMLObjectElementCustom.cpp
r55104 r64093 46 46 bool JSHTMLObjectElement::putDelegate(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) 47 47 { 48 return runtimeObjectCustomPut(exec, propertyName, value, impl(), slot);48 return runtimeObjectCustomPut(exec, propertyName, value, this, slot); 49 49 } 50 50 51 51 CallType JSHTMLObjectElement::getCallData(CallData& callData) 52 52 { 53 return runtimeObjectGetCallData( impl(), callData);53 return runtimeObjectGetCallData(this, callData); 54 54 } 55 55 -
trunk/WebCore/bindings/js/JSPluginElementFunctions.cpp
r60631 r64093 25 25 #include "HTMLPlugInElement.h" 26 26 #include "JSHTMLElement.h" 27 #include " runtime_object.h"27 #include "PluginViewBase.h" 28 28 29 29 using namespace JSC; … … 50 50 } 51 51 52 static RuntimeObject* getRuntimeObject(ExecState* exec, Node* node)52 static JSObject* pluginScriptObject(ExecState* exec, JSHTMLElement* jsHTMLElement) 53 53 { 54 Instance* instance = pluginInstance(node);55 if (! instance)54 HTMLElement* element = jsHTMLElement->impl(); 55 if (!(element->hasTagName(objectTag) || element->hasTagName(embedTag) || element->hasTagName(appletTag))) 56 56 return 0; 57 58 HTMLPlugInElement* pluginElement = static_cast<HTMLPlugInElement*>(element); 59 60 // First, see if we can ask the plug-in view for its script object. 61 if (Widget* pluginWidget = pluginElement->pluginWidget()) { 62 if (pluginWidget->isPluginViewBase()) { 63 PluginViewBase* pluginViewBase = static_cast<PluginViewBase*>(pluginWidget); 64 if (JSObject* scriptObject = pluginViewBase->scriptObject(exec, jsHTMLElement->globalObject())) 65 return scriptObject; 66 } 67 } 68 69 // Otherwise, fall back to getting the object from the instance. 70 71 // The plugin element holds an owning reference, so we don't have to. 72 Instance* instance = pluginElement->getInstance().get(); 73 if (!instance || !instance->rootObject()) 74 return 0; 75 57 76 return instance->createRuntimeObject(exec); 58 77 } 59 78 60 79 JSValue runtimeObjectPropertyGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName) 61 80 { 62 JSHTMLElement* thisObj = static_cast<JSHTMLElement*>(asObject(slotBase)); 63 HTMLElement* element = static_cast<HTMLElement*>(thisObj->impl()); 64 RuntimeObject* runtimeObject = getRuntimeObject(exec, element); 65 if (!runtimeObject) 81 JSHTMLElement* element = static_cast<JSHTMLElement*>(asObject(slotBase)); 82 JSObject* scriptObject = pluginScriptObject(exec, element); 83 if (!scriptObject) 66 84 return jsUndefined(); 67 return runtimeObject->get(exec, propertyName); 85 86 return scriptObject->get(exec, propertyName); 68 87 } 69 88 70 89 bool runtimeObjectCustomGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot, JSHTMLElement* element) 71 90 { 72 RuntimeObject* runtimeObject = getRuntimeObject(exec, element->impl());73 if (! runtimeObject)91 JSObject* scriptObject = pluginScriptObject(exec, element); 92 if (!scriptObject) 74 93 return false; 75 if (!runtimeObject->hasProperty(exec, propertyName)) 94 95 if (!scriptObject->hasProperty(exec, propertyName)) 76 96 return false; 77 97 slot.setCustom(element, runtimeObjectPropertyGetter); … … 81 101 bool runtimeObjectCustomGetOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, JSHTMLElement* element) 82 102 { 83 RuntimeObject* runtimeObject = getRuntimeObject(exec, element->impl());84 if (! runtimeObject)103 JSObject* scriptObject = pluginScriptObject(exec, element); 104 if (!scriptObject) 85 105 return false; 86 if (! runtimeObject->hasProperty(exec, propertyName))106 if (!scriptObject->hasProperty(exec, propertyName)) 87 107 return false; 88 108 PropertySlot slot; … … 95 115 } 96 116 97 bool runtimeObjectCustomPut(ExecState* exec, const Identifier& propertyName, JSValue value, HTMLElement* element, PutPropertySlot& slot)117 bool runtimeObjectCustomPut(ExecState* exec, const Identifier& propertyName, JSValue value, JSHTMLElement* element, PutPropertySlot& slot) 98 118 { 99 RuntimeObject* runtimeObject = getRuntimeObject(exec, element);100 if (! runtimeObject)119 JSObject* scriptObject = pluginScriptObject(exec, element); 120 if (!scriptObject) 101 121 return 0; 102 if (! runtimeObject->hasProperty(exec, propertyName))122 if (!scriptObject->hasProperty(exec, propertyName)) 103 123 return false; 104 runtimeObject->put(exec, propertyName, value, slot);124 scriptObject->put(exec, propertyName, value, slot); 105 125 return true; 106 126 } … … 115 135 } 116 136 117 CallType runtimeObjectGetCallData( HTMLElement* element, CallData& callData)137 CallType runtimeObjectGetCallData(JSHTMLElement* element, CallData& callData) 118 138 { 119 Instance* instance = pluginInstance(element );139 Instance* instance = pluginInstance(element->impl()); 120 140 if (!instance || !instance->supportsInvokeDefaultMethod()) 121 141 return CallTypeNone; -
trunk/WebCore/bindings/js/JSPluginElementFunctions.h
r55401 r64093 41 41 bool runtimeObjectCustomGetOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&, JSHTMLElement*); 42 42 bool runtimeObjectCustomGetOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&, JSHTMLElement*); 43 bool runtimeObjectCustomPut(JSC::ExecState*, const JSC::Identifier&, JSC::JSValue, HTMLElement*, JSC::PutPropertySlot&);44 JSC::CallType runtimeObjectGetCallData( HTMLElement*, JSC::CallData&);43 bool runtimeObjectCustomPut(JSC::ExecState*, const JSC::Identifier&, JSC::JSValue, JSHTMLElement*, JSC::PutPropertySlot&); 44 JSC::CallType runtimeObjectGetCallData(JSHTMLElement*, JSC::CallData&); 45 45 46 46 } // namespace WebCore -
trunk/WebCore/bridge/jsc/BridgeJSC.cpp
r59941 r64093 84 84 } 85 85 86 RuntimeObject* Instance::createRuntimeObject(ExecState* exec)86 JSObject* Instance::createRuntimeObject(ExecState* exec) 87 87 { 88 88 ASSERT(m_rootObject); -
trunk/WebCore/bridge/jsc/BridgeJSC.h
r60392 r64093 85 85 86 86 virtual Class* getClass() const = 0; 87 RuntimeObject* createRuntimeObject(ExecState*);87 JSObject* createRuntimeObject(ExecState*); 88 88 void willInvalidateRuntimeObject(); 89 89 void willDestroyRuntimeObject(); -
trunk/WebCore/html/HTMLPlugInElement.cpp
r62875 r64093 93 93 return m_instance; 94 94 95 RenderWidget* renderWidget = renderWidgetForJSBindings(); 96 if (renderWidget && renderWidget->widget()) 97 m_instance = frame->script()->createScriptInstanceForWidget(renderWidget->widget()); 95 if (Widget* widget = pluginWidget()) 96 m_instance = frame->script()->createScriptInstanceForWidget(widget); 98 97 99 98 return m_instance; 99 } 100 101 Widget* HTMLPlugInElement::pluginWidget() const 102 { 103 RenderWidget* renderWidget = renderWidgetForJSBindings(); 104 if (!renderWidget) 105 return 0; 106 107 return renderWidget->widget(); 100 108 } 101 109 -
trunk/WebCore/html/HTMLPlugInElement.h
r62875 r64093 34 34 35 35 class RenderWidget; 36 class Widget; 36 37 37 38 class HTMLPlugInElement : public HTMLFrameOwnerElement { … … 40 41 41 42 PassScriptInstance getInstance() const; 43 44 Widget* pluginWidget() const; 42 45 43 46 #if ENABLE(NETSCAPE_PLUGIN_API) -
trunk/WebCore/plugins/PluginViewBase.h
r63638 r64093 29 29 #include "GraphicsLayer.h" 30 30 31 namespace JSC { 32 class ExecState; 33 class JSGlobalObject; 34 class JSObject; 35 } 36 31 37 namespace WebCore { 32 38 … … 38 44 virtual PlatformLayer* platformLayer() const { return 0; } 39 45 #endif 46 47 JSC::JSObject* scriptObject(JSC::ExecState*, JSC::JSGlobalObject*) { return 0; } 40 48 41 49 protected:
Note: See TracChangeset
for help on using the changeset viewer.