Changeset 128056 in webkit
- Timestamp:
- Sep 10, 2012 6:54:40 AM (12 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r128051 r128056 1 2012-09-10 Alexander Shalamov <alexander.shalamov@intel.com> 2 3 [EFL][WK2] Add fullscreen enter / exit signals to the ewk_view API 4 https://bugs.webkit.org/show_bug.cgi?id=92362 5 6 Reviewed by Gyuyoung Kim. 7 8 Handle WebFullScreenManagerProxy::enterFullScreen and exitFullScreen 9 methods, so that ewk_view could enter and exit fullscreen mode when requested. 10 Also, two callbacks were added to ewk_view API, so that UI could customise 11 behavior when fullscreen mode is requested, e.g. show security dialog. 12 13 * UIProcess/API/efl/ewk_settings.cpp: 14 (ewk_settings_fullscreen_enabled_set): 15 (ewk_settings_fullscreen_enabled_get): 16 * UIProcess/API/efl/ewk_settings.h: 17 * UIProcess/API/efl/ewk_view.cpp: 18 (_ewk_view_initialize): 19 (ewk_view_full_screen_enter): 20 (ewk_view_full_screen_exit): 21 * UIProcess/API/efl/ewk_view.h: 22 * UIProcess/API/efl/ewk_view_private.h: 23 * UIProcess/API/efl/tests/test_ewk2_settings.cpp: 24 (TEST_F): 25 * UIProcess/API/efl/tests/test_ewk2_view.cpp: 26 (fullScreenCallback): 27 (checkFullScreenProperty): 28 (TEST_F): 29 * UIProcess/efl/WebFullScreenManagerProxyEfl.cpp: 30 (WebKit::WebFullScreenManagerProxy::enterFullScreen): 31 (WebKit::WebFullScreenManagerProxy::exitFullScreen): 32 1 33 2012-09-10 Kevin Funk <kevin.funk@kdab.com> 2 34 -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp
r127422 r128056 32 32 using namespace WebKit; 33 33 34 Eina_Bool ewk_settings_fullscreen_enabled_set(Ewk_Settings* settings, Eina_Bool enable) 35 { 36 #if ENABLE(FULLSCREEN_API) 37 EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); 38 WKPreferencesSetFullScreenEnabled(settings->preferences.get(), enable); 39 return true; 40 #else 41 return false; 42 #endif 43 } 44 45 Eina_Bool ewk_settings_fullscreen_enabled_get(const Ewk_Settings* settings) 46 { 47 #if ENABLE(FULLSCREEN_API) 48 EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); 49 return WKPreferencesGetFullScreenEnabled(settings->preferences.get()); 50 #else 51 return false; 52 #endif 53 } 54 34 55 Eina_Bool ewk_settings_javascript_enabled_set(Ewk_Settings* settings, Eina_Bool enable) 35 56 { -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_settings.h
r127422 r128056 43 43 /** Creates a type name for _Ewk_Settings */ 44 44 typedef struct _Ewk_Settings Ewk_Settings; 45 46 /** 47 * Enables/disables the Javascript Fullscreen API. The Javascript API allows 48 * to request full screen mode, for more information see: 49 * http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html 50 * 51 * Default value for Javascript Fullscreen API setting is @c EINA_TRUE . 52 * 53 * @param settings settings object to enable Javascript Fullscreen API 54 * @param enable @c EINA_TRUE to enable Javascript Fullscreen API or 55 * @c EINA_FALSE to disable 56 * 57 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure 58 */ 59 EAPI Eina_Bool ewk_settings_fullscreen_enabled_set(Ewk_Settings *settings, Eina_Bool enable); 60 61 /** 62 * Returns whether the Javascript Fullscreen API is enabled or not. 63 * 64 * @param settings settings object to query whether Javascript Fullscreen API is enabled 65 * 66 * @return @c EINA_TRUE if the Javascript Fullscreen API is enabled 67 * @c EINA_FALSE if not or on failure 68 */ 69 EAPI Eina_Bool ewk_settings_fullscreen_enabled_get(const Ewk_Settings *settings); 45 70 46 71 /** -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
r127842 r128056 36 36 #include "WebPopupItem.h" 37 37 #include "WebPopupMenuProxyEfl.h" 38 #include "WebPreferences.h" 38 39 #include "ewk_back_forward_list_private.h" 39 40 #include "ewk_context.h" … … 58 59 #include <WebKit2/WKPageGroup.h> 59 60 #include <wtf/text/CString.h> 61 62 #if ENABLE(FULLSCREEN_API) 63 #include "WebFullScreenManagerProxy.h" 64 #endif 60 65 61 66 #if USE(ACCELERATED_COMPOSITING) … … 716 721 ewk_view_resource_load_client_attach(wkPage, ewkView); 717 722 ewk_view_ui_client_attach(wkPage, ewkView); 723 #if ENABLE(FULLSCREEN_API) 724 priv->pageProxy->fullScreenManager()->setWebView(ewkView); 725 ewk_settings_fullscreen_enabled_set(priv->settings.get(), true); 726 #endif 718 727 } 719 728 … … 1151 1160 evas_object_image_data_update_add(smartData->image, rect.x(), rect.y(), rect.width(), rect.height()); 1152 1161 } 1162 1163 #if ENABLE(FULLSCREEN_API) 1164 /** 1165 * @internal 1166 * Calls fullscreen_enter callback or falls back to default behavior and enables fullscreen mode. 1167 */ 1168 void ewk_view_full_screen_enter(Evas_Object* ewkView) 1169 { 1170 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); 1171 1172 if (!smartData->api->fullscreen_enter || !smartData->api->fullscreen_enter(smartData)) { 1173 Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas); 1174 ecore_evas_fullscreen_set(ecoreEvas, true); 1175 } 1176 } 1177 1178 /** 1179 * @internal 1180 * Calls fullscreen_exit callback or falls back to default behavior and disables fullscreen mode. 1181 */ 1182 void ewk_view_full_screen_exit(Evas_Object* ewkView) 1183 { 1184 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); 1185 1186 if (!smartData->api->fullscreen_exit || !smartData->api->fullscreen_exit(smartData)) { 1187 Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas); 1188 ecore_evas_fullscreen_set(ecoreEvas, false); 1189 } 1190 } 1191 #endif 1192 1153 1193 1154 1194 /** -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h
r127842 r128056 107 107 Eina_Bool (*focus_in)(Ewk_View_Smart_Data *sd); 108 108 Eina_Bool (*focus_out)(Ewk_View_Smart_Data *sd); 109 Eina_Bool (*fullscreen_enter)(Ewk_View_Smart_Data *sd); 110 Eina_Bool (*fullscreen_exit)(Ewk_View_Smart_Data *sd); 109 111 Eina_Bool (*mouse_wheel)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Wheel *ev); 110 112 Eina_Bool (*mouse_down)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Down *ev); … … 119 121 * in the @a Ewk_View_Smart_Class structure. 120 122 */ 121 #define EWK_VIEW_SMART_CLASS_VERSION 2UL123 #define EWK_VIEW_SMART_CLASS_VERSION 3UL 122 124 123 125 /** … … 131 133 * @see EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION 132 134 */ 133 #define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }135 #define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 134 136 135 137 /** -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h
r126866 r128056 60 60 void ewk_view_download_job_requested(Evas_Object* ewkView, Ewk_Download_Job*); 61 61 void ewk_view_form_submission_request_new(Evas_Object* ewkView, Ewk_Form_Submission_Request*); 62 #if ENABLE(FULLSCREEN_API) 63 void ewk_view_full_screen_enter(Evas_Object* ewkView); 64 void ewk_view_full_screen_exit(Evas_Object* ewkView); 65 #endif 62 66 void ewk_view_image_data_set(Evas_Object* ewkView, void* imageData, const WebCore::IntSize& size); 63 67 void ewk_view_load_error(Evas_Object* ewkView, const Ewk_Web_Error* error); -
trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp
r127422 r128056 32 32 using namespace EWK2UnitTest; 33 33 34 TEST_F(EWK2UnitTestBase, ewk_settings_fullscreen_enabled) 35 { 36 Ewk_Settings* settings = ewk_view_settings_get(webView()); 37 38 #if ENABLE(FULLSCREEN_API) 39 ASSERT_TRUE(ewk_settings_fullscreen_enabled_get(settings)); 40 41 ASSERT_TRUE(ewk_settings_fullscreen_enabled_set(settings, EINA_TRUE)); 42 ASSERT_TRUE(ewk_settings_fullscreen_enabled_get(settings)); 43 44 ASSERT_TRUE(ewk_settings_fullscreen_enabled_set(settings, EINA_FALSE)); 45 ASSERT_FALSE(ewk_settings_fullscreen_enabled_get(settings)); 46 #else 47 ASSERT_FALSE(ewk_settings_fullscreen_enabled_get(settings)); 48 49 ASSERT_FALSE(ewk_settings_fullscreen_enabled_set(settings, EINA_TRUE)); 50 ASSERT_FALSE(ewk_settings_fullscreen_enabled_get(settings)); 51 52 ASSERT_FALSE(ewk_settings_fullscreen_enabled_set(settings, EINA_FALSE)); 53 ASSERT_FALSE(ewk_settings_fullscreen_enabled_get(settings)); 54 #endif 55 } 56 34 57 TEST_F(EWK2UnitTestBase, ewk_settings_javascript_enabled) 35 58 { -
trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp
r127842 r128056 35 35 36 36 extern EWK2UnitTestEnvironment* environment; 37 bool fullScreenCallbackCalled; 37 38 38 39 static void onLoadFinishedForRedirection(void* userData, Evas_Object*, void*) … … 301 302 ASSERT_FALSE(ewk_view_mouse_events_enabled_get(webView())); 302 303 } 304 305 static Eina_Bool fullScreenCallback(Ewk_View_Smart_Data* smartData) 306 { 307 fullScreenCallbackCalled = true; 308 return false; 309 } 310 311 static void checkFullScreenProperty(Evas_Object* webView, bool expectedState) 312 { 313 if (environment->useX11Window()) { 314 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(webView)); 315 Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas); 316 bool windowState = false; 317 while (((windowState = ecore_evas_fullscreen_get(ecoreEvas)) != expectedState)) 318 ecore_main_loop_iterate(); 319 ASSERT_TRUE(expectedState == windowState); 320 } 321 } 322 323 TEST_F(EWK2UnitTestBase, ewk_view_full_screen_enter) 324 { 325 const char fullscreenHTML[] = 326 "<!doctype html><head><script>function makeFullScreen(){" 327 "var div = document.getElementById(\"fullscreen\");" 328 "div.webkitRequestFullScreen();" 329 "document.title = \"fullscreen entered\";" 330 "}</script></head>" 331 "<body><div id=\"fullscreen\" style=\"width:100px; height:100px\" onclick=\"makeFullScreen()\"></div></body>"; 332 333 ewkViewClass()->fullscreen_enter = fullScreenCallback; 334 335 ewk_view_html_string_load(webView(), fullscreenHTML, "file:///", 0); 336 waitUntilLoadFinished(); 337 mouseClick(50, 50); 338 waitUntilTitleChangedTo("fullscreen entered"); 339 ASSERT_TRUE(fullScreenCallbackCalled); 340 checkFullScreenProperty(webView(), true); 341 } 342 343 TEST_F(EWK2UnitTestBase, ewk_view_full_screen_exit) 344 { 345 const char fullscreenHTML[] = 346 "<!doctype html><head><script>function makeFullScreenAndExit(){" 347 "var div = document.getElementById(\"fullscreen\");" 348 "div.webkitRequestFullScreen();" 349 "document.webkitCancelFullScreen();" 350 "document.title = \"fullscreen exited\";" 351 "}</script></head>" 352 "<body><div id=\"fullscreen\" style=\"width:100px; height:100px\" onclick=\"makeFullScreenAndExit()\"></div></body>"; 353 354 ewkViewClass()->fullscreen_exit = fullScreenCallback; 355 356 ewk_view_html_string_load(webView(), fullscreenHTML, "file:///", 0); 357 waitUntilLoadFinished(); 358 mouseClick(50, 50); 359 waitUntilTitleChangedTo("fullscreen exited"); 360 ASSERT_TRUE(fullScreenCallbackCalled); 361 checkFullScreenProperty(webView(), false); 362 } -
trunk/Source/WebKit2/UIProcess/efl/WebFullScreenManagerProxyEfl.cpp
r114397 r128056 26 26 #include "config.h" 27 27 #include "WebFullScreenManagerProxy.h" 28 #include "ewk_view_private.h" 28 29 29 30 #if ENABLE(FULLSCREEN_API) … … 53 54 void WebFullScreenManagerProxy::enterFullScreen() 54 55 { 55 notImplemented(); 56 if (!m_webView) 57 return; 58 59 willEnterFullScreen(); 60 ewk_view_full_screen_enter(m_webView); 61 didEnterFullScreen(); 56 62 } 57 63 58 64 void WebFullScreenManagerProxy::exitFullScreen() 59 65 { 60 notImplemented(); 66 if (!m_webView) 67 return; 68 69 willExitFullScreen(); 70 ewk_view_full_screen_exit(m_webView); 71 didExitFullScreen(); 61 72 } 62 73
Note: See TracChangeset
for help on using the changeset viewer.