WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch attached
0001-Enable-context-menu-on-inspector-window.patch (text/plain), 24.37 KB, created by
Andre Loureiro (IRC: loureiro)
on 2013-10-09 09:02:24 PDT
(
hide
)
Description:
Patch attached
Filename:
MIME Type:
Creator:
Andre Loureiro (IRC: loureiro)
Created:
2013-10-09 09:02:24 PDT
Size:
24.37 KB
patch
obsolete
>From a54aed12f6b6b8ab2c995725690d0d4a9c5dd38f Mon Sep 17 00:00:00 2001 >From: Andre Loureiro <andre.vl@samsung.com> >Date: Wed, 9 Oct 2013 11:55:10 -0400 >Subject: [PATCH] Enable context menu on inspector window > https://bugs.webkit.org/show_bug.cgi?id=120609 > >Reviewed by NOBODY (OOPS!). > >Use EFL Elementary Window widget set to create the a new inspector window instead >of use ecore evas directly thus allowing the creation and use of >Elementary Menu widget to handle context menus. > >* PlatformEfl.cmake: Enable Elementary. >* UIProcess/API/efl/ewk_view.cpp: >(ewk_view_inspector_window_get): Get inspector window object. >(ewk_view_inspector_view_get): Get inspector view object. >(ewk_view_inspector_show): Set a smart object to inspector window and >after that show it. >* UIProcess/API/efl/ewk_view.h: Getters declaration. >* UIProcess/API/efl/tests/test_ewk2_view.cpp: >(TEST_F): Just to fit the new ewk view declaration >* UIProcess/WebInspectorProxy.cpp: Initializing smart object. >(WebKit::WebInspectorProxy::WebInspectorProxy): >* UIProcess/WebInspectorProxy.h: Getters and Setters declaration. >(WebKit::WebInspectorProxy::inspectorView): Ditto. >(WebKit::WebInspectorProxy::inspectorWindow): Ditto. >(WebKit::WebInspectorProxy::setSmartObject): Ditto. >* UIProcess/efl/WebInspectorProxyEfl.cpp: >(WebKit::destroyInspectorWindow): Callback to an inspector window >widget. >(WebKit::onLoadFinished): Callback to finish the set up of a >inspector's smart object. >(WebKit::WebInspectorProxy::createInspectorWindow): Show the inspector >window and its contents. >(WebKit::WebInspectorProxy::platformCreateInspectorPage): Create the >inspector window and view widget. >(WebKit::WebInspectorProxy::platformDidClose): Free the resources. >(WebKit::WebInspectorProxy::platformInspectedURLChanged): Change the >URL window title >* MiniBrowser/efl/main.c: >(window_find_by_type): Search a window by its type. >(on_key_down): Calling inspector window create. >(on_inspector_window_close): Callback to remove inspector window from >windows list. >(on_window_close): Ditto. >(context_menu_item_selected_cb): Check menu item action type. >(window_create): Set the parent and window type. >(on_inspector_window_focus_in): Finish to set up the inspector smart >object callbacks. >(inspector_window_create): Create a new window as an inspector window >type. >--- > Source/WebKit2/ChangeLog | 39 ++++++++ > Source/WebKit2/PlatformEfl.cmake | 8 ++ > Source/WebKit2/UIProcess/API/efl/ewk_view.cpp | 42 ++++++++- > Source/WebKit2/UIProcess/API/efl/ewk_view.h | 5 +- > .../UIProcess/API/efl/tests/test_ewk2_view.cpp | 4 +- > Source/WebKit2/UIProcess/WebInspectorProxy.cpp | 3 + > Source/WebKit2/UIProcess/WebInspectorProxy.h | 9 +- > .../WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp | 78 +++++++++------- > Tools/ChangeLog | 23 +++++ > Tools/MiniBrowser/efl/main.c | 101 ++++++++++++++++++++- > 10 files changed, 269 insertions(+), 43 deletions(-) > >diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index 648d101..08fc085 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,3 +1,42 @@ >+2013-10-09 Andre Loureiro <andre.vl@samsung.com> >+ >+ Use Elementary Window widget set in WebInspectorProxyEfl >+ https://bugs.webkit.org/show_bug.cgi?id=120609 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Use EFL Elementary Window widget set to create the a new inspector window instead >+ of use ecore evas directly thus allowing the creation and use of >+ Elementary Menu widget to handle context menus. >+ >+ * PlatformEfl.cmake: Enable Elementary. >+ * UIProcess/API/efl/ewk_view.cpp: >+ (ewk_view_inspector_window_get): Get inspector window object. >+ (ewk_view_inspector_view_get): Get inspector view object. >+ (ewk_view_inspector_show): Set a smart object to inspector window and >+ after that show it. >+ * UIProcess/API/efl/ewk_view.h: Getters declaration. >+ * UIProcess/API/efl/tests/test_ewk2_view.cpp: >+ (TEST_F): Just to fit the new ewk view declaration >+ * UIProcess/WebInspectorProxy.cpp: Initializing smart object. >+ (WebKit::WebInspectorProxy::WebInspectorProxy): >+ * UIProcess/WebInspectorProxy.h: Getters and Setters declaration. >+ (WebKit::WebInspectorProxy::inspectorView): Ditto. >+ (WebKit::WebInspectorProxy::inspectorWindow): Ditto. >+ (WebKit::WebInspectorProxy::setSmartObject): Ditto. >+ * UIProcess/efl/WebInspectorProxyEfl.cpp: >+ (WebKit::destroyInspectorWindow): Callback to an inspector window >+ widget. >+ (WebKit::onLoadFinished): Callback to finish the set up of a >+ inspector's smart object. >+ (WebKit::WebInspectorProxy::createInspectorWindow): Show the inspector >+ window and its contents. >+ (WebKit::WebInspectorProxy::platformCreateInspectorPage): Create the >+ inspector window and view widget. >+ (WebKit::WebInspectorProxy::platformDidClose): Free the resources. >+ (WebKit::WebInspectorProxy::platformInspectedURLChanged): Change the >+ URL window title >+ > 2013-10-08 Darin Adler <darin@apple.com> > > Remove use of deleteAllValues in NPRemoteObjectMap::pluginDestroyed >diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake >index 88050c1..c65b8d2 100644 >--- a/Source/WebKit2/PlatformEfl.cmake >+++ b/Source/WebKit2/PlatformEfl.cmake >@@ -1,3 +1,5 @@ >+find_package(Elementary 1.7) >+ > list(APPEND WebKit2_SOURCES > Platform/CoreIPC/unix/AttachmentUnix.cpp > Platform/CoreIPC/unix/ConnectionUnix.cpp >@@ -220,6 +222,10 @@ list(APPEND WebKit2_INCLUDE_DIRECTORIES > ${EDJE_INCLUDE_DIRS} > ${EFREET_INCLUDE_DIRS} > ${EINA_INCLUDE_DIRS} >+ ${DBUS_INCLUDE_DIRS} >+ ${E_DBUS_INCLUDE_DIRS} >+ ${EET_INCLUDE_DIRS} >+ ${ELEMENTARY_INCLUDE_DIRS} > ${EO_INCLUDE_DIRS} > ${EVAS_INCLUDE_DIRS} > ${HARFBUZZ_INCLUDE_DIRS} >@@ -241,6 +247,8 @@ list(APPEND WebKit2_LIBRARIES > ${EDJE_LIBRARIES} > ${EFREET_LIBRARIES} > ${EINA_LIBRARIES} >+ ${EET_LIBRARIES} >+ ${ELEMENTARY_LIBRARIES} > ${EO_LIBRARIES} > ${EVAS_LIBRARIES} > ${FONTCONFIG_LIBRARIES} >diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp >index 17c21d5..8db7976 100644 >--- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp >+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp >@@ -474,18 +474,54 @@ Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object* ewkView) > #endif > } > >-Eina_Bool ewk_view_inspector_show(Evas_Object* ewkView) >+Evas_Object *ewk_view_inspector_window_get(Evas_Object* ewkView) > { > #if ENABLE(INSPECTOR) >- EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); >+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0); > > WKInspectorRef wkInspector = WKPageGetInspector(impl->wkPage()); > if (wkInspector) >- WKInspectorShow(wkInspector); >+ return toImpl(wkInspector)->inspectorWindow(); >+ >+ return 0; >+#else >+ UNUSED_PARAM(ewkView); >+ return 0; >+#endif >+} >+ >+Evas_Object *ewk_view_inspector_view_get(Evas_Object* ewkView) >+{ >+#if ENABLE(INSPECTOR) >+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0); >+ >+ WKInspectorRef wkInspector = WKPageGetInspector(impl->wkPage()); >+ if (wkInspector) { >+ return toImpl(wkInspector)->inspectorView(); >+ } >+ >+ return 0; >+#else >+ UNUSED_PARAM(ewkView); >+ return 0; >+#endif >+} > >+Eina_Bool ewk_view_inspector_show(Evas_Object* ewkView, Evas_Smart *smart) >+{ >+#if ENABLE(INSPECTOR) >+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); >+ >+ WKInspectorRef wkInspector = WKPageGetInspector(impl->wkPage()); >+ if (wkInspector) { >+ toImpl(wkInspector)->setSmartObject(smart); >+ WKInspectorShow(wkInspector); >+ } > return true; >+ > #else > UNUSED_PARAM(ewkView); >+ UNUSED_PARAM(smart); > return false; > #endif > } >diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.h b/Source/WebKit2/UIProcess/API/efl/ewk_view.h >index e991692..9137fc7 100644 >--- a/Source/WebKit2/UIProcess/API/efl/ewk_view.h >+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.h >@@ -781,6 +781,9 @@ EAPI Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object *o, Eina_Bool enabl > */ > EAPI Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object *o); > >+EAPI Evas_Object* ewk_view_inspector_window_get(Evas_Object *o); >+EAPI Evas_Object* ewk_view_inspector_view_get(Evas_Object *o); >+ > /** > * Show the inspector to debug a web page. > * >@@ -790,7 +793,7 @@ EAPI Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object *o); > * > * @see ewk_settings_developer_extras_enabled_set() > */ >-EAPI Eina_Bool ewk_view_inspector_show(Evas_Object *o); >+EAPI Eina_Bool ewk_view_inspector_show(Evas_Object *o, Evas_Smart* smart); > > /** > * Close the inspector >diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp >index b652400..ad5f16b 100644 >--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp >+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp >@@ -860,10 +860,10 @@ TEST_F(EWK2ViewTest, window_move_resize) > TEST_F(EWK2ViewTest, ewk_view_inspector) > { > #if ENABLE(INSPECTOR) >- ASSERT_TRUE(ewk_view_inspector_show(webView())); >+ ASSERT_TRUE(ewk_view_inspector_show(webView(), 0)); > ASSERT_TRUE(ewk_view_inspector_close(webView())); > #else >- ASSERT_FALSE(ewk_view_inspector_show(webView())); >+ ASSERT_FALSE(ewk_view_inspector_show(webView(), 0)); > ASSERT_FALSE(ewk_view_inspector_close(webView())); > #endif > } >diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp >index 2d2f3b3..569fc84 100644 >--- a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp >+++ b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp >@@ -94,6 +94,9 @@ WebInspectorProxy::WebInspectorProxy(WebPageProxy* page) > , m_inspectorView(0) > , m_inspectorWindow(0) > #endif >+#if PLATFORM(EFL) >+ , m_smart(0) >+#endif > #if ENABLE(INSPECTOR_SERVER) > , m_remoteInspectionPageId(0) > #endif >diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.h b/Source/WebKit2/UIProcess/WebInspectorProxy.h >index 1c6e7f4..60be3ab 100644 >--- a/Source/WebKit2/UIProcess/WebInspectorProxy.h >+++ b/Source/WebKit2/UIProcess/WebInspectorProxy.h >@@ -109,6 +109,12 @@ public: > void initializeInspectorClientGtk(const WKInspectorClientGtk*); > #endif > >+#if PLATFORM(EFL) >+ Evas_Object* inspectorView() const { return m_inspectorView; }; >+ Evas_Object* inspectorWindow() const { return m_inspectorWindow; }; >+ void setSmartObject(Evas_Smart* smart) { m_smart = smart; }; >+#endif >+ > void showConsole(); > void showResources(); > void showMainResourceForFrame(WebFrameProxy*); >@@ -233,7 +239,8 @@ private: > GtkWidget* m_inspectorWindow; > #elif PLATFORM(EFL) > Evas_Object* m_inspectorView; >- Ecore_Evas* m_inspectorWindow; >+ Evas_Object* m_inspectorWindow; >+ Evas_Smart* m_smart; > #endif > #if ENABLE(INSPECTOR_SERVER) > int m_remoteInspectionPageId; >diff --git a/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp b/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp >index ce75d53..0a36f73 100644 >--- a/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp >+++ b/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp >@@ -46,26 +46,20 @@ > #include <wtf/text/StringBuilder.h> > #include <wtf/text/WTFString.h> > >+#include <Elementary.h> >+ > namespace WebKit { > >-static void resizeInspectorWindow(Ecore_Evas* inspectorWindow) >+static void destroyInspectorWindow(void* userData, Evas_Object* inspectorWindow, void*) > { >- Evas_Object* inspectorView = evas_object_name_find(ecore_evas_get(inspectorWindow), "inspector"); >- if (!inspectorView) >- return; >- >- int width, height; >- ecore_evas_geometry_get(inspectorWindow, 0, 0, &width, &height); >- >- evas_object_move(inspectorView, 0, 0); >- evas_object_resize(inspectorView, width, height); >-} >+ Evas_Object* inspectorView = evas_object_name_find(evas_object_evas_get(inspectorWindow), "inspector"); >+ if (inspectorView) { >+ Ewk_View_Smart_Data* sd = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(inspectorView)); >+ if (sd->api->window_close) >+ sd->api->window_close(sd); > >-static void destroyInspectorWindow(Ecore_Evas* inspectorWindow) >-{ >- Evas_Object* inspectorView = evas_object_name_find(ecore_evas_get(inspectorWindow), "inspector"); >- if (inspectorView) > evas_object_smart_callback_call(inspectorView, "inspector,view,close", 0); >+ } > } > > static void closeInspectorWindow(void* userData, Evas_Object*, void*) >@@ -75,40 +69,54 @@ static void closeInspectorWindow(void* userData, Evas_Object*, void*) > inspectorProxy->close(); > } > >-void WebInspectorProxy::createInspectorWindow() >+static void onLoadFinished(void* userData, Evas_Object* inspectorView, void*) > { >- ecore_evas_title_set(m_inspectorWindow, "Web Inspector"); >- ecore_evas_callback_resize_set(m_inspectorWindow, resizeInspectorWindow); >- ecore_evas_callback_delete_request_set(m_inspectorWindow, destroyInspectorWindow); >- ecore_evas_show(m_inspectorWindow); >+ Ewk_View_Smart_Data* sd = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(inspectorView)); >+ if (!sd->api->focus_in) >+ return; >+ sd->api->focus_in(sd); >+} > >+void WebInspectorProxy::createInspectorWindow() >+{ > evas_object_name_set(m_inspectorView, "inspector"); > evas_object_move(m_inspectorView, 0, 0); > evas_object_resize(m_inspectorView, initialWindowWidth, initialWindowHeight); > evas_object_show(m_inspectorView); > >- evas_object_focus_set(m_inspectorView, true); >+ evas_object_resize(m_inspectorWindow, initialWindowWidth, initialWindowHeight); >+ evas_object_show(m_inspectorWindow); > } > > WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() > { > ASSERT(m_page); > >-#ifdef HAVE_ECORE_X >- const char* engine = "opengl_x11"; >- m_inspectorWindow = ecore_evas_new(engine, 0, 0, initialWindowWidth, initialWindowHeight, 0); >+ m_inspectorWindow = elm_win_add(NULL, "webinspector-window", ELM_WIN_BASIC); >+ elm_win_title_set(m_inspectorWindow, "Web Inspector"); > >- // Gracefully fall back to software if evas_gl engine is not available. >- if (!m_inspectorWindow) >-#endif >- m_inspectorWindow = ecore_evas_new(0, 0, 0, initialWindowWidth, initialWindowHeight, 0); >- if (!m_inspectorWindow) >- return 0; >+ Evas_Object *bg = elm_bg_add(m_inspectorWindow); >+ elm_bg_color_set(bg, 193, 192, 191); >+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); >+ elm_win_resize_object_add(m_inspectorWindow, bg); >+ evas_object_show(bg); >+ >+ evas_object_smart_callback_add(m_inspectorWindow, "delete,request", destroyInspectorWindow, 0); >+ >+ Evas_Object *layout = elm_box_add(m_inspectorWindow); >+ elm_box_padding_set(layout, 0, 2); >+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); >+ elm_win_resize_object_add(m_inspectorWindow, layout); >+ evas_object_show(layout); > > WKContextRef wkContext = toAPI(page()->process()->context()); > WKPageGroupRef wkPageGroup = toAPI(inspectorPageGroup()); > >- m_inspectorView = EWKViewCreate(wkContext, wkPageGroup, ecore_evas_get(m_inspectorWindow), /* smart */ 0); >+ m_inspectorView = EWKViewCreate(wkContext, wkPageGroup, evas_object_evas_get(m_inspectorWindow), m_smart); >+ >+ evas_object_size_hint_weight_set(m_inspectorView, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); >+ evas_object_size_hint_align_set(m_inspectorView, EVAS_HINT_FILL, EVAS_HINT_FILL); >+ > WKViewRef wkView = EWKViewGetWKView(m_inspectorView); > > WKRetainPtr<WKStringRef> wkTheme = adoptWK(WKStringCreateWithUTF8CString(TEST_THEME_DIR "/default.edj")); >@@ -117,6 +125,10 @@ WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() > WKPreferencesRef wkPreferences = WKPageGroupGetPreferences(wkPageGroup); > WKPreferencesSetFileAccessFromFileURLsAllowed(wkPreferences, true); > >+ elm_box_pack_end(layout, m_inspectorView); >+ >+ evas_object_smart_callback_add(m_inspectorView, "load,finished", onLoadFinished, 0); >+ > return toImpl(WKViewGetPage(wkView)); > } > >@@ -133,12 +145,10 @@ void WebInspectorProxy::platformOpen() > void WebInspectorProxy::platformDidClose() > { > if (m_inspectorView) { >- evas_object_del(m_inspectorView); > m_inspectorView = 0; > } > > if (m_inspectorWindow) { >- ecore_evas_free(m_inspectorWindow); > m_inspectorWindow = 0; > } > } >@@ -165,7 +175,7 @@ void WebInspectorProxy::platformInspectedURLChanged(const String& url) > return; > > String title = "WebInspector - " + url; >- ecore_evas_title_set(m_inspectorWindow, title.utf8().data()); >+ elm_win_title_set(m_inspectorWindow, title.utf8().data()); > } > > String WebInspectorProxy::inspectorPageURL() const >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 2deeaeb..c4fdb28 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,26 @@ >+2013-10-09 Andre Loureiro <andre.vl@samsung.com> >+ >+ Enable context menu on inspector window >+ https://bugs.webkit.org/show_bug.cgi?id=120609 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Updated EFL MiniBrowser to create and enable context menus on the new >+ inspector window. >+ >+ * MiniBrowser/efl/main.c: >+ (window_find_by_type): Search a window by its type. >+ (on_key_down): Calling inspector window create. >+ (on_inspector_window_close): Callback to remove inspector window from >+ windows list. >+ (on_window_close): Ditto. >+ (context_menu_item_selected_cb): Check menu item action type. >+ (window_create): Set the parent and window type. >+ (on_inspector_window_focus_in): Finish to set up the inspector smart >+ object callbacks. >+ (inspector_window_create): Create a new window as an inspector window >+ type. >+ > 2013-10-08 Mario Sanchez Prada <mario.prada@samsung.com> > > [ATK] Expose state of aria-invalid as ATK_STATE_INVALID_ENTRY >diff --git a/Tools/MiniBrowser/efl/main.c b/Tools/MiniBrowser/efl/main.c >index 03f9cf8..2cac5d2 100644 >--- a/Tools/MiniBrowser/efl/main.c >+++ b/Tools/MiniBrowser/efl/main.c >@@ -63,6 +63,11 @@ static Eina_Bool legacy_behavior_enabled = EINA_FALSE; > // The zoom values are chosen to be like in Mozilla Firefox 3. > const static float zoomLevels[] = {0.3, 0.5, 0.67, 0.8, 0.9, 1.0, 1.1, 1.2, 1.33, 1.5, 1.7, 2.0, 2.4, 3.0}; > >+typedef enum { >+ BROWSER_WIN_BASIC, >+ BROWSER_WIN_INSPECTOR >+} Browser_Window_Type; >+ > static Eina_Bool > zoom_level_set(Evas_Object *webview, int level) > { >@@ -104,6 +109,8 @@ typedef struct _Browser_Window { > Evas_Object *url_bar; > Evas_Object *back_button; > Evas_Object *forward_button; >+ Browser_Window_Type window_type; >+ void *parent; > struct { > Evas_Object *elm_menu; > Ewk_Popup_Menu *ewk_menu; >@@ -181,6 +188,7 @@ static const Ecore_Getopt options = { > > static Eina_Stringshare *show_file_entry_dialog(Browser_Window *window, const char *label_tag, const char *default_text); > static Browser_Window *window_create(Evas_Object* opener, const char *url, int width, int height, Eina_Bool view_mode); >+static Browser_Window *inspector_window_create(Evas_Object* opener); > > static Browser_Window *window_find_with_elm_window(Evas_Object *elm_window) > { >@@ -214,6 +222,19 @@ static Browser_Window *window_find_with_ewk_view(Evas_Object *ewk_view) > return NULL; > } > >+static Browser_Window *window_find_by_type(Browser_Window_Type type) >+{ >+ Eina_List *l; >+ void *data; >+ >+ EINA_LIST_FOREACH(windows, l, data) { >+ Browser_Window *window = (Browser_Window *)data; >+ if (window->window_type == type) >+ return window; >+ } >+ return NULL; >+} >+ > static Eina_Bool > on_tooltip_show(void *user_data) > { >@@ -434,7 +455,9 @@ on_key_down(void *user_data, Evas *e, Evas_Object *ewk_view, void *event_info) > windows = eina_list_append(windows, window); > } else if (!strcmp(ev->key, "i") && ctrlPressed) { > info("Show Inspector (Ctrl+i) was pressed."); >- ewk_view_inspector_show(ewk_view); >+ Browser_Window *inspector = inspector_window_create(ewk_view); >+ inspector->parent = window; >+ windows = eina_list_append(windows, inspector); > } else if (!strcmp(ev->key, "f") && ctrlPressed) { > info("Show Search Box (Ctrl+f) was pressed."); > search_box_show(window); >@@ -1379,9 +1402,16 @@ on_window_create(Ewk_View_Smart_Data *smartData, const char *url, const Ewk_Wind > } > > static void >+on_inspector_window_close(Ewk_View_Smart_Data *smartData) >+{ >+ Browser_Window *inspector = window_find_by_type(BROWSER_WIN_INSPECTOR); >+ window_close(inspector); >+} >+ >+static void > on_window_close(Ewk_View_Smart_Data *smartData) > { >- Browser_Window *window = window_find_with_ewk_view(smartData->self); >+ Browser_Window *window = window_find_by_type(BROWSER_WIN_BASIC); > window_close(window); > } > >@@ -1395,6 +1425,14 @@ context_menu_item_selected_cb(void *data, Evas_Object *obj, void *event_info) > > Ewk_Context_Menu_Item *ewk_item = (Ewk_Context_Menu_Item *)data; > info("Selected context menu item: %s.", ewk_context_menu_item_title_get(ewk_item)); >+ if (ewk_context_menu_item_action_get(ewk_item) == EWK_CONTEXT_MENU_ITEM_TAG_INSPECT_ELEMENT) { >+ Browser_Window *window = window_find_by_type(BROWSER_WIN_BASIC); >+ Browser_Window *inspector = inspector_window_create(window->ewk_view); >+ inspector->parent = window; >+ windows = eina_list_append(windows, inspector); >+ return; >+ } >+ > ewk_context_menu_item_select(ewk_context_menu_item_parent_menu_get(ewk_item), ewk_item); > ewk_context_menu_hide(ewk_context_menu_item_parent_menu_get(ewk_item)); > } >@@ -1877,9 +1915,68 @@ static Browser_Window *window_create(Evas_Object *opener, const char *url, int w > evas_object_event_callback_add(window->ewk_view, EVAS_CALLBACK_MOUSE_MOVE, on_mouse_move, window); > evas_object_event_callback_add(window->elm_window, EVAS_CALLBACK_RESIZE, on_window_resize, window); > >+ window->parent = window; >+ window->window_type = BROWSER_WIN_BASIC; >+ > return window; > } > >+static void >+on_inspector_window_focus_in(Ewk_View_Smart_Data *sd) >+{ >+ Browser_Window *inspector = window_find_by_type(BROWSER_WIN_INSPECTOR); >+ >+ if (!inspector) { >+ info("ERROR: Necessary objects are NULL."); >+ return; >+ } >+ >+ Browser_Window *window = (Browser_Window *)inspector->parent; >+ >+ /* Initialize tooltip information */ >+ inspector->tooltip.show_timer = NULL; >+ inspector->tooltip.activated = EINA_FALSE; >+ inspector->tooltip.text_set = EINA_FALSE; >+ inspector->tooltip.shown = EINA_FALSE; >+ >+ inspector->ewk_view = ewk_view_inspector_view_get(window->ewk_view); >+ inspector->elm_window = ewk_view_inspector_window_get(window->ewk_view); >+ >+ evas_object_smart_callback_add(inspector->ewk_view, "tooltip,text,set", on_tooltip_text_set, inspector); >+ evas_object_smart_callback_add(inspector->ewk_view, "tooltip,text,unset", on_tooltip_text_unset, inspector); >+ >+ evas_object_event_callback_add(inspector->ewk_view, EVAS_CALLBACK_KEY_DOWN, on_key_down, inspector); >+ evas_object_event_callback_add(inspector->ewk_view, EVAS_CALLBACK_MOUSE_DOWN, on_mouse_down, inspector); >+ >+ evas_object_event_callback_add(inspector->ewk_view, EVAS_CALLBACK_MOUSE_IN, on_mouse_in, inspector); >+ evas_object_event_callback_add(inspector->ewk_view, EVAS_CALLBACK_MOUSE_OUT, on_mouse_out, inspector); >+ evas_object_event_callback_add(inspector->ewk_view, EVAS_CALLBACK_MOUSE_MOVE, on_mouse_move, inspector); >+ evas_object_event_callback_add(inspector->elm_window, EVAS_CALLBACK_RESIZE, on_window_resize, inspector); >+} >+ >+static Browser_Window* inspector_window_create(Evas_Object *opener) >+{ >+ Browser_Window *inspector = calloc(1, sizeof(Browser_Window)); >+ if (!inspector) { >+ info("ERROR: could not create browser window."); >+ return NULL; >+ } >+ >+ inspector->window_type = BROWSER_WIN_INSPECTOR; >+ >+ static Ewk_View_Smart_Class ewkViewClass = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("Inspector_View"); >+ ewk_view_smart_class_set(&ewkViewClass); >+ ewkViewClass.window_close = on_inspector_window_close; >+ ewkViewClass.context_menu_show = on_context_menu_show; >+ ewkViewClass.context_menu_hide = on_context_menu_hide; >+ ewkViewClass.focus_in = on_inspector_window_focus_in; >+ >+ Evas_Smart* smart = evas_smart_class_new(&ewkViewClass.sc); >+ ewk_view_inspector_show(opener, smart); >+ >+ return inspector; >+} >+ > static Ewk_Cookie_Accept_Policy > parse_cookies_policy(const char *input_string) > { >-- >1.8.1.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 120609
:
213387
|
213782
|
213796