summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-07 11:22:47 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-07 11:22:47 +0100
commitcfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch)
tree24d68c6f61c464ecba1e05670b80390ea3b0e50c /Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
parent69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff)
downloadqtwebkit-cfd86b747d32ac22246a1aa908eaa720c63a88c1.tar.gz
Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733)
New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes.
Diffstat (limited to 'Source/WebKit2/UIProcess/API/efl/ewk_view.cpp')
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view.cpp1508
1 files changed, 197 insertions, 1311 deletions
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
index e77751934..429185cef 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
@@ -21,61 +21,44 @@
#include "config.h"
#include "ewk_view.h"
+#include "EwkViewImpl.h"
+#include "FindClientEfl.h"
+#include "FormClientEfl.h"
+#include "InputMethodContextEfl.h"
#include "NativeWebKeyboardEvent.h"
#include "NativeWebMouseEvent.h"
#include "NativeWebWheelEvent.h"
-#include "PageClientImpl.h"
+#include "PageClientBase.h"
#include "PageLoadClientEfl.h"
-#include "RefPtrEfl.h"
+#include "PagePolicyClientEfl.h"
+#include "PageUIClientEfl.h"
#include "ResourceLoadClientEfl.h"
#include "WKAPICast.h"
-#include "WKColorPickerResultListener.h"
#include "WKEinaSharedString.h"
#include "WKFindOptions.h"
#include "WKRetainPtr.h"
#include "WKString.h"
-#include "WKURL.h"
#include "WebContext.h"
#include "WebPageGroup.h"
-#include "WebPopupItem.h"
-#include "WebPopupMenuProxyEfl.h"
#include "WebPreferences.h"
#include "ewk_back_forward_list_private.h"
#include "ewk_context.h"
#include "ewk_context_private.h"
#include "ewk_favicon_database_private.h"
#include "ewk_intent_private.h"
-#include "ewk_popup_menu_item.h"
-#include "ewk_popup_menu_item_private.h"
#include "ewk_private.h"
-#include "ewk_resource.h"
-#include "ewk_resource_private.h"
#include "ewk_settings_private.h"
-#include "ewk_view_find_client_private.h"
-#include "ewk_view_form_client_private.h"
-#include "ewk_view_policy_client_private.h"
#include "ewk_view_private.h"
-#include "ewk_view_ui_client_private.h"
#include <Ecore_Evas.h>
-#include <Edje.h>
-#include <WebCore/Cursor.h>
-#include <WebCore/EflScreenUtilities.h>
#include <WebKit2/WKPageGroup.h>
#include <wtf/text/CString.h>
-#if ENABLE(FULLSCREEN_API)
-#include "WebFullScreenManagerProxy.h"
-#endif
-
#if ENABLE(INSPECTOR)
#include "WebInspectorProxy.h"
#endif
-#if USE(ACCELERATED_COMPOSITING)
-#include <Evas_GL.h>
-#endif
-
-#if USE(COORDINATED_GRAPHICS)
+#if USE(TILED_BACKING_STORE)
+#include "PageViewportController.h"
#include "PageViewportControllerClientEfl.h"
#endif
@@ -84,104 +67,14 @@ using namespace WebCore;
static const char EWK_VIEW_TYPE_STR[] = "EWK2_View";
-static const int defaultCursorSize = 16;
-
-static void _ewk_view_on_favicon_changed(const char* pageURL, void* eventInfo);
-
-typedef HashMap<const WebPageProxy*, const Evas_Object*> PageViewMap;
-
-static inline PageViewMap& pageViewMap()
-{
- DEFINE_STATIC_LOCAL(PageViewMap, map, ());
- return map;
-}
-
-static inline void addToPageViewMap(const Evas_Object* ewkView)
-{
- ASSERT(ewkView);
- ASSERT(ewk_view_page_get(ewkView));
- PageViewMap::AddResult result = pageViewMap().add(ewk_view_page_get(ewkView), ewkView);
- ASSERT_UNUSED(result, result.isNewEntry);
-}
-
-static inline void removeFromPageViewMap(const Evas_Object* ewkView)
-{
- ASSERT(ewkView);
- ASSERT(ewk_view_page_get(ewkView));
- ASSERT(pageViewMap().contains(ewk_view_page_get(ewkView)));
- pageViewMap().remove(ewk_view_page_get(ewkView));
-}
-
-struct Ewk_View_Private_Data {
- OwnPtr<PageClientImpl> pageClient;
-#if USE(COORDINATED_GRAPHICS)
- OwnPtr<PageViewportControllerClientEfl> pageViewportControllerClient;
-#endif
- RefPtr<WebPageProxy> pageProxy;
- OwnPtr<PageLoadClientEfl> pageLoadClient;
- OwnPtr<ResourceLoadClientEfl> resourceLoadClient;
-
- WKEinaSharedString url;
- WKEinaSharedString title;
- WKEinaSharedString theme;
- WKEinaSharedString customEncoding;
- WKEinaSharedString cursorGroup;
- WKEinaSharedString faviconURL;
- RefPtr<Evas_Object> cursorObject;
- OwnPtr<Ewk_Back_Forward_List> backForwardList;
- OwnPtr<Ewk_Settings> settings;
- bool areMouseEventsEnabled;
- WKRetainPtr<WKColorPickerResultListenerRef> colorPickerResultListener;
- RefPtr<Ewk_Context> context;
-#if ENABLE(TOUCH_EVENTS)
- bool areTouchEventsEnabled;
-#endif
-
- WebPopupMenuProxyEfl* popupMenuProxy;
- Eina_List* popupMenuItems;
-
-#ifdef HAVE_ECORE_X
- bool isUsingEcoreX;
-#endif
-
-#if USE(ACCELERATED_COMPOSITING)
- Evas_GL* evasGl;
- Evas_GL_Context* evasGlContext;
- Evas_GL_Surface* evasGlSurface;
-#endif
-
- Ewk_View_Private_Data()
- : areMouseEventsEnabled(false)
-#if ENABLE(TOUCH_EVENTS)
- , areTouchEventsEnabled(false)
-#endif
- , popupMenuProxy(0)
- , popupMenuItems(0)
-#ifdef HAVE_ECORE_X
- , isUsingEcoreX(false)
-#endif
-#if USE(ACCELERATED_COMPOSITING)
- , evasGl(0)
- , evasGlContext(0)
- , evasGlSurface(0)
-#endif
- { }
-
- ~Ewk_View_Private_Data()
- {
- /* Unregister icon change callback */
- Ewk_Favicon_Database* iconDatabase = context->faviconDatabase();
- iconDatabase->unwatchChanges(_ewk_view_on_favicon_changed);
-
- void* item;
- EINA_LIST_FREE(popupMenuItems, item)
- delete static_cast<Ewk_Popup_Menu_Item*>(item);
- }
-};
-
#define EWK_VIEW_TYPE_CHECK(ewkView, result) \
bool result = true; \
do { \
+ if (!ewkView) { \
+ EINA_LOG_CRIT("null is not a ewk_view"); \
+ result = false; \
+ break; \
+ } \
const char* _tmp_otype = evas_object_type_get(ewkView); \
const Evas_Smart* _tmp_s = evas_object_smart_smart_get(ewkView); \
if (EINA_UNLIKELY(!_tmp_s)) { \
@@ -189,6 +82,7 @@ struct Ewk_View_Private_Data {
("%p (%s) is not a smart object!", \
ewkView, _tmp_otype ? _tmp_otype : "(null)"); \
result = false; \
+ break; \
} \
const Evas_Smart_Class* _tmp_sc = evas_smart_class_get(_tmp_s); \
if (EINA_UNLIKELY(!_tmp_sc)) { \
@@ -196,6 +90,7 @@ struct Ewk_View_Private_Data {
("%p (%s) is not a smart object!", \
ewkView, _tmp_otype ? _tmp_otype : "(null)"); \
result = false; \
+ break; \
} \
if (EINA_UNLIKELY(_tmp_sc->data != EWK_VIEW_TYPE_STR)) { \
EINA_LOG_CRIT \
@@ -222,19 +117,28 @@ struct Ewk_View_Private_Data {
} \
} while (0)
-#define EWK_VIEW_PRIV_GET(smartData, priv) \
- Ewk_View_Private_Data* priv = smartData->priv
-
-#define EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, ...) \
+#define EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, ...) \
if (!smartData) { \
EINA_LOG_CRIT("smart data is null"); \
return __VA_ARGS__; \
} \
- EWK_VIEW_PRIV_GET(smartData, priv); \
+ EwkViewImpl* impl = smartData->priv; \
do { \
- if (!priv) { \
+ if (!impl) { \
EINA_LOG_CRIT("no private data for object %p (%s)", \
- smartData->self, evas_object_type_get(smartData->self)); \
+ smartData->self, evas_object_type_get(smartData->self)); \
+ return __VA_ARGS__; \
+ } \
+ } while (0)
+
+#define EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, ...) \
+ EwkViewImpl* impl = 0; \
+ do { \
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, __VA_ARGS__); \
+ impl = smartData->priv; \
+ if (!impl) { \
+ EINA_LOG_CRIT("no private data for object %p (%s)", \
+ smartData->self, evas_object_type_get(smartData->self)); \
return __VA_ARGS__; \
} \
} while (0)
@@ -247,83 +151,78 @@ static void _ewk_view_smart_changed(Ewk_View_Smart_Data* smartData)
evas_object_smart_changed(smartData->self);
}
-static void _ewk_view_on_favicon_changed(const char* pageURL, void* eventInfo)
-{
- Evas_Object* ewkView = static_cast<Evas_Object*>(eventInfo);
-
- const char* view_url = ewk_view_url_get(ewkView);
- if (!view_url || strcasecmp(view_url, pageURL))
- return;
-
- ewk_view_update_icon(ewkView);
-}
-
// Default Event Handling.
static Eina_Bool _ewk_view_smart_focus_in(Ewk_View_Smart_Data* smartData)
{
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false);
- priv->pageProxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive);
+ impl->page()->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive);
return true;
}
static Eina_Bool _ewk_view_smart_focus_out(Ewk_View_Smart_Data* smartData)
{
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false);
- priv->pageProxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive);
+ impl->page()->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive);
return true;
}
static Eina_Bool _ewk_view_smart_mouse_wheel(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Wheel* wheelEvent)
{
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false);
- Evas_Point position = {smartData->view.x, smartData->view.y};
- priv->pageProxy->handleWheelEvent(NativeWebWheelEvent(wheelEvent, &position));
+ impl->page()->handleWheelEvent(NativeWebWheelEvent(wheelEvent, impl->transformFromScene(), impl->transformToScreen()));
return true;
}
static Eina_Bool _ewk_view_smart_mouse_down(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Down* downEvent)
{
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false);
- Evas_Point position = {smartData->view.x, smartData->view.y};
- priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(downEvent, &position));
+ impl->page()->handleMouseEvent(NativeWebMouseEvent(downEvent, impl->transformFromScene(), impl->transformToScreen()));
return true;
}
static Eina_Bool _ewk_view_smart_mouse_up(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Up* upEvent)
{
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false);
+
+ impl->page()->handleMouseEvent(NativeWebMouseEvent(upEvent, impl->transformFromScene(), impl->transformToScreen()));
+
+ InputMethodContextEfl* inputMethodContext = impl->inputMethodContext();
+ if (inputMethodContext)
+ inputMethodContext->handleMouseUpEvent(upEvent);
- Evas_Point position = {smartData->view.x, smartData->view.y};
- priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(upEvent, &position));
return true;
}
static Eina_Bool _ewk_view_smart_mouse_move(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Move* moveEvent)
{
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false);
- Evas_Point position = {smartData->view.x, smartData->view.y};
- priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(moveEvent, &position));
+ impl->page()->handleMouseEvent(NativeWebMouseEvent(moveEvent, impl->transformFromScene(), impl->transformToScreen()));
return true;
}
static Eina_Bool _ewk_view_smart_key_down(Ewk_View_Smart_Data* smartData, const Evas_Event_Key_Down* downEvent)
{
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false);
+
+ bool isFiltered = false;
+ InputMethodContextEfl* inputMethodContext = impl->inputMethodContext();
+ if (inputMethodContext)
+ inputMethodContext->handleKeyDownEvent(downEvent, &isFiltered);
- priv->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(downEvent));
+ impl->page()->handleKeyboardEvent(NativeWebKeyboardEvent(downEvent, isFiltered));
return true;
}
static Eina_Bool _ewk_view_smart_key_up(Ewk_View_Smart_Data* smartData, const Evas_Event_Key_Up* upEvent)
{
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false);
- priv->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(upEvent));
+ impl->page()->handleKeyboardEvent(NativeWebKeyboardEvent(upEvent));
return true;
}
@@ -353,33 +252,6 @@ static void _ewk_view_on_mouse_wheel(void* data, Evas*, Evas_Object*, void* even
smartData->api->mouse_wheel(smartData, wheelEvent);
}
-static void _ewk_view_on_mouse_down(void* data, Evas*, Evas_Object*, void* eventInfo)
-{
- Evas_Event_Mouse_Down* downEvent = static_cast<Evas_Event_Mouse_Down*>(eventInfo);
- Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
- EINA_SAFETY_ON_NULL_RETURN(smartData->api);
- EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_down);
- smartData->api->mouse_down(smartData, downEvent);
-}
-
-static void _ewk_view_on_mouse_up(void* data, Evas*, Evas_Object*, void* eventInfo)
-{
- Evas_Event_Mouse_Up* upEvent = static_cast<Evas_Event_Mouse_Up*>(eventInfo);
- Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
- EINA_SAFETY_ON_NULL_RETURN(smartData->api);
- EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_up);
- smartData->api->mouse_up(smartData, upEvent);
-}
-
-static void _ewk_view_on_mouse_move(void* data, Evas*, Evas_Object*, void* eventInfo)
-{
- Evas_Event_Mouse_Move* moveEvent = static_cast<Evas_Event_Mouse_Move*>(eventInfo);
- Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
- EINA_SAFETY_ON_NULL_RETURN(smartData->api);
- EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_move);
- smartData->api->mouse_move(smartData, moveEvent);
-}
-
static void _ewk_view_on_key_down(void* data, Evas*, Evas_Object*, void* eventInfo)
{
Evas_Event_Key_Down* downEvent = static_cast<Evas_Event_Key_Down*>(eventInfo);
@@ -401,84 +273,23 @@ static void _ewk_view_on_key_up(void* data, Evas*, Evas_Object*, void* eventInfo
static void _ewk_view_on_show(void* data, Evas*, Evas_Object*, void* /*eventInfo*/)
{
Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
- priv->pageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible);
+ EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl);
+ impl->page()->viewStateDidChange(WebPageProxy::ViewIsVisible);
}
static void _ewk_view_on_hide(void* data, Evas*, Evas_Object*, void* /*eventInfo*/)
{
Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
+ EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl);
// This call may look wrong, but we really need to pass ViewIsVisible here.
// viewStateDidChange() itself is responsible for actually setting the visibility to Visible or Hidden
// depending on what WebPageProxy::isViewVisible() returns, this simply triggers the process.
- priv->pageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible);
+ impl->page()->viewStateDidChange(WebPageProxy::ViewIsVisible);
}
-#if ENABLE(TOUCH_EVENTS)
-static inline void _ewk_view_feed_touch_event_using_touch_point_list_of_evas(Evas_Object* ewkView, Ewk_Touch_Event_Type type)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
-
- unsigned count = evas_touch_point_list_count(smartData->base.evas);
- if (!count)
- return;
-
- Eina_List* points = 0;
- for (unsigned i = 0; i < count; ++i) {
- Ewk_Touch_Point* point = new Ewk_Touch_Point;
- point->id = evas_touch_point_list_nth_id_get(smartData->base.evas, i);
- evas_touch_point_list_nth_xy_get(smartData->base.evas, i, &point->x, &point->y);
- point->state = evas_touch_point_list_nth_state_get(smartData->base.evas, i);
- points = eina_list_append(points, point);
- }
-
- ewk_view_feed_touch_event(ewkView, type, points, evas_key_modifier_get(smartData->base.evas));
-
- void* data;
- EINA_LIST_FREE(points, data)
- delete static_cast<Ewk_Touch_Point*>(data);
-}
-
-static void _ewk_view_on_touch_down(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */)
-{
- _ewk_view_feed_touch_event_using_touch_point_list_of_evas(ewkView, EWK_TOUCH_START);
-}
-
-static void _ewk_view_on_touch_up(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */)
-{
- _ewk_view_feed_touch_event_using_touch_point_list_of_evas(ewkView, EWK_TOUCH_END);
-}
-
-static void _ewk_view_on_touch_move(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */)
-{
- _ewk_view_feed_touch_event_using_touch_point_list_of_evas(ewkView, EWK_TOUCH_MOVE);
-}
-#endif
-
static Evas_Smart_Class g_parentSmartClass = EVAS_SMART_CLASS_INIT_NULL;
-static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData)
-{
- Ewk_View_Private_Data* priv = new Ewk_View_Private_Data;
- if (!priv) {
- EINA_LOG_CRIT("could not allocate Ewk_View_Private_Data");
- return 0;
- }
-
-#ifdef HAVE_ECORE_X
- priv->isUsingEcoreX = WebCore::isUsingEcoreX(smartData->base.evas);
-#endif
-
- return priv;
-}
-
-static void _ewk_view_priv_del(Ewk_View_Private_Data* priv)
-{
- delete priv;
-}
-
static void _ewk_view_smart_add(Evas_Object* ewkView)
{
const Evas_Smart* smart = evas_object_smart_smart_get(ewkView);
@@ -500,13 +311,7 @@ static void _ewk_view_smart_add(Evas_Object* ewkView)
g_parentSmartClass.add(ewkView);
- smartData->priv = _ewk_view_priv_new(smartData);
- if (!smartData->priv) {
- EINA_LOG_CRIT("could not allocate Ewk_View_Private_Data");
- evas_object_smart_data_set(ewkView, 0);
- free(smartData);
- return;
- }
+ smartData->priv = 0;
// Create evas_object_image to draw web contents.
smartData->image = evas_object_image_add(smartData->base.evas);
@@ -515,8 +320,6 @@ static void _ewk_view_smart_add(Evas_Object* ewkView)
evas_object_smart_member_add(smartData->image, ewkView);
evas_object_show(smartData->image);
- ewk_view_mouse_events_enabled_set(ewkView, true);
-
#define CONNECT(s, c) evas_object_event_callback_add(ewkView, s, c, smartData)
CONNECT(EVAS_CALLBACK_FOCUS_IN, _ewk_view_on_focus_in);
CONNECT(EVAS_CALLBACK_FOCUS_OUT, _ewk_view_on_focus_out);
@@ -530,10 +333,9 @@ static void _ewk_view_smart_add(Evas_Object* ewkView)
static void _ewk_view_smart_del(Evas_Object* ewkView)
{
- removeFromPageViewMap(ewkView);
EWK_VIEW_SD_GET(ewkView, smartData);
- if (smartData && smartData->priv)
- _ewk_view_priv_del(smartData->priv);
+ if (smartData)
+ delete smartData->priv;
g_parentSmartClass.del(ewkView);
}
@@ -558,143 +360,42 @@ static void _ewk_view_smart_move(Evas_Object* ewkView, Evas_Coord /*x*/, Evas_Co
_ewk_view_smart_changed(smartData);
}
-IntSize ewk_view_size_get(const Evas_Object* ewkView)
-{
- int width, height;
- evas_object_geometry_get(ewkView, 0, 0, &width, &height);
- return IntSize(width, height);
-}
-
-#if USE(ACCELERATED_COMPOSITING)
-static bool ewk_view_create_gl_surface(const Evas_Object* ewkView, const IntSize& viewSize)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
-
- Evas_GL_Config evasGlConfig = {
- EVAS_GL_RGBA_8888,
- EVAS_GL_DEPTH_BIT_8,
- EVAS_GL_STENCIL_NONE,
- EVAS_GL_OPTIONS_NONE,
- EVAS_GL_MULTISAMPLE_NONE
- };
-
- ASSERT(!priv->evasGlSurface);
- priv->evasGlSurface = evas_gl_surface_create(priv->evasGl, &evasGlConfig, viewSize.width(), viewSize.height());
- if (!priv->evasGlSurface)
- return false;
-
- Evas_Native_Surface nativeSurface;
- evas_gl_native_surface_get(priv->evasGl, priv->evasGlSurface, &nativeSurface);
- evas_object_image_native_surface_set(smartData->image, &nativeSurface);
-
- return true;
-}
-
-bool ewk_view_accelerated_compositing_mode_enter(const Evas_Object* ewkView)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
-
- if (priv->evasGl) {
- EINA_LOG_DOM_WARN(_ewk_log_dom, "Accelerated compositing mode already entered.");
- return false;
- }
-
- Evas* evas = evas_object_evas_get(ewkView);
- priv->evasGl = evas_gl_new(evas);
- if (!priv->evasGl)
- return false;
-
- priv->evasGlContext = evas_gl_context_create(priv->evasGl, 0);
- if (!priv->evasGlContext) {
- evas_gl_free(priv->evasGl);
- priv->evasGl = 0;
- return false;
- }
-
- if (!ewk_view_create_gl_surface(ewkView, ewk_view_size_get(ewkView))) {
- evas_gl_context_destroy(priv->evasGl, priv->evasGlContext);
- priv->evasGlContext = 0;
-
- evas_gl_free(priv->evasGl);
- priv->evasGl = 0;
- return false;
- }
-
- priv->pageViewportControllerClient->setRendererActive(true);
- return true;
-}
-
-bool ewk_view_accelerated_compositing_mode_exit(const Evas_Object* ewkView)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(priv->evasGl, false);
-
- if (priv->evasGlSurface) {
- evas_gl_surface_destroy(priv->evasGl, priv->evasGlSurface);
- priv->evasGlSurface = 0;
- }
-
- if (priv->evasGlContext) {
- evas_gl_context_destroy(priv->evasGl, priv->evasGlContext);
- priv->evasGlContext = 0;
- }
-
- evas_gl_free(priv->evasGl);
- priv->evasGl = 0;
-
- return true;
-}
-#endif
-
static void _ewk_view_smart_calculate(Evas_Object* ewkView)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
-
-#if USE(ACCELERATED_COMPOSITING)
- bool needsNewSurface = false;
-#endif
+ EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl);
smartData->changed.any = false;
Evas_Coord x, y, width, height;
evas_object_geometry_get(ewkView, &x, &y, &width, &height);
- if (smartData->changed.size) {
-#if USE(COORDINATED_GRAPHICS)
- priv->pageViewportControllerClient->updateViewportSize(IntSize(width, height));
-#endif
-#if USE(ACCELERATED_COMPOSITING)
- needsNewSurface = priv->evasGlSurface;
-#endif
-
- if (priv->pageProxy->drawingArea())
- priv->pageProxy->drawingArea()->setSize(IntSize(width, height), IntSize());
-
- smartData->view.w = width;
- smartData->view.h = height;
- smartData->changed.size = false;
- }
-
if (smartData->changed.position) {
- evas_object_move(smartData->image, x, y);
+ smartData->changed.position = false;
smartData->view.x = x;
smartData->view.y = y;
- smartData->changed.position = false;
+ evas_object_move(smartData->image, x, y);
}
+ if (smartData->changed.size) {
+ smartData->changed.size = false;
+ smartData->view.w = width;
+ smartData->view.h = height;
+
+ if (impl->page()->drawingArea())
+ impl->page()->drawingArea()->setSize(IntSize(width, height), IntSize());
+
#if USE(ACCELERATED_COMPOSITING)
- if (needsNewSurface) {
- evas_gl_surface_destroy(priv->evasGl, priv->evasGlSurface);
- priv->evasGlSurface = 0;
- ewk_view_create_gl_surface(ewkView, IntSize(width, height));
- ewk_view_display(ewkView, IntRect(IntPoint(), IntSize(width, height)));
- }
+ // Recreate surface if needed.
+ if (impl->evasGLSurface())
+ impl->clearEvasGLSurface();
+
+ impl->createGLSurface(IntSize(width, height));
#endif
+#if USE(TILED_BACKING_STORE)
+ impl->pageClient()->updateViewportSize(IntSize(width, height));
+#endif
+ }
}
static void _ewk_view_smart_show(Evas_Object* ewkView)
@@ -717,7 +418,7 @@ static void _ewk_view_smart_hide(Evas_Object* ewkView)
static void _ewk_view_smart_color_set(Evas_Object* ewkView, int red, int green, int blue, int alpha)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
+ EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl);
if (alpha < 0)
alpha = 0;
@@ -735,8 +436,8 @@ static void _ewk_view_smart_color_set(Evas_Object* ewkView, int red, int green,
#undef CHECK_COLOR
evas_object_image_alpha_set(smartData->image, alpha < 255);
- priv->pageProxy->setDrawsBackground(red || green || blue);
- priv->pageProxy->setDrawsTransparentBackground(alpha < 255);
+ impl->page()->setDrawsBackground(red || green || blue);
+ impl->page()->setDrawsTransparentBackground(alpha < 255);
g_parentSmartClass.color_set(ewkView, red, green, blue, alpha);
}
@@ -780,7 +481,7 @@ Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class* api)
return true;
}
-static inline Evas_Smart* _ewk_view_smart_class_new(void)
+static inline Evas_Smart* createEwkViewSmartClass(void)
{
static Ewk_View_Smart_Class api = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("Ewk_View");
static Evas_Smart* smart = 0;
@@ -793,65 +494,14 @@ static inline Evas_Smart* _ewk_view_smart_class_new(void)
return smart;
}
-static void _ewk_view_initialize(Evas_Object* ewkView, PassRefPtr<Ewk_Context> context, WKPageGroupRef pageGroupRef)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
- EINA_SAFETY_ON_NULL_RETURN(context);
-
- if (priv->pageClient)
- return;
-
- priv->pageClient = PageClientImpl::create(ewkView);
-
- if (pageGroupRef)
- priv->pageProxy = toImpl(context->wkContext())->createWebPage(priv->pageClient.get(), toImpl(pageGroupRef));
- else
- priv->pageProxy = toImpl(context->wkContext())->createWebPage(priv->pageClient.get(), WebPageGroup::create().get());
-
- addToPageViewMap(ewkView);
-
-#if USE(COORDINATED_GRAPHICS)
- priv->pageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true);
- priv->pageProxy->pageGroup()->preferences()->setForceCompositingMode(true);
- priv->pageProxy->setUseFixedLayout(true);
-#endif
- priv->pageProxy->initializeWebPage();
-
- priv->backForwardList = Ewk_Back_Forward_List::create(toAPI(priv->pageProxy->backForwardList()));
- priv->settings = adoptPtr(new Ewk_Settings(WKPageGroupGetPreferences(WKPageGetPageGroup(toAPI(priv->pageProxy.get())))));
- priv->context = context;
-
-#if USE(COORDINATED_GRAPHICS)
- priv->pageViewportControllerClient = PageViewportControllerClientEfl::create(ewkView);
-#endif
-
- // Initialize page clients.
- WKPageRef wkPage = toAPI(priv->pageProxy.get());
- ewk_view_find_client_attach(wkPage, ewkView);
- ewk_view_form_client_attach(wkPage, ewkView);
- ewk_view_policy_client_attach(wkPage, ewkView);
- ewk_view_ui_client_attach(wkPage, ewkView);
-#if ENABLE(FULLSCREEN_API)
- priv->pageProxy->fullScreenManager()->setWebView(ewkView);
- ewk_settings_fullscreen_enabled_set(priv->settings.get(), true);
-#endif
- priv->pageLoadClient = PageLoadClientEfl::create(ewkView);
- priv->resourceLoadClient = ResourceLoadClientEfl::create(ewkView);
-
- /* Listen for favicon changes */
- Ewk_Favicon_Database* iconDatabase = priv->context->faviconDatabase();
- iconDatabase->watchChanges(IconChangeCallbackData(_ewk_view_on_favicon_changed, ewkView));
-}
-
-static Evas_Object* _ewk_view_add_with_smart(Evas* canvas, Evas_Smart* smart)
+static inline Evas_Object* createEwkView(Evas* canvas, Evas_Smart* smart, PassRefPtr<EwkContext> context, WKPageGroupRef pageGroupRef = 0, EwkViewImpl::ViewBehavior behavior = EwkViewImpl::DefaultBehavior)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
EINA_SAFETY_ON_NULL_RETURN_VAL(smart, 0);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
Evas_Object* ewkView = evas_object_smart_add(canvas, smart);
- if (!ewkView)
- return 0;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, 0);
EWK_VIEW_SD_GET(ewkView, smartData);
if (!smartData) {
@@ -859,12 +509,9 @@ static Evas_Object* _ewk_view_add_with_smart(Evas* canvas, Evas_Smart* smart)
return 0;
}
- EWK_VIEW_PRIV_GET(smartData, priv);
- if (!priv) {
- evas_object_del(ewkView);
- return 0;
- }
-
+ ASSERT(!smartData->priv);
+ RefPtr<WebPageGroup> pageGroup = pageGroupRef ? toImpl(pageGroupRef) : WebPageGroup::create();
+ smartData->priv = new EwkViewImpl(ewkView, context, pageGroup, behavior);
return ewkView;
}
@@ -874,36 +521,17 @@ static Evas_Object* _ewk_view_add_with_smart(Evas* canvas, Evas_Smart* smart)
*/
Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
{
- EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(contextRef, 0);
- Evas_Object* ewkView = _ewk_view_add_with_smart(canvas, _ewk_view_smart_class_new());
- if (!ewkView)
- return 0;
-
- _ewk_view_initialize(ewkView, Ewk_Context::create(contextRef), pageGroupRef);
-
- return ewkView;
+ return createEwkView(canvas, createEwkViewSmartClass(), EwkContext::create(contextRef), pageGroupRef, EwkViewImpl::LegacyBehavior);
}
Evas_Object* ewk_view_smart_add(Evas* canvas, Evas_Smart* smart, Ewk_Context* context)
{
- EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(smart, 0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
-
- Evas_Object* ewkView = _ewk_view_add_with_smart(canvas, smart);
- if (!ewkView)
- return 0;
-
- _ewk_view_initialize(ewkView, context, 0);
-
- return ewkView;
+ return createEwkView(canvas, smart, ewk_object_cast<EwkContext*>(context));
}
Evas_Object* ewk_view_add_with_context(Evas* canvas, Ewk_Context* context)
{
- EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
- return ewk_view_smart_add(canvas, _ewk_view_smart_class_new(), context);
+ return ewk_view_smart_add(canvas, createEwkViewSmartClass(), ewk_object_cast<EwkContext*>(context));
}
Evas_Object* ewk_view_add(Evas* canvas)
@@ -913,470 +541,136 @@ Evas_Object* ewk_view_add(Evas* canvas)
Ewk_Context* ewk_view_context_get(const Evas_Object* ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
- return priv->context.get();
-}
-
-/**
- * @internal
- * The url of view was changed by the frame loader.
- *
- * Emits signal: "url,changed" with pointer to new url string.
- */
-void ewk_view_url_update(Evas_Object* ewkView)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
-
- String activeURL = priv->pageProxy->activeURL();
- if (activeURL.isEmpty())
- return;
-
- if (priv->url == activeURL.utf8().data())
- return;
-
- priv->url = activeURL.utf8().data();
- const char* callbackArgument = static_cast<const char*>(priv->url);
- evas_object_smart_callback_call(ewkView, "url,changed", const_cast<char*>(callbackArgument));
-
- // Update the view's favicon.
- ewk_view_update_icon(ewkView);
+ return impl->ewkContext();
}
Eina_Bool ewk_view_url_set(Evas_Object* ewkView, const char* url)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(url, false);
- priv->pageProxy->loadURL(url);
- ewk_view_url_update(ewkView);
+ impl->page()->loadURL(url);
+ impl->informURLChange();
return true;
}
const char* ewk_view_url_get(const Evas_Object* ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
- return priv->url;
+ return impl->url();
}
const char *ewk_view_icon_url_get(const Evas_Object *ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
- return priv->faviconURL;
+ return impl->faviconURL();
}
Eina_Bool ewk_view_reload(Evas_Object* ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
- priv->pageProxy->reload(/*reloadFromOrigin*/ false);
- ewk_view_url_update(ewkView);
+ impl->page()->reload(/*reloadFromOrigin*/ false);
+ impl->informURLChange();
return true;
}
Eina_Bool ewk_view_reload_bypass_cache(Evas_Object* ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
- priv->pageProxy->reload(/*reloadFromOrigin*/ true);
- ewk_view_url_update(ewkView);
+ impl->page()->reload(/*reloadFromOrigin*/ true);
+ impl->informURLChange();
return true;
}
Eina_Bool ewk_view_stop(Evas_Object* ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
- priv->pageProxy->stopLoading();
+ impl->page()->stopLoading();
return true;
}
Ewk_Settings* ewk_view_settings_get(const Evas_Object* ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
- return priv->settings.get();
-}
-
-/**
- * @internal
- * Retrieves the internal WKPage for this view.
- */
-WKPageRef ewk_view_wkpage_get(const Evas_Object* ewkView)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
-
- return toAPI(priv->pageProxy.get());
-}
-
-/**
- * @internal
- * Load was initiated for a resource in the view.
- *
- * Emits signal: "resource,request,new" with pointer to resource request.
- */
-void ewk_view_resource_load_initiated(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Request* request)
-{
- Ewk_Resource_Request resourceRequest = {resource, request, 0};
-
- evas_object_smart_callback_call(ewkView, "resource,request,new", &resourceRequest);
-}
-
-/**
- * @internal
- * Received a response to a resource load request in the view.
- *
- * Emits signal: "resource,request,response" with pointer to resource response.
- */
-void ewk_view_resource_load_response(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Response* response)
-{
- Ewk_Resource_Load_Response resourceLoadResponse = {resource, response};
- evas_object_smart_callback_call(ewkView, "resource,request,response", &resourceLoadResponse);
-}
-
-/**
- * @internal
- * Failed loading a resource in the view.
- *
- * Emits signal: "resource,request,finished" with pointer to the resource load error.
- */
-void ewk_view_resource_load_failed(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Error* error)
-{
- Ewk_Resource_Load_Error resourceLoadError = {resource, error};
- evas_object_smart_callback_call(ewkView, "resource,request,failed", &resourceLoadError);
-}
-
-/**
- * @internal
- * Finished loading a resource in the view.
- *
- * Emits signal: "resource,request,finished" with pointer to the resource.
- */
-void ewk_view_resource_load_finished(Evas_Object* ewkView, Ewk_Resource* resource)
-{
- evas_object_smart_callback_call(ewkView, "resource,request,finished", resource);
-}
-
-/**
- * @internal
- * Request was sent for a resource in the view.
- *
- * Emits signal: "resource,request,sent" with pointer to resource request and possible redirect response.
- */
-void ewk_view_resource_request_sent(Evas_Object* ewkView, Ewk_Resource* resource, Ewk_Url_Request* request, Ewk_Url_Response* redirectResponse)
-{
- Ewk_Resource_Request resourceRequest = {resource, request, redirectResponse};
- evas_object_smart_callback_call(ewkView, "resource,request,sent", &resourceRequest);
+ return impl->settings();
}
const char* ewk_view_title_get(const Evas_Object* ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
- CString title = priv->pageProxy->pageTitle().utf8();
- priv->title = title.data();
-
- return priv->title;
-}
-
-/**
- * @internal
- * Reports that the requested text was found.
- *
- * Emits signal: "text,found" with the number of matches.
- */
-void ewk_view_text_found(Evas_Object* ewkView, unsigned int matchCount)
-{
- evas_object_smart_callback_call(ewkView, "text,found", &matchCount);
-}
-
-/**
- * @internal
- * The view title was changed by the frame loader.
- *
- * Emits signal: "title,changed" with pointer to new title string.
- */
-void ewk_view_title_changed(Evas_Object* ewkView, const char* title)
-{
- evas_object_smart_callback_call(ewkView, "title,changed", const_cast<char*>(title));
-}
-
-/**
- * @internal
- */
-void ewk_view_tooltip_text_set(Evas_Object* ewkView, const char* text)
-{
- if (text && *text)
- evas_object_smart_callback_call(ewkView, "tooltip,text,set", const_cast<char*>(text));
- else
- evas_object_smart_callback_call(ewkView, "tooltip,text,unset", 0);
+ return impl->title();
}
double ewk_view_load_progress_get(const Evas_Object* ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1.0);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, -1.0);
- return priv->pageProxy->estimatedProgress();
+ return impl->page()->estimatedProgress();
}
Eina_Bool ewk_view_scale_set(Evas_Object* ewkView, double scaleFactor, int x, int y)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
- priv->pageProxy->scalePage(scaleFactor, IntPoint(x, y));
+ impl->page()->scalePage(scaleFactor, IntPoint(x, y));
return true;
}
double ewk_view_scale_get(const Evas_Object* ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, -1);
- return priv->pageProxy->pageScaleFactor();
+ return impl->page()->pageScaleFactor();
}
Eina_Bool ewk_view_device_pixel_ratio_set(Evas_Object* ewkView, float ratio)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
- priv->pageProxy->setCustomDeviceScaleFactor(ratio);
+ impl->page()->setCustomDeviceScaleFactor(ratio);
return true;
}
float ewk_view_device_pixel_ratio_get(const Evas_Object* ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1.0);
-
- return priv->pageProxy->deviceScaleFactor();
-}
-
-/**
- * @internal
- * Reports load progress changed.
- *
- * Emits signal: "load,progress" with pointer to a double from 0.0 to 1.0.
- */
-void ewk_view_load_progress_changed(Evas_Object* ewkView, double progress)
-{
- evas_object_smart_callback_call(ewkView, "load,progress", &progress);
-}
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, -1.0);
-/**
- * @internal
- * The view received a new intent request.
- *
- * Emits signal: "intent,request,new" with pointer to a Ewk_Intent.
- */
-void ewk_view_intent_request_new(Evas_Object* ewkView, const Ewk_Intent* ewkIntent)
-{
-#if ENABLE(WEB_INTENTS)
- evas_object_smart_callback_call(ewkView, "intent,request,new", const_cast<Ewk_Intent*>(ewkIntent));
-#endif
+ return impl->page()->deviceScaleFactor();
}
void ewk_view_theme_set(Evas_Object* ewkView, const char* path)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
- if (priv->theme != path) {
- priv->theme = path;
- priv->pageProxy->setThemePath(path);
- }
+ impl->setThemePath(path);
}
const char* ewk_view_theme_get(const Evas_Object* ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
-
- return priv->theme;
-}
-
-void ewk_view_cursor_set(Evas_Object* ewkView, const Cursor& cursor)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
-
- const char* group = cursor.platformCursor();
- if (!group || group == priv->cursorGroup)
- return;
-
- priv->cursorGroup = group;
- priv->cursorObject = adoptRef(edje_object_add(smartData->base.evas));
-
- Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas);
- if (!priv->theme || !edje_object_file_set(priv->cursorObject.get(), priv->theme, group)) {
- priv->cursorObject.clear();
-
- ecore_evas_object_cursor_set(ecoreEvas, 0, 0, 0, 0);
-#ifdef HAVE_ECORE_X
- if (priv->isUsingEcoreX)
- WebCore::applyFallbackCursor(ecoreEvas, group);
-#endif
- return;
- }
-
- Evas_Coord width, height;
- edje_object_size_min_get(priv->cursorObject.get(), &width, &height);
- if (width <= 0 || height <= 0)
- edje_object_size_min_calc(priv->cursorObject.get(), &width, &height);
- if (width <= 0 || height <= 0) {
- width = defaultCursorSize;
- height = defaultCursorSize;
- }
- evas_object_resize(priv->cursorObject.get(), width, height);
-
- const char* data;
- int hotspotX = 0;
- data = edje_object_data_get(priv->cursorObject.get(), "hot.x");
- if (data)
- hotspotX = atoi(data);
-
- int hotspotY = 0;
- data = edje_object_data_get(priv->cursorObject.get(), "hot.y");
- if (data)
- hotspotY = atoi(data);
-
- ecore_evas_object_cursor_set(ecoreEvas, priv->cursorObject.get(), EVAS_LAYER_MAX, hotspotX, hotspotY);
-}
-
-void ewk_view_display(Evas_Object* ewkView, const IntRect& rect)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
- if (!smartData->image)
- return;
-
-#if USE(COORDINATED_GRAPHICS)
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
-
- evas_gl_make_current(priv->evasGl, priv->evasGlSurface, priv->evasGlContext);
- priv->pageViewportControllerClient->display(rect, IntPoint(smartData->view.x, smartData->view.y));
-#endif
-
- evas_object_image_data_update_add(smartData->image, rect.x(), rect.y(), rect.width(), rect.height());
-}
-
-#if ENABLE(FULLSCREEN_API)
-/**
- * @internal
- * Calls fullscreen_enter callback or falls back to default behavior and enables fullscreen mode.
- */
-void ewk_view_full_screen_enter(Evas_Object* ewkView)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
-
- if (!smartData->api->fullscreen_enter || !smartData->api->fullscreen_enter(smartData)) {
- Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas);
- ecore_evas_fullscreen_set(ecoreEvas, true);
- }
-}
-
-/**
- * @internal
- * Calls fullscreen_exit callback or falls back to default behavior and disables fullscreen mode.
- */
-void ewk_view_full_screen_exit(Evas_Object* ewkView)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
- if (!smartData->api->fullscreen_exit || !smartData->api->fullscreen_exit(smartData)) {
- Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas);
- ecore_evas_fullscreen_set(ecoreEvas, false);
- }
-}
-#endif
-
-#if ENABLE(SQL_DATABASE)
-/**
- * @internal
- * Calls exceeded_database_quota callback or falls back to default behavior returns default database quota.
- */
-unsigned long long ewk_view_database_quota_exceeded(Evas_Object* ewkView, const char* databaseName, const char* displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
-
- static const unsigned long long defaultQuota = 5 * 1024 * 1204; // 5 MB
- if (smartData->api->exceeded_database_quota)
- return smartData->api->exceeded_database_quota(smartData, databaseName, displayName, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage);
-
- return defaultQuota;
-}
-#endif
-
-/**
- * @internal
- * A download for that view was cancelled.
- *
- * Emits signal: "download,cancelled" with pointer to a Ewk_Download_Job.
- */
-void ewk_view_download_job_cancelled(Evas_Object* ewkView, Ewk_Download_Job* download)
-{
- evas_object_smart_callback_call(ewkView, "download,cancelled", download);
-}
-
-/**
- * @internal
- * A new download has been requested for that view.
- *
- * Emits signal: "download,request" with pointer to a Ewk_Download_Job.
- */
-void ewk_view_download_job_requested(Evas_Object* ewkView, Ewk_Download_Job* download)
-{
- evas_object_smart_callback_call(ewkView, "download,request", download);
-}
-
-/**
- * @internal
- * A download for that view has failed.
- *
- * Emits signal: "download,failed" with pointer to a Ewk_Download_Job_Error.
- */
-void ewk_view_download_job_failed(Evas_Object* ewkView, Ewk_Download_Job* download, Ewk_Error* error)
-{
- Ewk_Download_Job_Error downloadError = { download, error };
- evas_object_smart_callback_call(ewkView, "download,failed", &downloadError);
-}
-
-/**
- * @internal
- * A download for that view finished successfully.
- *
- * Emits signal: "download,finished" with pointer to a Ewk_Download_Job.
- */
-void ewk_view_download_job_finished(Evas_Object* ewkView, Ewk_Download_Job* download)
-{
- evas_object_smart_callback_call(ewkView, "download,finished", download);
+ return impl->themePath();
}
Eina_Bool ewk_view_back(Evas_Object* ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
- WebPageProxy* page = priv->pageProxy.get();
+ WebPageProxy* page = impl->page();
if (page->canGoBack()) {
page->goBack();
return true;
@@ -1387,10 +681,9 @@ Eina_Bool ewk_view_back(Evas_Object* ewkView)
Eina_Bool ewk_view_forward(Evas_Object* ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
- WebPageProxy* page = priv->pageProxy.get();
+ WebPageProxy* page = impl->page();
if (page->canGoForward()) {
page->goForward();
return true;
@@ -1402,11 +695,10 @@ Eina_Bool ewk_view_forward(Evas_Object* ewkView)
Eina_Bool ewk_view_intent_deliver(Evas_Object* ewkView, Ewk_Intent* intent)
{
#if ENABLE(WEB_INTENTS)
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(intent, false);
- WebPageProxy* page = priv->pageProxy.get();
+ WebPageProxy* page = impl->page();
page->deliverIntentToFrame(page->mainFrame(), intent->webIntentData());
return true;
@@ -1417,245 +709,56 @@ Eina_Bool ewk_view_intent_deliver(Evas_Object* ewkView, Ewk_Intent* intent)
Eina_Bool ewk_view_back_possible(Evas_Object* ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
- return priv->pageProxy->canGoBack();
+ return impl->page()->canGoBack();
}
Eina_Bool ewk_view_forward_possible(Evas_Object* ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
- return priv->pageProxy->canGoForward();
+ return impl->page()->canGoForward();
}
Ewk_Back_Forward_List* ewk_view_back_forward_list_get(const Evas_Object* ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
-
- return priv->backForwardList.get();
-}
-
-void ewk_view_image_data_set(Evas_Object* ewkView, void* imageData, const IntSize& size)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
- if (!imageData || !smartData->image)
- return;
-
- evas_object_resize(smartData->image, size.width(), size.height());
- evas_object_image_size_set(smartData->image, size.width(), size.height());
- evas_object_image_data_copy_set(smartData->image, imageData);
-}
-
-/**
- * @internal
- * Reports that a form request is about to be submitted.
- *
- * Emits signal: "form,submission,request" with pointer to Ewk_Form_Submission_Request.
- */
-void ewk_view_form_submission_request_new(Evas_Object* ewkView, Ewk_Form_Submission_Request* request)
-{
- evas_object_smart_callback_call(ewkView, "form,submission,request", request);
-}
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
-/**
- * @internal
- * Reports load failed with error information.
- *
- * Emits signal: "load,error" with pointer to Ewk_Error.
- */
-void ewk_view_load_error(Evas_Object* ewkView, const Ewk_Error* error)
-{
- evas_object_smart_callback_call(ewkView, "load,error", const_cast<Ewk_Error*>(error));
-}
-
-/**
- * @internal
- * Reports load finished.
- *
- * Emits signal: "load,finished".
- */
-void ewk_view_load_finished(Evas_Object* ewkView)
-{
- ewk_view_url_update(ewkView);
- evas_object_smart_callback_call(ewkView, "load,finished", 0);
-}
-
-/**
- * @internal
- * Reports view provisional load failed with error information.
- *
- * Emits signal: "load,provisional,failed" with pointer to Ewk_Error.
- */
-void ewk_view_load_provisional_failed(Evas_Object* ewkView, const Ewk_Error* error)
-{
- evas_object_smart_callback_call(ewkView, "load,provisional,failed", const_cast<Ewk_Error*>(error));
-}
-
-/**
- * @internal
- * Reports view received redirect for provisional load.
- *
- * Emits signal: "load,provisional,redirect".
- */
-void ewk_view_load_provisional_redirect(Evas_Object* ewkView)
-{
- ewk_view_url_update(ewkView);
- evas_object_smart_callback_call(ewkView, "load,provisional,redirect", 0);
-}
-
-/**
- * @internal
- * Reports view provisional load started.
- *
- * Emits signal: "load,provisional,started".
- */
-void ewk_view_load_provisional_started(Evas_Object* ewkView)
-{
- ewk_view_url_update(ewkView);
- evas_object_smart_callback_call(ewkView, "load,provisional,started", 0);
-}
-
-/**
- * @internal
- * Reports that the view's back / forward list has changed.
- *
- * Emits signal: "back,forward,list,changed".
- */
-void ewk_view_back_forward_list_changed(Evas_Object* ewkView)
-{
- evas_object_smart_callback_call(ewkView, "back,forward,list,changed", 0);
-}
-
-/**
- * @internal
- * Update the view's favicon and emits a "icon,changed" signal if it has
- * changed.
- *
- * This function is called whenever the URL has changed or when the icon for
- * the current page URL has changed.
- */
-void ewk_view_update_icon(Evas_Object* ewkView)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
-
- Ewk_Favicon_Database* iconDatabase = priv->context->faviconDatabase();
- ASSERT(iconDatabase);
-
- priv->faviconURL = ewk_favicon_database_icon_url_get(iconDatabase, priv->url);
- evas_object_smart_callback_call(ewkView, "icon,changed", 0);
-}
-
-/**
- * @internal
- * Reports that a navigation policy decision should be taken.
- *
- * Emits signal: "policy,decision,navigation".
- */
-void ewk_view_navigation_policy_decision(Evas_Object* ewkView, Ewk_Navigation_Policy_Decision* decision)
-{
- evas_object_smart_callback_call(ewkView, "policy,decision,navigation", decision);
-}
-
-/**
- * @internal
- * Reports that a new window policy decision should be taken.
- *
- * Emits signal: "policy,decision,new,window".
- */
-void ewk_view_new_window_policy_decision(Evas_Object* ewkView, Ewk_Navigation_Policy_Decision* decision)
-{
- evas_object_smart_callback_call(ewkView, "policy,decision,new,window", decision);
+ return impl->backForwardList();
}
Eina_Bool ewk_view_html_string_load(Evas_Object* ewkView, const char* html, const char* baseUrl, const char* unreachableUrl)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(html, false);
if (unreachableUrl && *unreachableUrl)
- priv->pageProxy->loadAlternateHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "", String::fromUTF8(unreachableUrl));
+ impl->page()->loadAlternateHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "", String::fromUTF8(unreachableUrl));
else
- priv->pageProxy->loadHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "");
- ewk_view_url_update(ewkView);
-
- return true;
-}
-
-#if ENABLE(WEB_INTENTS_TAG)
-/**
- * @internal
- * The view received a new intent service registration.
- *
- * Emits signal: "intent,service,register" with pointer to a Ewk_Intent_Service.
- */
-void ewk_view_intent_service_register(Evas_Object* ewkView, const Ewk_Intent_Service* ewkIntentService)
-{
- evas_object_smart_callback_call(ewkView, "intent,service,register", const_cast<Ewk_Intent_Service*>(ewkIntentService));
-}
-#endif // ENABLE(WEB_INTENTS_TAG)
-
-const Evas_Object* ewk_view_from_page_get(const WebKit::WebPageProxy* page)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(page, 0);
+ impl->page()->loadHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "");
- return pageViewMap().get(page);
-}
-
-WebPageProxy* ewk_view_page_get(const Evas_Object* ewkView)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
+ impl->informURLChange();
- return priv->pageProxy.get();
+ return true;
}
const char* ewk_view_setting_encoding_custom_get(const Evas_Object* ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
-
- String customEncoding = priv->pageProxy->customTextEncodingName();
- if (customEncoding.isEmpty())
- return 0;
-
- priv->customEncoding = customEncoding.utf8().data();
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
- return priv->customEncoding;
+ return impl->customTextEncodingName();
}
Eina_Bool ewk_view_setting_encoding_custom_set(Evas_Object* ewkView, const char* encoding)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
- priv->customEncoding = encoding;
- priv->pageProxy->setCustomTextEncodingName(encoding ? encoding : String());
+ impl->setCustomTextEncodingName(encoding ? encoding : String());
return true;
}
-void ewk_view_page_close(Evas_Object* ewkView)
-{
- evas_object_smart_callback_call(ewkView, "close,window", 0);
-}
-
-WKPageRef ewk_view_page_create(Evas_Object* ewkView)
-{
- Evas_Object* newEwkView = 0;
- evas_object_smart_callback_call(ewkView, "create,window", &newEwkView);
-
- if (!newEwkView)
- return 0;
-
- return static_cast<WKPageRef>(WKRetain(ewk_view_page_get(newEwkView)));
-}
-
// EwkFindOptions should be matched up orders with WkFindOptions.
COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_CASE_INSENSITIVE, kWKFindOptionsCaseInsensitive);
COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_AT_WORD_STARTS, kWKFindOptionsAtWordStarts);
@@ -1668,258 +771,47 @@ COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_HIGHLIGHT, kWKFindOptionsShow
Eina_Bool ewk_view_text_find(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned maxMatchCount)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(text, false);
- priv->pageProxy->findString(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount);
+ impl->page()->findString(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount);
return true;
}
Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object* ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
- priv->pageProxy->hideFindUI();
+ impl->page()->hideFindUI();
return true;
}
Eina_Bool ewk_view_text_matches_count(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned maxMatchCount)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(text, false);
- priv->pageProxy->countStringMatches(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount);
-
- return true;
-}
-
-void ewk_view_contents_size_changed(const Evas_Object* ewkView, const IntSize& size)
-{
-#if USE(COORDINATED_GRAPHICS)
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
-
- priv->pageViewportControllerClient->didChangeContentsSize(size);
-#else
- UNUSED_PARAM(ewkView);
- UNUSED_PARAM(size);
-#endif
-}
-
-COMPILE_ASSERT_MATCHING_ENUM(EWK_TEXT_DIRECTION_RIGHT_TO_LEFT, RTL);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_TEXT_DIRECTION_LEFT_TO_RIGHT, LTR);
-
-void ewk_view_popup_menu_request(Evas_Object* ewkView, WebPopupMenuProxyEfl* popupMenu, const IntRect& rect, TextDirection textDirection, double pageScaleFactor, const Vector<WebPopupItem>& items, int32_t selectedIndex)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
- EINA_SAFETY_ON_NULL_RETURN(smartData->api);
-
- ASSERT(popupMenu);
-
- if (!smartData->api->popup_menu_show)
- return;
-
- if (priv->popupMenuProxy)
- ewk_view_popup_menu_close(ewkView);
- priv->popupMenuProxy = popupMenu;
-
- Eina_List* popupItems = 0;
- size_t size = items.size();
- for (size_t i = 0; i < size; ++i)
- popupItems = eina_list_append(popupItems, Ewk_Popup_Menu_Item::create(items[i]).leakPtr());
- priv->popupMenuItems = popupItems;
-
- smartData->api->popup_menu_show(smartData, rect, static_cast<Ewk_Text_Direction>(textDirection), pageScaleFactor, popupItems, selectedIndex);
-}
-
-Eina_Bool ewk_view_popup_menu_close(Evas_Object* ewkView)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
- EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
-
- if (!priv->popupMenuProxy)
- return false;
-
- priv->popupMenuProxy = 0;
-
- if (smartData->api->popup_menu_hide)
- smartData->api->popup_menu_hide(smartData);
-
- void* item;
- EINA_LIST_FREE(priv->popupMenuItems, item)
- delete static_cast<Ewk_Popup_Menu_Item*>(item);
-
- return true;
-}
-
-Eina_Bool ewk_view_popup_menu_select(Evas_Object* ewkView, unsigned int selectedIndex)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
- EINA_SAFETY_ON_NULL_RETURN_VAL(priv->popupMenuProxy, false);
-
- if (selectedIndex >= eina_list_count(priv->popupMenuItems))
- return false;
-
- priv->popupMenuProxy->valueChanged(selectedIndex);
+ impl->page()->countStringMatches(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount);
return true;
}
Eina_Bool ewk_view_mouse_events_enabled_set(Evas_Object* ewkView, Eina_Bool enabled)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
- enabled = !!enabled;
- if (priv->areMouseEventsEnabled == enabled)
- return true;
-
- priv->areMouseEventsEnabled = enabled;
- if (enabled) {
- evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_mouse_down, smartData);
- evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_mouse_up, smartData);
- evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_mouse_move, smartData);
- } else {
- evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_mouse_down);
- evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_mouse_up);
- evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_mouse_move);
- }
+ impl->setMouseEventsEnabled(!!enabled);
return true;
}
Eina_Bool ewk_view_mouse_events_enabled_get(const Evas_Object* ewkView)
{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
- return priv->areMouseEventsEnabled;
-}
-
-/**
- * @internal
- * Web process has crashed.
- *
- * Emits signal: "webprocess,crashed" with pointer to crash handling boolean.
- */
-void ewk_view_webprocess_crashed(Evas_Object* ewkView)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
-
- bool handled = false;
- evas_object_smart_callback_call(ewkView, "webprocess,crashed", &handled);
-
- if (!handled) {
- CString url = priv->pageProxy->urlAtProcessExit().utf8();
- WARN("WARNING: The web process experienced a crash on '%s'.\n", url.data());
-
- // Display an error page
- ewk_view_html_string_load(ewkView, "The web process has crashed.", 0, url.data());
- }
-}
-
-/**
- * @internal
- * Calls a smart member function for javascript alert().
- */
-void ewk_view_run_javascript_alert(Evas_Object* ewkView, const WKEinaSharedString& message)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
- EINA_SAFETY_ON_NULL_RETURN(smartData->api);
-
- if (!smartData->api->run_javascript_alert)
- return;
-
- smartData->api->run_javascript_alert(smartData, message);
-}
-
-/**
- * @internal
- * Calls a smart member function for javascript confirm() and returns a value from the function. Returns false by default.
- */
-bool ewk_view_run_javascript_confirm(Evas_Object* ewkView, const WKEinaSharedString& message)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
-
- if (!smartData->api->run_javascript_confirm)
- return false;
-
- return smartData->api->run_javascript_confirm(smartData, message);
-}
-
-/**
- * @internal
- * Calls a smart member function for javascript prompt() and returns a value from the function. Returns null string by default.
- */
-WKEinaSharedString ewk_view_run_javascript_prompt(Evas_Object* ewkView, const WKEinaSharedString& message, const WKEinaSharedString& defaultValue)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, WKEinaSharedString());
- EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, WKEinaSharedString());
-
- if (!smartData->api->run_javascript_prompt)
- return WKEinaSharedString();
-
- return WKEinaSharedString::adopt(smartData->api->run_javascript_prompt(smartData, message, defaultValue));
-}
-
-#if ENABLE(INPUT_TYPE_COLOR)
-/**
- * @internal
- * Requests to show external color picker.
- */
-void ewk_view_color_picker_request(Evas_Object* ewkView, int r, int g, int b, int a, WKColorPickerResultListenerRef listener)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
- EINA_SAFETY_ON_NULL_RETURN(smartData->api->input_picker_color_request);
-
- priv->colorPickerResultListener = listener;
-
- smartData->api->input_picker_color_request(smartData, r, g, b, a);
-}
-
-/**
- * @internal
- * Requests to hide external color picker.
- */
-void ewk_view_color_picker_dismiss(Evas_Object* ewkView)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
- EINA_SAFETY_ON_NULL_RETURN(smartData->api->input_picker_color_dismiss);
-
- priv->colorPickerResultListener.clear();
-
- smartData->api->input_picker_color_dismiss(smartData);
-}
-#endif
-
-Eina_Bool ewk_view_color_picker_color_set(Evas_Object* ewkView, int r, int g, int b, int a)
-{
-#if ENABLE(INPUT_TYPE_COLOR)
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
- EINA_SAFETY_ON_NULL_RETURN_VAL(priv->colorPickerResultListener, false);
-
- WebCore::Color color = WebCore::Color(r, g, b, a);
- WKRetainPtr<WKStringRef> colorString(AdoptWK, WKStringCreateWithUTF8CString(color.serialized().utf8().data()));
- WKColorPickerResultListenerSetColor(priv->colorPickerResultListener.get(), colorString.get());
- priv->colorPickerResultListener.clear();
-
- return true;
-#else
- return false;
-#endif
+ return impl->mouseEventsEnabled();
}
Eina_Bool ewk_view_feed_touch_event(Evas_Object* ewkView, Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers)
@@ -1927,10 +819,9 @@ Eina_Bool ewk_view_feed_touch_event(Evas_Object* ewkView, Ewk_Touch_Event_Type t
#if ENABLE(TOUCH_EVENTS)
EINA_SAFETY_ON_NULL_RETURN_VAL(points, false);
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl, false);
- Evas_Point position = { smartData->view.x, smartData->view.y };
- priv->pageProxy->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, &position, ecore_time_get()));
+ impl->page()->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, impl->transformFromScene(), impl->transformToScreen(), ecore_time_get()));
return true;
#else
@@ -1941,34 +832,9 @@ Eina_Bool ewk_view_feed_touch_event(Evas_Object* ewkView, Ewk_Touch_Event_Type t
Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object* ewkView, Eina_Bool enabled)
{
#if ENABLE(TOUCH_EVENTS)
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
-
- enabled = !!enabled;
- if (priv->areTouchEventsEnabled == enabled)
- return true;
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
- priv->areTouchEventsEnabled = enabled;
- if (enabled) {
- // FIXME: We have to connect touch callbacks with mouse and multi events
- // because the Evas creates mouse events for first touch and multi events
- // for second and third touches. Below codes should be fixed when the Evas
- // supports the touch events.
- // See https://bugs.webkit.org/show_bug.cgi?id=97785 for details.
- evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_touch_down, smartData);
- evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_touch_up, smartData);
- evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_touch_move, smartData);
- evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MULTI_DOWN, _ewk_view_on_touch_down, smartData);
- evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MULTI_UP, _ewk_view_on_touch_up, smartData);
- evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MULTI_MOVE, _ewk_view_on_touch_move, smartData);
- } else {
- evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_touch_down);
- evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_touch_up);
- evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_touch_move);
- evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MULTI_DOWN, _ewk_view_on_touch_down);
- evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MULTI_UP, _ewk_view_on_touch_up);
- evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MULTI_MOVE, _ewk_view_on_touch_move);
- }
+ impl->setTouchEventsEnabled(!!enabled);
return true;
#else
@@ -1979,10 +845,9 @@ Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object* ewkView, Eina_Bool enab
Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object* ewkView)
{
#if ENABLE(TOUCH_EVENTS)
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
- return priv->areTouchEventsEnabled;
+ return impl->touchEventsEnabled();
#else
return false;
#endif
@@ -1991,10 +856,9 @@ Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object* ewkView)
Eina_Bool ewk_view_inspector_show(Evas_Object* ewkView)
{
#if ENABLE(INSPECTOR)
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
- WebInspectorProxy* inspector = priv->pageProxy->inspector();
+ WebInspectorProxy* inspector = impl->page()->inspector();
if (inspector)
inspector->show();
@@ -2007,10 +871,9 @@ Eina_Bool ewk_view_inspector_show(Evas_Object* ewkView)
Eina_Bool ewk_view_inspector_close(Evas_Object* ewkView)
{
#if ENABLE(INSPECTOR)
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
- WebInspectorProxy* inspector = priv->pageProxy->inspector();
+ WebInspectorProxy* inspector = impl->page()->inspector();
if (inspector)
inspector->close();
@@ -2019,3 +882,26 @@ Eina_Bool ewk_view_inspector_close(Evas_Object* ewkView)
return false;
#endif
}
+
+// Ewk_Pagination_Mode should be matched up orders with WebCore::Pagination::Mode.
+COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGINATION_MODE_UNPAGINATED, WebCore::Pagination::Unpaginated);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGINATION_MODE_LEFT_TO_RIGHT, WebCore::Pagination::LeftToRightPaginated);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGINATION_MODE_RIGHT_TO_LEFT, WebCore::Pagination::RightToLeftPaginated);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGINATION_MODE_TOP_TO_BOTTOM, WebCore::Pagination::TopToBottomPaginated);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGINATION_MODE_BOTTOM_TO_TOP, WebCore::Pagination::BottomToTopPaginated);
+
+Eina_Bool ewk_view_pagination_mode_set(Evas_Object* ewkView, Ewk_Pagination_Mode mode)
+{
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
+
+ impl->page()->setPaginationMode(static_cast<WebCore::Pagination::Mode>(mode));
+
+ return true;
+}
+
+Ewk_Pagination_Mode ewk_view_pagination_mode_get(const Evas_Object* ewkView)
+{
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EWK_PAGINATION_MODE_INVALID);
+
+ return static_cast<Ewk_Pagination_Mode>(impl->page()->paginationMode());
+}