}
};
-typedef struct _Viewport {
- int w;
- int h;
- float initScale;
- float minScale;
- float maxScale;
- float devicePixelRatio;
- Eina_Bool userScalable;
-} Viewport;
-
typedef struct _ELauncher {
Ecore_Evas *ee;
Evas *evas;
const char *userAgent;
const char *backingStore;
unsigned char isFlattening;
- Viewport viewport;
} ELauncher;
static void browserDestroy(Ecore_Evas *ee);
ecore_evas_title_set(ee, label);
}
-/**
- * This is en example function to adjust viewport via viewport tag's arguments.
- * Application can invoke this function in order to adjust viewport tag when it is required.
- */
-static void
-viewport_set()
-{
- ELauncher *app;
- app = (ELauncher*) eina_list_data_get(windows);
-
- ewk_view_fixed_layout_size_set(app->browser, app->viewport.w, app->viewport.h);
- ewk_view_zoom_set(app->browser, app->viewport.initScale, 0, 0);
- if (!ewk_view_zoom_range_set(app->browser, app->viewport.minScale, app->viewport.maxScale))
- info(" Fail to set zoom range. minScale = %f, maxScale = %f\n", app->viewport.minScale, app->viewport.maxScale);
- ewk_view_user_scalable_set(app->browser, app->viewport.userScalable);
-}
-
static void
on_title_changed(void *user_data, Evas_Object *webview, void *event_info)
{
}
-/**
- * "viewport,changed" signal will be always emitted regardless of the viewport existence.
- *
- * If you don't want to process the viewport tag, you can either do nothing in this callback
- * or simply ignore the signal in your application.
- *
- * More information about this can be found at http://developer.apple.com/safari/library/docum
- * entation/appleapplications/reference/safariwebcontent/usingtheviewport/usingtheviewport.html
- */
-static void
-on_viewport_changed(void* user_data, Evas_Object* webview, void* event_info)
-{
- ELauncher *app = (ELauncher *)user_data;
-
- int w, h;
- float initScale, minScale, maxScale, devicePixelRatio;
- Eina_Bool userScalable;
-
- ewk_view_viewport_attributes_get(webview, &w, &h, &initScale, &maxScale, &minScale, &devicePixelRatio, &userScalable);
-
- /**
- * If there is no argument in viewport tag, argument's value is -1.
- */
- if (w == -1)
- w = DEFAULT_WIDTH;
- if (h == -1)
- h = DEFAULT_HEIGHT;
- if ((int)initScale == -1)
- initScale = DEFAULT_ZOOM_INIT; // There's no scale separated from zooming in webkit-efl.
- if ((int)minScale == -1)
- minScale = ewk_view_zoom_range_min_get(webview);
- if ((int)maxScale == -1)
- maxScale = ewk_view_zoom_range_max_get(webview);
- if ((int)devicePixelRatio == -1)
- devicePixelRatio = ewk_view_device_pixel_ratio_get(webview);
- if ((int)userScalable == -1)
- userScalable = EINA_TRUE;
-
- app->viewport.w = w;
- app->viewport.h = h;
- app->viewport.initScale = initScale;
- app->viewport.minScale = minScale;
- app->viewport.maxScale = maxScale;
- app->viewport.devicePixelRatio = devicePixelRatio;
- app->viewport.userScalable = userScalable;
- viewport_set();
-}
-
static void
on_mouse_down(void* data, Evas* e, Evas_Object* webview, void* event_info)
{
evas_object_event_callback_del(app->browser, EVAS_CALLBACK_DEL, on_browser_del);
}
-static void
-on_closeWindow(Ecore_Evas *ee)
-{
- browserDestroy(ee);
-}
-
static int
quit(Eina_Bool success, const char *msg)
{
evas_object_smart_callback_add(app->browser, "load,progress", on_progress, app);
evas_object_smart_callback_add(app->browser, "load,finished", on_load_finished, app);
evas_object_smart_callback_add(app->browser, "load,error", on_load_error, app);
- evas_object_smart_callback_add(app->browser, "viewport,changed", on_viewport_changed, app);
evas_object_smart_callback_add(app->browser, "toolbars,visible,set", on_toolbars_visible_set, app);
evas_object_smart_callback_add(app->browser, "toolbars,visible,get", on_toolbars_visible_get, app);