summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyuan Choi <ryuan.choi@gmail.com>2014-07-05 01:43:43 +0900
committerRyuan Choi <ryuan.choi@gmail.com>2014-07-05 01:43:43 +0900
commitafb1d4a1e7f13bfbd1c7862b03b04b62b4c2d918 (patch)
treedc0bbbd577442304d007bfde97119e138aab5dee
parent304a922778ef1bf53538742408ba7280087877dc (diff)
elm_web: Drop ewebkit backend (ewebkit2 is only available from now)
ewebkit was dropped from webkit.org (https://bugs.webkit.org/show_bug.cgi?id=134087)
-rw-r--r--configure.ac20
-rw-r--r--src/lib/Elementary.h.in1
-rw-r--r--src/lib/Makefile.am1
-rw-r--r--src/lib/elm_web.c2122
-rw-r--r--src/lib/elm_web2.c161
-rw-r--r--src/lib/elm_widget_web.h4
6 files changed, 159 insertions, 2150 deletions
diff --git a/configure.ac b/configure.ac
index 580e86c81..a3948e7f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -494,27 +494,25 @@ if test "x$want_elementary_emap" = "xyes" -a "x$have_elementary_emap" = "xno"; t
494fi 494fi
495AC_SUBST(ELM_EMAP_DEF) 495AC_SUBST(ELM_EMAP_DEF)
496 496
497ELM_WEB_DEF="#undef"
498ELM_WEB2_DEF="#undef" 497ELM_WEB2_DEF="#undef"
499 498
500elementary_web_backend="detect" 499elementary_web_backend="detect"
501elementary_web="no" 500elementary_web="no"
502want_elementary_web="" 501want_elementary_web=""
503AC_ARG_WITH([elementary-web-backend], 502AC_ARG_WITH([elementary-web-backend],
504 [AC_HELP_STRING([--with-elementary-web-backend=@<:@ewebkit/ewebkit2/detect/none@:>@], [Select the WebKit backend for Elementary to support web @<:@default=detect@:>@])], 503 [AC_HELP_STRING([--with-elementary-web-backend=@<:@ewebkit2/detect/none@:>@], [Select the WebKit backend for Elementary to support web @<:@default=detect@:>@])],
505 [ 504 [
506 elementary_web_backend=${withval} 505 elementary_web_backend=${withval}
507 ], 506 ],
508 [elementary_web_backend="detect"]) 507 [elementary_web_backend="detect"])
509 508
510case "$elementary_web_backend" in 509case "$elementary_web_backend" in
511 ewebkit|ewebkit2|detect|none) ;; 510 ewebkit2|detect|none) ;;
512 *) AC_MSG_ERROR([Invalid web backend: must be ewebkit, ewebkit2, detect or none]) ;; 511 *) AC_MSG_ERROR([Invalid web backend: must be ewebkit2, detect or none]) ;;
513esac 512esac
514 513
515if test "x$elementary_web_backend" = "xdetect"; then 514if test "x$elementary_web_backend" = "xdetect"; then
516 # FIXME : detect option should check both ewebkit and ewebkit2. 515 want_elementary_web="ewebkit2"
517 want_elementary_web="ewebkit"
518else 516else
519 want_elementary_web=$elementary_web_backend 517 want_elementary_web=$elementary_web_backend
520fi 518fi
@@ -528,12 +526,7 @@ if test "x$want_elementary_web" != "xnone"; then
528 AC_DEFINE_UNQUOTED(WEBKIT_DATADIR, 526 AC_DEFINE_UNQUOTED(WEBKIT_DATADIR,
529 "$webkit_datadir", 527 "$webkit_datadir",
530 "WebKit's data dir") 528 "WebKit's data dir")
531 if test "x$elementary_web_backend" = "xewebkit2"; then 529 ELM_WEB2_DEF="#define"
532 AC_DEFINE(USE_WEBKIT2, 1, [Use ewebkit2 as Elementary web backend])
533 ELM_WEB2_DEF="#define"
534 else
535 ELM_WEB_DEF="#define"
536 fi
537 530
538 elementary_web=$want_elementary_web 531 elementary_web=$want_elementary_web
539 requirement_elm="${want_elementary_web} ${requirement_elm}" 532 requirement_elm="${want_elementary_web} ${requirement_elm}"
@@ -544,12 +537,11 @@ else
544 elementary_web="no" 537 elementary_web="no"
545fi 538fi
546 539
547if test "x$elementary_web_backend" = "xewebkit" -o "x$elementary_web_backend" = "xewebkit2"; then 540if test "x$elementary_web_backend" = "xewebkit2"; then
548 if test "x$elementary_web" = "xnone"; then 541 if test "x$elementary_web" = "xnone"; then
549 AC_MSG_ERROR([Web support requested, but no $elementary_web_backend found by pkg-config.]) 542 AC_MSG_ERROR([Web support requested, but no $elementary_web_backend found by pkg-config.])
550 fi 543 fi
551fi 544fi
552AC_SUBST(ELM_WEB_DEF)
553AC_SUBST(ELM_WEB2_DEF) 545AC_SUBST(ELM_WEB2_DEF)
554 546
555ELM_DEBUG_DEF="#undef" 547ELM_DEBUG_DEF="#undef"
diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in
index 351e70aea..d7687dfa6 100644
--- a/src/lib/Elementary.h.in
+++ b/src/lib/Elementary.h.in
@@ -14,7 +14,6 @@
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_ELOCATION_DEF@ ELM_ELOCATION 16@ELM_ELOCATION_DEF@ ELM_ELOCATION
17@ELM_WEB_DEF@ ELM_WEB
18@ELM_WEB2_DEF@ ELM_WEB2 17@ELM_WEB2_DEF@ ELM_WEB2
19@ELM_EMAP_DEF@ ELM_EMAP 18@ELM_EMAP_DEF@ ELM_EMAP
20@ELM_DEBUG_DEF@ ELM_DEBUG 19@ELM_DEBUG_DEF@ ELM_DEBUG
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 5a26bc663..887dfe82d 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -501,7 +501,6 @@ elm_transit.c \
501elm_util.c \ 501elm_util.c \
502elm_url.c \ 502elm_url.c \
503elm_video.c \ 503elm_video.c \
504elm_web.c \
505elm_web2.c \ 504elm_web2.c \
506elm_widget.c \ 505elm_widget.c \
507elm_win.c \ 506elm_win.c \
diff --git a/src/lib/elm_web.c b/src/lib/elm_web.c
deleted file mode 100644
index a8e55e426..000000000
--- a/src/lib/elm_web.c
+++ /dev/null
@@ -1,2122 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#include <Elementary.h>
6
7#include "elm_priv.h"
8#include "elm_widget_web.h"
9
10// TODO:
11// 1 - easy to use zoom like elm_photocam API
12// 2 - review scrolling to match elm_scroller. Maybe in future use
13// elm_interface_scroller
14
15#if !defined(HAVE_ELEMENTARY_WEB) || !defined(USE_WEBKIT2)
16
17#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
18#include "elm_interface_atspi_accessible.h"
19#include "elm_interface_atspi_accessible.eo.h"
20
21#define MY_CLASS ELM_WEB_CLASS
22
23#define MY_CLASS_NAME "Elm_Web"
24#define MY_CLASS_NAME_LEGACY "elm_web"
25
26#ifdef HAVE_ELEMENTARY_WEB
27#include <EWebKit.h>
28
29/* Similar to iPhone */
30// TODO: switch between iPhone, iPad or Chrome/Safari based on some
31// elm setting?
32
33#define ELM_WEB_USER_AGENT \
34 "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en)" \
35 " AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a" \
36 " Safari/419.3 " PACKAGE_NAME "/" PACKAGE_VERSION
37
38static Ewk_View_Smart_Class _ewk_view_parent_sc =
39 EWK_VIEW_SMART_CLASS_INIT_NULL;
40
41#endif
42
43static const Evas_Smart_Cb_Description _elm_web_smart_callbacks[] = {
44 { "download,request", "p" },
45 { "editorclient,contents,changed", "" },
46 { "editorclient,selection,changed", "" },
47 { "frame,created", "p" },
48 { "icon,received", "" },
49 { "inputmethod,changed", "b" },
50 { "js,windowobject,clear", "" },
51 { "link,hover,in", "p" },
52 { "link,hover,out", "" },
53 { "load,document,finished", "p" },
54 { "load,error", "p" },
55 { "load,finished", "p" },
56 { "load,newwindow,show", "" },
57 { "load,progress", "d" },
58 { "load,provisional", "" },
59 { "load,started", "" },
60 { "menubar,visible,get", "b" },
61 { "menubar,visible,set", "b" },
62 { "popup,created", "p" },
63 { "popup,willdelete", "p" },
64 { "ready", "" },
65 { "scrollbars,visible,get", "b" },
66 { "scrollbars,visible,set", "b" },
67 { "statusbar,text,set", "s" },
68 { "statusbar,visible,get", "b" },
69 { "statusbar,visible,set", "b" },
70 { "title,changed", "s" },
71 { "toolbars,visible,get", "b" },
72 { "toolbars,visible,set", "b" },
73 { "tooltip,text,set", "s" },
74 { "uri,changed", "s" },
75 { "url,changed", "s" },
76 { "view,resized", "" },
77 { "windows,close,request", ""},
78 { "zoom,animated,end", "" },
79 { SIG_WIDGET_FOCUSED, ""}, /**< handled by elm_widget */
80 { SIG_WIDGET_UNFOCUSED, ""}, /**< handled by elm_widget */
81 { NULL, NULL }
82};
83
84static Eina_Bool _key_action_return(Evas_Object *obj, const char *params);
85
86static const Elm_Action key_actions[] = {
87 {"return", _key_action_return},
88 {NULL, NULL}
89};
90
91#ifdef HAVE_ELEMENTARY_WEB
92static char *
93_webkit_theme_find(const Eina_List *list)
94{
95 const Eina_List *l;
96 const char *th;
97
98 EINA_LIST_FOREACH(list, l, th)
99 {
100 char *path = elm_theme_list_item_path_get(th, NULL);
101
102 if (!path) continue;
103
104 if (edje_file_group_exists(path, "webkit/base")) return path;
105
106 free(path);
107 }
108
109 return NULL;
110}
111
112#endif
113
114EOLIAN static Eina_Bool
115_elm_web_elm_widget_theme_apply(Eo *obj, Elm_Web_Data *sd EINA_UNUSED)
116{
117#ifdef HAVE_ELEMENTARY_WEB
118 Eina_Bool int_ret = EINA_FALSE;
119 Elm_Theme *theme;
120 const Eina_List *themes;
121 char *view_theme = NULL;
122
123 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
124
125 eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_theme_apply());
126 if (!int_ret) return EINA_FALSE;
127
128 theme = elm_object_theme_get(obj);
129 themes = elm_theme_overlay_list_get(theme);
130 view_theme = _webkit_theme_find(themes);
131 if (view_theme) goto set;
132
133 themes = elm_theme_list_get(theme);
134 view_theme = _webkit_theme_find(themes);
135 if (view_theme) goto set;
136
137 themes = elm_theme_extension_list_get(theme);
138 view_theme = _webkit_theme_find(themes);
139
140set:
141 if (view_theme)
142 {
143 ewk_view_theme_set(wd->resize_obj, view_theme);
144 free(view_theme);
145 }
146 else
147 ewk_view_theme_set
148 (wd->resize_obj, WEBKIT_DATADIR "/themes/default.edj");
149#else
150 (void)obj;
151#endif
152
153 return EINA_TRUE;
154}
155
156EOLIAN static Eina_Bool
157_elm_web_elm_widget_on_focus(Eo *obj, Elm_Web_Data *sd)
158{
159#ifdef HAVE_ELEMENTARY_WEB
160 Evas_Object *top;
161
162 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_TRUE);
163 Eina_Bool int_ret = EINA_FALSE;
164
165 eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_on_focus());
166 if (!int_ret) return EINA_TRUE;
167
168 top = elm_widget_top_get(obj);
169
170 if (elm_object_focus_get(obj))
171 {
172 evas_object_focus_set(wd->resize_obj, EINA_TRUE);
173 if (top) elm_win_keyboard_mode_set(top, sd->input_method);
174 }
175 else
176 {
177 evas_object_focus_set(wd->resize_obj, EINA_FALSE);
178 if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF);
179 }
180#else
181 (void)obj;
182 (void)sd;
183#endif
184 return EINA_TRUE;
185}
186
187static Eina_Bool
188_key_action_return(Evas_Object *obj, const char *params EINA_UNUSED)
189{
190#ifdef HAVE_ELEMENTARY_WEB
191 ELM_WEB_DATA_GET(obj, sd);
192
193 if (!sd->tab_propagate) return EINA_TRUE;
194 else return EINA_FALSE;
195#else
196 (void)obj;
197#endif
198 return EINA_FALSE;
199}
200
201EOLIAN static Eina_Bool
202_elm_web_elm_widget_event(Eo *obj, Elm_Web_Data *sd, Evas_Object *src, Evas_Callback_Type type, void *event_info)
203{
204 Evas_Event_Key_Down *ev = event_info;
205 (void)sd;
206 (void)src;
207
208#ifdef HAVE_ELEMENTARY_WEB
209 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
210 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
211
212 if (!_elm_config_key_binding_call(obj, ev, key_actions))
213 return EINA_FALSE;
214
215 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
216 return EINA_TRUE;
217#else
218 (void)obj;
219 (void)type;
220 (void)ev;
221#endif
222 return EINA_FALSE;
223}
224
225#ifdef HAVE_ELEMENTARY_WEB
226static Eina_Bool
227_view_pan_animator(void *data)
228{
229 View_Smart_Data *sd = data;
230 Evas_Coord x, y, dx, dy;
231
232 evas_pointer_canvas_xy_get(sd->base.base.evas, &x, &y);
233
234 dx = sd->mouse.x - x;
235 dy = sd->mouse.y - y;
236
237 if ((dx == 0) && (dy == 0))
238 goto end;
239
240 ewk_frame_scroll_add(sd->base.main_frame, dx, dy);
241
242 sd->mouse.x = x;
243 sd->mouse.y = y;
244
245end:
246 return ECORE_CALLBACK_RENEW;
247}
248
249static void
250_view_smart_add(Evas_Object *obj)
251{
252 View_Smart_Data *sd;
253
254 sd = calloc(1, sizeof(View_Smart_Data));
255 evas_object_smart_data_set(obj, sd);
256
257 _ewk_view_parent_sc.sc.add(obj);
258
259 ewk_view_history_enable_set(obj, EINA_TRUE);
260 ewk_history_limit_set(ewk_view_history_get(obj), 100);
261
262 // TODO: auto toggle between smooth/nearest during bring-in animations
263 //ewk_view_zoom_weak_smooth_scale_set(obj, EINA_TRUE);
264}
265
266static void
267_view_smart_del(Evas_Object *obj)
268{
269 View_Smart_Data *sd;
270
271 sd = evas_object_smart_data_get(obj);
272
273 ecore_animator_del(sd->mouse.pan_anim);
274
275 _ewk_view_parent_sc.sc.del(obj);
276}
277
278static Eina_Bool
279_view_longpress_timer(void *data)
280{
281 View_Smart_Data *sd = data;
282
283 sd->mouse.move_count = 0;
284 sd->mouse.longpress_timer = NULL;
285
286 return ECORE_CALLBACK_CANCEL;
287}
288
289static Eina_Bool
290_view_smart_mouse_down(Ewk_View_Smart_Data *esd,
291 const Evas_Event_Mouse_Down *event)
292{
293 // TODO: mimic elm_scroller and like
294 // TODO-minor: offer hook?
295 View_Smart_Data *sd = (View_Smart_Data *)esd;
296
297 if (event->button != 1)
298 return _ewk_view_parent_sc.mouse_down(esd, event);
299
300 sd->mouse.pan_anim = ecore_animator_add(_view_pan_animator, sd);
301 sd->mouse.longpress_timer = ecore_timer_add
302 (_elm_config->longpress_timeout, _view_longpress_timer, sd);
303 sd->mouse.move_count = 1;
304 sd->mouse.x = event->canvas.x;
305 sd->mouse.y = event->canvas.y;
306 sd->mouse.event = *event;
307
308 return EINA_TRUE;
309}
310
311static Eina_Bool
312_view_smart_mouse_up(Ewk_View_Smart_Data *esd,
313 const Evas_Event_Mouse_Up *event)
314{
315 // TODO: mimic elm_scroller and like
316 // TODO-minor: offer hook?
317 View_Smart_Data *sd = (View_Smart_Data *)esd;
318
319 if (sd->mouse.pan_anim)
320 {
321 ELM_SAFE_FREE(sd->mouse.pan_anim, ecore_animator_del);
322
323 if (sd->mouse.longpress_timer)
324 _ewk_view_parent_sc.mouse_down(esd, &sd->mouse.event);
325 else
326 return EINA_TRUE;
327 }
328
329 ELM_SAFE_FREE(sd->mouse.longpress_timer, ecore_timer_del);
330
331 sd->mouse.move_count = 0;
332 return _ewk_view_parent_sc.mouse_up(esd, event);
333}
334
335static Eina_Bool
336_view_smart_mouse_move(Ewk_View_Smart_Data *esd,
337 const Evas_Event_Mouse_Move *event)
338{
339 // TODO: mimic elm_scroller and like
340 // TODO-minor: offer hook?
341 View_Smart_Data *sd = (View_Smart_Data *)esd;
342
343 sd->mouse.move_count++;
344
345 if (((sd->mouse.x ^ sd->mouse.event.canvas.x) |
346 (sd->mouse.y ^ sd->mouse.event.canvas.y)) & (~0x07))
347 {
348 ELM_SAFE_FREE(sd->mouse.longpress_timer, ecore_timer_del);
349 }
350
351 if (sd->mouse.pan_anim)
352 {
353 return EINA_FALSE;
354 }
355
356 return _ewk_view_parent_sc.mouse_move(esd, event);
357}
358
359static Evas_Object *
360_view_smart_window_create(Ewk_View_Smart_Data *vsd,
361 Eina_Bool javascript,
362 const Ewk_Window_Features *window_features)
363{
364 Evas_Object *new;
365 Evas_Object *obj = evas_object_smart_parent_get(vsd->self);
366
367 ELM_WEB_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
368
369 if (!sd->hook.window_create) return NULL;
370
371 new = sd->hook.window_create
372 (sd->hook.window_create_data, obj, javascript,
373 (const Elm_Web_Window_Features *)window_features);
374 if (new) return elm_web_webkit_view_get(new);
375
376 return NULL;
377}
378
379static void
380_view_smart_window_close(Ewk_View_Smart_Data *sd)
381{
382 Evas_Object *obj = evas_object_smart_parent_get(sd->self);
383
384 ELM_WEB_CHECK(obj);
385
386 evas_object_smart_callback_call(obj, "windows,close,request", NULL);
387}
388
389static void
390_bt_close(void *data,
391 Evas_Object *obj,
392 void *event_info EINA_UNUSED)
393{
394 Dialog_Data *d = data;
395
396 *d->response = (obj == d->bt_ok);
397 if ((d->type == DIALOG_PROMPT) && (*d->response == EINA_TRUE))
398 *d->entry_value = strdup(elm_entry_entry_get(d->entry));
399
400 evas_object_del(d->dialog);
401}
402
403static void
404_file_sel_done(void *data,
405 Evas_Object *obj EINA_UNUSED,
406 void *event_info)
407{
408 Dialog_Data *d = data;
409
410 if (event_info)
411 {
412 *d->selected_files = eina_list_append(NULL, strdup(event_info));
413 *d->response = EINA_TRUE;
414 }
415 else *d->response = EINA_FALSE;
416
417 evas_object_del(d->dialog);
418 free(d);
419}
420
421static Dialog_Data *
422_dialog_new(Evas_Object *parent)
423{
424 Dialog_Data *d;
425
426 ELM_WEB_DATA_GET(parent, sd);
427
428 d = calloc(1, sizeof(Dialog_Data));
429 if (!d) return NULL;
430
431 if (!parent || !sd->inwin_mode)
432 {
433 Evas_Object *bg;
434
435 d->dialog = elm_win_add(NULL, "elm-web-popup", ELM_WIN_DIALOG_BASIC);
436 evas_object_smart_callback_add
437 (d->dialog, "delete,request", _bt_close, d);
438
439 bg = elm_bg_add(d->dialog);
440 evas_object_size_hint_weight_set
441 (bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
442 elm_win_resize_object_add(d->dialog, bg);
443 evas_object_show(bg);
444
445 d->box = elm_box_add(d->dialog);
446 evas_object_size_hint_weight_set
447 (d->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
448 elm_win_resize_object_add(d->dialog, d->box);
449 evas_object_show(d->box);
450 }
451 else
452 {
453 Evas_Object *win = elm_widget_top_get(parent);
454
455 d->dialog = elm_win_inwin_add(win);
456 elm_object_style_set(d->dialog, "minimal");
457 evas_object_size_hint_weight_set
458 (d->dialog, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
459
460 d->box = elm_box_add(win);
461 evas_object_size_hint_weight_set
462 (d->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
463 elm_win_inwin_content_set(d->dialog, d->box);
464 evas_object_show(d->box);
465 }
466
467 return d;
468}
469
470static Evas_Object *
471_run_dialog(Evas_Object *parent,
472 enum Dialog_Type type,
473 const char *message,
474 const char *default_entry_value,
475 const char **entry_value,
476 Eina_Bool allows_multiple_files EINA_UNUSED,
477 Eina_List *accept_types EINA_UNUSED,
478 Eina_List **selected_filenames,
479 Eina_Bool *response)
480{
481 Evas_Object *lb;
482 Evas_Object *obj;
483 Dialog_Data *dialog_data;
484
485 EINA_SAFETY_ON_TRUE_RETURN_VAL
486 ((type != DIALOG_PROMPT) && (!!default_entry_value), EINA_FALSE);
487 EINA_SAFETY_ON_TRUE_RETURN_VAL
488 ((type != DIALOG_PROMPT) && (!!entry_value), EINA_FALSE);
489
490 obj = evas_object_smart_parent_get(parent);
491
492 ELM_WEB_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
493
494 dialog_data = _dialog_new(obj);
495
496 if (type != DIALOG_FILE_SELECTOR)
497 {
498 lb = elm_label_add(dialog_data->box);
499 elm_object_text_set(lb, message);
500 elm_box_pack_end(dialog_data->box, lb);
501 evas_object_show(lb);
502 }
503
504 dialog_data->type = type;
505 dialog_data->response = response;
506 dialog_data->entry_value = entry_value;
507 dialog_data->selected_files = selected_filenames;
508
509 if (type == DIALOG_ALERT)
510 {
511 dialog_data->bt_ok = elm_button_add(dialog_data->box);
512 elm_object_text_set(dialog_data->bt_ok, "Close");
513 elm_box_pack_end(dialog_data->box, dialog_data->bt_ok);
514 evas_object_size_hint_align_set
515 (dialog_data->bt_ok, EVAS_HINT_FILL, EVAS_HINT_FILL);
516 evas_object_smart_callback_add
517 (dialog_data->bt_ok, "clicked", _bt_close, dialog_data);
518 evas_object_show(dialog_data->bt_ok);
519 }
520 else if (type == DIALOG_FILE_SELECTOR)
521 {
522 dialog_data->file_sel = elm_fileselector_add(dialog_data->dialog);
523 evas_object_size_hint_weight_set(dialog_data->file_sel,
524 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
525 evas_object_size_hint_align_set(dialog_data->file_sel, EVAS_HINT_FILL,
526 EVAS_HINT_FILL);
527 elm_box_pack_end(dialog_data->box, dialog_data->file_sel);
528 evas_object_show(dialog_data->file_sel);
529
530 elm_fileselector_path_set(dialog_data->file_sel, ".");
531 elm_fileselector_is_save_set(dialog_data->file_sel, EINA_FALSE);
532 elm_fileselector_folder_only_set(dialog_data->file_sel, EINA_FALSE);
533 elm_fileselector_buttons_ok_cancel_set(dialog_data->file_sel,
534 EINA_TRUE);
535 elm_fileselector_expandable_set(dialog_data->file_sel, EINA_FALSE);
536 evas_object_smart_callback_add(dialog_data->file_sel, "done",
537 _file_sel_done, dialog_data);
538 // fileselector can't set it's minimum size correctly
539 evas_object_size_hint_min_set(dialog_data->file_sel, 300, 400);
540 }
541 else
542 {
543 if (type == DIALOG_PROMPT)
544 {
545 dialog_data->entry = elm_entry_add(dialog_data->box);
546 elm_entry_single_line_set(dialog_data->entry, EINA_TRUE);
547 elm_entry_scrollable_set(dialog_data->entry, EINA_TRUE);
548 elm_entry_entry_set(dialog_data->entry, default_entry_value);
549 evas_object_size_hint_align_set
550 (dialog_data->entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
551 evas_object_size_hint_weight_set
552 (dialog_data->entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
553 elm_box_pack_end(dialog_data->box, dialog_data->entry);
554 evas_object_show(dialog_data->entry);
555 }
556
557 if (type == DIALOG_PROMPT || type == DIALOG_CONFIRM)
558 {
559 Evas_Object *bx_h = elm_box_add(dialog_data->box);
560 elm_box_horizontal_set(bx_h, EINA_TRUE);
561 elm_box_pack_end(dialog_data->box, bx_h);
562 evas_object_size_hint_weight_set
563 (bx_h, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
564 evas_object_size_hint_align_set
565 (bx_h, EVAS_HINT_FILL, EVAS_HINT_FILL);
566 evas_object_show(bx_h);
567
568 dialog_data->bt_cancel = elm_button_add(bx_h);
569 elm_object_text_set(dialog_data->bt_cancel, "Cancel");
570 elm_box_pack_end(bx_h, dialog_data->bt_cancel);
571 evas_object_size_hint_weight_set
572 (dialog_data->bt_cancel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
573 evas_object_size_hint_align_set
574 (dialog_data->bt_cancel, EVAS_HINT_FILL, EVAS_HINT_FILL);
575 evas_object_smart_callback_add
576 (dialog_data->bt_cancel, "clicked", _bt_close, dialog_data);
577 evas_object_show(dialog_data->bt_cancel);
578
579 dialog_data->bt_ok = elm_button_add(bx_h);
580 elm_object_text_set(dialog_data->bt_ok, "Ok");
581 elm_box_pack_end(bx_h, dialog_data->bt_ok);
582 evas_object_size_hint_weight_set
583 (dialog_data->bt_ok, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
584 evas_object_size_hint_align_set
585 (dialog_data->bt_ok, EVAS_HINT_FILL, EVAS_HINT_FILL);
586 evas_object_smart_callback_add
587 (dialog_data->bt_ok, "clicked", _bt_close, dialog_data);
588 evas_object_show(dialog_data->bt_ok);
589 }
590 else return EINA_FALSE;
591 }
592
593 evas_object_show(dialog_data->dialog);
594
595 return dialog_data->dialog;
596}
597
598static void
599_dialog_del_cb(void *data EINA_UNUSED,
600 Evas *e EINA_UNUSED,
601 Evas_Object *obj EINA_UNUSED,
602 void *event_info EINA_UNUSED)
603{
604 ecore_main_loop_quit();
605}
606
607static void
608_exec_dialog(Evas_Object *dialog)
609{
610 evas_object_event_callback_add
611 (dialog, EVAS_CALLBACK_DEL, _dialog_del_cb, NULL);
612 ecore_main_loop_begin();
613}
614
615/*
616 * called by ewk_view when javascript called alert()
617 */
618static void
619_view_smart_run_javascript_alert(Ewk_View_Smart_Data *esd,
620 Evas_Object *frame EINA_UNUSED,
621 const char *message)
622{
623 View_Smart_Data *vsd = (View_Smart_Data *)esd;
624 Evas_Object *view = vsd->base.self;
625 Evas_Object *obj = evas_object_smart_parent_get(view);
626 Evas_Object *diag = NULL;
627 Eina_Bool response = EINA_FALSE;
628
629 ELM_WEB_DATA_GET_OR_RETURN(obj, sd);
630
631 if (sd->hook.alert)
632 diag = sd->hook.alert(sd->hook.alert_data, obj, message);
633 else
634 diag = _run_dialog(view, DIALOG_ALERT, message, NULL, NULL, EINA_FALSE,
635 NULL, NULL, &response);
636 if (diag) _exec_dialog(diag);
637}
638
639/*
640 * called by ewk_view when javascript called confirm()
641 */
642static Eina_Bool
643_view_smart_run_javascript_confirm(Ewk_View_Smart_Data *esd,
644 Evas_Object *frame EINA_UNUSED,
645 const char *message)
646{
647 View_Smart_Data *vsd = (View_Smart_Data *)esd;
648 Evas_Object *view = vsd->base.self;
649 Evas_Object *obj = evas_object_smart_parent_get(view);
650 Evas_Object *diag = NULL;
651 Eina_Bool response = EINA_FALSE;
652
653 ELM_WEB_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
654
655 if (sd->hook.confirm)
656 diag = sd->hook.confirm(sd->hook.confirm_data, obj, message, &response);
657 else
658 diag = _run_dialog(view, DIALOG_CONFIRM, message, NULL, NULL, EINA_FALSE,
659 NULL, NULL, &response);
660 if (diag) _exec_dialog(diag);
661 return response;
662}
663
664/*
665 * called by ewk_view when javascript called confirm()
666 */
667static Eina_Bool
668_view_smart_run_javascript_prompt(Ewk_View_Smart_Data *esd,
669 Evas_Object *frame EINA_UNUSED,
670 const char *message,
671 const char *default_value,
672 const char **value)
673{
674 View_Smart_Data *vsd = (View_Smart_Data *)esd;
675 Evas_Object *view = vsd->base.self;
676 Evas_Object *obj = evas_object_smart_parent_get(view);
677 Evas_Object *diag = NULL;
678 Eina_Bool response = EINA_FALSE;
679
680 ELM_WEB_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
681
682 if (sd->hook.prompt)
683 diag = sd->hook.prompt(sd->hook.prompt_data, obj, message, default_value,
684 value, &response);
685 else
686 diag = _run_dialog(view, DIALOG_PROMPT, message, default_value, value,
687 EINA_FALSE, NULL, NULL, &response);
688 if (diag) _exec_dialog(diag);
689 if (!response)
690 *value = NULL;
691
692 return EINA_TRUE;
693}
694
695static Eina_Bool
696_view_smart_run_open_panel(Ewk_View_Smart_Data *esd,
697 Evas_Object *frame EINA_UNUSED,
698 Ewk_File_Chooser *request,
699 Eina_List **selected_filenames)
700{
701 View_Smart_Data *vsd = (View_Smart_Data *)esd;
702 Evas_Object *view = vsd->base.self;
703 Evas_Object *obj = evas_object_smart_parent_get(view);
704 Evas_Object *diag = NULL;
705 Eina_Bool response = EINA_FALSE;
706
707 ELM_WEB_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
708
709 if (sd->hook.file_selector)
710 diag = sd->hook.file_selector(sd->hook.file_selector_data, obj,
711 ewk_file_chooser_allows_multiple_files_get(request),
712 ewk_file_chooser_accept_mimetypes_get(request),
713 selected_filenames, &response);
714 else
715 diag = _run_dialog(view, DIALOG_FILE_SELECTOR, NULL, NULL, NULL,
716 ewk_file_chooser_allows_multiple_files_get(request),
717 ewk_file_chooser_accept_mimetypes_get(request),
718 selected_filenames, &response);
719 if (diag) _exec_dialog(diag);
720
721 return response;
722}
723
724static void
725_view_smart_add_console_message(Ewk_View_Smart_Data *esd,
726 const char *message,
727 unsigned int line_number,
728 const char *source_id)
729{
730 Evas_Object *obj = evas_object_smart_parent_get(esd->self);
731
732 ELM_WEB_DATA_GET_OR_RETURN(obj, sd);
733
734 if (sd->hook.console_message)
735 sd->hook.console_message(sd->hook.console_message_data, obj, message,
736 line_number, source_id);
737}
738
739static Eina_Bool
740_view_smart_focus_can_cycle(Ewk_View_Smart_Data *sd,
741 Ewk_Focus_Direction direction)
742{
743 Evas_Object *obj = evas_object_smart_parent_get(sd->self);
744
745 ELM_WEB_CHECK(obj) EINA_FALSE;
746
747 Elm_Focus_Direction dir;
748
749 switch (direction)
750 {
751 case EWK_FOCUS_DIRECTION_FORWARD:
752 dir = ELM_FOCUS_NEXT;
753 break;
754
755 case EWK_FOCUS_DIRECTION_BACKWARD:
756 dir = ELM_FOCUS_PREVIOUS;
757 break;
758
759 default:
760 return EINA_FALSE;
761 }
762
763 elm_widget_focus_cycle(elm_widget_parent_get(obj), dir);
764
765 return EINA_TRUE;
766}
767
768/**
769 * Creates a new view object given the parent.
770 *
771 * @param parent object to use as parent.
772 *
773 * @return newly added Evas_Object or @c NULL on errors.
774 */
775Evas_Object *
776_view_add(Evas_Object *parent)
777{
778 Evas *canvas = evas_object_evas_get(parent);
779 static Evas_Smart *smart = NULL;
780 Evas_Object *view;
781
782 if (!smart)
783 {
784 static Ewk_View_Smart_Class api =
785 EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("EWK_View_Elementary");
786
787 ewk_view_smart_set(&api);
788
789 _ewk_view_parent_sc = api;
790
791 // TODO: check every api method and provide overrides with hooks!
792 // TODO: hooks should provide extension points
793 // TODO: extension should have some kind of "default implementation",
794 // TODO: that can be replaced or controlled by hooks.
795 // TODO: ie: run_javascript_alert() should present an elm_win
796 // TODO: by default, but user could override it to show as inwin.
797 api.sc.add = _view_smart_add;
798 api.sc.del = _view_smart_del;
799 //api.sc.calculate = _view_smart_calculate;
800 api.mouse_down = _view_smart_mouse_down;
801 api.mouse_up = _view_smart_mouse_up;
802 api.mouse_move = _view_smart_mouse_move;
803 api.add_console_message = _view_smart_add_console_message;
804 api.window_create = _view_smart_window_create;
805 api.window_close = _view_smart_window_close;
806 api.run_javascript_alert = _view_smart_run_javascript_alert;
807 api.run_javascript_confirm = _view_smart_run_javascript_confirm;
808 api.run_javascript_prompt = _view_smart_run_javascript_prompt;
809 api.run_open_panel = _view_smart_run_open_panel;
810 api.focus_can_cycle = _view_smart_focus_can_cycle;
811
812 smart = evas_smart_class_new(&api.sc);
813 if (!smart)
814 {
815 CRI("Could not create smart class");
816 return NULL;
817 }
818 }
819
820 view = evas_object_smart_add(canvas, smart);
821 if (!view)
822 {
823 ERR("Could not create smart object object for view");
824 return NULL;
825 }
826
827 return view;
828}
829
830static void
831_ewk_view_inputmethod_change_cb(void *data,
832 Evas_Object *obj EINA_UNUSED,
833 void *event_info)
834{
835 ELM_WEB_DATA_GET(data, sd);
836 Evas_Object *top = elm_widget_top_get(sd->obj);
837 if (!top) return;
838
839 if (event_info)
840 sd->input_method = ELM_WIN_KEYBOARD_ON;
841 else
842 sd->input_method = ELM_WIN_KEYBOARD_OFF;
843 elm_win_keyboard_mode_set(top, sd->input_method);
844}
845
846static void
847_ewk_view_load_started_cb(void *data,
848 Evas_Object *obj,
849 void *event_info EINA_UNUSED)
850{
851 _ewk_view_inputmethod_change_cb(data, obj, (void *)(long)EINA_FALSE);
852}
853
854static void
855_ewk_view_load_finished_cb(void *data,
856 Evas_Object *obj EINA_UNUSED,
857 void *event_info)
858{
859 ELM_WEB_DATA_GET(data, sd);
860
861 if (event_info) return;
862
863 if (sd->zoom.mode != ELM_WEB_ZOOM_MODE_MANUAL)
864 {
865 float tz = sd->zoom.current;
866 sd->zoom.current = 0.0;
867 elm_web_zoom_set(sd->obj, tz);
868 }
869}
870
871static void
872_ewk_view_viewport_changed_cb(void *data,
873 Evas_Object *obj,
874 void *event_info EINA_UNUSED)
875{
876 ELM_WEB_DATA_GET(data, sd);
877
878 if (sd->zoom.mode != ELM_WEB_ZOOM_MODE_MANUAL)
879 {
880 ewk_view_zoom_set(obj, 1.0, 0, 0);
881 sd->zoom.no_anim = EINA_TRUE;
882 }
883}
884
885static Eina_Bool
886_restore_zoom_mode_timer_cb(void *data)
887{
888 ELM_WEB_DATA_GET(data, sd);
889 float tz = sd->zoom.current;
890
891 sd->zoom.timer = NULL;
892 sd->zoom.current = 0.0;
893 sd->zoom.no_anim = EINA_TRUE;
894 elm_web_zoom_set(sd->obj, tz);
895
896 return EINA_FALSE;
897}
898
899static Eina_Bool
900_reset_zoom_timer_cb(void *data)
901{
902 ELM_WEB_DATA_GET(data, sd);
903 ELM_WIDGET_DATA_GET_OR_RETURN(data, wd, EINA_FALSE);
904
905 sd->zoom.timer = ecore_timer_add(0.0, _restore_zoom_mode_timer_cb, data);
906 ewk_view_zoom_set(wd->resize_obj, 1.0, 0, 0);
907
908 return EINA_FALSE;
909}
910
911static void
912_ewk_view_resized_cb(void *data,
913 Evas_Object *obj EINA_UNUSED,
914 void *event_info EINA_UNUSED)
915{
916 ELM_WEB_DATA_GET(data, sd);
917
918 if (!(sd->zoom.mode != ELM_WEB_ZOOM_MODE_MANUAL))
919 return;
920
921 ecore_timer_del(sd->zoom.timer);
922 sd->zoom.timer = ecore_timer_add(0.5, _reset_zoom_timer_cb, data);
923}
924
925static void
926_popup_del_job(void *data)
927{
928 evas_object_del(data);
929}
930
931static void
932_popup_will_delete(void *data,
933 Evas_Object *obj,
934 void *event_info EINA_UNUSED)
935{
936 ecore_job_add(_popup_del_job, data);
937 evas_object_smart_callback_del(obj, "popup,willdelete", _popup_will_delete);
938}
939
940static void
941_popup_item_selected(void *data,
942 Evas_Object *obj,
943 void *event_info EINA_UNUSED)
944{
945 Elm_Object_Item *list_it = elm_list_selected_item_get(obj);
946 const Eina_List *itr, *list = elm_list_items_get(obj);
947 Evas_Object *view = data;
948 int i = 0;
949 void *d;
950
951 EINA_LIST_FOREACH(list, itr, d)
952 {
953 if (d == list_it)
954 break;
955
956 i++;
957 }
958
959 ewk_view_popup_selected_set(view, i);
960 ewk_view_popup_destroy(view);
961}
962
963static void
964_popup_dismiss_cb(void *data,
965 Evas_Object *obj EINA_UNUSED,
966 void *event_info EINA_UNUSED)
967{
968 ewk_view_popup_destroy(data);
969}
970
971static void
972_ewk_view_popup_create_cb(void *data,
973 Evas_Object *obj,
974 void *event_info)
975{
976 ELM_WEB_DATA_GET(data, sd);
977 Evas_Object *notify, *list, *grid, *win;
978 Ewk_Menu *m = event_info;
979 Ewk_Menu_Item *it;
980 Elm_Web_Menu m2;
981 Eina_List *itr;
982
983 int h, ww, wh;
984
985 m2.items = m->items;
986 m2.x = m->x;
987 m2.y = m->y;
988 m2.width = m->width;
989 m2.height = m->height;
990 m2.handled = EINA_FALSE;
991 evas_object_smart_callback_call
992 (sd->obj, "popup,create", &m2);
993 if (m2.handled) return;
994
995 win = elm_widget_top_get(data);
996
997 notify = elm_notify_add(win);
998 elm_notify_allow_events_set(notify, EINA_FALSE);
999 elm_notify_align_set(notify, 0.5, 1.0);
1000
1001 list = elm_list_add(data);
1002 elm_list_select_mode_set(data, ELM_OBJECT_SELECT_MODE_ALWAYS);
1003 elm_scroller_bounce_set(list, EINA_FALSE, EINA_FALSE);
1004 elm_list_mode_set(list, ELM_LIST_EXPAND);
1005 evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1006 evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
1007 evas_object_show(list);
1008
1009 EINA_LIST_FOREACH(m->items, itr, it)
1010 elm_list_item_append(list, it->text, NULL, NULL, _popup_item_selected,
1011 obj);
1012 elm_list_go(list);
1013
1014 grid = elm_grid_add(data);
1015 elm_grid_size_set(grid, 1, 1);
1016 elm_grid_pack(grid, list, 0, 0, 1, 1);
1017 evas_object_geometry_get(win, NULL, NULL, &ww, &wh);
1018 //FIXME: it should be the real height of items in the list.
1019 h = m->height * eina_list_count(m->items);
1020 evas_object_size_hint_min_set(grid, ww, h < wh / 2 ? h : wh / 2);
1021 elm_object_content_set(notify, grid);
1022 evas_object_show(grid);
1023
1024 evas_object_show(notify);
1025
1026 evas_object_smart_callback_add
1027 (obj, "popup,willdelete", _popup_will_delete, notify);
1028 evas_object_smart_callback_add
1029 (notify, "block,clicked", _popup_dismiss_cb, obj);
1030}
1031
1032static void
1033_view_smart_callback_proxy_free_cb(void *data,
1034 Evas *e EINA_UNUSED,
1035 Evas_Object *obj EINA_UNUSED,
1036 void *event_info EINA_UNUSED)
1037{
1038 free(data);
1039}
1040
1041static void
1042_view_smart_callback_proxy_cb(void *data,
1043 Evas_Object *obj EINA_UNUSED,
1044 void *event_info)
1045{
1046 Elm_Web_Callback_Proxy_Context *ctxt = data;
1047
1048 if (!strcmp(ctxt->name, "uri,changed"))
1049 evas_object_smart_callback_call(ctxt->obj, "url,changed", event_info);
1050
1051 evas_object_smart_callback_call(ctxt->obj, ctxt->name, event_info);
1052}
1053
1054static void
1055_view_smart_callback_proxy(Evas_Object *view,
1056 Evas_Object *parent)
1057{
1058 const Evas_Smart_Cb_Description **cls_descs, **inst_descs;
1059 unsigned int cls_count, inst_count, total;
1060 Elm_Web_Callback_Proxy_Context *ctxt;
1061
1062 evas_object_smart_callbacks_descriptions_get
1063 (view, &cls_descs, &cls_count, &inst_descs, &inst_count);
1064 total = cls_count + inst_count;
1065 if (!total) return;
1066
1067 ctxt = malloc(sizeof(Elm_Web_Callback_Proxy_Context) * total);
1068 if (!ctxt) return;
1069
1070 evas_object_event_callback_add
1071 (view, EVAS_CALLBACK_FREE, _view_smart_callback_proxy_free_cb, ctxt);
1072
1073 for (; cls_count > 0; cls_count--, cls_descs++, ctxt++)
1074 {
1075 const Evas_Smart_Cb_Description *d = *cls_descs;
1076 if (!strcmp(d->name, "popup,create"))
1077 continue;
1078 ctxt->name = d->name;
1079 ctxt->obj = parent;
1080 evas_object_smart_callback_add
1081 (view, d->name, _view_smart_callback_proxy_cb, ctxt);
1082 }
1083
1084 for (; inst_count > 0; inst_count--, inst_descs++, ctxt++)
1085 {
1086 const Evas_Smart_Cb_Description *d = *inst_descs;
1087 ctxt->name = d->name;
1088 ctxt->obj = parent;
1089 evas_object_smart_callback_add
1090 (view, d->name, _view_smart_callback_proxy_cb, ctxt);
1091 }
1092}
1093
1094static Eina_Bool
1095_bring_in_anim_cb(void *data,
1096 double pos)
1097{
1098 ELM_WEB_DATA_GET(data, sd);
1099 ELM_WIDGET_DATA_GET_OR_RETURN(data, wd, ECORE_CALLBACK_CANCEL);
1100
1101 Evas_Object *frame =
1102 ewk_view_frame_main_get(wd->resize_obj);
1103 int sx, sy, rx, ry;
1104
1105 sx = sd->bring_in.start.x;
1106 sy = sd->bring_in.start.y;
1107 rx = (sd->bring_in.end.x - sx) * pos;
1108 ry = (sd->bring_in.end.y - sy) * pos;
1109
1110 ewk_frame_scroll_set(frame, rx + sx, ry + sy);
1111
1112 if (pos == 1.0)
1113 {
1114 sd->bring_in.end.x = sd->bring_in.end.y = sd->bring_in.start.x =
1115 sd->bring_in.start.y = 0;
1116 sd->bring_in.animator = NULL;
1117 }
1118
1119 return ECORE_CALLBACK_RENEW;
1120}
1121
1122#endif
1123
1124#ifdef HAVE_ELEMENTARY_WEB
1125static Eina_Bool _elm_need_web = EINA_FALSE;
1126#endif
1127
1128void
1129_elm_unneed_web(void)
1130{
1131#ifdef HAVE_ELEMENTARY_WEB
1132 if (!_elm_need_web) return;
1133 _elm_need_web = EINA_FALSE;
1134 ewk_shutdown();
1135#endif
1136}
1137
1138EAPI Eina_Bool
1139elm_need_web(void)
1140{
1141#ifdef HAVE_ELEMENTARY_WEB
1142 if (_elm_need_web) return EINA_TRUE;
1143 _elm_need_web = EINA_TRUE;
1144 ewk_init();
1145 return EINA_TRUE;
1146#else
1147 return EINA_FALSE;
1148#endif
1149}
1150
1151EOLIAN static void
1152_elm_web_evas_object_smart_add(Eo *obj, Elm_Web_Data *priv)
1153{
1154 Evas_Object *resize_obj;
1155
1156#ifdef HAVE_ELEMENTARY_WEB
1157 resize_obj = _view_add(obj);
1158#else
1159 resize_obj = elm_label_add(obj);
1160 elm_object_text_set(resize_obj, "WebKit not supported!");
1161#endif
1162
1163 elm_widget_resize_object_set(obj, resize_obj, EINA_TRUE);
1164
1165 eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
1166 elm_widget_sub_object_parent_add(obj);
1167
1168#ifdef HAVE_ELEMENTARY_WEB
1169 ewk_view_setting_user_agent_set
1170 (resize_obj, ELM_WEB_USER_AGENT);
1171
1172 priv->input_method = ELM_WIN_KEYBOARD_OFF;
1173 evas_object_smart_callback_add
1174 (resize_obj, "inputmethod,changed",
1175 _ewk_view_inputmethod_change_cb, obj);
1176 evas_object_smart_callback_add
1177 (resize_obj, "load,started",
1178 _ewk_view_load_started_cb, obj);
1179 evas_object_smart_callback_add
1180 (resize_obj, "popup,create",
1181 _ewk_view_popup_create_cb, obj);
1182 evas_object_smart_callback_add
1183 (resize_obj, "load,finished",
1184 _ewk_view_load_finished_cb, obj);
1185 evas_object_smart_callback_add
1186 (resize_obj, "viewport,changed",
1187 _ewk_view_viewport_changed_cb, obj);
1188 evas_object_smart_callback_add
1189 (resize_obj, "view,resized",
1190 _ewk_view_resized_cb, obj);
1191
1192 priv->inwin_mode = _elm_config->inwin_dialogs_enable;
1193 priv->zoom.min =
1194 ewk_view_zoom_range_min_get(resize_obj);
1195 priv->zoom.max =
1196 ewk_view_zoom_range_max_get(resize_obj);
1197 priv->zoom.current = 1.0;
1198
1199 _view_smart_callback_proxy(resize_obj, obj);
1200 eo_do(obj, elm_obj_widget_theme_apply());
1201
1202 elm_widget_can_focus_set(obj, EINA_TRUE);
1203#else
1204 (void)priv;
1205#endif
1206}
1207
1208EOLIAN static void
1209_elm_web_evas_object_smart_del(Eo *obj, Elm_Web_Data *sd)
1210{
1211#ifdef HAVE_ELEMENTARY_WEB
1212 ecore_timer_del(sd->zoom.timer);
1213 ecore_animator_del(sd->bring_in.animator);
1214
1215#else
1216 (void)sd;
1217#endif
1218
1219 eo_do_super(obj, MY_CLASS, evas_obj_smart_del());
1220}
1221
1222EAPI Evas_Object *
1223elm_web_add(Evas_Object *parent)
1224{
1225 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
1226 Evas_Object *obj = eo_add(MY_CLASS, parent);
1227 eo_unref(obj);
1228 return obj;
1229}
1230
1231EOLIAN static void
1232_elm_web_eo_base_constructor(Eo *obj, Elm_Web_Data *sd)
1233{
1234 sd->obj = obj;
1235 eo_do_super(obj, MY_CLASS, eo_constructor());
1236 eo_do(obj,
1237 evas_obj_type_set(MY_CLASS_NAME_LEGACY),
1238 evas_obj_smart_callbacks_descriptions_set(_elm_web_smart_callbacks),
1239 elm_interface_atspi_accessible_role_set(ELM_ATSPI_ROLE_HTML_CONTAINER));
1240}
1241
1242EOLIAN static Evas_Object*
1243_elm_web_webkit_view_get(Eo *obj, Elm_Web_Data *sd EINA_UNUSED)
1244{
1245#ifdef HAVE_ELEMENTARY_WEB
1246 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
1247
1248 return wd->resize_obj;
1249#else
1250 (void)obj;
1251 ERR("Elementary not compiled with EWebKit support.");
1252 return NULL;
1253#endif
1254
1255}
1256
1257EOLIAN static void
1258_elm_web_window_create_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Elm_Web_Window_Open func, void *data)
1259{
1260#ifdef HAVE_ELEMENTARY_WEB
1261 sd->hook.window_create = func;
1262 sd->hook.window_create_data = data;
1263#else
1264 (void)sd;
1265 (void)func;
1266 (void)data;
1267#endif
1268}
1269
1270EOLIAN static void
1271_elm_web_dialog_alert_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Elm_Web_Dialog_Alert func, void *data)
1272{
1273#ifdef HAVE_ELEMENTARY_WEB
1274 sd->hook.alert = func;
1275 sd->hook.alert_data = data;
1276#else
1277 (void)func;
1278 (void)data;
1279 (void)sd;
1280#endif
1281}
1282
1283EOLIAN static void
1284_elm_web_dialog_confirm_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Elm_Web_Dialog_Confirm func, void *data)
1285{
1286#ifdef HAVE_ELEMENTARY_WEB
1287 sd->hook.confirm = func;
1288 sd->hook.confirm_data = data;
1289#else
1290 (void)func;
1291 (void)data;
1292 (void)sd;
1293#endif
1294}
1295
1296EOLIAN static void
1297_elm_web_dialog_prompt_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Elm_Web_Dialog_Prompt func, void *data)
1298{
1299#ifdef HAVE_ELEMENTARY_WEB
1300 sd->hook.prompt = func;
1301 sd->hook.prompt_data = data;
1302#else
1303 (void)func;
1304 (void)data;
1305 (void)sd;
1306#endif
1307}
1308
1309EOLIAN static void
1310_elm_web_dialog_file_selector_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Elm_Web_Dialog_File_Selector func, void *data)
1311{
1312#ifdef HAVE_ELEMENTARY_WEB
1313 sd->hook.file_selector = func;
1314 sd->hook.file_selector_data = data;
1315#else
1316 (void)func;
1317 (void)data;
1318 (void)sd;
1319#endif
1320}
1321
1322EOLIAN static void
1323_elm_web_console_message_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Elm_Web_Console_Message func, void *data)
1324{
1325#ifdef HAVE_ELEMENTARY_WEB
1326 sd->hook.console_message = func;
1327 sd->hook.console_message_data = data;
1328#else
1329 (void)func;
1330 (void)data;
1331 (void)sd;
1332#endif
1333}
1334
1335EOLIAN static void
1336_elm_web_useragent_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, const char *user_agent)
1337{
1338#ifdef HAVE_ELEMENTARY_WEB
1339 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
1340
1341 ewk_view_setting_user_agent_set
1342 (wd->resize_obj, user_agent);
1343#else
1344 (void)user_agent;
1345 (void)obj;
1346#endif
1347}
1348
1349EOLIAN static const char*
1350_elm_web_useragent_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1351{
1352#ifdef HAVE_ELEMENTARY_WEB
1353 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
1354
1355 return ewk_view_setting_user_agent_get(wd->resize_obj);
1356#else
1357 (void)obj;
1358 return NULL;
1359#endif
1360}
1361
1362EOLIAN static Eina_Bool
1363_elm_web_tab_propagate_get(Eo *obj EINA_UNUSED, Elm_Web_Data *sd)
1364{
1365#ifdef HAVE_ELEMENTARY_WEB
1366 return sd->tab_propagate;
1367#else
1368 (void)sd;
1369 return EINA_FALSE;
1370#endif
1371}
1372
1373EOLIAN static void
1374_elm_web_tab_propagate_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Eina_Bool propagate)
1375{
1376#ifdef HAVE_ELEMENTARY_WEB
1377 sd->tab_propagate = propagate;
1378#else
1379 (void)propagate;
1380 (void)sd;
1381#endif
1382}
1383
1384EAPI Eina_Bool
1385elm_web_uri_set(Evas_Object *obj,
1386 const char *url)
1387{
1388#ifdef HAVE_ELEMENTARY_WEB
1389 ELM_WEB_CHECK(obj) EINA_FALSE;
1390 Eina_Bool ret = EINA_FALSE;
1391 eo_do(obj, ret = elm_obj_web_url_set(url));
1392 return ret;
1393#else
1394 (void)obj;
1395 (void)url;
1396 return EINA_FALSE;
1397#endif
1398}
1399
1400EAPI const char *
1401elm_web_uri_get(const Evas_Object *obj)
1402{
1403 const char *ret = NULL;
1404 eo_do((Eo *) obj, ret = elm_obj_web_url_get());
1405 return ret;
1406}
1407
1408EOLIAN static Eina_Bool
1409_elm_web_url_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, const char *url)
1410{
1411#ifdef HAVE_ELEMENTARY_WEB
1412 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1413
1414 return ewk_view_uri_set(wd->resize_obj, url);
1415#else
1416 (void)url;
1417 (void)obj;
1418 return EINA_FALSE;
1419#endif
1420}
1421
1422EOLIAN static const char*
1423_elm_web_url_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1424{
1425#ifdef HAVE_ELEMENTARY_WEB
1426 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
1427
1428 return ewk_view_uri_get(wd->resize_obj);
1429#else
1430 (void)obj;
1431 return NULL;
1432#endif
1433}
1434
1435EOLIAN static Eina_Bool
1436_elm_web_html_string_load(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, const char *html, const char *base_url, const char *unreachable_url)
1437{
1438#ifdef HAVE_ELEMENTARY_WEB
1439 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1440
1441 if (!unreachable_url)
1442 return ewk_frame_contents_set(
1443 ewk_view_frame_main_get(wd->resize_obj),
1444 html, 0, NULL, NULL,
1445 base_url);
1446 else
1447 return ewk_frame_contents_alternate_set(
1448 ewk_view_frame_main_get(wd->resize_obj),
1449 html, 0, NULL, NULL,
1450 base_url, unreachable_url);
1451#else
1452 (void)obj;
1453 (void)html;
1454 (void)base_url;
1455 (void)unreachable_url;
1456 return EINA_FALSE;
1457#endif
1458}
1459
1460EOLIAN static const char*
1461_elm_web_title_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1462{
1463#ifdef HAVE_ELEMENTARY_WEB
1464 const Ewk_Text_With_Direction *txt;
1465
1466 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
1467
1468 txt = ewk_view_title_get(wd->resize_obj);
1469 if (txt) return txt->string;
1470#else
1471 (void)obj;
1472#endif
1473
1474 return NULL;
1475}
1476
1477EOLIAN static void
1478_elm_web_bg_color_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, int r, int g, int b, int a)
1479{
1480#ifdef HAVE_ELEMENTARY_WEB
1481 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
1482
1483 ewk_view_bg_color_set(wd->resize_obj, r, g, b, a);
1484#else
1485 (void)obj;
1486 (void)r;
1487 (void)g;
1488 (void)b;
1489 (void)a;
1490#endif
1491}
1492
1493EOLIAN static void
1494_elm_web_bg_color_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, int *r, int *g, int *b, int *a)
1495{
1496 if (r) *r = 0;
1497 if (g) *g = 0;
1498 if (b) *b = 0;
1499 if (a) *a = 0;
1500#ifdef HAVE_ELEMENTARY_WEB
1501 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
1502
1503 return ewk_view_bg_color_get(wd->resize_obj, r, g, b, a);
1504#else
1505 (void)obj;
1506#endif
1507}
1508
1509EOLIAN static const char*
1510_elm_web_selection_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1511{
1512#ifdef HAVE_ELEMENTARY_WEB
1513 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
1514
1515 return ewk_view_selection_get(wd->resize_obj);
1516#else
1517 (void)obj;
1518 return NULL;
1519#endif
1520}
1521
1522EOLIAN static void
1523_elm_web_popup_selected_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, int idx)
1524{
1525#ifdef HAVE_ELEMENTARY_WEB
1526 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
1527 ewk_view_popup_selected_set(wd->resize_obj, idx);
1528#else
1529 (void)idx;
1530 (void)obj;
1531#endif
1532}
1533
1534EOLIAN static Eina_Bool
1535_elm_web_popup_destroy(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1536{
1537#ifdef HAVE_ELEMENTARY_WEB
1538 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1539 return ewk_view_popup_destroy(wd->resize_obj);
1540#else
1541 (void)obj;
1542 return EINA_FALSE;
1543#endif
1544}
1545
1546EOLIAN static Eina_Bool
1547_elm_web_text_search(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, const char *string, Eina_Bool case_sensitive, Eina_Bool forward, Eina_Bool wrap)
1548{
1549
1550#ifdef HAVE_ELEMENTARY_WEB
1551 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1552
1553 return ewk_view_text_search
1554 (wd->resize_obj, string,
1555 case_sensitive, forward, wrap);
1556#else
1557 (void)string;
1558 (void)case_sensitive;
1559 (void)forward;
1560 (void)wrap;
1561 (void)obj;
1562 return EINA_FALSE;
1563#endif
1564}
1565
1566EOLIAN static unsigned int
1567_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)
1568{
1569#ifdef HAVE_ELEMENTARY_WEB
1570 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, 0);
1571 return ewk_view_text_matches_mark
1572 (wd->resize_obj, string,
1573 case_sensitive, highlight, limit);
1574#else
1575 (void)string;
1576 (void)case_sensitive;
1577 (void)highlight;
1578 (void)limit;
1579 (void)obj;
1580#endif
1581 return 0;
1582}
1583
1584EOLIAN static Eina_Bool
1585_elm_web_text_matches_unmark_all(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1586{
1587#ifdef HAVE_ELEMENTARY_WEB
1588 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1589
1590 return ewk_view_text_matches_unmark_all(wd->resize_obj);
1591#else
1592 (void)obj;
1593#endif
1594 return EINA_FALSE;
1595}
1596
1597EOLIAN static Eina_Bool
1598_elm_web_text_matches_highlight_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, Eina_Bool highlight)
1599{
1600#ifdef HAVE_ELEMENTARY_WEB
1601 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1602
1603 return ewk_view_text_matches_highlight_set
1604 (wd->resize_obj, highlight);
1605#else
1606 (void)obj;
1607 (void)highlight;
1608#endif
1609 return EINA_FALSE;
1610}
1611
1612EOLIAN static Eina_Bool
1613_elm_web_text_matches_highlight_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1614{
1615#ifdef HAVE_ELEMENTARY_WEB
1616 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1617
1618 return ewk_view_text_matches_highlight_get(wd->resize_obj);
1619#else
1620 (void)obj;
1621#endif
1622 return EINA_FALSE;
1623}
1624
1625EOLIAN static double
1626_elm_web_load_progress_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1627{
1628 double ret = -1.0;
1629#ifdef HAVE_ELEMENTARY_WEB
1630 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, ret);
1631
1632 return ewk_view_load_progress_get(wd->resize_obj);
1633#else
1634 (void)obj;
1635#endif
1636
1637 return ret;
1638}
1639
1640EOLIAN static Eina_Bool
1641_elm_web_stop(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1642{
1643#ifdef HAVE_ELEMENTARY_WEB
1644 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1645
1646 return ewk_view_stop(wd->resize_obj);
1647#else
1648 (void)obj;
1649#endif
1650
1651 return EINA_FALSE;
1652}
1653
1654EOLIAN static Eina_Bool
1655_elm_web_reload(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1656{
1657#ifdef HAVE_ELEMENTARY_WEB
1658 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1659
1660 return ewk_view_reload(wd->resize_obj);
1661#else
1662 (void)obj;
1663#endif
1664 return EINA_FALSE;
1665}
1666
1667EOLIAN static Eina_Bool
1668_elm_web_reload_full(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1669{
1670#ifdef HAVE_ELEMENTARY_WEB
1671 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1672
1673 return ewk_view_reload_full(wd->resize_obj);
1674#else
1675 (void)obj;
1676#endif
1677 return EINA_FALSE;
1678}
1679
1680EOLIAN static Eina_Bool
1681_elm_web_back(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1682{
1683#ifdef HAVE_ELEMENTARY_WEB
1684 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1685
1686 return ewk_view_back(wd->resize_obj);
1687#else
1688 (void)obj;
1689#endif
1690
1691 return EINA_FALSE;
1692}
1693
1694EOLIAN static Eina_Bool
1695_elm_web_forward(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1696{
1697#ifdef HAVE_ELEMENTARY_WEB
1698 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1699
1700 return ewk_view_forward(wd->resize_obj);
1701#else
1702 (void)obj;
1703#endif
1704
1705 return EINA_FALSE;
1706}
1707
1708EOLIAN static Eina_Bool
1709_elm_web_navigate(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, int steps)
1710{
1711#ifdef HAVE_ELEMENTARY_WEB
1712 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1713
1714 return ewk_view_navigate(wd->resize_obj, steps);
1715#else
1716 (void)steps;
1717 (void)obj;
1718#endif
1719
1720 return EINA_FALSE;
1721}
1722
1723EINA_DEPRECATED EAPI Eina_Bool
1724elm_web_back_possible(Evas_Object *obj)
1725{
1726 return elm_web_back_possible_get(obj);
1727}
1728
1729EOLIAN static Eina_Bool
1730_elm_web_back_possible_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1731{
1732#ifdef HAVE_ELEMENTARY_WEB
1733 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1734
1735 return ewk_view_back_possible(wd->resize_obj);
1736#else
1737 (void)obj;
1738#endif
1739
1740 return EINA_FALSE;
1741}
1742
1743EOLIAN static Eina_Bool
1744_elm_web_forward_possible_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1745{
1746#ifdef HAVE_ELEMENTARY_WEB
1747 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1748
1749 return ewk_view_forward_possible(wd->resize_obj);
1750#else
1751 (void)obj;
1752#endif
1753
1754 return EINA_FALSE;
1755}
1756
1757EOLIAN static Eina_Bool
1758_elm_web_navigate_possible_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, int steps)
1759{
1760#ifdef HAVE_ELEMENTARY_WEB
1761 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1762
1763 return ewk_view_navigate_possible(wd->resize_obj, steps);
1764#else
1765 (void)steps;
1766 (void)obj;
1767#endif
1768
1769 return EINA_FALSE;
1770}
1771
1772EOLIAN static Eina_Bool
1773_elm_web_history_enabled_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1774{
1775#ifdef HAVE_ELEMENTARY_WEB
1776 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1777
1778 return ewk_view_history_enable_get(wd->resize_obj);
1779#else
1780 (void)obj;
1781#endif
1782
1783 return EINA_FALSE;
1784}
1785
1786EOLIAN static void
1787_elm_web_history_enabled_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, Eina_Bool enable)
1788{
1789#ifdef HAVE_ELEMENTARY_WEB
1790 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
1791
1792 ewk_view_history_enable_set(wd->resize_obj, enable);
1793#else
1794 (void)enable;
1795 (void)obj;
1796#endif
1797}
1798
1799//EAPI Ewk_History *ewk_view_history_get(const Evas_Object *obj); // TODO:
1800
1801EOLIAN static void
1802_elm_web_zoom_set(Eo *obj, Elm_Web_Data *sd, double zoom)
1803{
1804#ifdef HAVE_ELEMENTARY_WEB
1805 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
1806
1807 int vw, vh, cx, cy;
1808 float z = 1.0;
1809
1810 evas_object_geometry_get
1811 (wd->resize_obj, NULL, NULL, &vw, &vh);
1812 cx = vw / 2;
1813 cy = vh / 2;
1814 if (zoom > sd->zoom.max) zoom = sd->zoom.max;
1815 else if (zoom < sd->zoom.min)
1816 zoom = sd->zoom.min;
1817 if (zoom == sd->zoom.current) return;
1818
1819 sd->zoom.current = zoom;
1820 if (sd->zoom.mode == ELM_WEB_ZOOM_MODE_MANUAL) z = zoom;
1821 else if (sd->zoom.mode == ELM_WEB_ZOOM_MODE_AUTO_FIT)
1822 {
1823 Evas_Object *frame =
1824 ewk_view_frame_main_get(wd->resize_obj);
1825 Evas_Coord fw, fh, pw, ph;
1826
1827 if (!ewk_frame_contents_size_get(frame, &fw, &fh)) return;
1828 z = ewk_frame_page_zoom_get(frame);
1829 fw /= z;
1830 fh /= z;
1831 if ((fw > 0) && (fh > 0))
1832 {
1833 ph = (fh * vw) / fw;
1834 if (ph > vh)
1835 {
1836 pw = (fw * vh) / fh;
1837 ph = vh;
1838 }
1839 else
1840 pw = vw;
1841 if (fw > fh)
1842 z = (float)pw / fw;
1843 else
1844 z = (float)ph / fh;
1845 }
1846 }
1847 else if (sd->zoom.mode == ELM_WEB_ZOOM_MODE_AUTO_FILL)
1848 {
1849 Evas_Object *frame =
1850 ewk_view_frame_main_get(wd->resize_obj);
1851 Evas_Coord fw, fh, pw, ph;
1852
1853 if (!ewk_frame_contents_size_get(frame, &fw, &fh)) return;
1854 z = ewk_frame_page_zoom_get(frame);
1855 fw /= z;
1856 fh /= z;
1857 if ((fw > 0) && (fh > 0))
1858 {
1859 ph = (fh * vw) / fw;
1860 if (ph < vh)
1861 {
1862 pw = (fw * vh) / fh;
1863 ph = vh;
1864 }
1865 else
1866 pw = vw;
1867 if (fw > fh)
1868 z = (float)pw / fw;
1869 else
1870 z = (float)ph / fh;
1871 }
1872 }
1873 if (sd->zoom.no_anim)
1874 ewk_view_zoom_set(wd->resize_obj, z, cx, cy);
1875 else
1876 ewk_view_zoom_animated_set
1877 (wd->resize_obj, z,
1878 _elm_config->zoom_friction, cx, cy);
1879 sd->zoom.no_anim = EINA_FALSE;
1880#else
1881 (void)obj;
1882 (void)sd;
1883 (void)zoom;
1884#endif
1885}
1886
1887EOLIAN static double
1888_elm_web_zoom_get(Eo *obj EINA_UNUSED, Elm_Web_Data *sd)
1889{
1890#ifdef HAVE_ELEMENTARY_WEB
1891 return sd->zoom.current;
1892#else
1893 (void)sd;
1894#endif
1895
1896 return -1.0;
1897}
1898
1899EOLIAN static void
1900_elm_web_zoom_mode_set(Eo *obj, Elm_Web_Data *sd, Elm_Web_Zoom_Mode mode)
1901{
1902#ifdef HAVE_ELEMENTARY_WEB
1903 float tz;
1904
1905 if (mode >= ELM_WEB_ZOOM_MODE_LAST)
1906 return;
1907 if (mode == sd->zoom.mode)
1908 return;
1909
1910 sd->zoom.mode = mode;
1911 tz = sd->zoom.current;
1912 sd->zoom.current = 0.0;
1913 elm_web_zoom_set(obj, tz);
1914#else
1915 (void)obj;
1916 (void)sd;
1917 (void)mode;
1918#endif
1919}
1920
1921EOLIAN static Elm_Web_Zoom_Mode
1922_elm_web_zoom_mode_get(Eo *obj EINA_UNUSED, Elm_Web_Data *sd)
1923{
1924#ifdef HAVE_ELEMENTARY_WEB
1925 return sd->zoom.mode;
1926#else
1927 (void)sd;
1928#endif
1929
1930 return ELM_WEB_ZOOM_MODE_LAST;
1931}
1932
1933EOLIAN static void
1934_elm_web_region_show(Eo *obj, Elm_Web_Data *sd, int x, int y, int w, int h)
1935{
1936 (void)w;
1937 (void)h;
1938
1939#ifdef HAVE_ELEMENTARY_WEB
1940 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
1941
1942 Evas_Object *frame =
1943 ewk_view_frame_main_get(wd->resize_obj);
1944 int fw, fh, zw, zh, rx, ry;
1945 float zoom;
1946
1947 ewk_frame_contents_size_get(frame, &fw, &fh);
1948 zoom = ewk_frame_page_zoom_get(frame);
1949 zw = fw / zoom;
1950 zh = fh / zoom;
1951 rx = (x * fw) / zw;
1952 ry = (y * fh) / zh;
1953 ELM_SAFE_FREE(sd->bring_in.animator, ecore_animator_del);
1954 ewk_frame_scroll_set(frame, rx, ry);
1955#else
1956 (void)obj;
1957 (void)sd;
1958 (void)x;
1959 (void)y;
1960#endif
1961}
1962
1963EOLIAN static void
1964_elm_web_region_bring_in(Eo *obj, Elm_Web_Data *sd, int x, int y, int w, int h)
1965{
1966 (void)w;
1967 (void)h;
1968
1969#ifdef HAVE_ELEMENTARY_WEB
1970 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
1971
1972 Evas_Object *frame =
1973 ewk_view_frame_main_get(wd->resize_obj);
1974 int fw, fh, zw, zh, rx, ry, sx, sy;
1975 float zoom;
1976
1977 ewk_frame_contents_size_get(frame, &fw, &fh);
1978 ewk_frame_scroll_pos_get(frame, &sx, &sy);
1979 zoom = ewk_frame_page_zoom_get(frame);
1980 zw = fw / zoom;
1981 zh = fh / zoom;
1982 rx = (x * fw) / zw;
1983 ry = (y * fh) / zh;
1984 if ((sd->bring_in.end.x == rx) && (sd->bring_in.end.y == ry))
1985 return;
1986 sd->bring_in.start.x = sx;
1987 sd->bring_in.start.y = sy;
1988 sd->bring_in.end.x = rx;
1989 sd->bring_in.end.y = ry;
1990 ecore_animator_del(sd->bring_in.animator);
1991 sd->bring_in.animator = ecore_animator_timeline_add(
1992 _elm_config->bring_in_scroll_friction, _bring_in_anim_cb, obj);
1993#else
1994 (void)obj;
1995 (void)sd;
1996 (void)x;
1997 (void)y;
1998#endif
1999}
2000
2001EOLIAN static void
2002_elm_web_inwin_mode_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Eina_Bool value)
2003{
2004#ifdef HAVE_ELEMENTARY_WEB
2005 sd->inwin_mode = value;
2006#else
2007 (void)sd;
2008 (void)value;
2009#endif
2010}
2011
2012EOLIAN static Eina_Bool
2013_elm_web_inwin_mode_get(Eo *obj EINA_UNUSED, Elm_Web_Data *sd)
2014{
2015#ifdef HAVE_ELEMENTARY_WEB
2016 return sd->inwin_mode;
2017#else
2018 (void)sd;
2019#endif
2020
2021 return EINA_FALSE;
2022}
2023
2024EAPI void
2025elm_web_window_features_ref(Elm_Web_Window_Features *wf)
2026{
2027#ifdef HAVE_ELEMENTARY_WEB
2028 ewk_window_features_ref((Ewk_Window_Features *)wf);
2029#else
2030 (void)wf;
2031#endif
2032}
2033
2034EAPI void
2035elm_web_window_features_unref(Elm_Web_Window_Features *wf)
2036{
2037#ifdef HAVE_ELEMENTARY_WEB
2038 ewk_window_features_unref((Ewk_Window_Features *)wf);
2039#else
2040 (void)wf;
2041#endif
2042}
2043
2044EAPI Eina_Bool
2045elm_web_window_features_property_get(const Elm_Web_Window_Features *wf,
2046 Elm_Web_Window_Feature_Flag flag)
2047{
2048#ifdef HAVE_ELEMENTARY_WEB
2049 Eina_Bool toolbar_visible, statusbar_visible;
2050 Eina_Bool scrollbars_visible, menubar_visible;
2051 Eina_Bool locationbar_visible, fullscreen;
2052
2053 ewk_window_features_bool_property_get
2054 ((const Ewk_Window_Features *)wf, &toolbar_visible, &statusbar_visible,
2055 &scrollbars_visible, &menubar_visible, &locationbar_visible,
2056 &fullscreen);
2057
2058 //TODO : Improve ewk API usage to get one value.
2059 switch (flag)
2060 {
2061 case ELM_WEB_WINDOW_FEATURE_TOOLBAR:
2062 return toolbar_visible;
2063 break;
2064
2065 case ELM_WEB_WINDOW_FEATURE_STATUSBAR:
2066 return statusbar_visible;
2067 break;
2068
2069 case ELM_WEB_WINDOW_FEATURE_SCROLLBARS:
2070 return scrollbars_visible;
2071 break;
2072
2073 case ELM_WEB_WINDOW_FEATURE_MENUBAR:
2074 return menubar_visible;
2075 break;
2076
2077 case ELM_WEB_WINDOW_FEATURE_LOCATIONBAR:
2078 return locationbar_visible;
2079 break;
2080
2081 case ELM_WEB_WINDOW_FEATURE_FULLSCREEN:
2082 return fullscreen;
2083 break;
2084 }
2085#else
2086 (void)wf;
2087 (void)flag;
2088#endif
2089 return EINA_FALSE;
2090}
2091
2092EAPI void
2093elm_web_window_features_region_get(const Elm_Web_Window_Features *wf,
2094 Evas_Coord *x,
2095 Evas_Coord *y,
2096 Evas_Coord *w,
2097 Evas_Coord *h)
2098{
2099#ifdef HAVE_ELEMENTARY_WEB
2100 ewk_window_features_int_property_get
2101 ((const Ewk_Window_Features *)wf, x, y, w, h);
2102#else
2103 (void)wf;
2104 (void)x;
2105 (void)y;
2106 (void)w;
2107 (void)h;
2108#endif
2109}
2110
2111// TODO: use all ewk_view_zoom stuff to implement bring-in and
2112// animated zoom like elm_photocam. Should be simple to use, must not
2113// expose every single bit to users!
2114
2115static void
2116_elm_web_class_constructor(Eo_Class *klass)
2117{
2118 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
2119}
2120
2121#include "elm_web.eo.c"
2122#endif
diff --git a/src/lib/elm_web2.c b/src/lib/elm_web2.c
index ffe768a58..42506eabf 100644
--- a/src/lib/elm_web2.c
+++ b/src/lib/elm_web2.c
@@ -7,8 +7,9 @@
7#include "elm_priv.h" 7#include "elm_priv.h"
8#include "elm_widget_web.h" 8#include "elm_widget_web.h"
9 9
10#if defined(HAVE_ELEMENTARY_WEB) && defined(USE_WEBKIT2) 10#if defined(HAVE_ELEMENTARY_WEB)
11#include <EWebKit2.h> 11#include <EWebKit2.h>
12#endif
12 13
13#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED 14#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
14#include "elm_interface_atspi_accessible.h" 15#include "elm_interface_atspi_accessible.h"
@@ -19,8 +20,10 @@
19#define MY_CLASS_NAME "Elm_Web" 20#define MY_CLASS_NAME "Elm_Web"
20#define MY_CLASS_NAME_LEGACY "elm_web" 21#define MY_CLASS_NAME_LEGACY "elm_web"
21 22
23#if defined(HAVE_ELEMENTARY_WEB)
22static Ewk_View_Smart_Class _ewk_view_parent_sc = 24static Ewk_View_Smart_Class _ewk_view_parent_sc =
23 EWK_VIEW_SMART_CLASS_INIT_NULL; 25 EWK_VIEW_SMART_CLASS_INIT_NULL;
26#endif
24 27
25static const char SIG_URI_CHANGED[] = "uri,changed"; // deprecated, use "url,changed" instead. 28static const char SIG_URI_CHANGED[] = "uri,changed"; // deprecated, use "url,changed" instead.
26static const char SIG_URL_CHANGED[] = "url,changed"; 29static const char SIG_URL_CHANGED[] = "url,changed";
@@ -33,6 +36,7 @@ static const Evas_Smart_Cb_Description _elm_web_smart_callbacks[] = {
33 { NULL, NULL } 36 { NULL, NULL }
34}; 37};
35 38
39#ifdef HAVE_ELEMENTARY_WEB
36static void 40static void
37_view_smart_add(Evas_Object *obj) 41_view_smart_add(Evas_Object *obj)
38{ 42{
@@ -583,22 +587,29 @@ _view_smart_callback_proxy(Evas_Object *view, Evas_Object *parent)
583} 587}
584 588
585static Eina_Bool _elm_need_web = EINA_FALSE; 589static Eina_Bool _elm_need_web = EINA_FALSE;
590#endif
586 591
587void 592void
588_elm_unneed_web(void) 593_elm_unneed_web(void)
589{ 594{
595#ifdef HAVE_ELEMENTARY_WEB
590 if (!_elm_need_web) return; 596 if (!_elm_need_web) return;
591 _elm_need_web = EINA_FALSE; 597 _elm_need_web = EINA_FALSE;
592 ewk_shutdown(); 598 ewk_shutdown();
599#endif
593} 600}
594 601
595EAPI Eina_Bool 602EAPI Eina_Bool
596elm_need_web(void) 603elm_need_web(void)
597{ 604{
605#ifdef HAVE_ELEMENTARY_WEB
598 if (_elm_need_web) return EINA_TRUE; 606 if (_elm_need_web) return EINA_TRUE;
599 _elm_need_web = EINA_TRUE; 607 _elm_need_web = EINA_TRUE;
600 ewk_init(); 608 ewk_init();
601 return EINA_TRUE; 609 return EINA_TRUE;
610#else
611 return EINA_FALSE;
612#endif
602} 613}
603 614
604EOLIAN static Eina_Bool 615EOLIAN static Eina_Bool
@@ -611,6 +622,7 @@ _elm_web_elm_widget_theme_apply(Eo *obj, Elm_Web_Data *sd EINA_UNUSED)
611EOLIAN static Eina_Bool 622EOLIAN static Eina_Bool
612_elm_web_elm_widget_on_focus(Eo *obj, Elm_Web_Data *sd) 623_elm_web_elm_widget_on_focus(Eo *obj, Elm_Web_Data *sd)
613{ 624{
625#ifdef HAVE_ELEMENTARY_WEB
614 Evas_Object *top; 626 Evas_Object *top;
615 627
616 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_TRUE); 628 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_TRUE);
@@ -631,6 +643,10 @@ _elm_web_elm_widget_on_focus(Eo *obj, Elm_Web_Data *sd)
631 evas_object_focus_set(wd->resize_obj, EINA_FALSE); 643 evas_object_focus_set(wd->resize_obj, EINA_FALSE);
632 if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF); 644 if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF);
633 } 645 }
646#else
647 (void)obj;
648 (void)sd;
649#endif
634 return EINA_TRUE; 650 return EINA_TRUE;
635} 651}
636 652
@@ -648,21 +664,31 @@ _elm_web_elm_widget_event(Eo *obj, Elm_Web_Data *sd, Evas_Object *src, Evas_Call
648EOLIAN static Eina_Bool 664EOLIAN static Eina_Bool
649_elm_web_tab_propagate_get(Eo *obj EINA_UNUSED, Elm_Web_Data *sd) 665_elm_web_tab_propagate_get(Eo *obj EINA_UNUSED, Elm_Web_Data *sd)
650{ 666{
667#ifdef HAVE_ELEMENTARY_WEB
651 return sd->tab_propagate; 668 return sd->tab_propagate;
669#else
670 (void)sd;
671 return EINA_FALSE;
672#endif
652} 673}
653 674
654EOLIAN static void 675EOLIAN static void
655_elm_web_tab_propagate_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Eina_Bool propagate) 676_elm_web_tab_propagate_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Eina_Bool propagate)
656{ 677{
678#ifdef HAVE_ELEMENTARY_WEB
657 sd->tab_propagate = propagate; 679 sd->tab_propagate = propagate;
680#else
681 (void)propagate;
682 (void)sd;
683#endif
658} 684}
659 685
660EOLIAN static void 686EOLIAN static void
661_elm_web_evas_object_smart_add(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED) 687_elm_web_evas_object_smart_add(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
662{ 688{
663#ifdef HAVE_ELEMENTARY_WEB
664 Evas_Object *resize_obj; 689 Evas_Object *resize_obj;
665 690
691#ifdef HAVE_ELEMENTARY_WEB
666 resize_obj = _view_add(obj); 692 resize_obj = _view_add(obj);
667 elm_widget_resize_object_set(obj, resize_obj, EINA_TRUE); 693 elm_widget_resize_object_set(obj, resize_obj, EINA_TRUE);
668 694
@@ -674,6 +700,13 @@ _elm_web_evas_object_smart_add(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
674 700
675 _view_smart_callback_proxy(resize_obj, obj); 701 _view_smart_callback_proxy(resize_obj, obj);
676 elm_widget_can_focus_set(obj, EINA_TRUE); 702 elm_widget_can_focus_set(obj, EINA_TRUE);
703#else
704 resize_obj = elm_label_add(obj);
705 elm_object_text_set(resize_obj, "WebKit not supported!");
706 elm_widget_resize_object_set(obj, resize_obj, EINA_TRUE);
707
708 eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
709 elm_widget_sub_object_parent_add(obj);
677#endif 710#endif
678} 711}
679 712
@@ -706,36 +739,66 @@ _elm_web_eo_base_constructor(Eo *obj, Elm_Web_Data *sd)
706EOLIAN static Evas_Object* 739EOLIAN static Evas_Object*
707_elm_web_webkit_view_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED) 740_elm_web_webkit_view_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
708{ 741{
742#ifdef HAVE_ELEMENTARY_WEB
709 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); 743 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
710 return wd->resize_obj; 744 return wd->resize_obj;
745#else
746 (void)obj;
747 ERR("Elementary not compiled with EWebKit support.");
748 return NULL;
749#endif
711} 750}
712 751
713EOLIAN static void 752EOLIAN static void
714_elm_web_window_create_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Elm_Web_Window_Open func, void *data) 753_elm_web_window_create_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Elm_Web_Window_Open func, void *data)
715{ 754{
755#ifdef HAVE_ELEMENTARY_WEB
716 sd->hook.window_create = func; 756 sd->hook.window_create = func;
717 sd->hook.window_create_data = data; 757 sd->hook.window_create_data = data;
758#else
759 (void)sd;
760 (void)func;
761 (void)data;
762#endif
718} 763}
719 764
720EOLIAN static void 765EOLIAN static void
721_elm_web_dialog_alert_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Elm_Web_Dialog_Alert func, void *data) 766_elm_web_dialog_alert_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Elm_Web_Dialog_Alert func, void *data)
722{ 767{
768#ifdef HAVE_ELEMENTARY_WEB
723 sd->hook.alert = func; 769 sd->hook.alert = func;
724 sd->hook.alert_data = data; 770 sd->hook.alert_data = data;
771#else
772 (void)func;
773 (void)data;
774 (void)sd;
775#endif
725} 776}
726 777
727EOLIAN static void 778EOLIAN static void
728_elm_web_dialog_confirm_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Elm_Web_Dialog_Confirm func, void *data) 779_elm_web_dialog_confirm_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Elm_Web_Dialog_Confirm func, void *data)
729{ 780{
781#ifdef HAVE_ELEMENTARY_WEB
730 sd->hook.confirm = func; 782 sd->hook.confirm = func;
731 sd->hook.confirm_data = data; 783 sd->hook.confirm_data = data;
784#else
785 (void)func;
786 (void)data;
787 (void)sd;
788#endif
732} 789}
733 790
734EOLIAN static void 791EOLIAN static void
735_elm_web_dialog_prompt_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Elm_Web_Dialog_Prompt func, void *data) 792_elm_web_dialog_prompt_hook_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Elm_Web_Dialog_Prompt func, void *data)
736{ 793{
794#ifdef HAVE_ELEMENTARY_WEB
737 sd->hook.prompt = func; 795 sd->hook.prompt = func;
738 sd->hook.prompt_data = data; 796 sd->hook.prompt_data = data;
797#else
798 (void)func;
799 (void)data;
800 (void)sd;
801#endif
739} 802}
740 803
741EOLIAN static void 804EOLIAN static void
@@ -793,8 +856,7 @@ _elm_web_useragent_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
793} 856}
794 857
795EAPI Eina_Bool 858EAPI Eina_Bool
796elm_web_uri_set(Evas_Object *obj, 859elm_web_uri_set(Evas_Object *obj, const char *url)
797 const char *url)
798{ 860{
799 ELM_WEB_CHECK(obj) EINA_FALSE; 861 ELM_WEB_CHECK(obj) EINA_FALSE;
800 Eina_Bool ret = EINA_FALSE; 862 Eina_Bool ret = EINA_FALSE;
@@ -802,42 +864,82 @@ elm_web_uri_set(Evas_Object *obj,
802 return ret; 864 return ret;
803} 865}
804 866
867EAPI const char *
868elm_web_uri_get(const Evas_Object *obj)
869{
870 const char *ret = NULL;
871 eo_do((Eo *) obj, ret = elm_obj_web_url_get());
872 return ret;
873}
874
805EOLIAN static Eina_Bool 875EOLIAN static Eina_Bool
806_elm_web_url_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, const char *url) 876_elm_web_url_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, const char *url)
807{ 877{
878#ifdef HAVE_ELEMENTARY_WEB
808 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); 879 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
809 return ewk_view_url_set(wd->resize_obj, url); 880 return ewk_view_url_set(wd->resize_obj, url);
881#else
882 (void)url;
883 (void)obj;
884 return EINA_FALSE;
885#endif
810} 886}
811 887
812EOLIAN static const char* 888EOLIAN static const char*
813_elm_web_url_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED) 889_elm_web_url_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
814{ 890{
891#ifdef HAVE_ELEMENTARY_WEB
815 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); 892 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
816 return ewk_view_url_get(wd->resize_obj); 893 return ewk_view_url_get(wd->resize_obj);
894#else
895 (void)obj;
896 return NULL;
897#endif
817} 898}
818 899
819EOLIAN static Eina_Bool 900EOLIAN static Eina_Bool
820_elm_web_html_string_load(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, const char *html, const char *base_url, const char *unreachable_url) 901_elm_web_html_string_load(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, const char *html, const char *base_url, const char *unreachable_url)
821{ 902{
903#ifdef HAVE_ELEMENTARY_WEB
822 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); 904 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
823 905
824 return ewk_view_html_string_load(wd->resize_obj, 906 return ewk_view_html_string_load(wd->resize_obj,
825 html, base_url, unreachable_url); 907 html, base_url, unreachable_url);
908#else
909 (void)obj;
910 (void)html;
911 (void)base_url;
912 (void)unreachable_url;
913 return EINA_FALSE;
914#endif
826} 915}
827 916
828EOLIAN static const char* 917EOLIAN static const char*
829_elm_web_title_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED) 918_elm_web_title_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
830{ 919{
920#ifdef HAVE_ELEMENTARY_WEB
831 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); 921 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
832 return ewk_view_title_get(wd->resize_obj); 922 return ewk_view_title_get(wd->resize_obj);
923#else
924 (void)obj;
925 return NULL;
926#endif
833} 927}
834 928
835EOLIAN static void 929EOLIAN static void
836_elm_web_bg_color_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, int r, int g, int b, int a) 930_elm_web_bg_color_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, int r, int g, int b, int a)
837{ 931{
932#ifdef HAVE_ELEMENTARY_WEB
838 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 933 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
839 934
840 ewk_view_bg_color_set(wd->resize_obj, r, g, b, a); 935 ewk_view_bg_color_set(wd->resize_obj, r, g, b, a);
936#else
937 (void)obj;
938 (void)r;
939 (void)g;
940 (void)b;
941 (void)a;
942#endif
841} 943}
842 944
843EOLIAN static void 945EOLIAN static void
@@ -848,9 +950,13 @@ _elm_web_bg_color_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, int *r, int *g, in
848 if (b) *b = 0; 950 if (b) *b = 0;
849 if (a) *a = 0; 951 if (a) *a = 0;
850 952
953#ifdef HAVE_ELEMENTARY_WEB
851 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 954 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
852 955
853 return ewk_view_bg_color_get(wd->resize_obj, r, g, b, a); 956 ewk_view_bg_color_get(wd->resize_obj, r, g, b, a);
957#else
958 (void)obj;
959#endif
854} 960}
855 961
856EOLIAN static const char* 962EOLIAN static const char*
@@ -1173,17 +1279,27 @@ _elm_web_history_enabled_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, Eina_Bool e
1173EOLIAN static void 1279EOLIAN static void
1174_elm_web_zoom_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, double zoom) 1280_elm_web_zoom_set(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, double zoom)
1175{ 1281{
1282#ifdef HAVE_ELEMENTARY_WEB
1176 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 1283 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
1177 1284
1178 ewk_view_page_zoom_set(wd->resize_obj, zoom); 1285 ewk_view_page_zoom_set(wd->resize_obj, zoom);
1286#else
1287 (void)obj;
1288 (void)zoom;
1289#endif
1179} 1290}
1180 1291
1181EOLIAN static double 1292EOLIAN static double
1182_elm_web_zoom_get(Eo *obj EINA_UNUSED, Elm_Web_Data *_pd EINA_UNUSED) 1293_elm_web_zoom_get(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED)
1183{ 1294{
1295#ifdef HAVE_ELEMENTARY_WEB
1184 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, -1); 1296 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, -1);
1185 1297
1186 return ewk_view_page_zoom_get(wd->resize_obj); 1298 return ewk_view_page_zoom_get(wd->resize_obj);
1299#else
1300 (void)obj;
1301 return -1;
1302#endif
1187} 1303}
1188 1304
1189EOLIAN static void 1305EOLIAN static void
@@ -1255,31 +1371,50 @@ _elm_web_region_bring_in(Eo *obj, Elm_Web_Data *_pd EINA_UNUSED, int x, int y, i
1255EOLIAN static void 1371EOLIAN static void
1256_elm_web_inwin_mode_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Eina_Bool value) 1372_elm_web_inwin_mode_set(Eo *obj EINA_UNUSED, Elm_Web_Data *sd, Eina_Bool value)
1257{ 1373{
1374#ifdef HAVE_ELEMENTARY_WEB
1258 sd->inwin_mode = value; 1375 sd->inwin_mode = value;
1376#else
1377 (void)sd;
1378 (void)value;
1379#endif
1259} 1380}
1260 1381
1261EOLIAN static Eina_Bool 1382EOLIAN static Eina_Bool
1262_elm_web_inwin_mode_get(Eo *obj EINA_UNUSED, Elm_Web_Data *sd) 1383_elm_web_inwin_mode_get(Eo *obj EINA_UNUSED, Elm_Web_Data *sd)
1263{ 1384{
1385#ifdef HAVE_ELEMENTARY_WEB
1264 return sd->inwin_mode; 1386 return sd->inwin_mode;
1387#else
1388 (void)sd;
1389 return EINA_FALSE;
1390#endif
1265} 1391}
1266 1392
1267EAPI void 1393EAPI void
1268elm_web_window_features_ref(Elm_Web_Window_Features *wf) 1394elm_web_window_features_ref(Elm_Web_Window_Features *wf)
1269{ 1395{
1396#ifdef HAVE_ELEMENTARY_WEB
1270 ewk_object_ref((Ewk_Object *)wf); 1397 ewk_object_ref((Ewk_Object *)wf);
1398#else
1399 (void)wf;
1400#endif
1271} 1401}
1272 1402
1273EAPI void 1403EAPI void
1274elm_web_window_features_unref(Elm_Web_Window_Features *wf) 1404elm_web_window_features_unref(Elm_Web_Window_Features *wf)
1275{ 1405{
1406#ifdef HAVE_ELEMENTARY_WEB
1276 ewk_object_unref((Ewk_Object *)wf); 1407 ewk_object_unref((Ewk_Object *)wf);
1408#else
1409 (void)wf;
1410#endif
1277} 1411}
1278 1412
1279EAPI Eina_Bool 1413EAPI Eina_Bool
1280elm_web_window_features_property_get(const Elm_Web_Window_Features *wf, 1414elm_web_window_features_property_get(const Elm_Web_Window_Features *wf,
1281 Elm_Web_Window_Feature_Flag flag) 1415 Elm_Web_Window_Feature_Flag flag)
1282{ 1416{
1417#ifdef HAVE_ELEMENTARY_WEB
1283 const Ewk_Window_Features *ewf = (const Ewk_Window_Features *)wf; 1418 const Ewk_Window_Features *ewf = (const Ewk_Window_Features *)wf;
1284 switch (flag) 1419 switch (flag)
1285 { 1420 {
@@ -1301,6 +1436,10 @@ elm_web_window_features_property_get(const Elm_Web_Window_Features *wf,
1301 case ELM_WEB_WINDOW_FEATURE_FULLSCREEN: 1436 case ELM_WEB_WINDOW_FEATURE_FULLSCREEN:
1302 return ewk_window_features_fullscreen_get(ewf); 1437 return ewk_window_features_fullscreen_get(ewf);
1303 } 1438 }
1439#else
1440 (void)wf;
1441 (void)flag;
1442#endif
1304 1443
1305 return EINA_FALSE; 1444 return EINA_FALSE;
1306} 1445}
@@ -1312,8 +1451,16 @@ elm_web_window_features_region_get(const Elm_Web_Window_Features *wf,
1312 Evas_Coord *w, 1451 Evas_Coord *w,
1313 Evas_Coord *h) 1452 Evas_Coord *h)
1314{ 1453{
1454#ifdef HAVE_ELEMENTARY_WEB
1315 ewk_window_features_geometry_get 1455 ewk_window_features_geometry_get
1316 ((const Ewk_Window_Features *)wf, x, y, w, h); 1456 ((const Ewk_Window_Features *)wf, x, y, w, h);
1457#else
1458 (void)wf;
1459 (void)x;
1460 (void)y;
1461 (void)w;
1462 (void)h;
1463#endif
1317} 1464}
1318 1465
1319static void 1466static void
@@ -1323,5 +1470,3 @@ _elm_web_class_constructor(Eo_Class *klass)
1323} 1470}
1324 1471
1325#include "elm_web.eo.c" 1472#include "elm_web.eo.c"
1326
1327#endif
diff --git a/src/lib/elm_widget_web.h b/src/lib/elm_widget_web.h
index 1273c0ad9..656cc6021 100644
--- a/src/lib/elm_widget_web.h
+++ b/src/lib/elm_widget_web.h
@@ -2,11 +2,7 @@
2#define ELM_WIDGET_WEB_H 2#define ELM_WIDGET_WEB_H
3 3
4#ifdef HAVE_ELEMENTARY_WEB 4#ifdef HAVE_ELEMENTARY_WEB
5#ifdef USE_WEBKIT2
6#include <EWebKit2.h> 5#include <EWebKit2.h>
7#else
8#include <EWebKit.h>
9#endif
10#endif 6#endif
11 7
12/** 8/**