Changeset 93637 in webkit
- Timestamp:
- Aug 23, 2011 2:01:52 PM (13 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/CMakeLists.txt
r83792 r93637 6 6 "${WEBCORE_DIR}/bindings" 7 7 "${WEBCORE_DIR}/bridge" 8 "${WEBCORE_DIR}/bridge/c" 8 9 "${WEBCORE_DIR}/bridge/jsc" 9 10 "${WEBCORE_DIR}/css" -
trunk/Source/WebKit/ChangeLog
r92492 r93637 1 2011-08-23 Jonas M. Gastal <jgastal@profusion.mobi> 2 3 Reviewed by Antonio Gomes. 4 5 [EFL] Exporting JavaScript objects for EFL port 6 https://bugs.webkit.org/show_bug.cgi?id=43446 7 8 This patch allows to export objects to JavaScript API, 9 just like qt does, but it uses the netscape api 10 to do the convertion to javascript object. 11 12 * CMakeLists.txt: 13 Adding necessary files for the patch. 14 1 15 2011-08-05 Anders Carlsson <andersca@apple.com> 2 16 -
trunk/Source/WebKit/efl/CMakeListsEfl.txt
r91973 r93637 81 81 efl/ewk/ewk_view_tiled.c 82 82 efl/ewk/ewk_window_features.cpp 83 efl/ewk/ewk_js.cpp 83 84 ) 84 85 -
trunk/Source/WebKit/efl/ChangeLog
r93617 r93637 1 2011-08-23 Jonas M. Gastal <jgastal@profusion.mobi> 2 3 [EFL] Exporting JavaScript objects for EFL port 4 https://bugs.webkit.org/show_bug.cgi?id=43446 5 6 Reviewed by Antonio Gomes. 7 8 This patch allows to export objects to JavaScript API, 9 just like qt does, but it uses the netscape api 10 to do the convertion to javascript object. 11 12 * CMakeLists.txt: 13 * WebCoreSupport/FrameLoaderClientEfl.cpp: 14 (WebCore::FrameLoaderClientEfl::dispatchDidClearWindowObjectInWorld): 15 * ewk/EWebKit.h: 16 * ewk/ewk_js.cpp: Added. 17 (ewk_js_variant_to_npvariant): 18 (ewk_js_npvariant_to_variant): 19 (ewk_js_property_has): 20 (ewk_js_property_get): 21 (ewk_js_property_set): 22 (ewk_js_property_remove): 23 (ewk_js_properties_enumerate): 24 (ewk_js_method_has): 25 (ewk_js_method_invoke): 26 (ewk_js_class_new): 27 (ewk_js_class_free): 28 (ewk_js_object_new): 29 (ewk_js_object_free): 30 (ewk_js_object_properties_get): 31 (ewk_js_object_name_get): 32 (ewk_js_variant_free): 33 * ewk/ewk_js.h: Added. 34 * ewk/ewk_main.cpp: 35 (ewk_init): 36 * ewk/ewk_private.h: 37 * ewk/ewk_view.cpp: 38 (ewk_view_js_window_object_clear): 39 (ewk_view_js_object_add): 40 * ewk/ewk_view.h: 41 1 42 2011-08-23 Raphael Kubo da Costa <kubo@profusion.mobi> 2 43 -
trunk/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp
r93611 r93637 441 441 442 442 evas_object_smart_callback_call(m_view, "window,object,cleared", &event); 443 444 #if ENABLE(NETSCAPE_PLUGIN_API) 445 ewk_view_js_window_object_clear(m_view, m_frame); 446 #endif 443 447 } 444 448 -
trunk/Source/WebKit/efl/ewk/EWebKit.h
r91255 r93637 35 35 #include "ewk_frame.h" 36 36 #include "ewk_history.h" 37 #include "ewk_js.h" 37 38 #include "ewk_main.h" 38 39 #include "ewk_network.h" -
trunk/Source/WebKit/efl/ewk/ewk_private.h
r93617 r93637 31 31 #include "EWebKit.h" 32 32 #include "Frame.h" 33 #include "NP_jsobject.h" 33 34 #include "Page.h" 34 35 #include "Settings.h" 35 36 #include "Widget.h" 37 #include "ewk_js.h" 36 38 #include "ewk_logging.h" 37 39 #include "ewk_util.h" … … 47 49 // If defined, ewk will do type checking to ensure objects are of correct type 48 50 #define EWK_TYPE_CHECK 1 51 52 #if ENABLE(NETSCAPE_PLUGIN_API) 53 #define EWK_JS_OBJECT_MAGIC 0x696969 54 55 typedef struct _Ewk_JS_Class Ewk_JS_Class; 56 struct _Ewk_JS_Object { 57 JavaScriptObject base; 58 const char *name; 59 const Ewk_JS_Class *cls; 60 Eina_Hash *properties; 61 Evas_Object *view; // ewk_view: check if this object has already been added to another ewk_view 62 Ewk_JS_Object_Type type; 63 EINA_MAGIC; 64 }; 65 #endif // ENABLE(NETSCAPE_PLUGIN_API) 49 66 50 67 // forward declarations … … 122 139 void ewk_view_editor_client_selection_changed(Evas_Object *o); 123 140 141 #if ENABLE(NETSCAPE_PLUGIN_API) 142 void ewk_view_js_window_object_clear(Evas_Object *o, Evas_Object *frame); 143 #endif 144 124 145 int ewk_util_dpi_get(void); 125 146 void ewk_util_javascript_gc_collect(); -
trunk/Source/WebKit/efl/ewk/ewk_view.cpp
r93401 r93637 24 24 25 25 #include "BackForwardListImpl.h" 26 #include "Bridge.h" 26 27 #include "Chrome.h" 27 28 #include "ChromeClientEfl.h" … … 41 42 #include "InspectorClientEfl.h" 42 43 #include "IntSize.h" 44 #include "JSDOMBinding.h" 45 #include "JSDOMWindow.h" 46 #include "JSLock.h" 43 47 #include "PlatformMouseEvent.h" 44 48 #include "PopupMenuClient.h" 45 49 #include "ProgressTracker.h" 46 50 #include "RenderTheme.h" 51 #include "c_instance.h" 47 52 #include "ewk_private.h" 48 53 … … 3391 3396 /** 3392 3397 * @internal 3398 * Reports the JS window object was cleared. 3399 * 3400 * @param o view. 3401 * @param frame the frame. 3402 */ 3403 void ewk_view_js_window_object_clear(Evas_Object *o, Evas_Object *frame) 3404 { 3405 evas_object_smart_callback_call(o, "js,windowobject,clear", frame); 3406 } 3407 3408 /** 3409 * @internal 3393 3410 * Reports the viewport has changed. 3394 3411 * … … 3539 3556 return sd->api->navigation_policy_decision(sd, request); 3540 3557 } 3558 3559 Eina_Bool ewk_view_js_object_add(Evas_Object *o, Ewk_JS_Object *obj, const char *obj_name) 3560 { 3561 #if ENABLE(NETSCAPE_PLUGIN_API) 3562 if (obj->view) // object has already been added to another ewk_view 3563 return EINA_FALSE; 3564 obj->name = eina_stringshare_add(obj_name); 3565 EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE); 3566 EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, EINA_FALSE); 3567 3568 JSC::JSLock lock(JSC::SilenceAssertionsOnly); 3569 WebCore::JSDOMWindow *window = toJSDOMWindow(priv->main_frame, WebCore::mainThreadNormalWorld()); 3570 JSC::Bindings::RootObject *root; 3571 root = priv->main_frame->script()->bindingRootObject(); 3572 3573 if (!window) { 3574 ERR("Warning: couldn't get window object"); 3575 return EINA_FALSE; 3576 } 3577 3578 JSC::ExecState* exec = window->globalExec(); 3579 3580 obj->view = o; 3581 JSC::JSObject *runtimeObject = (JSC::JSObject*)JSC::Bindings::CInstance::create((NPObject*)obj, root)->createRuntimeObject(exec); 3582 JSC::Identifier id = JSC::Identifier(exec, obj_name); 3583 3584 JSC::PutPropertySlot slot; 3585 window->put(exec, id, runtimeObject, slot); 3586 return EINA_TRUE; 3587 #else 3588 return EINA_FALSE; 3589 #endif // ENABLE(NETSCAPE_PLUGIN_API) 3590 } 3591 3541 3592 3542 3593 /** -
trunk/Source/WebKit/efl/ewk/ewk_view.h
r93488 r93637 41 41 * - "inputmethod,changed", Eina_Bool: reports that input method was changed and 42 42 * it gives a boolean value whether it's enabled or not as an argument. 43 * - "js,windowobject,clear", void: Report that the JS window object has been cleared. 43 44 * - "link,hover,in", const char *link[2]: reports mouse is over a link. 44 45 * It gives the url in link[0] and link's title in link[1] as an argument. … … 86 87 #include "ewk_frame.h" 87 88 #include "ewk_history.h" 89 #include "ewk_js.h" 88 90 #include "ewk_window_features.h" 89 91 … … 2176 2178 */ 2177 2179 EAPI Ewk_View_Mode ewk_view_mode_get(Evas_Object *o); 2180 2181 /** 2182 * Creates a JS object named @a obj_name as property of the window object. This should be called on a callback connectedto the 2183 * js,windowobject,clear signal. 2184 * 2185 * @param o view. 2186 * @param obj object that will be added(see: @a ewk_js_object_new). 2187 * @param obj_name name of the object. 2188 * 2189 * @return @c EINA_TRUE if object was added, @c EINA_FALSE if not. 2190 */ 2191 EAPI Eina_Bool ewk_view_js_object_add(Evas_Object *o, Ewk_JS_Object *obj, const char *obj_name); 2178 2192 #ifdef __cplusplus 2179 2193 }
Note: See TracChangeset
for help on using the changeset viewer.