summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-03-09 15:57:09 -0800
committerCedric BAIL <cedric@osg.samsung.com>2016-03-09 16:55:48 -0800
commitdcc8a491133ec51f50ebb27d7182ec109b47e1e5 (patch)
tree7fbe91e97afae4e6810eb1ca700ec7e6137a9711
parentde897d633f58b81a3b73c0af3ff3c586fdeb8056 (diff)
web: split web into a module.
There is currently no configuration to switch backend. Another patch will introduce it.
-rw-r--r--configure.ac149
-rw-r--r--m4/elm_check_option.m458
-rw-r--r--src/lib/Elementary.h.in1
-rw-r--r--src/lib/elm_config.c1
-rw-r--r--src/lib/elm_main.c4
-rw-r--r--src/lib/elm_priv.h3
-rw-r--r--src/lib/elm_web.eo51
-rw-r--r--src/lib/elm_web2.c1505
-rw-r--r--src/lib/elm_widget_web.h86
-rw-r--r--src/modules/Makefile.am3
-rw-r--r--src/modules/web/Makefile.am6
-rw-r--r--src/modules/web/none/Makefile.am40
-rw-r--r--src/modules/web/none/elm_web_none.c341
-rw-r--r--src/modules/web/none/elm_web_none.eo54
-rw-r--r--src/modules/web/none/elm_web_none.eo.c212
-rw-r--r--src/modules/web/none/elm_web_none.eo.h21
-rw-r--r--src/modules/web/webkit2/Makefile.am42
-rw-r--r--src/modules/web/webkit2/elm_web_webkit2.c1149
-rw-r--r--src/modules/web/webkit2/elm_web_webkit2.eo53
-rw-r--r--src/modules/web/webkit2/elm_web_webkit2.eo.c208
-rw-r--r--src/modules/web/webkit2/elm_web_webkit2.eo.h21
21 files changed, 2414 insertions, 1594 deletions
diff --git a/configure.ac b/configure.ac
index 741217ae5..038ebab4d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,6 +25,58 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
25LT_INIT([win32-dll disable-static pic-only]) 25LT_INIT([win32-dll disable-static pic-only])
26EFL_INIT 26EFL_INIT
27 27
28### Checks for programs
29
30# compilers
31AC_PROG_CC
32AC_PROG_CC_STDC
33AC_PROG_CXX
34
35EFL_CXX_COMPILE_STDCXX_11([ext])
36
37# pkg-config
38PKG_PROG_PKG_CONFIG
39
40# gettext
41m4_ifdef([AM_GNU_GETTEXT_VERSION], [
42AM_GNU_GETTEXT_VERSION([0.18])
43])
44
45m4_ifdef([AM_GNU_GETTEXT], [
46AM_GNU_GETTEXT([external])
47po_makefile_in=po/Makefile.in
48have_po="yes"
49],[
50have_po="no"
51])
52AC_SUBST([LTLIBINTL])
53
54if test "x${POSUB}" = "x" ; then
55 have_po="no"
56fi
57
58AM_CONDITIONAL([HAVE_PO], [test "x${have_po}" = "xyes"])
59
60# doxygen
61EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
62
63# EFL binaries
64EFL_WITH_BIN([eet], [eet-eet], [eet])
65EFL_WITH_BIN([edje], [edje-cc], [edje_cc])
66EFL_WITH_BIN([elementary], [elementary-codegen], [elementary_codegen])
67EFL_WITH_BIN([elementary], [elm-prefs-cc], [elm_prefs_cc])
68EFL_WITH_BIN([eolian], [eolian-gen], [eolian_gen])
69EFL_WITH_BIN([eolian-cxx], [eolian-cxx], [eolian_cxx])
70EFL_WITH_BIN([eldbus], [eldbus_codegen], [eldbus-codegen])
71# Force the helper to try external eolian generators
72AM_CONDITIONAL([HAVE_EOLIAN_GEN], [true])
73AM_CONDITIONAL([HAVE_EOLIAN_CXX], [true])
74AM_CONDITIONAL([HAVE_EOLIAN_JS], [true])
75
76EFL_ENABLE_BIN([elementary-test])
77EFL_ENABLE_BIN([elementary-codegen])
78EFL_ENABLE_BIN([elm-prefs-cc])
79EFL_ENABLE_BIN([elementary-config])
28 80
29### Additional options to configure 81### Additional options to configure
30 82
@@ -113,6 +165,43 @@ AC_ARG_ENABLE([quick-launch],
113 [want_quicklaunch=$enableval], 165 [want_quicklaunch=$enableval],
114 [want_quicklaunch="auto"]) 166 [want_quicklaunch="auto"])
115 167
168# Webkit support
169AC_ARG_WITH([elementary-web-backend],
170 [AS_HELP_STRING([--with-elementary-web-backend=@<:@ewebkit2/detect/none@:>@],
171 [Select the WebKit backend for Elementary to support web @<:@default=detect@:>@])],
172 [elementary_web_backend=${withval}],
173 [elementary_web_backend="detect"])
174
175elementary_webkit2="no"
176elementary_web="none"
177
178case "${elementary_web_backend}" in
179 ewebkit2|detect)
180# For now only ewebkit2 exist so detect is similar to it
181 PKG_CHECK_MODULES([EWEBKIT2], [ewebkit2],
182 [elementary_webkit2="yes"],
183 [elementary_webkit2="no"])
184 ;;
185 none)
186 ;;
187 *)
188 AC_MSG_ERROR([Invalid web backend: must be ewebkit2, detect or none instead of '${elementary_web_backend}'])
189 ;;
190esac
191
192if test "x${elementary_webkit2}" = "xyes"; then
193 AC_DEFINE([HAVE_ELEMENTARY_WEB], [1], [Web support for Elementary])
194 webkit_datadir=$(${PKG_CONFIG} ewebkit2 --variable=datadir)
195 AC_DEFINE_UNQUOTED([WEBKIT_DATADIR],
196 ["${webkit_datadir}"],
197 ["WebKit's data dir"])
198 ELM_WEB2_DEF="#define"
199 elementary_web="ewebkit2"
200fi
201AM_CONDITIONAL([HAVE_EWEBKIT2], [test "x${elementary_web}" = "xewebkit2"])
202
203AC_MSG_CHECKING([whether to build web option])
204AC_MSG_RESULT([${elementary_web}])
116 205
117### Default options with respect to host and default values 206### Default options with respect to host and default values
118 207
@@ -156,60 +245,6 @@ AM_CONDITIONAL([HAVE_FREEBSD], [test "x${have_freebsd}" = "xyes"])
156AC_SUBST([ELM_UNIX_DEF]) 245AC_SUBST([ELM_UNIX_DEF])
157AC_SUBST([ELM_WIN32_DEF]) 246AC_SUBST([ELM_WIN32_DEF])
158 247
159### Checks for programs
160
161# compilers
162AC_PROG_CC
163AC_PROG_CC_STDC
164AC_PROG_CXX
165
166EFL_CXX_COMPILE_STDCXX_11([ext])
167
168# pkg-config
169PKG_PROG_PKG_CONFIG
170
171# gettext
172m4_ifdef([AM_GNU_GETTEXT_VERSION], [
173AM_GNU_GETTEXT_VERSION([0.18])
174])
175
176m4_ifdef([AM_GNU_GETTEXT], [
177AM_GNU_GETTEXT([external])
178po_makefile_in=po/Makefile.in
179have_po="yes"
180],[
181have_po="no"
182])
183AC_SUBST([LTLIBINTL])
184
185if test "x${POSUB}" = "x" ; then
186 have_po="no"
187fi
188
189AM_CONDITIONAL([HAVE_PO], [test "x${have_po}" = "xyes"])
190
191# doxygen
192EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
193
194# EFL binaries
195EFL_WITH_BIN([eet], [eet-eet], [eet])
196EFL_WITH_BIN([edje], [edje-cc], [edje_cc])
197EFL_WITH_BIN([elementary], [elementary-codegen], [elementary_codegen])
198EFL_WITH_BIN([elementary], [elm-prefs-cc], [elm_prefs_cc])
199EFL_WITH_BIN([eolian], [eolian-gen], [eolian_gen])
200EFL_WITH_BIN([eolian-cxx], [eolian-cxx], [eolian_cxx])
201EFL_WITH_BIN([eldbus], [eldbus_codegen], [eldbus-codegen])
202# Force the helper to try external eolian generators
203AM_CONDITIONAL([HAVE_EOLIAN_GEN], [true])
204AM_CONDITIONAL([HAVE_EOLIAN_CXX], [true])
205AM_CONDITIONAL([HAVE_EOLIAN_JS], [true])
206
207EFL_ENABLE_BIN([elementary-test])
208EFL_ENABLE_BIN([elementary-codegen])
209EFL_ENABLE_BIN([elm-prefs-cc])
210EFL_ENABLE_BIN([elementary-config])
211
212
213### Checks for libraries 248### Checks for libraries
214 249
215requirement_elm_pc="" 250requirement_elm_pc=""
@@ -263,7 +298,6 @@ ELM_CHECK_OPTION([elocation], [0.1.0])
263ELM_CHECK_OPTION([eweather], [0.2.0]) 298ELM_CHECK_OPTION([eweather], [0.2.0])
264# emap is in svn : trunk/PROTO 299# emap is in svn : trunk/PROTO
265ELM_CHECK_OPTION([emap], [0.1.0]) 300ELM_CHECK_OPTION([emap], [0.1.0])
266ELM_CHECK_OPTION([eweb])
267 301
268if test "x${HAVE_CXX11}" = "x1" -a "x${want_cxx11}" = "xyes"; then 302if test "x${HAVE_CXX11}" = "x1" -a "x${want_cxx11}" = "xyes"; then
269 PKG_CHECK_MODULES([ELEMENTARY_CXX], 303 PKG_CHECK_MODULES([ELEMENTARY_CXX],
@@ -564,6 +598,9 @@ src/modules/access_output/Makefile
564src/modules/datetime_input_ctxpopup/Makefile 598src/modules/datetime_input_ctxpopup/Makefile
565src/modules/test_entry/Makefile 599src/modules/test_entry/Makefile
566src/modules/test_map/Makefile 600src/modules/test_map/Makefile
601src/modules/web/Makefile
602src/modules/web/none/Makefile
603src/modules/web/webkit2/Makefile
567src/edje_externals/Makefile 604src/edje_externals/Makefile
568src/examples/Makefile 605src/examples/Makefile
569src/examples/sphere_hunter/Makefile 606src/examples/sphere_hunter/Makefile
@@ -616,7 +653,7 @@ echo
616echo " Features:" 653echo " Features:"
617echo " EWeather...............: ${have_elementary_eweather}" 654echo " EWeather...............: ${have_elementary_eweather}"
618echo " EMap...................: ${have_elementary_emap}" 655echo " EMap...................: ${have_elementary_emap}"
619echo " Web (WebKit)...........: ${elementary_web}" 656echo " Web....................: ${elementary_web}"
620echo " Quick Launch...........: ${ac_cv_func_fork}" 657echo " Quick Launch...........: ${ac_cv_func_fork}"
621echo " Elocation..............: ${have_elementary_elocation}" 658echo " Elocation..............: ${have_elementary_elocation}"
622echo 659echo
diff --git a/m4/elm_check_option.m4 b/m4/elm_check_option.m4
index 9fae5ffaf..999636ad3 100644
--- a/m4/elm_check_option.m4
+++ b/m4/elm_check_option.m4
@@ -42,64 +42,6 @@ m4_popdef([UP])dnl
42m4_popdef([DOWN])dnl 42m4_popdef([DOWN])dnl
43]) 43])
44 44
45dnl use: ELM_CHECK_OPTION_DEP_EWK2()
46AC_DEFUN([ELM_CHECK_OPTION_DEP_EWK2],
47[dnl
48
49ELM_WEB2_DEF="#undef"
50elementary_web="no"
51
52AC_ARG_WITH([elementary-web-backend],
53 [AS_HELP_STRING(
54 [--with-elementary-web-backend=@<:@ewebkit2/detect/none@:>@],
55 [Select the WebKit backend for Elementary to support web @<:@default=detect@:>@])],
56 [elementary_web_backend=${withval}],
57 [elementary_web_backend="detect"])
58
59case "${elementary_web_backend}" in
60 ewebkit2|detect|none)
61 ;;
62 *)
63 AC_MSG_ERROR([Invalid web backend: must be ewebkit2, detect or none])
64 ;;
65esac
66
67if test "x${elementary_web_backend}" = "xdetect"; then
68 want_elementary_web="ewebkit2"
69else
70 want_elementary_web=${elementary_web_backend}
71fi
72
73AC_MSG_CHECKING([which web option to use])
74AC_MSG_RESULT([${want_elementary_web}])
75
76if test "x${want_elementary_web}" != "xnone"; then
77 PKG_CHECK_EXISTS([$want_elementary_web],
78 [
79 AC_DEFINE([HAVE_ELEMENTARY_WEB], [1], [Web support for Elementary])
80 webkit_datadir=$(${PKG_CONFIG} ${want_elementary_web} --variable=datadir)
81 AC_DEFINE_UNQUOTED([WEBKIT_DATADIR],
82 ["${webkit_datadir}"],
83 ["WebKit's data dir"])
84 ELM_WEB2_DEF="#define"
85 elementary_web=${want_elementary_web}
86 requirement_elm_pc="${want_elementary_web} ${requirement_elm_pc}"
87 ],
88 [elementary_web="no"]
89 )
90fi
91
92AC_MSG_CHECKING([whether to build web option])
93AC_MSG_RESULT([${elementary_web}])
94
95if test "x${elementary_web_backend}" = "xewebkit2" && test "x${elementary_web}" = "xnone"; then
96 AC_MSG_ERROR([Web support requested, but no ${elementary_web_backend} found by pkg-config.])
97fi
98
99AC_SUBST([ELM_WEB2_DEF])
100])
101
102
103dnl use: ELM_CHECK_OPTION(option, pkgver) 45dnl use: ELM_CHECK_OPTION(option, pkgver)
104AC_DEFUN([ELM_CHECK_OPTION], 46AC_DEFUN([ELM_CHECK_OPTION],
105[dnl 47[dnl
diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in
index 3b5d73d1d..b8fe89a2f 100644
--- a/src/lib/Elementary.h.in
+++ b/src/lib/Elementary.h.in
@@ -13,7 +13,6 @@
13 13
14@ELM_UNIX_DEF@ ELM_UNIX 14@ELM_UNIX_DEF@ ELM_UNIX
15@ELM_WIN32_DEF@ ELM_WIN32 15@ELM_WIN32_DEF@ ELM_WIN32
16@ELM_WEB2_DEF@ ELM_WEB2
17@ELM_EMAP_DEF@ ELM_EMAP 16@ELM_EMAP_DEF@ ELM_EMAP
18@ELM_DEBUG_DEF@ ELM_DEBUG 17@ELM_DEBUG_DEF@ ELM_DEBUG
19@ELM_ALLOCA_H_DEF@ ELM_ALLOCA_H 18@ELM_ALLOCA_H_DEF@ ELM_ALLOCA_H
diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c
index 185a0ef4e..bf5a3a34f 100644
--- a/src/lib/elm_config.c
+++ b/src/lib/elm_config.c
@@ -380,6 +380,7 @@ _desc_init(void)
380 ELM_CONFIG_VAL(D, T, config_version, T_INT); 380 ELM_CONFIG_VAL(D, T, config_version, T_INT);
381 ELM_CONFIG_VAL(D, T, engine, T_STRING); 381 ELM_CONFIG_VAL(D, T, engine, T_STRING);
382 ELM_CONFIG_VAL(D, T, accel, T_STRING); 382 ELM_CONFIG_VAL(D, T, accel, T_STRING);
383 ELM_CONFIG_VAL(D, T, web_backend, T_STRING);
383 ELM_CONFIG_VAL(D, T, accel_override, T_UCHAR); 384 ELM_CONFIG_VAL(D, T, accel_override, T_UCHAR);
384 ELM_CONFIG_VAL(D, T, vsync, T_UCHAR); 385 ELM_CONFIG_VAL(D, T, vsync, T_UCHAR);
385 ELM_CONFIG_VAL(D, T, thumbscroll_enable, T_UCHAR); 386 ELM_CONFIG_VAL(D, T, thumbscroll_enable, T_UCHAR);
diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c
index 12294446d..0bb4c4d4b 100644
--- a/src/lib/elm_main.c
+++ b/src/lib/elm_main.c
@@ -320,6 +320,10 @@ elm_init(int argc, char **argv)
320 320
321 if (_elm_config->atspi_mode != ELM_ATSPI_MODE_OFF) 321 if (_elm_config->atspi_mode != ELM_ATSPI_MODE_OFF)
322 _elm_atspi_bridge_init(); 322 _elm_atspi_bridge_init();
323 if (!_elm_config->web_backend)
324 _elm_config->web_backend = "none";
325 if (!_elm_web_init(_elm_config->web_backend))
326 _elm_config->web_backend = "none";
323 327
324 return _elm_init_count; 328 return _elm_init_count;
325} 329}
diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
index 9b7fce896..91b4285a6 100644
--- a/src/lib/elm_priv.h
+++ b/src/lib/elm_priv.h
@@ -194,6 +194,7 @@ struct _Elm_Config
194 int config_version; 194 int config_version;
195 const char *engine; 195 const char *engine;
196 const char *accel; 196 const char *accel;
197 const char *web_backend;
197 unsigned char accel_override; 198 unsigned char accel_override;
198 unsigned char vsync; 199 unsigned char vsync;
199 unsigned char thumbscroll_enable; 200 unsigned char thumbscroll_enable;
@@ -359,6 +360,8 @@ struct _Elm_Module
359 int references; 360 int references;
360}; 361};
361 362
363Eina_Bool _elm_web_init(const char *engine);
364
362Eo *_elm_atspi_bridge_get(void); 365Eo *_elm_atspi_bridge_get(void);
363void _elm_atspi_bridge_init(void); 366void _elm_atspi_bridge_init(void);
364void _elm_atspi_bridge_shutdown(void); 367void _elm_atspi_bridge_shutdown(void);
diff --git a/src/lib/elm_web.eo b/src/lib/elm_web.eo
index ddeec3d78..0df0a21a6 100644
--- a/src/lib/elm_web.eo
+++ b/src/lib/elm_web.eo
@@ -490,16 +490,55 @@ class Elm.Web (Elm.Widget)
490 implements { 490 implements {
491 class.constructor; 491 class.constructor;
492 Eo.Base.constructor; 492 Eo.Base.constructor;
493 Evas.Object_Smart.add; 493 @virtual .tab_propagate.get;
494 Evas.Object_Smart.del; 494 @virtual .tab_propagate.set;
495 Elm.Widget.theme_apply; 495 @virtual .webkit_view.get;
496 Elm.Widget.on_focus; 496 @virtual .window_create_hook.set;
497 Elm.Widget.event; 497 @virtual .dialog_alert_hook.set;
498 @virtual .dialog_confirm_hook.set;
499 @virtual .dialog_prompt_hook.set;
500 @virtual .dialog_file_selector_hook.set;
501 @virtual .console_message_hook.set;
502 @virtual .useragent.set;
503 @virtual .useragent.get;
504 @virtual .url.set;
505 @virtual .url.get;
506 @virtual .html_string_load;
507 @virtual .title.get;
508 @virtual .bg_color.set;
509 @virtual .bg_color.get;
510 @virtual .selection.get;
511 @virtual .popup_selected.set;
512 @virtual .popup_destroy;
513 @virtual .text_search;
514 @virtual .text_matches_mark;
515 @virtual .text_matches_unmark_all;
516 @virtual .text_matches_highlight.set;
517 @virtual .text_matches_highlight.get;
518 @virtual .load_progress.get;
519 @virtual .stop;
520 @virtual .reload;
521 @virtual .reload_full;
522 @virtual .back;
523 @virtual .forward;
524 @virtual .navigate;
525 @virtual .back_possible.get;
526 @virtual .forward_possible.get;
527 @virtual .navigate_possible_get;
528 @virtual .history_enabled.get;
529 @virtual .history_enabled.set;
530 @virtual .zoom.set;
531 @virtual .zoom.get;
532 @virtual .zoom_mode.set;
533 @virtual .zoom_mode.get;
534 @virtual .region_show;
535 @virtual .region_bring_in;
536 @virtual .inwin_mode.set;
537 @virtual .inwin_mode.get;
498 } 538 }
499 events { 539 events {
500 uri,changed; 540 uri,changed;
501 url,changed; 541 url,changed;
502 windows,close,request; 542 windows,close,request;
503 } 543 }
504
505} 544}
diff --git a/src/lib/elm_web2.c b/src/lib/elm_web2.c
index f78c47d5e..37d1d757f 100644
--- a/src/lib/elm_web2.c
+++ b/src/lib/elm_web2.c
@@ -9,19 +9,43 @@
9#include "elm_priv.h" 9#include "elm_priv.h"
10#include "elm_widget_web.h" 10#include "elm_widget_web.h"
11 11
12#if defined(HAVE_ELEMENTARY_WEB)
13#include <EWebKit2.h>
14#endif
15
16#define MY_CLASS ELM_WEB_CLASS 12#define MY_CLASS ELM_WEB_CLASS
17 13
18#define MY_CLASS_NAME "Elm_Web" 14#define MY_CLASS_NAME "Elm_Web"
19#define MY_CLASS_NAME_LEGACY "elm_web" 15#define MY_CLASS_NAME_LEGACY "elm_web"
20 16
21#if defined(HAVE_ELEMENTARY_WEB) 17typedef struct _Elm_Web_Module Elm_Web_Module;
22static Ewk_View_Smart_Class _ewk_view_parent_sc = 18struct _Elm_Web_Module
23 EWK_VIEW_SMART_CLASS_INIT_NULL; 19{
24#endif 20 void (*unneed_web)(void);
21 Eina_Bool (*need_web)(void);
22
23 void (*window_features_ref)(Elm_Web_Window_Features *wf);
24 void (*window_features_unref)(Elm_Web_Window_Features *wf);
25 Eina_Bool (*window_features_property_get)(const Elm_Web_Window_Features *wf,
26 Elm_Web_Window_Feature_Flag flag);
27 void (*window_features_region_get)(const Elm_Web_Window_Features *wf,
28 Evas_Coord *x,
29 Evas_Coord *y,
30 Evas_Coord *w,
31 Evas_Coord *h);
32
33 const Eo_Class *(*class_get)(void);
34
35 Eina_Module *m;
36};
37
38static Elm_Web_Module ewm = {
39 NULL,
40 NULL,
41
42 NULL,
43 NULL,
44 NULL,
45 NULL,
46
47 NULL
48};
25 49
26static const char SIG_URI_CHANGED[] = "uri,changed"; // deprecated, use "url,changed" instead. 50static const char SIG_URI_CHANGED[] = "uri,changed"; // deprecated, use "url,changed" instead.
27static const char SIG_URL_CHANGED[] = "url,changed"; 51static const char SIG_URL_CHANGED[] = "url,changed";
@@ -34,707 +58,29 @@ static const Evas_Smart_Cb_Description _elm_web_smart_callbacks[] = {
34 { NULL, NULL } 58 { NULL, NULL }
35}; 59};
36 60
37#ifdef HAVE_ELEMENTARY_WEB 61// FIXME: init/shutdown module below
38static void
39_view_smart_add(Evas_Object *obj)
40{
41 View_Smart_Data *sd;
42
43 sd = calloc(1, sizeof(View_Smart_Data));
44 evas_object_smart_data_set(obj, sd);
45
46 _ewk_view_parent_sc.sc.add(obj);
47}
48
49static void
50_view_smart_del(Evas_Object *obj)
51{
52 _ewk_view_parent_sc.sc.del(obj);
53}
54
55static Evas_Object *
56_view_smart_window_create(Ewk_View_Smart_Data *vsd,
57 const Ewk_Window_Features *window_features)
58{
59 Evas_Object *new;
60 Evas_Object *obj = evas_object_smart_parent_get(vsd->self);
61
62 ELM_WEB_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
63
64 if (!sd->hook.window_create) return NULL;
65
66 new = sd->hook.window_create
67 (sd->hook.window_create_data, obj, EINA_TRUE,
68 (const Elm_Web_Window_Features *)window_features);
69 if (new) return elm_web_webkit_view_get(new);
70
71 return NULL;
72}
73
74static void
75_view_smart_window_close(Ewk_View_Smart_Data *sd)
76{
77 Evas_Object *obj = evas_object_smart_parent_get(sd->self);
78
79 ELM_WEB_CHECK(obj);
80
81 eo_event_callback_call(obj, ELM_WEB_EVENT_WINDOWS_CLOSE_REQUEST, NULL);
82}
83
84static void
85_popup_item_selected(void *data,
86 Evas_Object *obj,
87 void *event_info EINA_UNUSED)
88{
89 Elm_Object_Item *list_it = elm_list_selected_item_get(obj);
90 const Eina_List *itr, *list = elm_list_items_get(obj);
91 Ewk_Popup_Menu *menu = data;
92 int i = 0;
93 void *d;
94
95 EINA_LIST_FOREACH(list, itr, d)
96 {
97 if (d == list_it)
98 break;
99
100 i++;
101 }
102
103 ewk_popup_menu_selected_index_set(menu, i);
104 ewk_popup_menu_close(menu);
105
106 evas_object_del(evas_object_data_get(obj, "_notify"));
107}
108
109static Eina_Bool
110_popup_dismiss_cb(void *data,
111 Eo *obj,
112 const Eo_Event_Description *desc EINA_UNUSED,
113 void *event_info EINA_UNUSED)
114{
115 ewk_popup_menu_close(data);
116 evas_object_del(obj);
117 return EINA_TRUE;
118}
119
120static Eina_Bool
121_view_smart_popup_menu_show(Ewk_View_Smart_Data *sd,
122 Eina_Rectangle r,
123 Ewk_Text_Direction dir EINA_UNUSED,
124 double scale EINA_UNUSED,
125 Ewk_Popup_Menu *menu)
126{
127 Evas_Object *notify, *list, *grid, *win;
128 const Eina_List* items = ewk_popup_menu_items_get(menu);
129 Evas_Object *obj = evas_object_smart_parent_get(sd->self);
130 int h, ww, wh;
131
132 Elm_Object_Item *lit;
133 Eina_Bool disabled;
134 const char *txt;
135 Ewk_Popup_Menu_Item *it;
136 const Eina_List *itr;
137
138 Evas_Object *popup = evas_object_data_get(sd->self, "_select_popup");
139 if (popup) evas_object_del(popup);
140
141 win = elm_widget_top_get(obj);
142
143 notify = elm_notify_add(win);
144 elm_notify_allow_events_set(notify, EINA_FALSE);
145 elm_notify_align_set(notify, 0.5, 1.0);
146
147 list = elm_list_add(notify);
148 evas_object_data_set(list, "_notify", notify);
149 elm_list_select_mode_set(list, ELM_OBJECT_SELECT_MODE_ALWAYS);
150 elm_scroller_bounce_set(list, EINA_FALSE, EINA_FALSE);
151 elm_list_mode_set(list, ELM_LIST_EXPAND);
152 evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
153 evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
154 evas_object_show(list);
155
156 EINA_LIST_FOREACH(items, itr, it)
157 {
158 switch (ewk_popup_menu_item_type_get(it))
159 {
160 case EWK_POPUP_MENU_SEPARATOR:
161 // TODO:
162 break;
163 case EWK_POPUP_MENU_ITEM:
164 txt = ewk_popup_menu_item_text_get(it);
165 if (ewk_popup_menu_item_is_label_get(it))
166 {
167 lit = elm_list_item_append(list, txt, NULL, NULL, NULL, NULL);
168 disabled = EINA_TRUE;
169 }
170 else
171 {
172 lit = elm_list_item_append(list, txt, NULL, NULL, _popup_item_selected, menu);
173 disabled = !ewk_popup_menu_item_enabled_get(it);
174 }
175
176 elm_object_item_disabled_set(lit, disabled);
177 break;
178 default:
179 break;
180 }
181 }
182 elm_list_go(list);
183
184 grid = elm_grid_add(win);
185 elm_grid_size_set(grid, 1, 1);
186 elm_grid_pack(grid, list, 0, 0, 1, 1);
187 evas_object_geometry_get(win, NULL, NULL, &ww, &wh);
188
189 //FIXME: it should be the real height of items in the list.
190 h = r.h * eina_list_count(items);
191 evas_object_size_hint_min_set(grid, ww, h < wh / 2 ? h : wh / 2);
192 elm_object_content_set(notify, grid);
193 evas_object_show(grid);
194
195 evas_object_show(notify);
196
197 evas_object_data_set(sd->self, "_select_popup", notify);
198
199 eo_event_callback_add
200 (notify, ELM_NOTIFY_EVENT_BLOCK_CLICKED, _popup_dismiss_cb, menu);
201
202 return EINA_TRUE;
203}
204
205static Eina_Bool
206_view_smart_popup_menu_hide(Ewk_View_Smart_Data *sd)
207{
208 Evas_Object *popup = evas_object_data_get(sd->self, "_select_popup");
209 if (!popup) return EINA_FALSE;
210
211 evas_object_del(popup);
212 evas_object_data_del(sd->self, "_select_popup");
213
214 return EINA_TRUE;
215}
216
217static Eina_Bool
218_fullscreen_accept(void *data,
219 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
220{
221 Evas_Object *ewk = data;
222 evas_object_del(evas_object_data_get(ewk, "_fullscreen_permission_popup"));
223
224 return EINA_TRUE;
225}
226
227static Eina_Bool
228_fullscreen_deny(void *data,
229 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
230{
231 Evas_Object *ewk = data;
232 ewk_view_fullscreen_exit(ewk);
233 evas_object_del(evas_object_data_get(ewk, "_fullscreen_permission_popup"));
234
235 return EINA_TRUE;
236}
237
238static Eina_Bool
239_view_smart_fullscreen_enter(Ewk_View_Smart_Data *sd, Ewk_Security_Origin *origin)
240{
241 Evas_Object *btn, *popup, *top;
242 const char *host;
243 char buffer[2048];
244
245 Evas_Object *obj = evas_object_smart_parent_get(sd->self);
246
247 ELM_WEB_CHECK(obj) EINA_FALSE;
248
249 top = elm_widget_top_get(obj);
250 elm_win_fullscreen_set(top, EINA_TRUE);
251
252 popup = elm_popup_add(top);
253 elm_popup_orient_set(popup, ELM_POPUP_ORIENT_TOP);
254 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
255
256 host = ewk_security_origin_host_get(origin);
257 snprintf(buffer, sizeof(buffer), "%s is now fullscreen.<br>Press ESC at any time to exit fullscreen,<br>Allow fullscreen?<br>", host);
258 elm_object_text_set(popup, buffer);
259
260 btn = elm_button_add(popup);
261 elm_object_text_set(btn, "Accept");
262 elm_object_part_content_set(popup, "button1", btn);
263 eo_event_callback_add
264 (btn, EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, _fullscreen_accept, sd->self);
265
266 btn = elm_button_add(popup);
267 elm_object_text_set(btn, "Deny");
268 elm_object_part_content_set(popup, "button2", btn);
269 eo_event_callback_add
270 (btn, EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, _fullscreen_deny, sd->self);
271
272 evas_object_data_set(sd->self, "_fullscreen_permission_popup", popup);
273 evas_object_show(popup);
274
275 return EINA_TRUE;
276}
277
278static Eina_Bool
279_view_smart_fullscreen_exit(Ewk_View_Smart_Data *sd)
280{
281 Evas_Object *obj = evas_object_smart_parent_get(sd->self);
282
283 ELM_WEB_CHECK(obj) EINA_FALSE;
284
285 Evas_Object *top = elm_widget_top_get(obj);
286 elm_win_fullscreen_set(top, EINA_FALSE);
287
288 return EINA_TRUE;
289}
290
291static Eina_Bool
292_bt_close(void *data,
293 Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
294{
295 Dialog_Data *d = data;
296
297 if (d->type == DIALOG_ALERT) goto end;
298
299 *d->response = (obj == d->bt_ok);
300 if (d->type == DIALOG_CONFIRM) goto end;
301
302 if (d->type == DIALOG_PROMPT)
303 *d->entry_value = strdup(elm_entry_entry_get(d->entry));
304
305end:
306 evas_object_del(d->dialog);
307 free(d);
308
309 return EINA_TRUE;
310}
311
312static Dialog_Data *
313_dialog_new(Evas_Object *web, Eina_Bool inwin_mode)
314{
315 Dialog_Data *d;
316
317 d = calloc(1, sizeof(Dialog_Data));
318 if (!d) return NULL;
319
320 if (!web || inwin_mode)
321 {
322 Evas_Object *bg;
323
324 d->dialog = elm_win_add(NULL, "elm-web-popup", ELM_WIN_DIALOG_BASIC);
325 eo_event_callback_add
326 (d->dialog, ELM_WIN_EVENT_DELETE_REQUEST, _bt_close, d);
327
328 bg = elm_bg_add(d->dialog);
329 evas_object_size_hint_weight_set
330 (bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
331 elm_win_resize_object_add(d->dialog, bg);
332 evas_object_show(bg);
333
334 d->box = elm_box_add(d->dialog);
335 evas_object_size_hint_weight_set
336 (d->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
337 elm_win_resize_object_add(d->dialog, d->box);
338 evas_object_show(d->box);
339 }
340 else
341 {
342 Evas_Object *win = elm_widget_top_get(web);
343
344 d->dialog = elm_win_inwin_add(win);
345 elm_object_style_set(d->dialog, "minimal");
346 evas_object_size_hint_weight_set
347 (d->dialog, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
348
349 d->box = elm_box_add(win);
350 evas_object_size_hint_weight_set
351 (d->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
352 elm_win_inwin_content_set(d->dialog, d->box);
353 evas_object_show(d->box);
354 }
355
356 return d;
357}
358
359static void
360_dialog_ok_cancel_buttons_add(Dialog_Data *dialog_data)
361{
362 Evas_Object *bx, *bt;
363 bx = elm_box_add(dialog_data->box);
364 elm_box_horizontal_set(bx, EINA_TRUE);
365 elm_box_pack_end(dialog_data->box, bx);
366 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
367 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
368 evas_object_show(bx);
369
370 dialog_data->bt_cancel = bt = elm_button_add(bx);
371 elm_object_text_set(bt, "Cancel");
372 elm_box_pack_end(bx, bt);
373 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
374 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
375 eo_event_callback_add
376 (bt, EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, _bt_close, dialog_data);
377 evas_object_show(bt);
378
379 dialog_data->bt_ok = bt = elm_button_add(bx);
380 elm_object_text_set(bt, "Ok");
381 elm_box_pack_end(bx, bt);
382 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
383 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
384 eo_event_callback_add
385 (bt, EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, _bt_close, dialog_data);
386 evas_object_show(bt);
387}
388
389static void
390_dialog_del_cb(void *data EINA_UNUSED,
391 Evas *e EINA_UNUSED,
392 Evas_Object *obj EINA_UNUSED,
393 void *event_info EINA_UNUSED)
394{
395 ecore_main_loop_quit();
396}
397
398static void
399_exec_dialog(Evas_Object *dialog)
400{
401 evas_object_event_callback_add
402 (dialog, EVAS_CALLBACK_DEL, _dialog_del_cb, NULL);
403 ecore_main_loop_begin();
404}
405
406static void
407_view_smart_run_javascript_alert(Ewk_View_Smart_Data *vsd, const char *message)
408{
409 Evas_Object *obj = evas_object_smart_parent_get(vsd->self);
410 Evas_Object *dialog = NULL;
411
412 ELM_WEB_DATA_GET_OR_RETURN(obj, sd);
413
414 if (sd->hook.alert)
415 dialog = sd->hook.alert(sd->hook.alert_data, obj, message);
416 else
417 {
418 Evas_Object *lb;
419 Dialog_Data *dialog_data = _dialog_new(obj, sd->inwin_mode);
420 dialog_data->type = DIALOG_ALERT;
421 dialog = dialog_data->dialog;
422
423 lb = elm_label_add(dialog_data->box);
424 elm_object_text_set(lb, message);
425 elm_box_pack_end(dialog_data->box, lb);
426 evas_object_show(lb);
427
428 dialog_data->bt_ok = elm_button_add(dialog_data->box);
429 elm_object_text_set(dialog_data->bt_ok, "Close");
430 elm_box_pack_end(dialog_data->box, dialog_data->bt_ok);
431 evas_object_size_hint_align_set
432 (dialog_data->bt_ok, EVAS_HINT_FILL, EVAS_HINT_FILL);
433 eo_event_callback_add
434 (dialog_data->bt_ok, EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, _bt_close, dialog_data);
435 evas_object_show(dialog_data->bt_ok);
436
437 evas_object_show(dialog);
438 }
439
440 if (dialog) _exec_dialog(dialog);
441}
442
443static Eina_Bool
444_view_smart_run_javascript_confirm(Ewk_View_Smart_Data *vsd, const char *message)
445{
446 Evas_Object *obj = evas_object_smart_parent_get(vsd->self);
447 Eina_Bool response = EINA_FALSE;
448 Evas_Object *dialog = NULL;
449
450 ELM_WEB_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
451
452 if (sd->hook.confirm)
453 dialog = sd->hook.confirm(sd->hook.confirm_data, obj, message, &response);
454 else
455 {
456 Evas_Object *lb;
457 Dialog_Data *dialog_data = _dialog_new(obj, sd->inwin_mode);
458 dialog_data->type = DIALOG_CONFIRM;
459 dialog_data->response = &response;
460 dialog = dialog_data->dialog;
461
462 lb = elm_label_add(dialog_data->box);
463 elm_object_text_set(lb, message);
464 elm_box_pack_end(dialog_data->box, lb);
465 evas_object_show(lb);
466
467 _dialog_ok_cancel_buttons_add(dialog_data);
468
469 evas_object_show(dialog);
470 }
471
472 if (dialog) _exec_dialog(dialog);
473
474 return response;
475}
476
477static const char *
478_view_smart_run_javascript_prompt(Ewk_View_Smart_Data *vsd, const char *message, const char *default_value)
479{
480 Evas_Object *obj = evas_object_smart_parent_get(vsd->self);
481 Eina_Bool response = EINA_FALSE;
482 Evas_Object *dialog = NULL;
483 char *value = NULL;
484 const char *ret;
485
486 ELM_WEB_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
487
488 if (sd->hook.prompt)
489 dialog = sd->hook.prompt(sd->hook.prompt_data, obj, message, default_value, (const char**)&value, &response);
490 else
491 {
492 Evas_Object *lb, *entry;
493 Dialog_Data *dialog_data = _dialog_new(obj, sd->inwin_mode);
494 dialog_data->type = DIALOG_PROMPT;
495 dialog_data->response = &response;
496 dialog_data->entry_value = (const char**)&value;
497 dialog = dialog_data->dialog;
498
499 lb = elm_label_add(dialog_data->box);
500 elm_object_text_set(lb, message);
501 elm_box_pack_end(dialog_data->box, lb);
502 evas_object_show(lb);
503
504 dialog_data->entry = entry = elm_entry_add(dialog_data->box);
505 elm_entry_single_line_set(entry, EINA_TRUE);
506 elm_entry_scrollable_set(entry, EINA_TRUE);
507 elm_entry_entry_set(entry, default_value);
508 evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
509 evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
510 elm_box_pack_end(dialog_data->box, entry);
511 evas_object_show(entry);
512
513 _dialog_ok_cancel_buttons_add(dialog_data);
514
515 evas_object_show(dialog);
516 }
517
518 if (dialog) _exec_dialog(dialog);
519
520 if (!value) return NULL;
521
522 ret = eina_stringshare_add(value);
523 free(value);
524 return ret;
525}
526
527/**
528 * Creates a new view object given the parent.
529 *
530 * @param parent object to use as parent.
531 *
532 * @return newly added Evas_Object or @c NULL on errors.
533 */
534Evas_Object *
535_view_add(Evas_Object *parent)
536{
537 Evas *canvas = evas_object_evas_get(parent);
538 static Evas_Smart *smart = NULL;
539 Evas_Object *view;
540
541 if (!smart)
542 {
543 static Ewk_View_Smart_Class api =
544 EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("EWK_View_Elementary");
545
546 ewk_view_smart_class_set(&api);
547 ewk_view_smart_class_set(&_ewk_view_parent_sc);
548
549 // TODO: check every api method and provide overrides with hooks!
550 // TODO: hooks should provide extension points
551 // TODO: extension should have some kind of "default implementation",
552 // TODO: that can be replaced or controlled by hooks.
553 // TODO: ie: run_javascript_alert() should present an elm_win
554 // TODO: by default, but user could override it to show as inwin.
555 api.sc.add = _view_smart_add;
556 api.sc.del = _view_smart_del;
557 api.window_create = _view_smart_window_create;
558 api.window_close = _view_smart_window_close;
559 api.popup_menu_show = _view_smart_popup_menu_show;
560 api.popup_menu_hide = _view_smart_popup_menu_hide;
561 api.fullscreen_enter = _view_smart_fullscreen_enter;
562 api.fullscreen_exit = _view_smart_fullscreen_exit;
563 api.run_javascript_alert = _view_smart_run_javascript_alert;
564 api.run_javascript_confirm = _view_smart_run_javascript_confirm;
565 api.run_javascript_prompt = _view_smart_run_javascript_prompt;
566
567 smart = evas_smart_class_new(&api.sc);
568 if (!smart)
569 {
570 CRI("Could not create smart class");
571 return NULL;
572 }
573 }
574
575 view = ewk_view_smart_add(canvas, smart, ewk_context_default_get(), ewk_page_group_create(0));
576 if (!view)
577 {
578 ERR("Could not create smart object object for view");
579 return NULL;
580 }
581
582 return view;
583}
584
585static Eina_Bool
586_view_smart_url_changed_cb(void *data,
587 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
588{
589 eo_event_callback_call(data, ELM_WEB_EVENT_URI_CHANGED, event_info);
590 eo_event_callback_call(data, ELM_WEB_EVENT_URL_CHANGED, event_info);
591
592 return EINA_TRUE;
593}
594
595static void
596_view_smart_callback_proxy(Evas_Object *view, Evas_Object *parent)
597{
598 eo_event_callback_add
599 (view, ELM_WEB_EVENT_URL_CHANGED, _view_smart_url_changed_cb, parent);
600}
601
602static Eina_Bool _elm_need_web = EINA_FALSE;
603#endif
604
605void 62void
606_elm_unneed_web(void) 63_elm_unneed_web(void)
607{ 64{
608#ifdef HAVE_ELEMENTARY_WEB 65 if (!ewm.unneed_web) return ;
609 if (!_elm_need_web) return; 66 ewm.unneed_web();
610 _elm_need_web = EINA_FALSE;
611 ewk_shutdown();
612#endif
613} 67}
614 68
615EAPI Eina_Bool 69EAPI Eina_Bool
616elm_need_web(void) 70elm_need_web(void)
617{ 71{
618#ifdef HAVE_ELEMENTARY_WEB 72 if (!ewm.need_web) return EINA_FALSE;
619 if (_elm_need_web) return EINA_TRUE; 73 return ewm.need_web();
620 _elm_need_web = EINA_TRUE;
621 ewk_init();
622 return EINA_TRUE;
623#else
624 return EINA_FALSE;
625#endif
626}
627
628EOLIAN static Eina_Bool
629_elm_web_elm_widget_theme_apply(Eo *obj, Elm_Web_Data *sd EINA_UNUSED)
630{
631 (void)obj;
632 return EINA_TRUE;
633}
634
635EOLIAN static Eina_Bool
636_elm_web_elm_widget_on_focus(Eo *obj, Elm_Web_Data *sd, Elm_Object_Item *item EINA_UNUSED)
637{
638#ifdef HAVE_ELEMENTARY_WEB
639 Evas_Object *top;
640
641 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_TRUE);
642 Eina_Bool int_ret = EINA_FALSE;
643
644 int_ret = elm_obj_widget_on_focus(eo_super(obj, MY_CLASS), NULL);
645 if (!int_ret) return EINA_TRUE;
646
647 top = elm_widget_top_get(obj);
648
649 if (elm_object_focus_get(obj))
650 {
651 evas_object_focus_set(wd->resize_obj, EINA_TRUE);
652 if (top) elm_win_keyboard_mode_set(top, sd->input_method);
653 }
654 else
655 {
656 evas_object_focus_set(wd->resize_obj, EINA_FALSE);
657 if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF);
658 }
659#else
660 (void)obj;
661 (void)sd;
662#endif
663 return EINA_TRUE;
664}
665
666EOLIAN static Eina_Bool
667_elm_web_elm_widget_event(Eo *obj, Elm_Web_Data *sd, Evas_Object *src, Evas_Callback_Type type, void *event_info)
668{
669 (void)obj;
670 (void)sd;
671 (void)src;
672 (void)type;
673 (void)event_info;
674 return EINA_FALSE;
675}
676
677EOLIAN static Eina_Bool
678_elm_web_tab_propagate_get(Eo *obj EINA_UNUSED, Elm_Web_Data *sd)
679{
680#ifdef HAVE_ELEMENTARY_WEB
681 return sd->tab_propagate;
682#else
683 (void)sd;
684 return EINA_FALSE;
685#endif
686}
687
688EOLIAN static void
689_elm_web_tab_propagate_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Eina_Bool propagate)
690{
691#ifdef HAVE_ELEMENTARY_WEB
692 sd->tab_propagate = propagate;
693#else
694 (void)propagate;
695 (void)sd;
696#endif
697}
698
699EOLIAN static void
700_elm_web_evas_object_smart_add(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
701{
702 Evas_Object *resize_obj;
703
704#ifdef HAVE_ELEMENTARY_WEB
705 resize_obj = _view_add(obj);
706 elm_widget_resize_object_set(obj, resize_obj, EINA_TRUE);
707
708 evas_obj_smart_add(eo_super(obj, MY_CLASS));
709 elm_widget_sub_object_parent_add(obj);
710
711 //TODO: need a way to change theme
712 ewk_view_theme_set(resize_obj, WEBKIT_DATADIR "/themes/default.edj");
713
714 _view_smart_callback_proxy(resize_obj, obj);
715 elm_widget_can_focus_set(obj, EINA_TRUE);
716#else
717 resize_obj = elm_label_add(obj);
718 elm_object_text_set(resize_obj, "WebKit not supported!");
719 elm_widget_resize_object_set(obj, resize_obj, EINA_TRUE);
720
721 evas_obj_smart_add(eo_super(obj, MY_CLASS));
722 elm_widget_sub_object_parent_add(obj);
723#endif
724}
725
726EOLIAN static void
727_elm_web_evas_object_smart_del(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
728{
729 evas_obj_smart_del(eo_super(obj, MY_CLASS));
730} 74}
731 75
732EAPI Evas_Object * 76EAPI Evas_Object *
733elm_web_add(Evas_Object *parent) 77elm_web_add(Evas_Object *parent)
734{ 78{
735 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); 79 Evas_Object *obj;
736 Evas_Object *obj = NULL; 80
737 eo_add(&obj, MY_CLASS, parent); 81 if (!parent || !ewm.class_get) return NULL;
82
83 eo_add(&obj, ewm.class_get(), parent);
738 return obj; 84 return obj;
739} 85}
740 86
@@ -750,737 +96,124 @@ _elm_web_eo_base_constructor(Eo *obj, Elm_Web_Data *sd)
750 return obj; 96 return obj;
751} 97}
752 98
753EOLIAN static Evas_Object*
754_elm_web_webkit_view_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
755{
756#ifdef HAVE_ELEMENTARY_WEB
757 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
758 return wd->resize_obj;
759#else
760 (void)obj;
761 ERR("Elementary not compiled with EWebKit support.");
762 return NULL;
763#endif
764}
765
766EOLIAN static void
767_elm_web_window_create_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Elm_Web_Window_Open func, void *data)
768{
769#ifdef HAVE_ELEMENTARY_WEB
770 sd->hook.window_create = func;
771 sd->hook.window_create_data = data;
772#else
773 (void)sd;
774 (void)func;
775 (void)data;
776#endif
777}
778
779EOLIAN static void
780_elm_web_dialog_alert_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Elm_Web_Dialog_Alert func, void *data)
781{
782#ifdef HAVE_ELEMENTARY_WEB
783 sd->hook.alert = func;
784 sd->hook.alert_data = data;
785#else
786 (void)func;
787 (void)data;
788 (void)sd;
789#endif
790}
791
792EOLIAN static void
793_elm_web_dialog_confirm_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Elm_Web_Dialog_Confirm func, void *data)
794{
795#ifdef HAVE_ELEMENTARY_WEB
796 sd->hook.confirm = func;
797 sd->hook.confirm_data = data;
798#else
799 (void)func;
800 (void)data;
801 (void)sd;
802#endif
803}
804
805EOLIAN static void
806_elm_web_dialog_prompt_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Elm_Web_Dialog_Prompt func, void *data)
807{
808#ifdef HAVE_ELEMENTARY_WEB
809 sd->hook.prompt = func;
810 sd->hook.prompt_data = data;
811#else
812 (void)func;
813 (void)data;
814 (void)sd;
815#endif
816}
817
818EOLIAN static void
819_elm_web_dialog_file_selector_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *_pd EINA_UNUSED, Elm_Web_Dialog_File_Selector func, void *data)
820{
821#ifdef HAVE_ELEMENTARY_WEB
822 (void)func;
823 (void)data;
824 (void)_pd;
825#else
826 (void)func;
827 (void)data;
828 (void)_pd;
829#endif
830}
831
832EOLIAN static void
833_elm_web_console_message_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *_pd EINA_UNUSED, Elm_Web_Console_Message func, void *data)
834{
835#ifdef HAVE_ELEMENTARY_WEB
836 (void)func;
837 (void)data;
838 (void)_pd;
839#else
840 (void)func;
841 (void)data;
842 (void)_pd;
843#endif
844}
845
846EOLIAN static void
847_elm_web_useragent_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, const char *user_agent)
848{
849#ifdef HAVE_ELEMENTARY_WEB
850 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
851
852 ewk_view_user_agent_set(wd->resize_obj, user_agent);
853#else
854 (void)user_agent;
855 (void)obj;
856#endif
857}
858
859EOLIAN static const char*
860_elm_web_useragent_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
861{
862#ifdef HAVE_ELEMENTARY_WEB
863 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
864
865 return ewk_view_user_agent_get(wd->resize_obj);
866#else
867 (void)obj;
868 return NULL;
869#endif
870}
871
872EAPI Eina_Bool 99EAPI Eina_Bool
873elm_web_uri_set(Evas_Object *obj, const char *url) 100elm_web_uri_set(Evas_Object *obj, const char *url)
874{ 101{
875 ELM_WEB_CHECK(obj) EINA_FALSE; 102 ELM_WEB_CHECK(obj) EINA_FALSE;
876 Eina_Bool ret = EINA_FALSE; 103
877 ret = elm_obj_web_url_set(obj, url); 104 return elm_obj_web_url_set(obj, url);
878 return ret;
879} 105}
880 106
881EAPI const char * 107EAPI const char *
882elm_web_uri_get(const Evas_Object *obj) 108elm_web_uri_get(const Evas_Object *obj)
883{ 109{
884 const char *ret = NULL; 110 return elm_obj_web_url_get((Eo *) obj);
885 ret = elm_obj_web_url_get((Eo *) obj);
886 return ret;
887}
888
889EOLIAN static Eina_Bool
890_elm_web_url_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, const char *url)
891{
892#ifdef HAVE_ELEMENTARY_WEB
893 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
894 return ewk_view_url_set(wd->resize_obj, url);
895#else
896 (void)url;
897 (void)obj;
898 return EINA_FALSE;
899#endif
900}
901
902EOLIAN static const char*
903_elm_web_url_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
904{
905#ifdef HAVE_ELEMENTARY_WEB
906 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
907 return ewk_view_url_get(wd->resize_obj);
908#else
909 (void)obj;
910 return NULL;
911#endif
912}
913
914EOLIAN static Eina_Bool
915_elm_web_html_string_load(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, const char *html, const char *base_url, const char *unreachable_url)
916{
917#ifdef HAVE_ELEMENTARY_WEB
918 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
919
920 return ewk_view_html_string_load(wd->resize_obj,
921 html, base_url, unreachable_url);
922#else
923 (void)obj;
924 (void)html;
925 (void)base_url;
926 (void)unreachable_url;
927 return EINA_FALSE;
928#endif
929}
930
931EOLIAN static const char*
932_elm_web_title_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
933{
934#ifdef HAVE_ELEMENTARY_WEB
935 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
936 return ewk_view_title_get(wd->resize_obj);
937#else
938 (void)obj;
939 return NULL;
940#endif
941}
942
943EOLIAN static void
944_elm_web_bg_color_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, int r, int g, int b, int a)
945{
946#ifdef HAVE_ELEMENTARY_WEB
947 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
948
949 ewk_view_bg_color_set(wd->resize_obj, r, g, b, a);
950#else
951 (void)obj;
952 (void)r;
953 (void)g;
954 (void)b;
955 (void)a;
956#endif
957}
958
959EOLIAN static void
960_elm_web_bg_color_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, int *r, int *g, int *b, int *a)
961{
962 if (r) *r = 0;
963 if (g) *g = 0;
964 if (b) *b = 0;
965 if (a) *a = 0;
966
967#ifdef HAVE_ELEMENTARY_WEB
968 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
969
970 ewk_view_bg_color_get(wd->resize_obj, r, g, b, a);
971#else
972 (void)obj;
973#endif
974}
975
976EOLIAN static const char*
977_elm_web_selection_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
978{
979#ifdef HAVE_ELEMENTARY_WEB
980 (void)obj;
981 return NULL;
982#else
983 (void)obj;
984 return NULL;
985#endif
986}
987
988EOLIAN static void
989_elm_web_popup_selected_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, int idx)
990{
991#ifdef HAVE_ELEMENTARY_WEB
992 (void)idx;
993 (void)obj;
994#else
995 (void)idx;
996 (void)obj;
997#endif
998}
999
1000EOLIAN static Eina_Bool
1001_elm_web_popup_destroy(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1002{
1003#ifdef HAVE_ELEMENTARY_WEB
1004 (void)obj;
1005#else
1006 (void)obj;
1007#endif
1008
1009 return EINA_FALSE;
1010}
1011
1012EOLIAN static Eina_Bool
1013_elm_web_text_search(const Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, const char *string, Eina_Bool case_sensitive, Eina_Bool forward, Eina_Bool wrap)
1014{
1015#ifdef HAVE_ELEMENTARY_WEB
1016 (void)string;
1017 (void)case_sensitive;
1018 (void)forward;
1019 (void)wrap;
1020 (void)obj;
1021#else
1022 (void)string;
1023 (void)case_sensitive;
1024 (void)forward;
1025 (void)wrap;
1026 (void)obj;
1027#endif
1028
1029 return EINA_FALSE;
1030}
1031
1032EOLIAN static unsigned int
1033_elm_web_text_matches_mark(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, const char *string, Eina_Bool case_sensitive, Eina_Bool highlight, unsigned int limit)
1034{
1035#ifdef HAVE_ELEMENTARY_WEB
1036 (void)string;
1037 (void)case_sensitive;
1038 (void)highlight;
1039 (void)limit;
1040 (void)obj;
1041#else
1042 (void)string;
1043 (void)case_sensitive;
1044 (void)highlight;
1045 (void)limit;
1046 (void)obj;
1047#endif
1048
1049 return 0;
1050}
1051
1052EOLIAN static Eina_Bool
1053_elm_web_text_matches_unmark_all(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1054{
1055#ifdef HAVE_ELEMENTARY_WEB
1056 (void)obj;
1057#else
1058 (void)obj;
1059#endif
1060
1061 return EINA_FALSE;
1062}
1063
1064EOLIAN static Eina_Bool
1065_elm_web_text_matches_highlight_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, Eina_Bool highlight)
1066{
1067#ifdef HAVE_ELEMENTARY_WEB
1068 (void)obj;
1069 (void)highlight;
1070#else
1071 (void)obj;
1072 (void)highlight;
1073#endif
1074
1075 return EINA_FALSE;
1076}
1077
1078EOLIAN static Eina_Bool
1079_elm_web_text_matches_highlight_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1080{
1081#ifdef HAVE_ELEMENTARY_WEB
1082 (void)obj;
1083#else
1084 (void)obj;
1085#endif
1086
1087 return EINA_FALSE;
1088} 111}
1089 112
1090EOLIAN static double 113// FIXME: override with module function
1091_elm_web_load_progress_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED) 114EAPI void
115elm_web_window_features_ref(Elm_Web_Window_Features *wf)
1092{ 116{
1093 double ret; 117 if (!ewm.window_features_ref) return ;
1094 ret = -1.0; 118 ewm.window_features_ref(wf);
1095
1096#ifdef HAVE_ELEMENTARY_WEB
1097 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, ret);
1098
1099 ret = ewk_view_load_progress_get(wd->resize_obj);
1100#else
1101 (void)obj;
1102#endif
1103
1104 return ret;
1105} 119}
1106 120
1107EOLIAN static Eina_Bool 121EAPI void
1108_elm_web_stop(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED) 122elm_web_window_features_unref(Elm_Web_Window_Features *wf)
1109{ 123{
1110 Eina_Bool ret = EINA_FALSE; 124 if (!ewm.window_features_unref) return ;
1111 125 ewm.window_features_unref(wf);
1112#ifdef HAVE_ELEMENTARY_WEB
1113 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, ret);
1114
1115 ret = ewk_view_stop(wd->resize_obj);
1116#else
1117 (void)obj;
1118#endif
1119
1120 return ret;
1121} 126}
1122 127
1123EOLIAN static Eina_Bool 128EAPI Eina_Bool
1124_elm_web_reload(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED) 129elm_web_window_features_property_get(const Elm_Web_Window_Features *wf,
130 Elm_Web_Window_Feature_Flag flag)
1125{ 131{
1126 Eina_Bool ret = EINA_FALSE; 132 if (!ewm.window_features_property_get) return EINA_FALSE;
1127 133 return ewm.window_features_property_get(wf, flag);
1128#ifdef HAVE_ELEMENTARY_WEB
1129 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, ret);
1130
1131 ret = ewk_view_reload(wd->resize_obj);
1132#else
1133 (void)obj;
1134#endif
1135
1136 return ret;
1137} 134}
1138 135
1139EOLIAN static Eina_Bool 136EAPI void
1140_elm_web_reload_full(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED) 137elm_web_window_features_region_get(const Elm_Web_Window_Features *wf,
138 Evas_Coord *x,
139 Evas_Coord *y,
140 Evas_Coord *w,
141 Evas_Coord *h)
1141{ 142{
1142 Eina_Bool ret = EINA_FALSE; 143 if (x) *x = 0;
1143 144 if (y) *y = 0;
1144#ifdef HAVE_ELEMENTARY_WEB 145 if (w) *w = 0;
1145 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, ret); 146 if (h) *h = 0;
1146
1147 ret = ewk_view_reload_bypass_cache(wd->resize_obj);
1148#else
1149 (void)obj;
1150#endif
1151 147
1152 return ret; 148 if (!ewm.window_features_region_get) return;
149 ewm.window_features_region_get(wf, x, y, w, h);
1153} 150}
1154 151
1155EOLIAN static Eina_Bool 152static void
1156_elm_web_back(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED) 153_elm_web_class_constructor(Eo_Class *klass)
1157{ 154{
1158 Eina_Bool ret = EINA_FALSE; 155 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
1159
1160#ifdef HAVE_ELEMENTARY_WEB
1161 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, ret);
1162
1163 ret = ewk_view_back(wd->resize_obj);
1164#else
1165 (void)obj;
1166#endif
1167
1168 return ret;
1169} 156}
1170 157
1171EOLIAN static Eina_Bool 158#if defined(_WIN32) || defined(__CYGWIN__)
1172_elm_web_forward(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED) 159# define EFL_SHARED_EXTENSION ".dll"
1173{
1174 Eina_Bool ret = EINA_FALSE;
1175
1176#ifdef HAVE_ELEMENTARY_WEB
1177 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1178
1179 ret = ewk_view_forward(wd->resize_obj);
1180#else 160#else
1181 (void)obj; 161# define EFL_SHARED_EXTENSION ".so"
1182#endif 162#endif
1183 163
1184 return ret; 164Eina_Bool
1185} 165_elm_web_init(const char *engine)
1186
1187EOLIAN static Eina_Bool
1188_elm_web_navigate(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, int steps)
1189{ 166{
1190 Eina_Bool ret = EINA_FALSE; 167 char buf[PATH_MAX];
1191 168
1192#ifdef HAVE_ELEMENTARY_WEB 169 if (getenv("ELM_RUN_IN_TREE"))
1193 Ewk_Back_Forward_List *history; 170 snprintf(buf, sizeof(buf),
1194 Ewk_Back_Forward_List_Item *item = NULL; 171 ELM_TOP_BUILD_DIR"/src/modules/web/%s/.libs/module"EFL_SHARED_EXTENSION,
1195 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, ret); 172 engine);
173 else
174 snprintf(buf, sizeof(buf),
175 "%s/elementary/modules/web/%s/%s/module"EFL_SHARED_EXTENSION,
176 _elm_lib_dir, engine, MODULE_ARCH);
1196 177
1197 history = ewk_view_back_forward_list_get(wd->resize_obj); 178 if (ewm.m)
1198 if (history)
1199 { 179 {
1200 item = ewk_back_forward_list_item_at_index_get(history, steps); 180 // Check if the module is already open
1201 if (item) ret = ewk_view_navigate_to(wd->resize_obj, item); 181 if (!strcmp(buf, eina_module_file_get(ewm.m)))
182 return EINA_TRUE;
183
184 // We are leaking reference on purpose here, as we can't be sure that
185 // the web engine is not leaking state around preventing a clean exit.
186 // Only future elm_web object created from now will use the new engine.
187 ewm.unneed_web = NULL;
188 ewm.need_web = NULL;
189 ewm.window_features_ref = NULL;
190 ewm.window_features_unref = NULL;
191 ewm.window_features_property_get = NULL;
192 ewm.window_features_region_get = NULL;
193 ewm.class_get = NULL;
1202 } 194 }
1203#else
1204 (void)steps;
1205 (void)obj;
1206#endif
1207
1208 return ret;
1209}
1210
1211EOLIAN static Eina_Bool
1212_elm_web_back_possible_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1213{
1214 Eina_Bool ret;
1215 ret = EINA_FALSE;
1216
1217#ifdef HAVE_ELEMENTARY_WEB
1218 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, ret);
1219
1220 ret = ewk_view_back_possible(wd->resize_obj);
1221#else
1222 (void)obj;
1223#endif
1224
1225 return ret;
1226}
1227
1228EOLIAN static Eina_Bool
1229_elm_web_forward_possible_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1230{
1231 Eina_Bool ret;
1232 ret = EINA_FALSE;
1233
1234#ifdef HAVE_ELEMENTARY_WEB
1235 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, ret);
1236
1237 ret = ewk_view_forward_possible(wd->resize_obj);
1238#else
1239 (void)obj;
1240#endif
1241
1242 return ret;
1243}
1244
1245EOLIAN static Eina_Bool
1246_elm_web_navigate_possible_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, int steps)
1247{
1248 Eina_Bool ret;
1249 ret = EINA_FALSE;
1250
1251#ifdef HAVE_ELEMENTARY_WEB
1252 Ewk_Back_Forward_List *history;
1253 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, ret);
1254
1255 history = ewk_view_back_forward_list_get(wd->resize_obj);
1256 if (history && ewk_back_forward_list_item_at_index_get(history, steps))
1257 ret = EINA_TRUE;
1258#else
1259 (void)steps;
1260 (void)obj;
1261#endif
1262
1263 return ret;
1264}
1265
1266EOLIAN static Eina_Bool
1267_elm_web_history_enabled_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1268{
1269 Eina_Bool ret;
1270 ret = EINA_FALSE;
1271
1272#ifdef HAVE_ELEMENTARY_WEB
1273 (void)obj;
1274#else
1275 (void)obj;
1276#endif
1277
1278 return ret;
1279}
1280
1281EOLIAN static void
1282_elm_web_history_enabled_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, Eina_Bool enable)
1283{
1284#ifdef HAVE_ELEMENTARY_WEB
1285 (void)enable;
1286 (void)obj;
1287#else
1288 (void)enable;
1289 (void)obj;
1290#endif
1291}
1292
1293EOLIAN static void
1294_elm_web_zoom_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, double zoom)
1295{
1296#ifdef HAVE_ELEMENTARY_WEB
1297 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
1298
1299 ewk_view_page_zoom_set(wd->resize_obj, zoom);
1300#else
1301 (void)obj;
1302 (void)zoom;
1303#endif
1304}
1305
1306EOLIAN static double
1307_elm_web_zoom_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1308{
1309#ifdef HAVE_ELEMENTARY_WEB
1310 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, -1);
1311
1312 return ewk_view_page_zoom_get(wd->resize_obj);
1313#else
1314 (void)obj;
1315 return -1;
1316#endif
1317}
1318
1319EOLIAN static void
1320_elm_web_zoom_mode_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, Elm_Web_Zoom_Mode mode)
1321{
1322#ifdef HAVE_ELEMENTARY_WEB
1323 (void)obj;
1324 (void)_pd;
1325 (void)mode;
1326#else
1327 (void)obj;
1328 (void)_pd;
1329 (void)mode;
1330#endif
1331}
1332
1333EOLIAN static Elm_Web_Zoom_Mode
1334_elm_web_zoom_mode_get(Eo *obj EINA_UNUSED, Elm_Web_Data *_pd EINA_UNUSED)
1335{
1336 Elm_Web_Zoom_Mode ret;
1337 ret = ELM_WEB_ZOOM_MODE_LAST;
1338#ifdef HAVE_ELEMENTARY_WEB
1339 (void)_pd;
1340#else
1341 (void)_pd;
1342#endif
1343
1344 return ret;
1345}
1346
1347EOLIAN static void
1348_elm_web_region_show(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, int x, int y, int w, int h)
1349{
1350 (void)w;
1351 (void)h;
1352
1353#ifdef HAVE_ELEMENTARY_WEB
1354 (void)obj;
1355 (void)_pd;
1356 (void)x;
1357 (void)y;
1358#else
1359 (void)obj;
1360 (void)_pd;
1361 (void)x;
1362 (void)y;
1363#endif
1364}
1365
1366EOLIAN static void
1367_elm_web_region_bring_in(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, int x, int y, int w, int h)
1368{
1369 (void)w;
1370 (void)h;
1371
1372#ifdef HAVE_ELEMENTARY_WEB
1373 (void)obj;
1374 (void)_pd;
1375 (void)x;
1376 (void)y;
1377#else
1378 (void)obj;
1379 (void)_pd;
1380 (void)x;
1381 (void)y;
1382#endif
1383}
1384
1385EOLIAN static void
1386_elm_web_inwin_mode_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Eina_Bool value)
1387{
1388#ifdef HAVE_ELEMENTARY_WEB
1389 sd->inwin_mode = value;
1390#else
1391 (void)sd;
1392 (void)value;
1393#endif
1394}
1395
1396EOLIAN static Eina_Bool
1397_elm_web_inwin_mode_get(Eo *obj EINA_UNUSED, Elm_Web_Data *sd)
1398{
1399#ifdef HAVE_ELEMENTARY_WEB
1400 return sd->inwin_mode;
1401#else
1402 (void)sd;
1403 return EINA_FALSE;
1404#endif
1405}
1406
1407EAPI void
1408elm_web_window_features_ref(Elm_Web_Window_Features *wf)
1409{
1410#ifdef HAVE_ELEMENTARY_WEB
1411 ewk_object_ref((Ewk_Object *)wf);
1412#else
1413 (void)wf;
1414#endif
1415}
1416 195
1417EAPI void 196 ewm.m = eina_module_new(buf);
1418elm_web_window_features_unref(Elm_Web_Window_Features *wf) 197 if (!ewm.m) return EINA_FALSE;
1419{
1420#ifdef HAVE_ELEMENTARY_WEB
1421 ewk_object_unref((Ewk_Object *)wf);
1422#else
1423 (void)wf;
1424#endif
1425}
1426 198
1427EAPI Eina_Bool 199 if (!eina_module_load(ewm.m))
1428elm_web_window_features_property_get(const Elm_Web_Window_Features *wf,
1429 Elm_Web_Window_Feature_Flag flag)
1430{
1431#ifdef HAVE_ELEMENTARY_WEB
1432 const Ewk_Window_Features *ewf = (const Ewk_Window_Features *)wf;
1433 switch (flag)
1434 { 200 {
1435 case ELM_WEB_WINDOW_FEATURE_TOOLBAR: 201 eina_module_free(ewm.m);
1436 return ewk_window_features_toolbar_visible_get(ewf); 202 ewm.m = NULL;
1437 203 return EINA_FALSE;
1438 case ELM_WEB_WINDOW_FEATURE_STATUSBAR:
1439 return ewk_window_features_statusbar_visible_get(ewf);
1440
1441 case ELM_WEB_WINDOW_FEATURE_SCROLLBARS:
1442 return ewk_window_features_scrollbars_visible_get(ewf);
1443
1444 case ELM_WEB_WINDOW_FEATURE_MENUBAR:
1445 return ewk_window_features_menubar_visible_get(ewf);
1446
1447 case ELM_WEB_WINDOW_FEATURE_LOCATIONBAR:
1448 return ewk_window_features_locationbar_visible_get(ewf);
1449
1450 case ELM_WEB_WINDOW_FEATURE_FULLSCREEN:
1451 return ewk_window_features_fullscreen_get(ewf);
1452 } 204 }
1453#else
1454 (void)wf;
1455 (void)flag;
1456#endif
1457 205
1458 return EINA_FALSE; 206 ewm.unneed_web = eina_module_symbol_get(ewm.m, "ewm_unneed_web");
1459} 207 ewm.need_web = eina_module_symbol_get(ewm.m, "ewm_need_web");
208 ewm.window_features_ref = eina_module_symbol_get(ewm.m, "ewm_window_features_ref");
209 ewm.window_features_unref = eina_module_symbol_get(ewm.m, "ewm_window_features_unref");
210 ewm.window_features_property_get = eina_module_symbol_get(ewm.m, "ewm_window_features_property_get");
211 ewm.window_features_region_get = eina_module_symbol_get(ewm.m, "ewm_window_features_region_get");
212 ewm.class_get = eina_module_symbol_get(ewm.m, "ewm_class_get");
1460 213
1461EAPI void 214 // Only the class_get is mandatory
1462elm_web_window_features_region_get(const Elm_Web_Window_Features *wf, 215 if (!ewm.class_get) return EINA_FALSE;
1463 Evas_Coord *x, 216 return EINA_TRUE;
1464 Evas_Coord *y,
1465 Evas_Coord *w,
1466 Evas_Coord *h)
1467{
1468#ifdef HAVE_ELEMENTARY_WEB
1469 ewk_window_features_geometry_get
1470 ((const Ewk_Window_Features *)wf, x, y, w, h);
1471#else
1472 (void)wf;
1473 (void)x;
1474 (void)y;
1475 (void)w;
1476 (void)h;
1477#endif
1478}
1479
1480static void
1481_elm_web_class_constructor(Eo_Class *klass)
1482{
1483 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
1484} 217}
1485 218
1486#include "elm_web.eo.c" 219#include "elm_web.eo.c"
diff --git a/src/lib/elm_widget_web.h b/src/lib/elm_widget_web.h
index 6eceacd41..f71617e07 100644
--- a/src/lib/elm_widget_web.h
+++ b/src/lib/elm_widget_web.h
@@ -1,10 +1,6 @@
1#ifndef ELM_WIDGET_WEB_H 1#ifndef ELM_WIDGET_WEB_H
2#define ELM_WIDGET_WEB_H 2#define ELM_WIDGET_WEB_H
3 3
4#ifdef HAVE_ELEMENTARY_WEB
5#include <EWebKit2.h>
6#endif
7
8/* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR 4/* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR
9 * CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT 5 * CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT
10 * FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK 6 * FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK
@@ -29,70 +25,6 @@ typedef struct _Elm_Web_Data Elm_Web_Data;
29struct _Elm_Web_Data 25struct _Elm_Web_Data
30{ 26{
31 Evas_Object *obj; 27 Evas_Object *obj;
32#ifdef HAVE_ELEMENTARY_WEB
33 struct
34 {
35 Elm_Web_Window_Open window_create;
36 void *window_create_data;
37 Elm_Web_Dialog_Alert alert;
38 void *alert_data;
39 Elm_Web_Dialog_Confirm confirm;
40 void *confirm_data;
41 Elm_Web_Dialog_Prompt prompt;
42 void *prompt_data;
43 Elm_Web_Dialog_File_Selector file_selector;
44 void *file_selector_data;
45 Elm_Web_Console_Message console_message;
46 void *console_message_data;
47 } hook;
48
49 Elm_Win_Keyboard_Mode input_method;
50
51 struct
52 {
53 Elm_Web_Zoom_Mode mode;
54 float current;
55 float min, max;
56 Eina_Bool no_anim;
57 Ecore_Timer *timer;
58 } zoom;
59
60 struct
61 {
62 struct
63 {
64 int x, y;
65 } start, end;
66 Ecore_Animator *animator;
67 } bring_in;
68
69 Eina_Bool tab_propagate : 1;
70 Eina_Bool inwin_mode : 1;
71#endif
72};
73
74enum Dialog_Type
75{
76 DIALOG_ALERT,
77 DIALOG_CONFIRM,
78 DIALOG_PROMPT,
79 DIALOG_FILE_SELECTOR
80};
81
82typedef struct _Dialog_Data Dialog_Data;
83struct _Dialog_Data
84{
85 enum Dialog_Type type;
86
87 Evas_Object *dialog;
88 Evas_Object *box;
89 Evas_Object *bt_ok, *bt_cancel;
90 Evas_Object *entry;
91 Evas_Object *file_sel;
92
93 Eina_Bool *response;
94 const char **entry_value;
95 Eina_List **selected_files;
96}; 28};
97 29
98struct _Elm_Web_Callback_Proxy_Context 30struct _Elm_Web_Callback_Proxy_Context
@@ -102,24 +34,6 @@ struct _Elm_Web_Callback_Proxy_Context
102}; 34};
103typedef struct _Elm_Web_Callback_Proxy_Context Elm_Web_Callback_Proxy_Context; 35typedef struct _Elm_Web_Callback_Proxy_Context Elm_Web_Callback_Proxy_Context;
104 36
105#ifdef HAVE_ELEMENTARY_WEB
106
107typedef struct _View_Smart_Data View_Smart_Data;
108struct _View_Smart_Data
109{
110 Ewk_View_Smart_Data base;
111 struct
112 {
113 Evas_Event_Mouse_Down event;
114 Evas_Coord x, y;
115 unsigned int move_count;
116 Ecore_Timer *longpress_timer;
117 Ecore_Animator *pan_anim;
118 } mouse;
119};
120
121#endif
122
123/** 37/**
124 * @} 38 * @}
125 */ 39 */
diff --git a/src/modules/Makefile.am b/src/modules/Makefile.am
index 00fbcc05c..8ad4392db 100644
--- a/src/modules/Makefile.am
+++ b/src/modules/Makefile.am
@@ -6,4 +6,5 @@ prefs \
6test_entry \ 6test_entry \
7test_map \ 7test_map \
8access_output \ 8access_output \
9datetime_input_ctxpopup 9datetime_input_ctxpopup \
10web
diff --git a/src/modules/web/Makefile.am b/src/modules/web/Makefile.am
new file mode 100644
index 000000000..9b7287b74
--- /dev/null
+++ b/src/modules/web/Makefile.am
@@ -0,0 +1,6 @@
1AUTOMAKE_OPTIONS = 1.4 foreign
2MAINTAINERCLEANFILES = Makefile.in
3
4SUBDIRS = \
5none \
6webkit2
diff --git a/src/modules/web/none/Makefile.am b/src/modules/web/none/Makefile.am
new file mode 100644
index 000000000..f3a0f11dd
--- /dev/null
+++ b/src/modules/web/none/Makefile.am
@@ -0,0 +1,40 @@
1AUTOMAKE_OPTIONS = 1.4 foreign
2MAINTAINERCLEANFILES = Makefile.in
3
4CLEANFILES =
5
6EOLIAN_FLAGS = @DEPS_EOLIAN_FLAGS@ \
7 -I$(top_srcdir)/src/lib
8
9include $(top_srcdir)/Makefile_Eolian_Helper.am
10
11AM_CPPFLAGS = \
12-DELM_INTERNAL_API_ARGESFSDFEFC=1 \
13-DMODULES_PATH=\"$(pkglibdir)/modules\" \
14-I. \
15-I$(top_builddir) \
16-I$(top_srcdir) \
17-I$(top_srcdir)/src/imported \
18-I$(top_srcdir)/src/lib \
19-I$(top_builddir)/src/lib \
20-DPACKAGE_DATA_DIR=\"$(pkgdatadir)\" \
21-DLOCALE_DIR=\"$(localedir)\" \
22-DPACKAGE_LIB_DIR=\"$(libdir)\" \
23-DICON_DIR=\"$(datadir)/icons\" \
24-DELM_TOP_BUILD_DIR=\"$(top_builddir)\" \
25-DELEMENTARY_BUILD \
26@ELEMENTARY_CFLAGS@
27
28pkgdir = $(pkglibdir)/modules/web/none/$(MODULE_ARCH)
29pkg_LTLIBRARIES = module.la
30
31BUILT_SOURCES = elm_web_none.eo.h elm_web_none.eo.c
32
33module_la_SOURCES = elm_web_none.c elm_web_none.eo.h
34module_la_LIBADD = @ELEMENTARY_LIBS@ $(top_builddir)/src/lib/libelementary.la
35module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
36module_la_LIBTOOLFLAGS = --tag=disable-static
37
38EXTRA_DIST = elm_web_none.eo
39
40
diff --git a/src/modules/web/none/elm_web_none.c b/src/modules/web/none/elm_web_none.c
new file mode 100644
index 000000000..eed6296bc
--- /dev/null
+++ b/src/modules/web/none/elm_web_none.c
@@ -0,0 +1,341 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
6
7#include <Elementary.h>
8
9#include "elm_priv.h"
10#include "elm_widget_web.h"
11#include "elm_web_none.eo.h"
12
13#define MY_CLASS ELM_WEB_CLASS
14
15#define MY_CLASS_NAME "Elm_Web_None"
16
17typedef struct _Elm_Web_None_Data Elm_Web_None_Data;
18struct _Elm_Web_None_Data
19{
20};
21
22EOLIAN static Eina_Bool
23_elm_web_none_elm_web_tab_propagate_get(Eo *obj EINA_UNUSED, Elm_Web_None_Data *sd EINA_UNUSED)
24{
25 return EINA_FALSE;
26}
27
28EOLIAN static void
29_elm_web_none_elm_web_tab_propagate_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *sd EINA_UNUSED, Eina_Bool propagate EINA_UNUSED)
30{
31}
32
33EOLIAN static void
34_elm_web_none_evas_object_smart_add(Eo *obj, Elm_Web_None_Data *_pd EINA_UNUSED)
35{
36 Evas_Object *resize_obj;
37
38 resize_obj = elm_label_add(obj);
39 elm_object_text_set(resize_obj, "WebKit not supported!");
40 elm_widget_resize_object_set(obj, resize_obj, EINA_TRUE);
41
42 evas_obj_smart_add(eo_super(obj, MY_CLASS));
43 elm_widget_sub_object_parent_add(obj);
44}
45
46EOLIAN static Evas_Object*
47_elm_web_none_elm_web_webkit_view_get(Eo *obj, Elm_Web_None_Data *_pd EINA_UNUSED)
48{
49 (void)obj;
50 ERR("Elementary not compiled with EWebKit support.");
51 return NULL;
52}
53
54EOLIAN static void
55_elm_web_none_elm_web_window_create_hook_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *sd EINA_UNUSED, Elm_Web_Window_Open func EINA_UNUSED, void *data EINA_UNUSED)
56{
57}
58
59EOLIAN static void
60_elm_web_none_elm_web_dialog_alert_hook_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *sd EINA_UNUSED, Elm_Web_Dialog_Alert func EINA_UNUSED, void *data EINA_UNUSED)
61{
62}
63
64EOLIAN static void
65_elm_web_none_elm_web_dialog_confirm_hook_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *sd EINA_UNUSED, Elm_Web_Dialog_Confirm func EINA_UNUSED, void *data EINA_UNUSED)
66{
67}
68
69EOLIAN static void
70_elm_web_none_elm_web_dialog_prompt_hook_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *sd EINA_UNUSED, Elm_Web_Dialog_Prompt func EINA_UNUSED, void *data EINA_UNUSED)
71{
72}
73
74EOLIAN static void
75_elm_web_none_elm_web_dialog_file_selector_hook_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, Elm_Web_Dialog_File_Selector func EINA_UNUSED, void *data EINA_UNUSED)
76{
77}
78
79EOLIAN static void
80_elm_web_none_elm_web_console_message_hook_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, Elm_Web_Console_Message func EINA_UNUSED, void *data EINA_UNUSED)
81{
82}
83
84EOLIAN static void
85_elm_web_none_elm_web_useragent_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, const char *user_agent EINA_UNUSED)
86{
87}
88
89EOLIAN static const char*
90_elm_web_none_elm_web_useragent_get(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
91{
92 return NULL;
93}
94
95EOLIAN static Eina_Bool
96_elm_web_none_elm_web_url_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, const char *url EINA_UNUSED)
97{
98 return EINA_FALSE;
99}
100
101EOLIAN static const char*
102_elm_web_none_elm_web_url_get(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
103{
104 return NULL;
105}
106
107EOLIAN static Eina_Bool
108_elm_web_none_elm_web_html_string_load(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, const char *html EINA_UNUSED, const char *base_url EINA_UNUSED, const char *unreachable_url EINA_UNUSED)
109{
110 return EINA_FALSE;
111}
112
113EOLIAN static const char*
114_elm_web_none_elm_web_title_get(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
115{
116 return NULL;
117}
118
119EOLIAN static void
120_elm_web_none_elm_web_bg_color_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, int r EINA_UNUSED, int g EINA_UNUSED, int b EINA_UNUSED, int a EINA_UNUSED)
121{
122}
123
124EOLIAN static void
125_elm_web_none_elm_web_bg_color_get(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, int *r, int *g, int *b, int *a)
126{
127 if (r) *r = 0;
128 if (g) *g = 0;
129 if (b) *b = 0;
130 if (a) *a = 0;
131}
132
133EOLIAN static const char*
134_elm_web_none_elm_web_selection_get(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
135{
136 return NULL;
137}
138
139EOLIAN static void
140_elm_web_none_elm_web_popup_selected_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, int idx EINA_UNUSED)
141{
142}
143
144EOLIAN static Eina_Bool
145_elm_web_none_elm_web_popup_destroy(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
146{
147 return EINA_FALSE;
148}
149
150EOLIAN static Eina_Bool
151_elm_web_none_elm_web_text_search(const Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, const char *string EINA_UNUSED, Eina_Bool case_sensitive EINA_UNUSED, Eina_Bool forward EINA_UNUSED, Eina_Bool wrap EINA_UNUSED)
152{
153 return EINA_FALSE;
154}
155
156EOLIAN static unsigned int
157_elm_web_none_elm_web_text_matches_mark(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, const char *string EINA_UNUSED, Eina_Bool case_sensitive EINA_UNUSED, Eina_Bool highlight EINA_UNUSED, unsigned int limit EINA_UNUSED)
158{
159 return 0;
160}
161
162EOLIAN static Eina_Bool
163_elm_web_none_elm_web_text_matches_unmark_all(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
164{
165 return EINA_FALSE;
166}
167
168EOLIAN static Eina_Bool
169_elm_web_none_elm_web_text_matches_highlight_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, Eina_Bool highlight EINA_UNUSED)
170{
171 return EINA_FALSE;
172}
173
174EOLIAN static Eina_Bool
175_elm_web_none_elm_web_text_matches_highlight_get(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
176{
177 return EINA_FALSE;
178}
179
180EOLIAN static double
181_elm_web_none_elm_web_load_progress_get(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
182{
183 return -1.0;
184}
185
186EOLIAN static Eina_Bool
187_elm_web_none_elm_web_stop(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
188{
189 return EINA_FALSE;
190}
191
192EOLIAN static Eina_Bool
193_elm_web_none_elm_web_reload(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
194{
195 return EINA_FALSE;
196}
197
198EOLIAN static Eina_Bool
199_elm_web_none_elm_web_reload_full(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
200{
201 return EINA_FALSE;
202}
203
204EOLIAN static Eina_Bool
205_elm_web_none_elm_web_back(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
206{
207 return EINA_FALSE;
208}
209
210EOLIAN static Eina_Bool
211_elm_web_none_elm_web_forward(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
212{
213 return EINA_FALSE;
214}
215
216EOLIAN static Eina_Bool
217_elm_web_none_elm_web_navigate(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, int steps EINA_UNUSED)
218{
219 return EINA_FALSE;
220}
221
222EOLIAN static Eina_Bool
223_elm_web_none_elm_web_back_possible_get(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
224{
225 return EINA_FALSE;
226}
227
228EOLIAN static Eina_Bool
229_elm_web_none_elm_web_forward_possible_get(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
230{
231 return EINA_FALSE;
232}
233
234EOLIAN static Eina_Bool
235_elm_web_none_elm_web_navigate_possible_get(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, int steps EINA_UNUSED)
236{
237 return EINA_FALSE;
238}
239
240EOLIAN static Eina_Bool
241_elm_web_none_elm_web_history_enabled_get(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
242{
243 return EINA_FALSE;
244}
245
246EOLIAN static void
247_elm_web_none_elm_web_history_enabled_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, Eina_Bool enable EINA_UNUSED)
248{
249}
250
251EOLIAN static void
252_elm_web_none_elm_web_zoom_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, double zoom EINA_UNUSED)
253{
254}
255
256EOLIAN static double
257_elm_web_none_elm_web_zoom_get(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
258{
259 return -1;
260}
261
262EOLIAN static void
263_elm_web_none_elm_web_zoom_mode_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, Elm_Web_Zoom_Mode mode EINA_UNUSED)
264{
265}
266
267EOLIAN static Elm_Web_Zoom_Mode
268_elm_web_none_elm_web_zoom_mode_get(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED)
269{
270 return ELM_WEB_ZOOM_MODE_LAST;
271}
272
273EOLIAN static void
274_elm_web_none_elm_web_region_show(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, int x EINA_UNUSED, int y EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED)
275{
276}
277
278EOLIAN static void
279_elm_web_none_elm_web_region_bring_in(Eo *obj EINA_UNUSED, Elm_Web_None_Data *_pd EINA_UNUSED, int x EINA_UNUSED, int y EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED)
280{
281}
282
283EOLIAN static void
284_elm_web_none_elm_web_inwin_mode_set(Eo *obj EINA_UNUSED, Elm_Web_None_Data *sd EINA_UNUSED, Eina_Bool value EINA_UNUSED)
285{
286}
287
288EOLIAN static Eina_Bool
289_elm_web_none_elm_web_inwin_mode_get(Eo *obj EINA_UNUSED, Elm_Web_None_Data *sd EINA_UNUSED)
290{
291 return EINA_FALSE;
292}
293
294EAPI void
295ewm_window_features_ref(Elm_Web_Window_Features *wf EINA_UNUSED)
296{
297}
298
299EAPI void
300ewm_window_features_unref(Elm_Web_Window_Features *wf EINA_UNUSED)
301{
302}
303
304EAPI Eina_Bool
305ewm_window_features_property_get(const Elm_Web_Window_Features *wf EINA_UNUSED,
306 Elm_Web_Window_Feature_Flag flag EINA_UNUSED)
307{
308 return EINA_FALSE;
309}
310
311EAPI void
312ewm_window_features_region_get(const Elm_Web_Window_Features *wf EINA_UNUSED,
313 Evas_Coord *x,
314 Evas_Coord *y,
315 Evas_Coord *w,
316 Evas_Coord *h)
317{
318 if (x) *x = 0;
319 if (y) *y = 0;
320 if (w) *w = 0;
321 if (h) *h = 0;
322}
323
324EAPI void
325ewm_unneed_web(void)
326{
327}
328
329EAPI Eina_Bool
330ewm_need_web(void)
331{
332 return EINA_TRUE;
333}
334
335EAPI const Eo_Class *
336ewm_class_get(void)
337{
338 return elm_web_none_class_get();
339}
340
341#include "elm_web_none.eo.c"
diff --git a/src/modules/web/none/elm_web_none.eo b/src/modules/web/none/elm_web_none.eo
new file mode 100644
index 000000000..505665048
--- /dev/null
+++ b/src/modules/web/none/elm_web_none.eo
@@ -0,0 +1,54 @@
1class Elm.Web.None (Elm.Web)
2{
3 implements {
4 Evas.Object_Smart.add;
5 Elm.Widget.theme_apply;
6 Elm.Widget.on_focus;
7 Elm.Widget.event;
8 Elm.Web.tab_propagate.get;
9 Elm.Web.tab_propagate.set;
10 Elm.Web.webkit_view.get;
11 Elm.Web.window_create_hook.set;
12 Elm.Web.dialog_alert_hook.set;
13 Elm.Web.dialog_confirm_hook.set;
14 Elm.Web.dialog_prompt_hook.set;
15 Elm.Web.dialog_file_selector_hook.set;
16 Elm.Web.console_message_hook.set;
17 Elm.Web.useragent.set;
18 Elm.Web.useragent.get;
19 Elm.Web.url.set;
20 Elm.Web.url.get;
21 Elm.Web.html_string_load;
22 Elm.Web.title.get;
23 Elm.Web.bg_color.set;
24 Elm.Web.bg_color.get;
25 Elm.Web.selection.get;
26 Elm.Web.popup_selected.set;
27 Elm.Web.popup_destroy;
28 Elm.Web.text_search;
29 Elm.Web.text_matches_mark;
30 Elm.Web.text_matches_unmark_all;
31 Elm.Web.text_matches_highlight.set;
32 Elm.Web.text_matches_highlight.get;
33 Elm.Web.load_progress.get;
34 Elm.Web.stop;
35 Elm.Web.reload;
36 Elm.Web.reload_full;
37 Elm.Web.back;
38 Elm.Web.forward;
39 Elm.Web.navigate;
40 Elm.Web.back_possible.get;
41 Elm.Web.forward_possible.get;
42 Elm.Web.navigate_possible_get;
43 Elm.Web.history_enabled.get;
44 Elm.Web.history_enabled.set;
45 Elm.Web.zoom.set;
46 Elm.Web.zoom.get;
47 Elm.Web.zoom_mode.set;
48 Elm.Web.zoom_mode.get;
49 Elm.Web.region_show;
50 Elm.Web.region_bring_in;
51 Elm.Web.inwin_mode.set;
52 Elm.Web.inwin_mode.get;
53 }
54}
diff --git a/src/modules/web/none/elm_web_none.eo.c b/src/modules/web/none/elm_web_none.eo.c
new file mode 100644
index 000000000..723bf5768
--- /dev/null
+++ b/src/modules/web/none/elm_web_none.eo.c
@@ -0,0 +1,212 @@
1
2void _elm_web_none_evas_object_smart_add(Eo *obj, Elm_Web_None_Data *pd);
3
4
5Eina_Bool _elm_web_none_elm_widget_theme_apply(Eo *obj, Elm_Web_None_Data *pd);
6
7
8Eina_Bool _elm_web_none_elm_widget_on_focus(Eo *obj, Elm_Web_None_Data *pd, Elm_Widget_Item *item);
9
10
11Eina_Bool _elm_web_none_elm_widget_event(Eo *obj, Elm_Web_None_Data *pd, Evas_Object *source, Evas_Callback_Type type, void *event_info);
12
13
14Eina_Bool _elm_web_none_elm_web_tab_propagate_get(Eo *obj, Elm_Web_None_Data *pd);
15
16
17void _elm_web_none_elm_web_tab_propagate_set(Eo *obj, Elm_Web_None_Data *pd, Eina_Bool propagate);
18
19
20Evas_Object * _elm_web_none_elm_web_webkit_view_get(Eo *obj, Elm_Web_None_Data *pd);
21
22
23void _elm_web_none_elm_web_window_create_hook_set(Eo *obj, Elm_Web_None_Data *pd, Elm_Web_Window_Open func, void *data);
24
25
26void _elm_web_none_elm_web_dialog_alert_hook_set(Eo *obj, Elm_Web_None_Data *pd, Elm_Web_Dialog_Alert func, void *data);
27
28
29void _elm_web_none_elm_web_dialog_confirm_hook_set(Eo *obj, Elm_Web_None_Data *pd, Elm_Web_Dialog_Confirm func, void *data);
30
31
32void _elm_web_none_elm_web_dialog_prompt_hook_set(Eo *obj, Elm_Web_None_Data *pd, Elm_Web_Dialog_Prompt func, void *data);
33
34
35void _elm_web_none_elm_web_dialog_file_selector_hook_set(Eo *obj, Elm_Web_None_Data *pd, Elm_Web_Dialog_File_Selector func, void *data);
36
37
38void _elm_web_none_elm_web_console_message_hook_set(Eo *obj, Elm_Web_None_Data *pd, Elm_Web_Console_Message func, void *data);
39
40
41void _elm_web_none_elm_web_useragent_set(Eo *obj, Elm_Web_None_Data *pd, const char *user_agent);
42
43
44const char * _elm_web_none_elm_web_useragent_get(Eo *obj, Elm_Web_None_Data *pd);
45
46
47Eina_Bool _elm_web_none_elm_web_url_set(Eo *obj, Elm_Web_None_Data *pd, const char *url);
48
49
50const char * _elm_web_none_elm_web_url_get(Eo *obj, Elm_Web_None_Data *pd);
51
52
53Eina_Bool _elm_web_none_elm_web_html_string_load(Eo *obj, Elm_Web_None_Data *pd, const char *html, const char *base_url, const char *unreachable_url);
54
55
56const char * _elm_web_none_elm_web_title_get(Eo *obj, Elm_Web_None_Data *pd);
57
58
59void _elm_web_none_elm_web_bg_color_set(Eo *obj, Elm_Web_None_Data *pd, int r, int g, int b, int a);
60
61
62void _elm_web_none_elm_web_bg_color_get(Eo *obj, Elm_Web_None_Data *pd, int *r, int *g, int *b, int *a);
63
64
65const char * _elm_web_none_elm_web_selection_get(Eo *obj, Elm_Web_None_Data *pd);
66
67
68void _elm_web_none_elm_web_popup_selected_set(Eo *obj, Elm_Web_None_Data *pd, int idx);
69
70
71Eina_Bool _elm_web_none_elm_web_popup_destroy(Eo *obj, Elm_Web_None_Data *pd);
72
73
74Eina_Bool _elm_web_none_elm_web_text_search(const Eo *obj, Elm_Web_None_Data *pd, const char *string, Eina_Bool case_sensitive, Eina_Bool forward, Eina_Bool wrap);
75
76
77unsigned int _elm_web_none_elm_web_text_matches_mark(Eo *obj, Elm_Web_None_Data *pd, const char *string, Eina_Bool case_sensitive, Eina_Bool highlight, unsigned int limit);
78
79
80Eina_Bool _elm_web_none_elm_web_text_matches_unmark_all(Eo *obj, Elm_Web_None_Data *pd);
81
82
83Eina_Bool _elm_web_none_elm_web_text_matches_highlight_set(Eo *obj, Elm_Web_None_Data *pd, Eina_Bool highlight);
84
85
86Eina_Bool _elm_web_none_elm_web_text_matches_highlight_get(Eo *obj, Elm_Web_None_Data *pd);
87
88
89double _elm_web_none_elm_web_load_progress_get(Eo *obj, Elm_Web_None_Data *pd);
90
91
92Eina_Bool _elm_web_none_elm_web_stop(Eo *obj, Elm_Web_None_Data *pd);
93
94
95Eina_Bool _elm_web_none_elm_web_reload(Eo *obj, Elm_Web_None_Data *pd);
96
97
98Eina_Bool _elm_web_none_elm_web_reload_full(Eo *obj, Elm_Web_None_Data *pd);
99
100
101Eina_Bool _elm_web_none_elm_web_back(Eo *obj, Elm_Web_None_Data *pd);
102
103
104Eina_Bool _elm_web_none_elm_web_forward(Eo *obj, Elm_Web_None_Data *pd);
105
106
107Eina_Bool _elm_web_none_elm_web_navigate(Eo *obj, Elm_Web_None_Data *pd, int steps);
108
109
110Eina_Bool _elm_web_none_elm_web_back_possible_get(Eo *obj, Elm_Web_None_Data *pd);
111
112
113Eina_Bool _elm_web_none_elm_web_forward_possible_get(Eo *obj, Elm_Web_None_Data *pd);
114
115
116Eina_Bool _elm_web_none_elm_web_navigate_possible_get(Eo *obj, Elm_Web_None_Data *pd, int steps);
117
118
119Eina_Bool _elm_web_none_elm_web_history_enabled_get(Eo *obj, Elm_Web_None_Data *pd);
120
121
122void _elm_web_none_elm_web_history_enabled_set(Eo *obj, Elm_Web_None_Data *pd, Eina_Bool enable);
123
124
125void _elm_web_none_elm_web_zoom_set(Eo *obj, Elm_Web_None_Data *pd, double zoom);
126
127
128double _elm_web_none_elm_web_zoom_get(Eo *obj, Elm_Web_None_Data *pd);
129
130
131void _elm_web_none_elm_web_zoom_mode_set(Eo *obj, Elm_Web_None_Data *pd, Elm_Web_Zoom_Mode mode);
132
133
134Elm_Web_Zoom_Mode _elm_web_none_elm_web_zoom_mode_get(Eo *obj, Elm_Web_None_Data *pd);
135
136
137void _elm_web_none_elm_web_region_show(Eo *obj, Elm_Web_None_Data *pd, int x, int y, int w, int h);
138
139
140void _elm_web_none_elm_web_region_bring_in(Eo *obj, Elm_Web_None_Data *pd, int x, int y, int w, int h);
141
142
143void _elm_web_none_elm_web_inwin_mode_set(Eo *obj, Elm_Web_None_Data *pd, Eina_Bool value);
144
145
146Eina_Bool _elm_web_none_elm_web_inwin_mode_get(Eo *obj, Elm_Web_None_Data *pd);
147
148
149static const Eo_Op_Description _elm_web_none_op_desc[] = {
150 EO_OP_FUNC_OVERRIDE(evas_obj_smart_add, _elm_web_none_evas_object_smart_add),
151 EO_OP_FUNC_OVERRIDE(elm_obj_widget_theme_apply, _elm_web_none_elm_widget_theme_apply),
152 EO_OP_FUNC_OVERRIDE(elm_obj_widget_on_focus, _elm_web_none_elm_widget_on_focus),
153 EO_OP_FUNC_OVERRIDE(elm_obj_widget_event, _elm_web_none_elm_widget_event),
154 EO_OP_FUNC_OVERRIDE(elm_obj_web_tab_propagate_get, _elm_web_none_elm_web_tab_propagate_get),
155 EO_OP_FUNC_OVERRIDE(elm_obj_web_tab_propagate_set, _elm_web_none_elm_web_tab_propagate_set),
156 EO_OP_FUNC_OVERRIDE(elm_obj_web_webkit_view_get, _elm_web_none_elm_web_webkit_view_get),
157 EO_OP_FUNC_OVERRIDE(elm_obj_web_window_create_hook_set, _elm_web_none_elm_web_window_create_hook_set),
158 EO_OP_FUNC_OVERRIDE(elm_obj_web_dialog_alert_hook_set, _elm_web_none_elm_web_dialog_alert_hook_set),
159 EO_OP_FUNC_OVERRIDE(elm_obj_web_dialog_confirm_hook_set, _elm_web_none_elm_web_dialog_confirm_hook_set),
160 EO_OP_FUNC_OVERRIDE(elm_obj_web_dialog_prompt_hook_set, _elm_web_none_elm_web_dialog_prompt_hook_set),
161 EO_OP_FUNC_OVERRIDE(elm_obj_web_dialog_file_selector_hook_set, _elm_web_none_elm_web_dialog_file_selector_hook_set),
162 EO_OP_FUNC_OVERRIDE(elm_obj_web_console_message_hook_set, _elm_web_none_elm_web_console_message_hook_set),
163 EO_OP_FUNC_OVERRIDE(elm_obj_web_useragent_set, _elm_web_none_elm_web_useragent_set),
164 EO_OP_FUNC_OVERRIDE(elm_obj_web_useragent_get, _elm_web_none_elm_web_useragent_get),
165 EO_OP_FUNC_OVERRIDE(elm_obj_web_url_set, _elm_web_none_elm_web_url_set),
166 EO_OP_FUNC_OVERRIDE(elm_obj_web_url_get, _elm_web_none_elm_web_url_get),
167 EO_OP_FUNC_OVERRIDE(elm_obj_web_html_string_load, _elm_web_none_elm_web_html_string_load),
168 EO_OP_FUNC_OVERRIDE(elm_obj_web_title_get, _elm_web_none_elm_web_title_get),
169 EO_OP_FUNC_OVERRIDE(elm_obj_web_bg_color_set, _elm_web_none_elm_web_bg_color_set),
170 EO_OP_FUNC_OVERRIDE(elm_obj_web_bg_color_get, _elm_web_none_elm_web_bg_color_get),
171 EO_OP_FUNC_OVERRIDE(elm_obj_web_selection_get, _elm_web_none_elm_web_selection_get),
172 EO_OP_FUNC_OVERRIDE(elm_obj_web_popup_selected_set, _elm_web_none_elm_web_popup_selected_set),
173 EO_OP_FUNC_OVERRIDE(elm_obj_web_popup_destroy, _elm_web_none_elm_web_popup_destroy),
174 EO_OP_FUNC_OVERRIDE(elm_obj_web_text_search, _elm_web_none_elm_web_text_search),
175 EO_OP_FUNC_OVERRIDE(elm_obj_web_text_matches_mark, _elm_web_none_elm_web_text_matches_mark),
176 EO_OP_FUNC_OVERRIDE(elm_obj_web_text_matches_unmark_all, _elm_web_none_elm_web_text_matches_unmark_all),
177 EO_OP_FUNC_OVERRIDE(elm_obj_web_text_matches_highlight_set, _elm_web_none_elm_web_text_matches_highlight_set),
178 EO_OP_FUNC_OVERRIDE(elm_obj_web_text_matches_highlight_get, _elm_web_none_elm_web_text_matches_highlight_get),
179 EO_OP_FUNC_OVERRIDE(elm_obj_web_load_progress_get, _elm_web_none_elm_web_load_progress_get),
180 EO_OP_FUNC_OVERRIDE(elm_obj_web_stop, _elm_web_none_elm_web_stop),
181 EO_OP_FUNC_OVERRIDE(elm_obj_web_reload, _elm_web_none_elm_web_reload),
182 EO_OP_FUNC_OVERRIDE(elm_obj_web_reload_full, _elm_web_none_elm_web_reload_full),
183 EO_OP_FUNC_OVERRIDE(elm_obj_web_back, _elm_web_none_elm_web_back),
184 EO_OP_FUNC_OVERRIDE(elm_obj_web_forward, _elm_web_none_elm_web_forward),
185 EO_OP_FUNC_OVERRIDE(elm_obj_web_navigate, _elm_web_none_elm_web_navigate),
186 EO_OP_FUNC_OVERRIDE(elm_obj_web_back_possible_get, _elm_web_none_elm_web_back_possible_get),
187 EO_OP_FUNC_OVERRIDE(elm_obj_web_forward_possible_get, _elm_web_none_elm_web_forward_possible_get),
188 EO_OP_FUNC_OVERRIDE(elm_obj_web_navigate_possible_get, _elm_web_none_elm_web_navigate_possible_get),
189 EO_OP_FUNC_OVERRIDE(elm_obj_web_history_enabled_get, _elm_web_none_elm_web_history_enabled_get),
190 EO_OP_FUNC_OVERRIDE(elm_obj_web_history_enabled_set, _elm_web_none_elm_web_history_enabled_set),
191 EO_OP_FUNC_OVERRIDE(elm_obj_web_zoom_set, _elm_web_none_elm_web_zoom_set),
192 EO_OP_FUNC_OVERRIDE(elm_obj_web_zoom_get, _elm_web_none_elm_web_zoom_get),
193 EO_OP_FUNC_OVERRIDE(elm_obj_web_zoom_mode_set, _elm_web_none_elm_web_zoom_mode_set),
194 EO_OP_FUNC_OVERRIDE(elm_obj_web_zoom_mode_get, _elm_web_none_elm_web_zoom_mode_get),
195 EO_OP_FUNC_OVERRIDE(elm_obj_web_region_show, _elm_web_none_elm_web_region_show),
196 EO_OP_FUNC_OVERRIDE(elm_obj_web_region_bring_in, _elm_web_none_elm_web_region_bring_in),
197 EO_OP_FUNC_OVERRIDE(elm_obj_web_inwin_mode_set, _elm_web_none_elm_web_inwin_mode_set),
198 EO_OP_FUNC_OVERRIDE(elm_obj_web_inwin_mode_get, _elm_web_none_elm_web_inwin_mode_get),
199};
200
201static const Eo_Class_Description _elm_web_none_class_desc = {
202 EO_VERSION,
203 "Elm_Web_None",
204 EO_CLASS_TYPE_REGULAR,
205 EO_CLASS_DESCRIPTION_OPS(_elm_web_none_op_desc),
206 NULL,
207 sizeof(Elm_Web_None_Data),
208 NULL,
209 NULL
210};
211
212EO_DEFINE_CLASS(elm_web_none_class_get, &_elm_web_none_class_desc, ELM_WEB_CLASS, NULL); \ No newline at end of file
diff --git a/src/modules/web/none/elm_web_none.eo.h b/src/modules/web/none/elm_web_none.eo.h
new file mode 100644
index 000000000..2ae7b0d0d
--- /dev/null
+++ b/src/modules/web/none/elm_web_none.eo.h
@@ -0,0 +1,21 @@
1#ifndef _ELM_WEB_NONE_EO_H_
2#define _ELM_WEB_NONE_EO_H_
3
4#ifndef _ELM_WEB_NONE_EO_CLASS_TYPE
5#define _ELM_WEB_NONE_EO_CLASS_TYPE
6
7typedef Eo Elm_Web_None;
8
9#endif
10
11#ifndef _ELM_WEB_NONE_EO_TYPES
12#define _ELM_WEB_NONE_EO_TYPES
13
14
15#endif
16#define ELM_WEB_NONE_CLASS elm_web_none_class_get()
17
18EAPI const Eo_Class *elm_web_none_class_get(void);
19
20
21#endif
diff --git a/src/modules/web/webkit2/Makefile.am b/src/modules/web/webkit2/Makefile.am
new file mode 100644
index 000000000..d34cdcd94
--- /dev/null
+++ b/src/modules/web/webkit2/Makefile.am
@@ -0,0 +1,42 @@
1AUTOMAKE_OPTIONS = 1.4 foreign
2MAINTAINERCLEANFILES = Makefile.in
3
4CLEANFILES =
5
6EOLIAN_FLAGS = @DEPS_EOLIAN_FLAGS@ \
7 -I$(top_srcdir)/src/lib
8
9include $(top_srcdir)/Makefile_Eolian_Helper.am
10
11AM_CPPFLAGS = \
12-DELM_INTERNAL_API_ARGESFSDFEFC=1 \
13-DMODULES_PATH=\"$(pkglibdir)/modules\" \
14-I. \
15-I$(top_builddir) \
16-I$(top_srcdir) \
17-I$(top_srcdir)/src/imported \
18-I$(top_srcdir)/src/lib \
19-I$(top_builddir)/src/lib \
20-DPACKAGE_DATA_DIR=\"$(pkgdatadir)\" \
21-DLOCALE_DIR=\"$(localedir)\" \
22-DPACKAGE_LIB_DIR=\"$(libdir)\" \
23-DICON_DIR=\"$(datadir)/icons\" \
24-DELM_TOP_BUILD_DIR=\"$(top_builddir)\" \
25-DELEMENTARY_BUILD \
26@ELEMENTARY_CFLAGS@ \
27@EWEBKIT2_CFLAGS@
28
29if HAVE_EWEBKIT2
30pkgdir = $(pkglibdir)/modules/web/webkit2/$(MODULE_ARCH)
31pkg_LTLIBRARIES = module.la
32
33BUILT_SOURCES = elm_web_webkit2.eo.h elm_web_webkit2.eo.c
34
35module_la_SOURCES = elm_web_webkit2.c elm_web_webkit2.eo.h
36module_la_LIBADD = @ELEMENTARY_LIBS@ $(top_builddir)/src/lib/libelementary.la @EWEBKIT2_LIBS@
37module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
38module_la_LIBTOOLFLAGS = --tag=disable-static
39endif
40
41EXTRA_DIST = elm_web_webkit2.eo
42
diff --git a/src/modules/web/webkit2/elm_web_webkit2.c b/src/modules/web/webkit2/elm_web_webkit2.c
new file mode 100644
index 000000000..a39ce713e
--- /dev/null
+++ b/src/modules/web/webkit2/elm_web_webkit2.c
@@ -0,0 +1,1149 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
6
7#include <Elementary.h>
8
9#include "elm_priv.h"
10#include "elm_widget_web.h"
11#include "elm_web_webkit2.eo.h"
12
13#include <EWebKit2.h>
14
15#define MY_CLASS ELM_WEB_WEBKIT2_CLASS
16
17#define MY_CLASS_NAME "Elm_Web_Webkit2"
18
19#define ELM_WEB_WEBKIT2_DATA_GET(o, sd) \
20 Elm_Web_Webkit2_Data * sd = eo_data_scope_get(o, ELM_WEB_WEBKIT2_CLASS)
21
22#define ELM_WEB_WEBKIT2_DATA_GET_OR_RETURN(o, ptr) \
23 ELM_WEB_WEBKIT2_DATA_GET(o, ptr); \
24 if (EINA_UNLIKELY(!ptr)) \
25 { \
26 CRI("No widget data for object %p (%s)", \
27 o, evas_object_type_get(o)); \
28 return; \
29 }
30
31#define ELM_WEB_WEBKIT2_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
32 ELM_WEB_WEBKIT2_DATA_GET(o, ptr); \
33 if (EINA_UNLIKELY(!ptr)) \
34 { \
35 CRI("No widget data for object %p (%s)", \
36 o, evas_object_type_get(o)); \
37 return val; \
38 }
39
40#define ELM_WEB_WEBKIT2_CHECK(obj) \
41 if (EINA_UNLIKELY(!eo_isa((obj), ELM_WEB_WEBKIT2_CLASS))) \
42 return
43
44typedef struct _Elm_Web_Webkit2_Data Elm_Web_Webkit2_Data;
45struct _Elm_Web_Webkit2_Data
46{
47 struct
48 {
49 Elm_Web_Window_Open window_create;
50 void *window_create_data;
51 Elm_Web_Dialog_Alert alert;
52 void *alert_data;
53 Elm_Web_Dialog_Confirm confirm;
54 void *confirm_data;
55 Elm_Web_Dialog_Prompt prompt;
56 void *prompt_data;
57 Elm_Web_Dialog_File_Selector file_selector;
58 void *file_selector_data;
59 Elm_Web_Console_Message console_message;
60 void *console_message_data;
61 } hook;
62
63 Elm_Win_Keyboard_Mode input_method;
64
65 struct
66 {
67 Elm_Web_Zoom_Mode mode;
68 float current;
69 float min, max;
70 Eina_Bool no_anim;
71 Ecore_Timer *timer;
72 } zoom;
73
74 struct
75 {
76 struct
77 {
78 int x, y;
79 } start, end;
80 Ecore_Animator *animator;
81 } bring_in;
82
83 Eina_Bool tab_propagate : 1;
84 Eina_Bool inwin_mode : 1;
85};
86
87typedef struct _View_Smart_Data View_Smart_Data;
88struct _View_Smart_Data
89{
90 Ewk_View_Smart_Data base;
91 struct
92 {
93 Evas_Event_Mouse_Down event;
94 Evas_Coord x, y;
95 unsigned int move_count;
96 Ecore_Timer *longpress_timer;
97 Ecore_Animator *pan_anim;
98 } mouse;
99};
100
101enum Dialog_Type
102{
103 DIALOG_ALERT,
104 DIALOG_CONFIRM,
105 DIALOG_PROMPT,
106 DIALOG_FILE_SELECTOR
107};
108
109typedef struct _Dialog_Data Dialog_Data;
110struct _Dialog_Data
111{
112 enum Dialog_Type type;
113
114 Evas_Object *dialog;
115 Evas_Object *box;
116 Evas_Object *bt_ok, *bt_cancel;
117 Evas_Object *entry;
118 Evas_Object *file_sel;
119
120 Eina_Bool *response;
121 const char **entry_value;
122 Eina_List **selected_files;
123};
124
125static Ewk_View_Smart_Class _ewk_view_parent_sc =
126 EWK_VIEW_SMART_CLASS_INIT_NULL;
127
128static int _webkit2_log_dom = -1;
129
130#define CRI(...) EINA_LOG_DOM_CRIT(_webkit2_log_dom, __VA_ARGS__)
131#define ERR(...) EINA_LOG_DOM_ERR(_webkit2_log_dom, __VA_ARGS__)
132#define WRN(...) EINA_LOG_DOM_WARN(_webkit2_log_dom, __VA_ARGS__)
133#define INF(...) EINA_LOG_DOM_INFO(_webkit2_log_dom, __VA_ARGS__)
134#define DBG(...) EINA_LOG_DOM_DBG(_webkit2_log_dom, __VA_ARGS__)
135
136static void
137_view_smart_add(Evas_Object *obj)
138{
139 View_Smart_Data *sd;
140
141 sd = calloc(1, sizeof(View_Smart_Data));
142 evas_object_smart_data_set(obj, sd);
143
144 _ewk_view_parent_sc.sc.add(obj);
145}
146
147static void
148_view_smart_del(Evas_Object *obj)
149{
150 _ewk_view_parent_sc.sc.del(obj);
151}
152
153static Evas_Object *
154_view_smart_window_create(Ewk_View_Smart_Data *vsd,
155 const Ewk_Window_Features *window_features)
156{
157 Evas_Object *new;
158 Evas_Object *obj = evas_object_smart_parent_get(vsd->self);
159
160 ELM_WEB_WEBKIT2_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
161
162 if (!sd->hook.window_create) return NULL;
163
164 new = sd->hook.window_create
165 (sd->hook.window_create_data, obj, EINA_TRUE,
166 (const Elm_Web_Window_Features *)window_features);
167 if (new) return elm_web_webkit_view_get(new);
168
169 return NULL;
170}
171
172static void
173_view_smart_window_close(Ewk_View_Smart_Data *sd)
174{
175 Evas_Object *obj = evas_object_smart_parent_get(sd->self);
176
177 ELM_WEB_WEBKIT2_CHECK(obj);
178
179 eo_event_callback_call(obj, ELM_WEB_EVENT_WINDOWS_CLOSE_REQUEST, NULL);
180}
181
182static void
183_popup_item_selected(void *data,
184 Evas_Object *obj,
185 void *event_info EINA_UNUSED)
186{
187 Elm_Object_Item *list_it = elm_list_selected_item_get(obj);
188 const Eina_List *itr, *list = elm_list_items_get(obj);
189 Ewk_Popup_Menu *menu = data;
190 int i = 0;
191 void *d;
192
193 EINA_LIST_FOREACH(list, itr, d)
194 {
195 if (d == list_it)
196 break;
197
198 i++;
199 }
200
201 ewk_popup_menu_selected_index_set(menu, i);
202 ewk_popup_menu_close(menu);
203
204 evas_object_del(evas_object_data_get(obj, "_notify"));
205}
206
207static Eina_Bool
208_popup_dismiss_cb(void *data, const Eo_Event *event)
209{
210 ewk_popup_menu_close(data);
211 evas_object_del(event->obj);
212 return EINA_TRUE;
213}
214
215static Eina_Bool
216_view_smart_popup_menu_show(Ewk_View_Smart_Data *sd,
217 Eina_Rectangle r,
218 Ewk_Text_Direction dir EINA_UNUSED,
219 double scale EINA_UNUSED,
220 Ewk_Popup_Menu *menu)
221{
222 Evas_Object *notify, *list, *grid, *win;
223 const Eina_List* items = ewk_popup_menu_items_get(menu);
224 Evas_Object *obj = evas_object_smart_parent_get(sd->self);
225 int h, ww, wh;
226
227 Elm_Object_Item *lit;
228 Eina_Bool disabled;
229 const char *txt;
230 Ewk_Popup_Menu_Item *it;
231 const Eina_List *itr;
232
233 Evas_Object *popup = evas_object_data_get(sd->self, "_select_popup");
234 if (popup) evas_object_del(popup);
235
236 win = elm_widget_top_get(obj);
237
238 notify = elm_notify_add(win);
239 elm_notify_allow_events_set(notify, EINA_FALSE);
240 elm_notify_align_set(notify, 0.5, 1.0);
241
242 list = elm_list_add(notify);
243 evas_object_data_set(list, "_notify", notify);
244 elm_list_select_mode_set(list, ELM_OBJECT_SELECT_MODE_ALWAYS);
245 elm_scroller_bounce_set(list, EINA_FALSE, EINA_FALSE);
246 elm_list_mode_set(list, ELM_LIST_EXPAND);
247 evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
248 evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
249 evas_object_show(list);
250
251 EINA_LIST_FOREACH(items, itr, it)
252 {
253 switch (ewk_popup_menu_item_type_get(it))
254 {
255 case EWK_POPUP_MENU_SEPARATOR:
256 // TODO:
257 break;
258 case EWK_POPUP_MENU_ITEM:
259 txt = ewk_popup_menu_item_text_get(it);
260 if (ewk_popup_menu_item_is_label_get(it))
261 {
262 lit = elm_list_item_append(list, txt, NULL, NULL, NULL, NULL);
263 disabled = EINA_TRUE;
264 }
265 else
266 {
267 lit = elm_list_item_append(list, txt, NULL, NULL, _popup_item_selected, menu);
268 disabled = !ewk_popup_menu_item_enabled_get(it);
269 }
270
271 elm_object_item_disabled_set(lit, disabled);
272 break;
273 default:
274 break;
275 }
276 }
277 elm_list_go(list);
278
279 grid = elm_grid_add(win);
280 elm_grid_size_set(grid, 1, 1);
281 elm_grid_pack(grid, list, 0, 0, 1, 1);
282 evas_object_geometry_get(win, NULL, NULL, &ww, &wh);
283
284 //FIXME: it should be the real height of items in the list.
285 h = r.h * eina_list_count(items);
286 evas_object_size_hint_min_set(grid, ww, h < wh / 2 ? h : wh / 2);
287 elm_object_content_set(notify, grid);
288 evas_object_show(grid);
289
290 evas_object_show(notify);
291
292 evas_object_data_set(sd->self, "_select_popup", notify);
293
294 eo_event_callback_add
295 (notify, ELM_NOTIFY_EVENT_BLOCK_CLICKED, _popup_dismiss_cb, menu);
296
297 return EINA_TRUE;
298}
299
300static Eina_Bool
301_view_smart_popup_menu_hide(Ewk_View_Smart_Data *sd)
302{
303 Evas_Object *popup = evas_object_data_get(sd->self, "_select_popup");
304 if (!popup) return EINA_FALSE;
305
306 evas_object_del(popup);
307 evas_object_data_del(sd->self, "_select_popup");
308
309 return EINA_TRUE;
310}
311
312static Eina_Bool
313_fullscreen_accept(void *data, const Eo_Event *event EINA_UNUSED)
314{
315 Evas_Object *ewk = data;
316 evas_object_del(evas_object_data_get(ewk, "_fullscreen_permission_popup"));
317
318 return EINA_TRUE;
319}
320
321static Eina_Bool
322_fullscreen_deny(void *data, const Eo_Event *event EINA_UNUSED)
323{
324 Evas_Object *ewk = data;
325 ewk_view_fullscreen_exit(ewk);
326 evas_object_del(evas_object_data_get(ewk, "_fullscreen_permission_popup"));
327
328 return EINA_TRUE;
329}
330
331static Eina_Bool
332_view_smart_fullscreen_enter(Ewk_View_Smart_Data *sd, Ewk_Security_Origin *origin)
333{
334 Evas_Object *btn, *popup, *top;
335 const char *host;
336 char buffer[2048];
337
338 Evas_Object *obj = evas_object_smart_parent_get(sd->self);
339
340 ELM_WEB_WEBKIT2_CHECK(obj) EINA_FALSE;
341
342 top = elm_widget_top_get(obj);
343 elm_win_fullscreen_set(top, EINA_TRUE);
344
345 popup = elm_popup_add(top);
346 elm_popup_orient_set(popup, ELM_POPUP_ORIENT_TOP);
347 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
348
349 host = ewk_security_origin_host_get(origin);
350 snprintf(buffer, sizeof(buffer), "%s is now fullscreen.<br>Press ESC at any time to exit fullscreen,<br>Allow fullscreen?<br>", host);
351 elm_object_text_set(popup, buffer);
352
353 btn = elm_button_add(popup);
354 elm_object_text_set(btn, "Accept");
355 elm_object_part_content_set(popup, "button1", btn);
356 eo_event_callback_add
357 (btn, EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, _fullscreen_accept, sd->self);
358
359 btn = elm_button_add(popup);
360 elm_object_text_set(btn, "Deny");
361 elm_object_part_content_set(popup, "button2", btn);
362 eo_event_callback_add
363 (btn, EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, _fullscreen_deny, sd->self);
364
365 evas_object_data_set(sd->self, "_fullscreen_permission_popup", popup);
366 evas_object_show(popup);
367
368 return EINA_TRUE;
369}
370
371static Eina_Bool
372_view_smart_fullscreen_exit(Ewk_View_Smart_Data *sd)
373{
374 Evas_Object *obj = evas_object_smart_parent_get(sd->self);
375
376 ELM_WEB_WEBKIT2_CHECK(obj) EINA_FALSE;
377
378 Evas_Object *top = elm_widget_top_get(obj);
379 elm_win_fullscreen_set(top, EINA_FALSE);
380
381 return EINA_TRUE;
382}
383
384static Eina_Bool
385_bt_close(void *data, const Eo_Event *event)
386{
387 Dialog_Data *d = data;
388
389 if (d->type == DIALOG_ALERT) goto end;
390
391 *d->response = (event->obj == d->bt_ok);
392 if (d->type == DIALOG_CONFIRM) goto end;
393
394 if (d->type == DIALOG_PROMPT)
395 *d->entry_value = strdup(elm_entry_entry_get(d->entry));
396
397end:
398 evas_object_del(d->dialog);
399 free(d);
400
401 return EINA_TRUE;
402}
403
404static Dialog_Data *
405_dialog_new(Evas_Object *web, Eina_Bool inwin_mode)
406{
407 Dialog_Data *d;
408
409 d = calloc(1, sizeof(Dialog_Data));
410 if (!d) return NULL;
411
412 if (!web || inwin_mode)
413 {
414 Evas_Object *bg;
415
416 d->dialog = elm_win_add(NULL, "elm-web-popup", ELM_WIN_DIALOG_BASIC);
417 eo_event_callback_add
418 (d->dialog, ELM_WIN_EVENT_DELETE_REQUEST, _bt_close, d);
419
420 bg = elm_bg_add(d->dialog);
421 evas_object_size_hint_weight_set
422 (bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
423 elm_win_resize_object_add(d->dialog, bg);
424 evas_object_show(bg);
425
426 d->box = elm_box_add(d->dialog);
427 evas_object_size_hint_weight_set
428 (d->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
429 elm_win_resize_object_add(d->dialog, d->box);
430 evas_object_show(d->box);
431 }
432 else
433 {
434 Evas_Object *win = elm_widget_top_get(web);
435
436 d->dialog = elm_win_inwin_add(win);
437 elm_object_style_set(d->dialog, "minimal");
438 evas_object_size_hint_weight_set
439 (d->dialog, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
440
441 d->box = elm_box_add(win);
442 evas_object_size_hint_weight_set
443 (d->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
444 elm_win_inwin_content_set(d->dialog, d->box);
445 evas_object_show(d->box);
446 }
447
448 return d;
449}
450
451static void
452_dialog_ok_cancel_buttons_add(Dialog_Data *dialog_data)
453{
454 Evas_Object *bx, *bt;
455 bx = elm_box_add(dialog_data->box);
456 elm_box_horizontal_set(bx, EINA_TRUE);
457 elm_box_pack_end(dialog_data->box, bx);
458 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
459 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
460 evas_object_show(bx);
461
462 dialog_data->bt_cancel = bt = elm_button_add(bx);
463 elm_object_text_set(bt, "Cancel");
464 elm_box_pack_end(bx, bt);
465 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
466 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
467 eo_event_callback_add
468 (bt, EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, _bt_close, dialog_data);
469 evas_object_show(bt);
470
471 dialog_data->bt_ok = bt = elm_button_add(bx);
472 elm_object_text_set(bt, "Ok");
473 elm_box_pack_end(bx, bt);
474 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
475 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
476 eo_event_callback_add
477 (bt, EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, _bt_close, dialog_data);
478 evas_object_show(bt);
479}
480
481static void
482_dialog_del_cb(void *data EINA_UNUSED,
483 Evas *e EINA_UNUSED,
484 Evas_Object *obj EINA_UNUSED,
485 void *event_info EINA_UNUSED)
486{
487 ecore_main_loop_quit();
488}
489
490static void
491_exec_dialog(Evas_Object *dialog)
492{
493 evas_object_event_callback_add
494 (dialog, EVAS_CALLBACK_DEL, _dialog_del_cb, NULL);
495 ecore_main_loop_begin();
496}
497
498static void
499_view_smart_run_javascript_alert(Ewk_View_Smart_Data *vsd, const char *message)
500{
501 Evas_Object *obj = evas_object_smart_parent_get(vsd->self);
502 Evas_Object *dialog = NULL;
503
504 ELM_WEB_WEBKIT2_DATA_GET_OR_RETURN(obj, sd);
505
506 if (sd->hook.alert)
507 dialog = sd->hook.alert(sd->hook.alert_data, obj, message);
508 else
509 {
510 Evas_Object *lb;
511 Dialog_Data *dialog_data = _dialog_new(obj, sd->inwin_mode);
512 dialog_data->type = DIALOG_ALERT;
513 dialog = dialog_data->dialog;
514
515 lb = elm_label_add(dialog_data->box);
516 elm_object_text_set(lb, message);
517 elm_box_pack_end(dialog_data->box, lb);
518 evas_object_show(lb);
519
520 dialog_data->bt_ok = elm_button_add(dialog_data->box);
521 elm_object_text_set(dialog_data->bt_ok, "Close");
522 elm_box_pack_end(dialog_data->box, dialog_data->bt_ok);
523 evas_object_size_hint_align_set
524 (dialog_data->bt_ok, EVAS_HINT_FILL, EVAS_HINT_FILL);
525 eo_event_callback_add
526 (dialog_data->bt_ok, EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, _bt_close, dialog_data);
527 evas_object_show(dialog_data->bt_ok);
528
529 evas_object_show(dialog);
530 }
531
532 if (dialog) _exec_dialog(dialog);
533}
534
535static Eina_Bool
536_view_smart_run_javascript_confirm(Ewk_View_Smart_Data *vsd, const char *message)
537{
538 Evas_Object *obj = evas_object_smart_parent_get(vsd->self);
539 Eina_Bool response = EINA_FALSE;
540 Evas_Object *dialog = NULL;
541
542 ELM_WEB_WEBKIT2_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
543
544 if (sd->hook.confirm)
545 dialog = sd->hook.confirm(sd->hook.confirm_data, obj, message, &response);
546 else
547 {
548 Evas_Object *lb;
549 Dialog_Data *dialog_data = _dialog_new(obj, sd->inwin_mode);
550 dialog_data->type = DIALOG_CONFIRM;
551 dialog_data->response = &response;
552 dialog = dialog_data->dialog;
553
554 lb = elm_label_add(dialog_data->box);
555 elm_object_text_set(lb, message);
556 elm_box_pack_end(dialog_data->box, lb);
557 evas_object_show(lb);
558
559 _dialog_ok_cancel_buttons_add(dialog_data);
560
561 evas_object_show(dialog);
562 }
563
564 if (dialog) _exec_dialog(dialog);
565
566 return response;
567}
568
569static const char *
570_view_smart_run_javascript_prompt(Ewk_View_Smart_Data *vsd, const char *message, const char *default_value)
571{
572 Evas_Object *obj = evas_object_smart_parent_get(vsd->self);
573 Eina_Bool response = EINA_FALSE;
574 Evas_Object *dialog = NULL;
575 char *value = NULL;
576 const char *ret;
577
578 ELM_WEB_WEBKIT2_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
579
580 if (sd->hook.prompt)
581 dialog = sd->hook.prompt(sd->hook.prompt_data, obj, message, default_value, (const char**)&value, &response);
582 else
583 {
584 Evas_Object *lb, *entry;
585 Dialog_Data *dialog_data = _dialog_new(obj, sd->inwin_mode);
586 dialog_data->type = DIALOG_PROMPT;
587 dialog_data->response = &response;
588 dialog_data->entry_value = (const char**)&value;
589 dialog = dialog_data->dialog;
590
591 lb = elm_label_add(dialog_data->box);
592 elm_object_text_set(lb, message);
593 elm_box_pack_end(dialog_data->box, lb);
594 evas_object_show(lb);
595
596 dialog_data->entry = entry = elm_entry_add(dialog_data->box);
597 elm_entry_single_line_set(entry, EINA_TRUE);
598 elm_entry_scrollable_set(entry, EINA_TRUE);
599 elm_entry_entry_set(entry, default_value);
600 evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
601 evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
602 elm_box_pack_end(dialog_data->box, entry);
603 evas_object_show(entry);
604
605 _dialog_ok_cancel_buttons_add(dialog_data);
606
607 evas_object_show(dialog);
608 }
609
610 if (dialog) _exec_dialog(dialog);
611
612 if (!value) return NULL;
613
614 ret = eina_stringshare_add(value);
615 free(value);
616 return ret;
617}
618
619/**
620 * Creates a new view object given the parent.
621 *
622 * @param parent object to use as parent.
623 *
624 * @return newly added Evas_Object or @c NULL on errors.
625 */
626Evas_Object *
627_view_add(Evas_Object *parent)
628{
629 Evas *canvas = evas_object_evas_get(parent);
630 static Evas_Smart *smart = NULL;
631 Evas_Object *view;
632
633 if (!smart)
634 {
635 static Ewk_View_Smart_Class api =
636 EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("EWK_View_Elementary");
637
638 ewk_view_smart_class_set(&api);
639 ewk_view_smart_class_set(&_ewk_view_parent_sc);
640
641 // TODO: check every api method and provide overrides with hooks!
642 // TODO: hooks should provide extension points
643 // TODO: extension should have some kind of "default implementation",
644 // TODO: that can be replaced or controlled by hooks.
645 // TODO: ie: run_javascript_alert() should present an elm_win
646 // TODO: by default, but user could override it to show as inwin.
647 api.sc.add = _view_smart_add;
648 api.sc.del = _view_smart_del;
649 api.window_create = _view_smart_window_create;
650 api.window_close = _view_smart_window_close;
651 api.popup_menu_show = _view_smart_popup_menu_show;
652 api.popup_menu_hide = _view_smart_popup_menu_hide;
653 api.fullscreen_enter = _view_smart_fullscreen_enter;
654 api.fullscreen_exit = _view_smart_fullscreen_exit;
655 api.run_javascript_alert = _view_smart_run_javascript_alert;
656 api.run_javascript_confirm = _view_smart_run_javascript_confirm;
657 api.run_javascript_prompt = _view_smart_run_javascript_prompt;
658
659 smart = evas_smart_class_new(&api.sc);
660 if (!smart)
661 {
662 CRI("Could not create smart class");
663 return NULL;
664 }
665 }
666
667 view = ewk_view_smart_add(canvas, smart, ewk_context_default_get(), ewk_page_group_create(0));
668 if (!view)
669 {
670 ERR("Could not create smart object object for view");
671 return NULL;
672 }
673
674 return view;
675}
676
677static Eina_Bool
678_view_smart_url_changed_cb(void *data, const Eo_Event *event)
679{
680 eo_event_callback_call(data, ELM_WEB_EVENT_URI_CHANGED, event->event_info);
681 eo_event_callback_call(data, ELM_WEB_EVENT_URL_CHANGED, event->event_info);
682
683 return EINA_TRUE;
684}
685
686static void
687_view_smart_callback_proxy(Evas_Object *view, Evas_Object *parent)
688{
689 eo_event_callback_add
690 (view, ELM_WEB_EVENT_URL_CHANGED, _view_smart_url_changed_cb, parent);
691}
692
693EOLIAN static Eina_Bool
694_elm_web_webkit2_elm_widget_on_focus(Eo *obj, Elm_Web_Webkit2_Data *sd, Elm_Object_Item *item EINA_UNUSED)
695{
696 Evas_Object *top;
697
698 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_TRUE);
699 Eina_Bool int_ret = EINA_FALSE;
700
701 int_ret = elm_obj_widget_on_focus(eo_super(obj, MY_CLASS), NULL);
702 if (!int_ret) return EINA_TRUE;
703
704 top = elm_widget_top_get(obj);
705
706 if (elm_object_focus_get(obj))
707 {
708 evas_object_focus_set(wd->resize_obj, EINA_TRUE);
709 if (top) elm_win_keyboard_mode_set(top, sd->input_method);
710 }
711 else
712 {
713 evas_object_focus_set(wd->resize_obj, EINA_FALSE);
714 if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF);
715 }
716 return EINA_TRUE;
717}
718
719EOLIAN static Eina_Bool
720_elm_web_webkit2_elm_web_tab_propagate_get(Eo *obj EINA_UNUSED, Elm_Web_Webkit2_Data *sd)
721{
722 return sd->tab_propagate;
723}
724
725EOLIAN static void
726_elm_web_webkit2_elm_web_tab_propagate_set(Eo *obj EINA_UNUSED, Elm_Web_Webkit2_Data *sd, Eina_Bool propagate)
727{
728 sd->tab_propagate = propagate;
729}
730
731EOLIAN static void
732_elm_web_webkit2_evas_object_smart_add(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED)
733{
734 Evas_Object *resize_obj;
735
736 resize_obj = _view_add(obj);
737 elm_widget_resize_object_set(obj, resize_obj, EINA_TRUE);
738
739 evas_obj_smart_add(eo_super(obj, MY_CLASS));
740 elm_widget_sub_object_parent_add(obj);
741
742 //TODO: need a way to change theme
743 ewk_view_theme_set(resize_obj, WEBKIT_DATADIR "/themes/default.edj");
744
745 _view_smart_callback_proxy(resize_obj, obj);
746 elm_widget_can_focus_set(obj, EINA_TRUE);
747}
748
749EOLIAN static void
750_elm_web_webkit2_evas_object_smart_del(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED)
751{
752 evas_obj_smart_del(eo_super(obj, MY_CLASS));
753}
754
755EOLIAN static Evas_Object*
756_elm_web_webkit2_elm_web_webkit_view_get(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED)
757{
758 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
759 return wd->resize_obj;
760}
761
762EOLIAN static void
763_elm_web_webkit2_elm_web_window_create_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Webkit2_Data *sd, Elm_Web_Window_Open func, void *data)
764{
765 sd->hook.window_create = func;
766 sd->hook.window_create_data = data;
767}
768
769EOLIAN static void
770_elm_web_webkit2_elm_web_dialog_alert_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Webkit2_Data *sd, Elm_Web_Dialog_Alert func, void *data)
771{
772 sd->hook.alert = func;
773 sd->hook.alert_data = data;
774}
775
776EOLIAN static void
777_elm_web_webkit2_elm_web_dialog_confirm_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Webkit2_Data *sd, Elm_Web_Dialog_Confirm func, void *data)
778{
779 sd->hook.confirm = func;
780 sd->hook.confirm_data = data;
781}
782
783EOLIAN static void
784_elm_web_webkit2_elm_web_dialog_prompt_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Webkit2_Data *sd, Elm_Web_Dialog_Prompt func, void *data)
785{
786 sd->hook.prompt = func;
787 sd->hook.prompt_data = data;
788}
789
790EOLIAN static void
791_elm_web_webkit2_elm_web_dialog_file_selector_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Webkit2_Data *_pd EINA_UNUSED, Elm_Web_Dialog_File_Selector func EINA_UNUSED, void *data EINA_UNUSED)
792{
793}
794
795EOLIAN static void
796_elm_web_webkit2_elm_web_console_message_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Webkit2_Data *_pd EINA_UNUSED, Elm_Web_Console_Message func EINA_UNUSED, void *data EINA_UNUSED)
797{
798}
799
800EOLIAN static void
801_elm_web_webkit2_elm_web_useragent_set(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED, const char *user_agent)
802{
803 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
804
805 ewk_view_user_agent_set(wd->resize_obj, user_agent);
806}
807
808EOLIAN static const char*
809_elm_web_webkit2_elm_web_useragent_get(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED)
810{
811 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
812
813 return ewk_view_user_agent_get(wd->resize_obj);
814}
815
816EOLIAN static Eina_Bool
817_elm_web_webkit2_elm_web_url_set(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED, const char *url)
818{
819 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
820 return ewk_view_url_set(wd->resize_obj, url);
821}
822
823EOLIAN static const char*
824_elm_web_webkit2_elm_web_url_get(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED)
825{
826 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
827 return ewk_view_url_get(wd->resize_obj);
828}
829
830EOLIAN static Eina_Bool
831_elm_web_webkit2_elm_web_html_string_load(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED, const char *html, const char *base_url, const char *unreachable_url)
832{
833 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
834
835 return ewk_view_html_string_load(wd->resize_obj,
836 html, base_url, unreachable_url);
837}
838
839EOLIAN static const char*
840_elm_web_webkit2_elm_web_title_get(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED)
841{
842 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
843 return ewk_view_title_get(wd->resize_obj);
844}
845
846EOLIAN static void
847_elm_web_webkit2_elm_web_bg_color_set(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED, int r, int g, int b, int a)
848{
849 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
850
851 ewk_view_bg_color_set(wd->resize_obj, r, g, b, a);
852}
853
854EOLIAN static void
855_elm_web_webkit2_elm_web_bg_color_get(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED, int *r, int *g, int *b, int *a)
856{
857 if (r) *r = 0;
858 if (g) *g = 0;
859 if (b) *b = 0;
860 if (a) *a = 0;
861
862 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
863
864 ewk_view_bg_color_get(wd->resize_obj, r, g, b, a);
865}
866
867EOLIAN static const char*
868_elm_web_webkit2_elm_web_selection_get(Eo *obj EINA_UNUSED, Elm_Web_Webkit2_Data *_pd EINA_UNUSED)
869{
870 return NULL;
871}
872
873EOLIAN static void
874_elm_web_webkit2_elm_web_popup_selected_set(Eo *obj EINA_UNUSED, Elm_Web_Webkit2_Data *_pd EINA_UNUSED, int idx EINA_UNUSED)
875{
876}
877
878EOLIAN static Eina_Bool
879_elm_web_webkit2_elm_web_popup_destroy(Eo *obj EINA_UNUSED, Elm_Web_Webkit2_Data *_pd EINA_UNUSED)
880{
881 return EINA_FALSE;
882}
883
884EOLIAN static Eina_Bool
885_elm_web_webkit2_elm_web_text_search(const Eo *obj EINA_UNUSED, Elm_Web_Webkit2_Data *_pd EINA_UNUSED, const char *string EINA_UNUSED, Eina_Bool case_sensitive EINA_UNUSED, Eina_Bool forward EINA_UNUSED, Eina_Bool wrap EINA_UNUSED)
886{
887 return EINA_FALSE;
888}
889
890EOLIAN static unsigned int
891_elm_web_webkit2_elm_web_text_matches_mark(Eo *obj EINA_UNUSED, Elm_Web_Webkit2_Data *_pd EINA_UNUSED, const char *string EINA_UNUSED, Eina_Bool case_sensitive EINA_UNUSED, Eina_Bool highlight EINA_UNUSED, unsigned int limit EINA_UNUSED)
892{
893 return 0;
894}
895
896EOLIAN static Eina_Bool
897_elm_web_webkit2_elm_web_text_matches_unmark_all(Eo *obj EINA_UNUSED, Elm_Web_Webkit2_Data *_pd EINA_UNUSED)
898{
899 return EINA_FALSE;
900}
901
902EOLIAN static Eina_Bool
903_elm_web_webkit2_elm_web_text_matches_highlight_set(Eo *obj EINA_UNUSED, Elm_Web_Webkit2_Data *_pd EINA_UNUSED, Eina_Bool highlight EINA_UNUSED)
904{
905 return EINA_FALSE;
906}
907
908EOLIAN static Eina_Bool
909_elm_web_webkit2_elm_web_text_matches_highlight_get(Eo *obj EINA_UNUSED, Elm_Web_Webkit2_Data *_pd EINA_UNUSED)
910{
911 return EINA_FALSE;
912}
913
914EOLIAN static double
915_elm_web_webkit2_elm_web_load_progress_get(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED)
916{
917 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, -1.0);
918
919 return ewk_view_load_progress_get(wd->resize_obj);
920}
921
922EOLIAN static Eina_Bool
923_elm_web_webkit2_elm_web_stop(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED)
924{
925 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
926
927 return ewk_view_stop(wd->resize_obj);
928}
929
930EOLIAN static Eina_Bool
931_elm_web_webkit2_elm_web_reload(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED)
932{
933 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
934
935 return ewk_view_reload(wd->resize_obj);
936}
937
938EOLIAN static Eina_Bool
939_elm_web_webkit2_elm_web_reload_full(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED)
940{
941 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
942
943 return ewk_view_reload_bypass_cache(wd->resize_obj);
944}
945
946EOLIAN static Eina_Bool
947_elm_web_webkit2_elm_web_back(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED)
948{
949 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
950
951 return ewk_view_back(wd->resize_obj);
952}
953
954EOLIAN static Eina_Bool
955_elm_web_webkit2_elm_web_forward(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED)
956{
957 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
958
959 return ewk_view_forward(wd->resize_obj);
960}
961
962EOLIAN static Eina_Bool
963_elm_web_webkit2_elm_web_navigate(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED, int steps)
964{
965 Ewk_Back_Forward_List *history;
966 Ewk_Back_Forward_List_Item *item = NULL;
967
968 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
969
970 history = ewk_view_back_forward_list_get(wd->resize_obj);
971 if (history)
972 {
973 item = ewk_back_forward_list_item_at_index_get(history, steps);
974 if (item) return ewk_view_navigate_to(wd->resize_obj, item);
975 }
976
977 return EINA_FALSE;
978}
979
980EOLIAN static Eina_Bool
981_elm_web_webkit2_elm_web_back_possible_get(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED)
982{
983 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
984
985 return ewk_view_back_possible(wd->resize_obj);
986}
987
988EOLIAN static Eina_Bool
989_elm_web_webkit2_elm_web_forward_possible_get(Eo *obj, Elm_Web_Webkit2_Data *_pd EINA_UNUSED)
990{
991 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
992
993 return ewk_view_forward_possible(wd->resize_obj);
994}
995