Changeset 171182 in webkit
- Timestamp:
- Jul 17, 2014 3:55:57 AM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r171171 r171182 1 2014-07-17 Sanghyup Lee <sh53.lee@samsung.com> 2 3 [EFL][WK2] Add a "focus,notfound" signal. 4 https://bugs.webkit.org/show_bug.cgi?id=134674 5 6 Reviewed by Gyuyoung Kim. 7 8 Add a "focus,notfound" signal to handover focus control to application 9 because there are no elements of webview to focus on the given direction. 10 11 Application can decide to move the focus to next widget of ewk_view or something else 12 by using this signal. 13 14 * UIProcess/API/efl/EwkViewCallbacks.h: 15 * UIProcess/API/efl/ewk_view.h: 16 * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp: Added keyDown and keyUp function. 17 (EWK2UnitTest::EWK2UnitTestBase::waitUntilDirectionChanged): 18 (EWK2UnitTest::EWK2UnitTestBase::keyDown): 19 (EWK2UnitTest::EWK2UnitTestBase::keyUp): 20 * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h: 21 * UIProcess/API/efl/tests/test_ewk2_view.cpp: 22 (EWK2ViewTest::FocusNotFoundCallback): 23 (TEST_F): 24 * UIProcess/efl/PageUIClientEfl.cpp: Removed unnecessary calls to evas_object_focus_set(). 25 (WebKit::PageUIClientEfl::takeFocus): 26 1 27 2014-07-16 Brady Eidson <beidson@apple.com> 2 28 -
trunk/Source/WebKit2/UIProcess/API/efl/EwkViewCallbacks.h
r168961 r171182 28 28 29 29 #include "WKEinaSharedString.h" 30 #include "WKPageUIClient.h" 30 31 #include "ewk_view.h" 31 32 #include <Evas.h> … … 53 54 DownloadJobRequested, 54 55 FileChooserRequest, 56 FocusNotFound, 55 57 NewFormSubmissionRequest, 56 58 LoadError, … … 145 147 }; 146 148 149 template <CallbackType callbackType> 150 struct CallBack <callbackType, Ewk_Focus_Direction> : public EvasObjectHolder { 151 explicit CallBack(Evas_Object* view) 152 : EvasObjectHolder(view) 153 { } 154 155 void call(Ewk_Focus_Direction direction) 156 { 157 evas_object_smart_callback_call(m_object, CallBackInfo<callbackType>::name(), &direction); 158 } 159 160 void call(const WKFocusDirection arg) 161 { 162 Ewk_Focus_Direction direction = (arg == kWKFocusDirectionForward) ? EWK_FOCUS_DIRECTION_FORWARD : EWK_FOCUS_DIRECTION_BACKWARD; 163 call(direction); 164 } 165 }; 166 147 167 #define DECLARE_EWK_VIEW_CALLBACK(callbackType, string, type) \ 148 168 template <> \ … … 162 182 DECLARE_EWK_VIEW_CALLBACK(DownloadJobRequested, "download,request", Ewk_Download_Job*); 163 183 DECLARE_EWK_VIEW_CALLBACK(FileChooserRequest, "file,chooser,request", Ewk_File_Chooser_Request*); 184 DECLARE_EWK_VIEW_CALLBACK(FocusNotFound, "focus,notfound", Ewk_Focus_Direction); 164 185 DECLARE_EWK_VIEW_CALLBACK(NewFormSubmissionRequest, "form,submission,request", Ewk_Form_Submission_Request*); 165 186 DECLARE_EWK_VIEW_CALLBACK(LoadError, "load,error", Ewk_Error*); -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h
r169997 r171182 40 40 * a file (or several) on the file system. Call ewk_file_chooser_request_ref() on the request object to process it 41 41 * asynchronously. 42 * - "focus,notfound", Ewk_Focus_Direction*: reports that there was no element to be focused on the given direction. 43 * The user can handle next focus behavior using the signal. 42 44 * - "form,submission,request", Ewk_Form_Submission_Request*: Reports that a form request is about to be submitted. 43 45 * The Ewk_Form_Submission_Request passed contains information about the text fields of the form. This … … 277 279 278 280 /** 281 * Enum values used to set focus direction. 282 */ 283 typedef enum Ewk_Focus_Direction { 284 EWK_FOCUS_DIRECTION_FORWARD = 0, 285 EWK_FOCUS_DIRECTION_BACKWARD, 286 } Ewk_Focus_Direction; 287 288 /** 279 289 * @typedef Ewk_View_Script_Execute_Cb Ewk_View_Script_Execute_Cb 280 290 * @brief Callback type for use with ewk_view_script_execute() -
trunk/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp
r169366 r171182 235 235 236 236 while (!data.isDone() && !flag) 237 ecore_main_loop_iterate(); 238 239 return !data.didTimeOut(); 240 } 241 242 bool EWK2UnitTestBase::waitUntilDirectionChanged(Ewk_Focus_Direction &direction, double timeoutSeconds) 243 { 244 CallbackDataTimer data(timeoutSeconds); 245 Ewk_Focus_Direction initialDirection = direction; 246 247 while (!data.isDone() && direction == initialDirection) 237 248 ecore_main_loop_iterate(); 238 249 … … 313 324 } 314 325 326 void EWK2UnitTestBase::keyDown(char* keyname, char* key, char* string, char* modifier) 327 { 328 Evas* evas = evas_object_evas_get(m_webView); 329 ASSERT(evas); 330 331 if (modifier) { 332 evas_key_modifier_on(evas, modifier); 333 evas_event_feed_key_down(evas, keyname, key, string, 0, 0, 0); 334 evas_key_modifier_off(evas, modifier); 335 return; 336 } 337 338 evas_event_feed_key_down(evas, keyname, key, string, 0, 0, 0); 339 } 340 341 void EWK2UnitTestBase::keyUp(char* keyname, char* key, char* string) 342 { 343 evas_event_feed_key_up(evas_object_evas_get(m_webView), keyname, key, string, 0, 0, 0); 344 } 345 315 346 } // namespace EWK2UnitTest -
trunk/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h
r166355 r171182 53 53 bool waitUntilURLChangedTo(const char* expectedURL, double timeoutSeconds = defaultTimeoutSeconds); 54 54 bool waitUntilTrue(bool &flag, double timeoutSeconds = defaultTimeoutSeconds); 55 bool waitUntilDirectionChanged(Ewk_Focus_Direction &direction, double timeoutSeconds = defaultTimeoutSeconds); 55 56 Eina_List* waitUntilSpellingLanguagesLoaded(unsigned expectedLanguageCount, double timeoutValue = defaultTimeoutSeconds); 56 57 … … 63 64 void multiUp(int id, int x, int y); 64 65 void multiMove(int id, int x, int y); 66 void keyDown(char* keyname, char* key, char* string, char* modifier); 67 void keyUp(char* keyname, char* key, char* string); 65 68 66 69 private: -
trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp
r169997 r171182 238 238 239 239 obtainedPageContents = true; 240 } 241 242 static void FocusNotFoundCallback(void* userData, Evas_Object*, void* eventInfo) 243 { 244 Ewk_Focus_Direction* direction = static_cast<Ewk_Focus_Direction*>(eventInfo); 245 Ewk_Focus_Direction* result = static_cast<Ewk_Focus_Direction*>(userData); 246 *result = *direction; 240 247 } 241 248 }; … … 1202 1209 EXPECT_EQ(3000, contentsHeight); 1203 1210 } 1211 1212 TEST_F(EWK2ViewTest, ewk_focus_notfound) 1213 { 1214 const char contents[] = 1215 "<!DOCTYPE html>" 1216 "<body><input type='text' autofocus></body>"; 1217 ewk_view_html_string_load(webView(), contents, 0, 0); 1218 ASSERT_TRUE(waitUntilLoadFinished()); 1219 1220 Ewk_Settings* settings = ewk_page_group_settings_get(ewk_view_page_group_get(webView())); 1221 ewk_settings_spatial_navigation_enabled_set(settings, EINA_TRUE); 1222 1223 Ewk_Focus_Direction direction = EWK_FOCUS_DIRECTION_FORWARD; 1224 evas_object_smart_callback_add(webView(), "focus,notfound", FocusNotFoundCallback, &direction); 1225 1226 keyDown("Tab", "Tab", 0, "Shift"); 1227 keyUp("Tab", "Tab", 0); 1228 1229 ASSERT_TRUE(waitUntilDirectionChanged(direction)); 1230 EXPECT_EQ(EWK_FOCUS_DIRECTION_BACKWARD, direction); 1231 1232 // Set focus to the input element again. 1233 keyDown("Tab", "Tab", 0, 0); 1234 keyUp("Tab", "Tab", 0); 1235 1236 keyDown("Tab", "Tab", 0, 0); 1237 keyUp("Tab", "Tab", 0); 1238 1239 ASSERT_TRUE(waitUntilDirectionChanged(direction)); 1240 EXPECT_EQ(EWK_FOCUS_DIRECTION_FORWARD, direction); 1241 1242 evas_object_smart_callback_del(webView(), "focus,notfound", FocusNotFoundCallback); 1243 } -
trunk/Source/WebKit2/UIProcess/efl/PageUIClientEfl.cpp
r167653 r171182 99 99 } 100 100 101 void PageUIClientEfl::takeFocus(WKPageRef, WKFocusDirection, const void* clientInfo) 102 { 103 // FIXME: this is only a partial implementation. 104 evas_object_focus_set(toPageUIClientEfl(clientInfo)->m_view->evasObject(), false); 101 void PageUIClientEfl::takeFocus(WKPageRef, WKFocusDirection direction, const void* clientInfo) 102 { 103 toPageUIClientEfl(clientInfo)->m_view->smartCallback<FocusNotFound>().call(direction); 105 104 } 106 105
Note: See TracChangeset
for help on using the changeset viewer.