Modified: trunk/Source/WebKit2/ChangeLog (125029 => 125030)
--- trunk/Source/WebKit2/ChangeLog 2012-08-08 13:13:43 UTC (rev 125029)
+++ trunk/Source/WebKit2/ChangeLog 2012-08-08 13:15:59 UTC (rev 125030)
@@ -1,3 +1,30 @@
+2012-08-08 Eunmi Lee <eunmi15....@samsung.com>
+
+ [EFL][WK2] Make ewk_view inheritable in the WebKit2.
+ https://bugs.webkit.org/show_bug.cgi?id=90054
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Make the ewk_view inheritable by exposing ewk_view_smart_class_set()
+ API. Additionally, the ewk_view_smart_add() API is added to create
+ Evas_Object for WebKit2 EFL. The default initialization is done in the
+ ewk_view_smart_add(), so the object which inherits the ewk_view should
+ use ewk_view_smart_add() instead of evas_object_smart_add() to create
+ Evas_Object.
+
+ * UIProcess/API/efl/ewk_context.cpp:
+ (ewk_context_new_from_WKContext):
+ * UIProcess/API/efl/ewk_context_private.h:
+ * UIProcess/API/efl/ewk_view.cpp:
+ (ewk_view_smart_class_set):
+ (_ewk_view_smart_class_new):
+ (_ewk_view_initialize):
+ (_ewk_view_add_with_smart):
+ (ewk_view_base_add):
+ (ewk_view_smart_add):
+ (ewk_view_add_with_context):
+ * UIProcess/API/efl/ewk_view.h:
+
2012-08-08 Allan Sandfeld Jensen <allan.jen...@nokia.com>
[Qt] WebProcess hangs on plugin initialization.
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp (125029 => 125030)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp 2012-08-08 13:13:43 UTC (rev 125029)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp 2012-08-08 13:15:59 UTC (rev 125030)
@@ -118,6 +118,17 @@
/**
* @internal
+ * Create Ewk_Context from WKContext.
+ */
+Ewk_Context* ewk_context_new_from_WKContext(WKContextRef contextRef)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(contextRef, 0);
+
+ return new Ewk_Context(contextRef);
+}
+
+/**
+ * @internal
* Registers that a new download has been requested.
*/
void ewk_context_download_job_add(Ewk_Context* ewkContext, Ewk_Download_Job* ewkDownload)
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp (125029 => 125030)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp 2012-08-08 13:13:43 UTC (rev 125029)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp 2012-08-08 13:15:59 UTC (rev 125030)
@@ -611,7 +611,7 @@
g_parentSmartClass.color_set(ewkView, red, green, blue, alpha);
}
-Eina_Bool ewk_view_smart_class_init(Ewk_View_Smart_Class* api)
+Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class* api)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(api, false);
@@ -656,16 +656,46 @@
static Evas_Smart* smart = 0;
if (EINA_UNLIKELY(!smart)) {
- ewk_view_smart_class_init(&api);
+ ewk_view_smart_class_set(&api);
smart = evas_smart_class_new(&api.sc);
}
return smart;
}
-Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
+static void _ewk_view_initialize(Evas_Object* ewkView, Ewk_Context* context, WKPageGroupRef pageGroupRef)
{
- Evas_Object* ewkView = evas_object_smart_add(canvas, _ewk_view_smart_class_new());
+ 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(toImpl(ewk_context_WKContext_get(context)), toImpl(pageGroupRef), ewkView);
+ priv->backForwardList = ewk_back_forward_list_new(toAPI(priv->pageClient->page()->backForwardList()));
+
+#if USE(COORDINATED_GRAPHICS)
+ priv->viewportHandler = EflViewportHandler::create(priv->pageClient.get());
+#endif
+
+ WKPageRef wkPage = toAPI(priv->pageClient->page());
+ ewk_view_find_client_attach(wkPage, ewkView);
+ ewk_view_form_client_attach(wkPage, ewkView);
+ ewk_view_loader_client_attach(wkPage, ewkView);
+ ewk_view_policy_client_attach(wkPage, ewkView);
+ ewk_view_resource_load_client_attach(wkPage, ewkView);
+ ewk_view_ui_client_attach(wkPage, ewkView);
+
+ ewk_view_theme_set(ewkView, DEFAULT_THEME_PATH"/default.edj");
+}
+
+static Evas_Object* _ewk_view_add_with_smart(Evas* canvas, Evas_Smart* smart)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(smart, 0);
+
+ Evas_Object* ewkView = evas_object_smart_add(canvas, smart);
if (!ewkView)
return 0;
@@ -681,29 +711,44 @@
return 0;
}
- priv->pageClient = PageClientImpl::create(toImpl(contextRef), toImpl(pageGroupRef), ewkView);
- priv->backForwardList = ewk_back_forward_list_new(toAPI(priv->pageClient->page()->backForwardList()));
+ return ewkView;
+}
- WKPageRef wkPage = toAPI(priv->pageClient->page());
- ewk_view_find_client_attach(wkPage, ewkView);
- ewk_view_form_client_attach(wkPage, ewkView);
- ewk_view_loader_client_attach(wkPage, ewkView);
- ewk_view_policy_client_attach(wkPage, ewkView);
- ewk_view_resource_load_client_attach(wkPage, ewkView);
- ewk_view_ui_client_attach(wkPage, ewkView);
+/**
+ * @internal
+ * Constructs a ewk_view Evas_Object with WKType parameters.
+ */
+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_theme_set(ewkView, DEFAULT_THEME_PATH"/default.edj");
+ _ewk_view_initialize(ewkView, ewk_context_new_from_WKContext(contextRef), pageGroupRef);
-#if USE(COORDINATED_GRAPHICS)
- priv->viewportHandler = EflViewportHandler::create(priv->pageClient.get());
-#endif
+ return ewkView;
+}
+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;
}
Evas_Object* ewk_view_add_with_context(Evas* canvas, Ewk_Context* context)
{
- return ewk_view_base_add(canvas, ewk_context_WKContext_get(context), 0);
+ return ewk_view_smart_add(canvas, _ewk_view_smart_class_new(), context);
}
Evas_Object* ewk_view_add(Evas* canvas)
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h (125029 => 125030)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h 2012-08-08 13:13:43 UTC (rev 125029)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h 2012-08-08 13:15:59 UTC (rev 125030)
@@ -238,6 +238,44 @@
typedef enum _Ewk_Find_Options Ewk_Find_Options;
/**
+ * Sets the smart class APIs, enabling view to be inherited.
+ *
+ * @param api class definition to set, all members with the
+ * exception of @a Evas_Smart_Class->data may be overridden, must
+ * @b not be @c NULL
+ *
+ * @note @a Evas_Smart_Class->data is used to implement type checking and
+ * is not supposed to be changed/overridden. If you need extra
+ * data for your smart class to work, just extend
+ * Ewk_View_Smart_Class instead.
+ * The Evas_Object which inherits the ewk_view should use
+ * ewk_view_smart_add() to create Evas_Object instead of
+ * evas_object_smart_add() because it performs additional initialization
+ * for the ewk_view.
+ *
+ * @return @c EINA_TRUE on success or @c EINA_FALSE on failure (probably
+ * version mismatch)
+ *
+ * @see ewk_view_smart_add()
+ */
+EAPI Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class *api);
+
+/**
+ * Creates a new EFL WebKit view object with Evas_Smart and Ewk_Context.
+ *
+ * @note The Evas_Object which inherits the ewk_view should create its
+ * Evas_Object using this API instead of evas_object_smart_add()
+ * because the default initialization for ewk_view is done in this API.
+ *
+ * @param e canvas object where to create the view object
+ * @param smart Evas_Smart object. Its type should be EWK_VIEW_TYPE_STR
+ * @param context Ewk_Context object which is used for initializing
+ *
+ * @return view object on success or @c NULL on failure
+ */
+Evas_Object *ewk_view_smart_add(Evas *e, Evas_Smart *smart, Ewk_Context *context);
+
+/**
* Creates a new EFL WebKit view object.
*
* @param e canvas object where to create the view object