[Title] Add APIs to get/set state of transparent background.
[Issue#] N/A
[Problem] We can not make pd of web-dynamic-box transparent,
and pd is disappeared if webview's color is set to transparent.
[Cause] There is no way to set transparent background and Evas does not draws if object's color is transparent.
[Solution] Add APIs to get/set state of transparent background.
Change-Id: I9635959e4984338d5e58a240e8d1aac3a1174901
UNUSED_PARAM(ewkView);
#endif
}
+
+Eina_Bool ewk_view_draws_transparent_background_set(Evas_Object* ewkView, Eina_Bool enabled)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
+
+ impl->pageProxy->setDrawsTransparentBackground(enabled);
+ evas_object_image_alpha_set(smartData->image, enabled);
+
+ return true;
+}
+
+Eina_Bool ewk_view_draws_transparent_background_get(Evas_Object* ewkView)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
+ EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
+
+ return impl->pageProxy->drawsTransparentBackground();
+}
*/
EAPI void ewk_view_fullscreen_exit(Evas_Object* o);
+/**
+ * Sets whether to draw transparent background or not.
+ *
+ * @param o view object to enable/disable transparent background
+ * @param enabled a state to set
+ *
+ * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
+ */
+EAPI Eina_Bool ewk_view_draws_transparent_background_set(Evas_Object *o, Eina_Bool enabled);
+
+/**
+ * Queries if transparent background is enabled.
+ *
+ * @param o view object to get whether transparent background is enabled or not.
+ *
+ * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable
+ */
+EAPI Eina_Bool ewk_view_draws_transparent_background_get(Evas_Object *o);
+
#ifdef __cplusplus
}
#endif
utc_webkit2_ewk_view_contents_size_get_func \
utc_webkit2_ewk_view_context_get_func \
utc_webkit2_ewk_view_custom_header_add_func \
+ utc_webkit2_ewk_view_draws_transparent_background_get_func \
+ utc_webkit2_ewk_view_draws_transparent_background_set_func \
utc_webkit2_ewk_view_feed_touch_event_func \
utc_webkit2_ewk_view_focused_frame_get_func \
utc_webkit2_ewk_view_forward_func \
/unit_test/webkit2/utc_webkit2_ewk_view_contents_size_get_func
/unit_test/webkit2/utc_webkit2_ewk_view_context_get_func
/unit_test/webkit2/utc_webkit2_ewk_view_custom_header_add_func
+/unit_test/webkit2/utc_webkit2_ewk_view_draws_transparent_background_get_func
+/unit_test/webkit2/utc_webkit2_ewk_view_draws_transparent_background_set_func
/unit_test/webkit2/utc_webkit2_ewk_view_feed_touch_event_func
/unit_test/webkit2/utc_webkit2_ewk_view_focused_frame_get_func
/unit_test/webkit2/utc_webkit2_ewk_view_forward_func
--- /dev/null
+/*
+ * WebKit2 EFL
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+/* Define those macros _before_ you include the utc_webkit2_ewk.h header file. */
+#define TESTED_FUN_NAME ewk_view_draws_transparent_background_get
+#define POSITIVE_TEST_FUN_NUM 1
+#define NEGATIVE_TEST_FUN_NUM 1
+
+#include "utc_webkit2_ewk.h"
+
+/* Startup and cleanup functions */
+static void startup(void)
+{
+ utc_webkit2_ewk_test_init();
+}
+
+static void cleanup(void)
+{
+ utc_webkit2_ewk_test_end();
+}
+
+/**
+ * @brief Checking whether the state of transparent background is returned properly.
+ */
+POS_TEST_FUN(1)
+{
+ Eina_Bool result = EINA_TRUE;
+ Eina_Bool enable_set;
+ Eina_Bool enable_get;
+
+ enable_set = EINA_TRUE;
+ ewk_view_draws_transparent_background_set(test_view.webview, enable_set);
+ enable_get = ewk_view_draws_transparent_background_get(test_view.webview);
+ if (enable_set != enable_get) {
+ result = EINA_FALSE;
+ }
+
+ enable_set = EINA_FALSE;
+ ewk_view_draws_transparent_background_set(test_view.webview, enable_set);
+ enable_get = ewk_view_draws_transparent_background_get(test_view.webview);
+ if (enable_set != enable_get) {
+ result = EINA_FALSE;
+ }
+
+ utc_check_eq(result, EINA_TRUE);
+}
+
+/**
+ * @brief There is no negative case for ewk_view_draws_transparent_background_get function.
+ */
+NEG_TEST_FUN(1)
+{
+ ewk_view_draws_transparent_background_get(test_view.webview);
+ utc_pass();
+}
--- /dev/null
+/*
+ * WebKit EFL
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+/* Define those macros _before_ you include the utc_webkit2_ewk.h header file. */
+#define TESTED_FUN_NAME ewk_view_draws_transparent_background_set
+#define POSITIVE_TEST_FUN_NUM 2
+#define NEGATIVE_TEST_FUN_NUM 1
+
+#include "utc_webkit2_ewk.h"
+
+/* Startup and cleanup functions */
+static void startup(void)
+{
+ utc_webkit2_ewk_test_init();
+}
+
+static void cleanup(void)
+{
+ utc_webkit2_ewk_test_end();
+}
+
+
+POS_TEST_FUN(1)
+{
+ Eina_Bool result = ewk_view_draws_transparent_background_set(test_view.webview, EINA_TRUE);
+ utc_check_eq(result, EINA_TRUE);
+}
+
+POS_TEST_FUN(2)
+{
+ Eina_Bool result = ewk_view_draws_transparent_background_set(test_view.webview, EINA_FALSE);
+ utc_check_eq(result, EINA_TRUE);
+}
+
+NEG_TEST_FUN(1)
+{
+ Eina_Bool result = ewk_view_draws_transparent_background_set(NULL, EINA_FALSE);
+ utc_check_eq(result, EINA_FALSE);
+}