summaryrefslogtreecommitdiffstats
path: root/WebKit/efl/ewk
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/efl/ewk')
-rw-r--r--WebKit/efl/ewk/ewk_frame.cpp117
-rw-r--r--WebKit/efl/ewk/ewk_frame.h25
-rw-r--r--WebKit/efl/ewk/ewk_private.h120
-rw-r--r--WebKit/efl/ewk/ewk_view.cpp215
-rw-r--r--WebKit/efl/ewk/ewk_view.h8
5 files changed, 421 insertions, 64 deletions
diff --git a/WebKit/efl/ewk/ewk_frame.cpp b/WebKit/efl/ewk/ewk_frame.cpp
index ec56221..ca76f02 100644
--- a/WebKit/efl/ewk/ewk_frame.cpp
+++ b/WebKit/efl/ewk/ewk_frame.cpp
@@ -31,6 +31,7 @@
#include "FrameTree.h"
#include "FrameView.h"
#include "HTMLPlugInElement.h"
+#include "HistoryItem.h"
#include "HitTestResult.h"
#include "KURL.h"
#include "PlatformKeyboardEvent.h"
@@ -1633,6 +1634,70 @@ WebCore::Frame* ewk_frame_core_get(const Evas_Object* o)
/**
* @internal
+ * Reports a resource will be requested. User may override behavior of webkit by
+ * changing values in @param request.
+ *
+ * @param o Frame.
+ * @param request Request details that user may override. Whenever values on
+ * this struct changes, it must be properly malloc'd as it will be freed
+ * afterwards.
+ *
+ * Emits signal: "resource,request,willsend"
+ */
+void ewk_frame_request_will_send(Evas_Object *o, Ewk_Frame_Resource_Request *request)
+{
+ evas_object_smart_callback_call(o, "resource,request,willsend", request);
+}
+
+/**
+ * @internal
+ * Reports that there's a new resource.
+ *
+ * @param o Frame.
+ * @param request New request details. No changes are allowed to fields.
+ *
+ * Emits signal: "resource,request,new"
+ */
+void ewk_frame_request_assign_identifier(Evas_Object *o, const Ewk_Frame_Resource_Request *request)
+{
+ evas_object_smart_callback_call(o, "resource,request,new", (void *)request);
+}
+
+/**
+ * @internal
+ * Reports that first navigation occurred
+ *
+ * @param o Frame.
+ *
+ * Emits signal: "navigation,first"
+ */
+void ewk_frame_did_perform_first_navigation(Evas_Object *o)
+{
+ evas_object_smart_callback_call(o, "navigation,first", 0);
+}
+
+/**
+ * @internal
+ * Reports frame will be saved to current state
+ *
+ * @param o Frame.
+ * @param item History item to save details to.
+ *
+ * Emits signal: "state,save"
+ */
+void ewk_frame_view_state_save(Evas_Object *o, WebCore::HistoryItem* item)
+{
+ const char *title = ewk_frame_title_get(o);
+ const char *uri = ewk_frame_uri_get(o);
+
+ item->setTitle(WebCore::String::fromUTF8(title));
+ item->setURLString(WebCore::String::fromUTF8(uri));
+
+ evas_object_smart_callback_call(o, "state,save", 0);
+}
+
+/**
+ * @internal
* Reports the frame started loading something.
*
* Emits signal: "load,started" with no parameters.
@@ -1652,6 +1717,58 @@ void ewk_frame_load_started(Evas_Object* o)
/**
* @internal
+ * Reports the frame started provisional load.
+ *
+ * @param o Frame.
+ *
+ * Emits signal: "load,provisional" with no parameters.
+ */
+void ewk_frame_load_provisional(Evas_Object* o)
+{
+ evas_object_smart_callback_call(o, "load,provisional", 0);
+}
+
+/**
+ * @internal
+ * Reports the frame finished first layout.
+ *
+ * @param o Frame.
+ *
+ * Emits signal: "load,firstlayout,finished" with no parameters.
+ */
+void ewk_frame_load_firstlayout_finished(Evas_Object *o)
+{
+ evas_object_smart_callback_call(o, "load,firstlayout,finished", 0);
+}
+
+/**
+ * @internal
+ * Reports the frame finished first non empty layout.
+ *
+ * @param o Frame.
+ *
+ * Emits signal: "load,nonemptylayout,finished" with no parameters.
+ */
+void ewk_frame_load_firstlayout_nonempty_finished(Evas_Object *o)
+{
+ evas_object_smart_callback_call(o, "load,nonemptylayout,finished", 0);
+}
+
+/**
+ * @internal
+ * Reports the loading of a document has finished on frame.
+ *
+ * @param o Frame.
+ *
+ * Emits signal: "load,document,finished" with no parameters.
+ */
+void ewk_frame_load_document_finished(Evas_Object *o)
+{
+ evas_object_smart_callback_call(o, "load,document,finished", 0);
+}
+
+/**
+ * @internal
* Reports load finished, optionally with error information.
*
* Emits signal: "load,finished" with pointer to Ewk_Frame_Load_Error
diff --git a/WebKit/efl/ewk/ewk_frame.h b/WebKit/efl/ewk/ewk_frame.h
index c71269b..1a9fe81 100644
--- a/WebKit/efl/ewk/ewk_frame.h
+++ b/WebKit/efl/ewk/ewk_frame.h
@@ -48,16 +48,28 @@ extern "C" {
*
* - "title,changed", const char*: title of the main frame changed.
* - "uri,changed", const char*: uri of the main frame changed.
+ * - "load,document,finished", void: loading of a document has
+ * finished on this frame.
+ * - "load,nonemptylayout,finished", void: frame finished first
+ * non-empty layout.
* - "load,started", void: frame started loading.
* - "load,progress", double*: load progress changed (overall value
* from 0.0 to 1.0, connect to individual frames for fine grained).
* - "load,finished", const Ewk_Frame_Load_Error*: reports load
* finished and as argument @c NULL if successfully or pointer to
* structure defining the error.
+ * - "load,provisional", void: frame started provisional load.
+ * - "load,firstlayout,finished", void: frame finished first layout.
* - "load,error", const Ewk_Frame_Load_Error*: reports load failed
* and as argument a pointer to structure defining the error.
* - "contents,size,changed", Evas_Coord[2]: reports contents size
* changed due new layout, script actions or any other events.
+ * - "navigation,first", void: first navigation occurred.
+ * - "resource,request,new", Ewk_Frame_Resource_Request*: reports that
+ * there's a new resource request.
+ * - "resource,request,willsend", Ewk_Frame_Resource_Request*: a resource will
+ * be requested.
+ * - "state,save", void: frame's state will be saved as a history item.
*/
@@ -82,6 +94,19 @@ struct _Ewk_Frame_Load_Error {
};
/**
+ * Structure used to report resource requests
+ *
+ * Details given before a resource is loaded on a given frame. It's used by
+ * ewk_frame_request_will_send() to inform the details of a to-be-loaded
+ * resource, allowing them to be overridden.
+ */
+typedef struct _Ewk_Frame_Resource_Request Ewk_Frame_Resource_Request;
+struct _Ewk_Frame_Resource_Request {
+ const char *url; /**< url of this resource */
+ const unsigned long identifier; /**< resource's identifier. Can not be changed */
+};
+
+/**
* Structure used to report hit test results.
*/
typedef struct _Ewk_Hit_Test Ewk_Hit_Test;
diff --git a/WebKit/efl/ewk/ewk_private.h b/WebKit/efl/ewk/ewk_private.h
index 83eef91..c549ad7 100644
--- a/WebKit/efl/ewk/ewk_private.h
+++ b/WebKit/efl/ewk/ewk_private.h
@@ -48,85 +48,101 @@ struct ContextMenu;
struct ContextMenuItem;
}
-void ewk_view_ready(Evas_Object *o);
-void ewk_view_title_set(Evas_Object *o, const char *title);
-void ewk_view_uri_changed(Evas_Object *o);
-void ewk_view_load_started(Evas_Object *o);
-void ewk_view_frame_main_load_started(Evas_Object *o);
-void ewk_view_load_finished(Evas_Object *o, const Ewk_Frame_Load_Error *error);
-void ewk_view_load_error(Evas_Object *o, const Ewk_Frame_Load_Error *error);
-void ewk_view_load_progress_changed(Evas_Object *o);
-Evas_Object *ewk_view_window_create(Evas_Object *o, Eina_Bool javascript, const WebCore::WindowFeatures* coreFeatures);
+void ewk_view_ready(Evas_Object *o);
+void ewk_view_title_set(Evas_Object *o, const char *title);
+void ewk_view_uri_changed(Evas_Object *o);
+void ewk_view_load_started(Evas_Object *o);
+void ewk_view_load_provisional(Evas_Object *o);
+void ewk_view_frame_main_load_started(Evas_Object *o);
+void ewk_view_frame_main_cleared(Evas_Object *o);
+void ewk_view_frame_main_icon_received(Evas_Object *o);
+void ewk_view_load_finished(Evas_Object *o, const Ewk_Frame_Load_Error *error);
+void ewk_view_load_error(Evas_Object *o, const Ewk_Frame_Load_Error *error);
+void ewk_view_load_progress_changed(Evas_Object *o);
+void ewk_view_load_show(Evas_Object* o);
+void ewk_view_restore_state(Evas_Object *o, Evas_Object *frame);
+Evas_Object *ewk_view_window_create(Evas_Object *o, Eina_Bool javascript, const WebCore::WindowFeatures* coreFeatures);
-void ewk_view_mouse_link_hover_in(Evas_Object *o, void *data);
-void ewk_view_mouse_link_hover_out(Evas_Object *o);
+void ewk_view_mouse_link_hover_in(Evas_Object *o, void *data);
+void ewk_view_mouse_link_hover_out(Evas_Object *o);
-void ewk_view_toolbars_visible_set(Evas_Object *o, Eina_Bool visible);
-void ewk_view_toolbars_visible_get(Evas_Object *o, Eina_Bool *visible);
+void ewk_view_toolbars_visible_set(Evas_Object *o, Eina_Bool visible);
+void ewk_view_toolbars_visible_get(Evas_Object *o, Eina_Bool *visible);
-void ewk_view_statusbar_visible_set(Evas_Object *o, Eina_Bool visible);
-void ewk_view_statusbar_visible_get(Evas_Object *o, Eina_Bool *visible);
-void ewk_view_statusbar_text_set(Evas_Object *o, const char *text);
+void ewk_view_statusbar_visible_set(Evas_Object *o, Eina_Bool visible);
+void ewk_view_statusbar_visible_get(Evas_Object *o, Eina_Bool *visible);
+void ewk_view_statusbar_text_set(Evas_Object *o, const char *text);
-void ewk_view_scrollbars_visible_set(Evas_Object *o, Eina_Bool visible);
-void ewk_view_scrollbars_visible_get(Evas_Object *o, Eina_Bool *visible);
+void ewk_view_scrollbars_visible_set(Evas_Object *o, Eina_Bool visible);
+void ewk_view_scrollbars_visible_get(Evas_Object *o, Eina_Bool *visible);
-void ewk_view_menubar_visible_set(Evas_Object *o, Eina_Bool visible);
-void ewk_view_menubar_visible_get(Evas_Object *o, Eina_Bool *visible);
+void ewk_view_menubar_visible_set(Evas_Object *o, Eina_Bool visible);
+void ewk_view_menubar_visible_get(Evas_Object *o, Eina_Bool *visible);
-void ewk_view_tooltip_text_set(Evas_Object *o, const char *text);
+void ewk_view_tooltip_text_set(Evas_Object *o, const char *text);
-void ewk_view_add_console_message(Evas_Object *o, const char *message, unsigned int lineNumber, const char *sourceID);
+void ewk_view_add_console_message(Evas_Object *o, const char *message, unsigned int lineNumber, const char *sourceID);
-void ewk_view_run_javascript_alert(Evas_Object *o, Evas_Object *frame, const char *message);
-Eina_Bool ewk_view_run_javascript_confirm(Evas_Object *o, Evas_Object *frame, const char *message);
-Eina_Bool ewk_view_run_javascript_prompt(Evas_Object *o, Evas_Object *frame, const char *message, const char *defaultValue, char **value);
-Eina_Bool ewk_view_should_interrupt_javascript(Evas_Object *o);
-uint64_t ewk_view_exceeded_database_quota(Evas_Object *o, Evas_Object *frame, const char *databaseName, uint64_t current_size, uint64_t expected_size);
+void ewk_view_run_javascript_alert(Evas_Object *o, Evas_Object *frame, const char *message);
+Eina_Bool ewk_view_run_javascript_confirm(Evas_Object *o, Evas_Object *frame, const char *message);
+Eina_Bool ewk_view_run_javascript_prompt(Evas_Object *o, Evas_Object *frame, const char *message, const char *defaultValue, char **value);
+Eina_Bool ewk_view_should_interrupt_javascript(Evas_Object *o);
+uint64_t ewk_view_exceeded_database_quota(Evas_Object *o, Evas_Object *frame, const char *databaseName, uint64_t current_size, uint64_t expected_size);
-Eina_Bool ewk_view_run_open_panel(Evas_Object *o, Evas_Object *frame, Eina_Bool allows_multiple_files, const Eina_List *suggested_filenames, Eina_List **selected_filenames);
+Eina_Bool ewk_view_run_open_panel(Evas_Object *o, Evas_Object *frame, Eina_Bool allows_multiple_files, const Eina_List *suggested_filenames, Eina_List **selected_filenames);
-void ewk_view_repaint(Evas_Object *o, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
-void ewk_view_scroll(Evas_Object *o, Evas_Coord dx, Evas_Coord dy, Evas_Coord sx, Evas_Coord sy, Evas_Coord sw, Evas_Coord sh, Evas_Coord cx, Evas_Coord cy, Evas_Coord cw, Evas_Coord ch, Eina_Bool main_frame);
-WebCore::Page *ewk_view_core_page_get(const Evas_Object *o);
+void ewk_view_repaint(Evas_Object *o, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
+void ewk_view_scroll(Evas_Object *o, Evas_Coord dx, Evas_Coord dy, Evas_Coord sx, Evas_Coord sy, Evas_Coord sw, Evas_Coord sh, Evas_Coord cx, Evas_Coord cy, Evas_Coord cw, Evas_Coord ch, Eina_Bool main_frame);
+WebCore::Page *ewk_view_core_page_get(const Evas_Object *o);
WTF::PassRefPtr<WebCore::Frame> ewk_view_frame_create(Evas_Object *o, Evas_Object *frame, const WebCore::String& name, WebCore::HTMLFrameOwnerElement* ownerElement, const WebCore::KURL& url, const WebCore::String& referrer);
WTF::PassRefPtr<WebCore::Widget> ewk_view_plugin_create(Evas_Object* o, Evas_Object* frame, const WebCore::IntSize& pluginSize, WebCore::HTMLPlugInElement* element, const WebCore::KURL& url, const WTF::Vector<WebCore::String>& paramNames, const WTF::Vector<WebCore::String>& paramValues, const WebCore::String& mimeType, bool loadManually);
-void ewk_view_popup_new(Evas_Object *o, WebCore::PopupMenuClient* client, int selected, const WebCore::IntRect& rect);
+void ewk_view_popup_new(Evas_Object *o, WebCore::PopupMenuClient* client, int selected, const WebCore::IntRect& rect);
+void ewk_view_viewport_set(Evas_Object *o, float w, float h, float init_scale, float max_scale, float min_scale, float user_scalable);
-void ewk_view_download_request(Evas_Object *o, Ewk_Download *download);
+void ewk_view_download_request(Evas_Object *o, Ewk_Download *download);
-Ewk_History *ewk_history_new(WebCore::BackForwardList *history);
-void ewk_history_free(Ewk_History *history);
+Ewk_History *ewk_history_new(WebCore::BackForwardList *history);
+void ewk_history_free(Ewk_History *history);
Ewk_Context_Menu *ewk_context_menu_new(Evas_Object *view, WebCore::ContextMenuController *controller);
-Eina_Bool ewk_context_menu_free(Ewk_Context_Menu *o);
-void ewk_context_menu_item_append(Ewk_Context_Menu *o, WebCore::ContextMenuItem& core);
+Eina_Bool ewk_context_menu_free(Ewk_Context_Menu *o);
+void ewk_context_menu_item_append(Ewk_Context_Menu *o, WebCore::ContextMenuItem& core);
Ewk_Context_Menu *ewk_context_menu_custom_get(Ewk_Context_Menu *o);
-void ewk_context_menu_show(Ewk_Context_Menu *o);
+void ewk_context_menu_show(Ewk_Context_Menu *o);
Ewk_Window_Features *ewk_window_features_new_from_core(const WebCore::WindowFeatures* core);
-Evas_Object *ewk_frame_add(Evas *e);
-Eina_Bool ewk_frame_init(Evas_Object *o, Evas_Object *view, WebCore::Frame *frame);
-Evas_Object *ewk_frame_child_add(Evas_Object *o, WTF::PassRefPtr<WebCore::Frame> child, const WebCore::String& name, const WebCore::KURL& url, const WebCore::String& referrer);
+Evas_Object *ewk_frame_add(Evas *e);
+Eina_Bool ewk_frame_init(Evas_Object *o, Evas_Object *view, WebCore::Frame *frame);
+Evas_Object *ewk_frame_child_add(Evas_Object *o, WTF::PassRefPtr<WebCore::Frame> child, const WebCore::String& name, const WebCore::KURL& url, const WebCore::String& referrer);
-WebCore::Frame *ewk_frame_core_get(const Evas_Object *o);
-void ewk_frame_core_gone(Evas_Object *o);
+WebCore::Frame *ewk_frame_core_get(const Evas_Object *o);
+void ewk_frame_core_gone(Evas_Object *o);
-void ewk_frame_load_started(Evas_Object *o);
-void ewk_frame_load_finished(Evas_Object *o, const char *error_domain, int error_code, Eina_Bool is_cancellation, const char *error_description, const char *failing_url);
-void ewk_frame_load_error(Evas_Object *o, const char *error_domain, int error_code, Eina_Bool is_cancellation, const char *error_description, const char *failing_url);
-void ewk_frame_load_progress_changed(Evas_Object *o);
+void ewk_frame_load_started(Evas_Object *o);
+void ewk_frame_load_provisional(Evas_Object *o);
+void ewk_frame_load_firstlayout_finished(Evas_Object *o);
+void ewk_frame_load_firstlayout_nonempty_finished(Evas_Object *o);
+void ewk_frame_load_document_finished(Evas_Object *o);
+void ewk_frame_load_finished(Evas_Object *o, const char *error_domain, int error_code, Eina_Bool is_cancellation, const char *error_description, const char *failing_url);
+void ewk_frame_load_error(Evas_Object *o, const char *error_domain, int error_code, Eina_Bool is_cancellation, const char *error_description, const char *failing_url);
+void ewk_frame_load_progress_changed(Evas_Object *o);
-void ewk_frame_contents_size_changed(Evas_Object *o, Evas_Coord w, Evas_Coord h);
-void ewk_frame_title_set(Evas_Object *o, const char *title);
+void ewk_frame_request_will_send(Evas_Object *o, Ewk_Frame_Resource_Request *request);
+void ewk_frame_request_assign_identifier(Evas_Object *o, const Ewk_Frame_Resource_Request *request);
+void ewk_frame_view_state_save(Evas_Object *o, WebCore::HistoryItem* item);
-void ewk_frame_view_create_for_view(Evas_Object *o, Evas_Object *view);
-Eina_Bool ewk_frame_uri_changed(Evas_Object *o);
-void ewk_frame_force_layout(Evas_Object *o);
+void ewk_frame_did_perform_first_navigation(Evas_Object *o);
+
+void ewk_frame_contents_size_changed(Evas_Object *o, Evas_Coord w, Evas_Coord h);
+void ewk_frame_title_set(Evas_Object *o, const char *title);
+
+void ewk_frame_view_create_for_view(Evas_Object *o, Evas_Object *view);
+Eina_Bool ewk_frame_uri_changed(Evas_Object *o);
+void ewk_frame_force_layout(Evas_Object *o);
WTF::PassRefPtr<WebCore::Widget> ewk_frame_plugin_create(Evas_Object* o, const WebCore::IntSize& pluginSize, WebCore::HTMLPlugInElement* element, const WebCore::KURL& url, const WTF::Vector<WebCore::String>& paramNames, const WTF::Vector<WebCore::String>& paramValues, const WebCore::String& mimeType, bool loadManually);
diff --git a/WebKit/efl/ewk/ewk_view.cpp b/WebKit/efl/ewk/ewk_view.cpp
index ca26f64..39dc0a7 100644
--- a/WebKit/efl/ewk/ewk_view.cpp
+++ b/WebKit/efl/ewk/ewk_view.cpp
@@ -102,6 +102,19 @@ struct _Ewk_View_Private_Data {
Eina_Bool resizable_textareas:1;
Eina_Bool private_browsing:1;
Eina_Bool caret_browsing:1;
+ struct {
+ float w;
+ float h;
+ float init_scale;
+ float min_scale;
+ float max_scale;
+ float user_scalable;
+ } viewport;
+ struct {
+ float min_scale;
+ float max_scale;
+ Eina_Bool user_scalable:1;
+ } zoom_range;
} settings;
struct {
struct {
@@ -520,6 +533,7 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* sd)
static_cast<WebCore::InspectorClient*>(new WebCore::InspectorClientEfl),
0,
0,
+ 0,
0);
if (!priv->page) {
CRITICAL("Could not create WebKit Page");
@@ -576,6 +590,12 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* sd)
priv->settings.private_browsing = priv->page_settings->privateBrowsingEnabled();
priv->settings.caret_browsing = priv->page_settings->caretBrowsingEnabled();
+ // Since there's no scale separated from zooming in webkit-efl, this functionality of
+ // viewport meta tag is implemented using zoom. When scale zoom is supported by webkit-efl,
+ // this functionality will be modified by the scale zoom patch.
+ priv->settings.zoom_range.min_scale = ZOOM_MIN;
+ priv->settings.zoom_range.max_scale = ZOOM_MAX;
+
priv->main_frame = _ewk_view_core_frame_new(sd, priv, 0).get();
if (!priv->main_frame) {
CRITICAL("Could not create main frame.");
@@ -1001,6 +1021,11 @@ void ewk_view_fixed_layout_size_set(Evas_Object* o, Evas_Coord w, Evas_Coord h)
{
EWK_VIEW_SD_GET_OR_RETURN(o, sd);
EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv);
+
+ WebCore::FrameLoaderClientEfl* client = static_cast<WebCore::FrameLoaderClientEfl*>(priv->main_frame->loader()->client());
+ if (!client->getInitLayoutCompleted())
+ return;
+
WebCore::FrameView* view = sd->_priv->main_frame->view();
if (w <= 0 && h <= 0) {
if (!priv->fixed_layout.use)
@@ -1757,14 +1782,22 @@ float ewk_view_zoom_get(const Evas_Object* o)
Eina_Bool ewk_view_zoom_set(Evas_Object* o, float zoom, Evas_Coord cx, Evas_Coord cy)
{
EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE);
+ EWK_VIEW_PRIV_GET(sd, priv);
+
EINA_SAFETY_ON_NULL_RETURN_VAL(sd->api, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(sd->api->zoom_set, EINA_FALSE);
- if (zoom < ZOOM_MIN) {
- WRN("zoom level is < %f : %f", (double)ZOOM_MIN, (double)zoom);
+
+ if (!priv->settings.zoom_range.user_scalable) {
+ WRN("userScalable is false");
+ return EINA_FALSE;
+ }
+
+ if (zoom < priv->settings.zoom_range.min_scale) {
+ WRN("zoom level is < %f : %f", (double)priv->settings.zoom_range.min_scale, (double)zoom);
return EINA_FALSE;
}
- if (zoom > ZOOM_MAX) {
- WRN("zoom level is > %f : %f", (double)ZOOM_MAX, (double)zoom);
+ if (zoom > priv->settings.zoom_range.max_scale) {
+ WRN("zoom level is > %f : %f", (double)priv->settings.zoom_range.max_scale, (double)zoom);
return EINA_FALSE;
}
@@ -1827,14 +1860,22 @@ void ewk_view_zoom_weak_smooth_scale_set(Evas_Object* o, Eina_Bool smooth_scale)
Eina_Bool ewk_view_zoom_weak_set(Evas_Object* o, float zoom, Evas_Coord cx, Evas_Coord cy)
{
EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE);
+ EWK_VIEW_PRIV_GET(sd, priv);
+
EINA_SAFETY_ON_NULL_RETURN_VAL(sd->api, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(sd->api->zoom_weak_set, EINA_FALSE);
- if (zoom < ZOOM_MIN) {
- WRN("zoom level is < %f : %f", (double)ZOOM_MIN, (double)zoom);
+
+ if (!priv->settings.zoom_range.user_scalable) {
+ WRN("userScalable is false");
+ return EINA_FALSE;
+ }
+
+ if (zoom < priv->settings.zoom_range.min_scale) {
+ WRN("zoom level is < %f : %f", (double)priv->settings.zoom_range.min_scale, (double)zoom);
return EINA_FALSE;
}
- if (zoom > ZOOM_MAX) {
- WRN("zoom level is > %f : %f", (double)ZOOM_MAX, (double)zoom);
+ if (zoom > priv->settings.zoom_range.max_scale) {
+ WRN("zoom level is > %f : %f", (double)priv->settings.zoom_range.max_scale, (double)zoom);
return EINA_FALSE;
}
@@ -1977,12 +2018,17 @@ Eina_Bool ewk_view_zoom_animated_set(Evas_Object* o, float zoom, float duration,
EINA_SAFETY_ON_NULL_RETURN_VAL(sd->api, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(sd->api->zoom_weak_set, EINA_FALSE);
- if (zoom < ZOOM_MIN) {
- WRN("zoom level is < %f : %f", (double)ZOOM_MIN, (double)zoom);
+ if (!priv->settings.zoom_range.user_scalable) {
+ WRN("userScalable is false");
return EINA_FALSE;
}
- if (zoom > ZOOM_MAX) {
- WRN("zoom level is > %f : %f", (double)ZOOM_MAX, (double)zoom);
+
+ if (zoom < priv->settings.zoom_range.min_scale) {
+ WRN("zoom level is < %f : %f", (double)priv->settings.zoom_range.min_scale, (double)zoom);
+ return EINA_FALSE;
+ }
+ if (zoom > priv->settings.zoom_range.max_scale) {
+ WRN("zoom level is > %f : %f", (double)priv->settings.zoom_range.max_scale, (double)zoom);
return EINA_FALSE;
}
@@ -3710,3 +3756,148 @@ void ewk_view_download_request(Evas_Object* o, Ewk_Download* download)
DBG("view=%p", o);
evas_object_smart_callback_call(o, "download,request", download);
}
+
+/**
+ * @internal
+ * Reports the viewport has changed.
+ *
+ * @param o view.
+ * @param w width.
+ * @param h height.
+ * @param init_scale initialScale value.
+ * @param max_scale maximumScale value.
+ * @param min_scale minimumScale value.
+ * @param user_scalable userscalable flag.
+ *
+ * Emits signal: "viewport,changed" with no parameters.
+ */
+void ewk_view_viewport_set(Evas_Object *o, float w, float h, float init_scale, float max_scale, float min_scale, float user_scalable)
+{
+ EWK_VIEW_SD_GET(o, sd);
+ EWK_VIEW_PRIV_GET(sd, priv);
+
+ priv->settings.viewport.w = w;
+ priv->settings.viewport.h = h;
+ priv->settings.viewport.init_scale = init_scale;
+ priv->settings.viewport.min_scale = min_scale;
+ priv->settings.viewport.max_scale = max_scale;
+ priv->settings.viewport.user_scalable = user_scalable;
+
+ evas_object_smart_callback_call(o, "viewport,changed", 0);
+}
+
+/**
+ * Gets data of viewport meta tag.
+ *
+ * @param o view.
+ * @param w width.
+ * @param h height.
+ * @param init_scale initial Scale value.
+ * @param max_scale maximum Scale value.
+ * @param min_scale minimum Scale value.
+ * @param user_scalable user Scalable value.
+ */
+void ewk_view_viewport_get(Evas_Object *o, float* w, float* h, float* init_scale, float* max_scale, float* min_scale, float* user_scalable)
+{
+ EWK_VIEW_SD_GET(o, sd);
+ EWK_VIEW_PRIV_GET(sd, priv);
+
+ if (w)
+ *w = priv->settings.viewport.w;
+ if (h)
+ *h = priv->settings.viewport.h;
+ if (init_scale)
+ *init_scale = priv->settings.viewport.init_scale;
+ if (max_scale)
+ *max_scale = priv->settings.viewport.max_scale;
+ if (min_scale)
+ *min_scale = priv->settings.viewport.min_scale;
+ if (user_scalable)
+ *user_scalable = priv->settings.viewport.user_scalable;
+}
+
+/**
+ * Sets the zoom range.
+ *
+ * @param o view.
+ * @param min_scale minimum value of zoom range.
+ * @param max_scale maximum value of zoom range.
+ *
+ * @return @c EINA_TRUE if zoom range is changed, @c EINA_FALSE if not or failure.
+ */
+Eina_Bool ewk_view_zoom_range_set(Evas_Object* o, float min_scale, float max_scale)
+{
+ EWK_VIEW_SD_GET(o, sd);
+ EWK_VIEW_PRIV_GET(sd, priv);
+
+ if (max_scale < min_scale) {
+ WRN("min_scale is larger than max_scale");
+ return EINA_FALSE;
+ }
+
+ priv->settings.zoom_range.min_scale = min_scale;
+ priv->settings.zoom_range.max_scale = max_scale;
+
+ return EINA_TRUE;
+}
+
+/**
+ * Gets the minimum value of zoom range.
+ *
+ * @param o view.
+ *
+ * @return minimum value of zoom range.
+ */
+float ewk_view_zoom_range_min_get(Evas_Object* o)
+{
+ EWK_VIEW_SD_GET(o, sd);
+ EWK_VIEW_PRIV_GET(sd, priv);
+
+ return priv->settings.zoom_range.min_scale;
+}
+
+/**
+ * Gets the maximum value of zoom range.
+ *
+ * @param o view.
+ *
+ * @return maximum value of zoom range.
+ */
+float ewk_view_zoom_range_max_get(Evas_Object* o)
+{
+ EWK_VIEW_SD_GET(o, sd);
+ EWK_VIEW_PRIV_GET(sd, priv);
+
+ return priv->settings.zoom_range.max_scale;
+}
+
+/**
+ * Sets if zoom is enabled.
+ *
+ * @param o view.
+ * @param user_scalable boolean pointer in which to enable zoom. It defaults
+ * to @c EINA_TRUE.
+ */
+void ewk_view_user_scalable_set(Evas_Object* o, Eina_Bool user_scalable)
+{
+ EWK_VIEW_SD_GET(o, sd);
+ EWK_VIEW_PRIV_GET(sd, priv);
+
+ priv->settings.zoom_range.user_scalable = user_scalable;
+}
+
+/**
+ * Gets if zoom is enabled.
+ *
+ * @param o view.
+ * @param user_scalable where to return the current user scalable value.
+ *
+ * @return @c EINA_TRUE if zoom is enabled, @c EINA_FALSE if not.
+ */
+Eina_Bool ewk_view_user_scalable_get(Evas_Object* o)
+{
+ EWK_VIEW_SD_GET(o, sd);
+ EWK_VIEW_PRIV_GET(sd, priv);
+
+ return priv->settings.zoom_range.user_scalable;
+}
diff --git a/WebKit/efl/ewk/ewk_view.h b/WebKit/efl/ewk/ewk_view.h
index a8fe3b8..209beff 100644
--- a/WebKit/efl/ewk/ewk_view.h
+++ b/WebKit/efl/ewk/ewk_view.h
@@ -85,6 +85,7 @@ extern "C" {
* - "download,request", Ewk_Download: reports a download is being requested
* and as arguments gives its details.
* - "icon,received", void: main frame received an icon.
+ * - "viewport,changed", void: Report that viewport has changed.
*/
typedef struct _Ewk_View_Smart_Data Ewk_View_Smart_Data;
@@ -453,6 +454,13 @@ EAPI void ewk_view_paint_context_translate(Ewk_View_Paint_Context *ctxt, float x
EAPI Eina_Bool ewk_view_paint(Ewk_View_Private_Data *priv, cairo_t *cr, const Eina_Rectangle *area);
EAPI Eina_Bool ewk_view_paint_contents(Ewk_View_Private_Data *priv, cairo_t *cr, const Eina_Rectangle *area);
+EAPI void ewk_view_viewport_get(Evas_Object *o, float* w, float* h, float* init_scale, float* max_scale, float* min_scale, float* user_scalable);
+EAPI Eina_Bool ewk_view_zoom_range_set(Evas_Object* o, float min_scale, float max_scale);
+EAPI float ewk_view_zoom_range_min_get(Evas_Object* o);
+EAPI float ewk_view_zoom_range_max_get(Evas_Object* o);
+EAPI void ewk_view_user_scalable_set(Evas_Object* o, Eina_Bool user_scalable);
+EAPI Eina_Bool ewk_view_user_scalable_get(Evas_Object* o);
+
#ifdef __cplusplus
}
#endif