Changeset 269035 in webkit
- Timestamp:
- Oct 27, 2020 6:26:48 AM (21 months ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.cpp (modified) (2 diffs)
-
Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.h (modified) (3 diffs)
-
Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp (modified) (1 diff)
-
WebDriverTests/ChangeLog (modified) (1 diff)
-
WebDriverTests/TestExpectations.json (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r269027 r269035 1 2020-10-27 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 WebDriver: sequence of char key press is not supported 4 https://bugs.webkit.org/show_bug.cgi?id=217951 5 6 Reviewed by Brian Burg. 7 8 We are assuming there can be only one char key pressed at a time. Use a HashSet to store the currently pressed 9 char keys and the handle them the same way we do with virtual keys. 10 11 Fixes: imported/w3c/webdriver/tests/perform_actions/key_events.py::test_sequence_of_keydown_printable_keys_sends_events 12 13 * UIProcess/Automation/SimulatedInputDispatcher.cpp: 14 (WebKit::SimulatedInputDispatcher::transitionInputSourceToState): 15 * UIProcess/Automation/SimulatedInputDispatcher.h: 16 * UIProcess/Automation/WebAutomationSession.cpp: 17 (WebKit::WebAutomationSession::performInteractionSequence): 18 1 19 2020-10-27 Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> 2 20 -
trunk/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.cpp
r268793 r269035 340 340 break; 341 341 } 342 case SimulatedInputSourceType::Keyboard: 342 case SimulatedInputSourceType::Keyboard: { 343 343 #if !ENABLE(WEBDRIVER_KEYBOARD_INTERACTIONS) 344 344 RELEASE_ASSERT_NOT_REACHED(); 345 345 #else 346 auto comparePressedCharKeys = [](const auto& a, const auto& b) { 347 if (a.size() != b.size()) 348 return false; 349 for (const auto& charKey : a) { 350 if (!b.contains(charKey)) 351 return false; 352 } 353 return true; 354 }; 355 346 356 // The "dispatch a key{Down,Up} action" algorithms (§17.4 Dispatching Actions). 347 if (!a.pressedCharKey && b.pressedCharKey) { 348 LOG(Automation, "SimulatedInputDispatcher[%p]: simulating KeyPress[key=%c] for transition to %d.%d", this, b.pressedCharKey.value(), m_keyframeIndex, m_inputSourceStateIndex); 349 m_client.simulateKeyboardInteraction(m_page, KeyboardInteraction::KeyPress, b.pressedCharKey.value(), WTFMove(eventDispatchFinished)); 350 } else if (a.pressedCharKey && !b.pressedCharKey) { 351 LOG(Automation, "SimulatedInputDispatcher[%p]: simulating KeyRelease[key=%c] for transition to %d.%d", this, a.pressedCharKey.value(), m_keyframeIndex, m_inputSourceStateIndex); 352 m_client.simulateKeyboardInteraction(m_page, KeyboardInteraction::KeyRelease, a.pressedCharKey.value(), WTFMove(eventDispatchFinished)); 357 if (!comparePressedCharKeys(a.pressedCharKeys, b.pressedCharKeys)) { 358 bool simulatedAnInteraction = false; 359 for (auto charKey : b.pressedCharKeys) { 360 if (!a.pressedCharKeys.contains(charKey)) { 361 ASSERT_WITH_MESSAGE(!simulatedAnInteraction, "Only one CharKey may differ at a time between two input source states."); 362 if (simulatedAnInteraction) 363 continue; 364 simulatedAnInteraction = true; 365 366 LOG(Automation, "SimulatedInputDispatcher[%p]: simulating KeyPress[key=%c] for transition to %d.%d", this, charKey, m_keyframeIndex, m_inputSourceStateIndex); 367 m_client.simulateKeyboardInteraction(m_page, KeyboardInteraction::KeyPress, charKey, WTFMove(eventDispatchFinished)); 368 } 369 } 370 371 for (auto charKey : a.pressedCharKeys) { 372 if (!b.pressedCharKeys.contains(charKey)) { 373 ASSERT_WITH_MESSAGE(!simulatedAnInteraction, "Only one CharKey may differ at a time between two input source states."); 374 if (simulatedAnInteraction) 375 continue; 376 simulatedAnInteraction = true; 377 378 LOG(Automation, "SimulatedInputDispatcher[%p]: simulating KeyRelease[key=%c] for transition to %d.%d", this, charKey, m_keyframeIndex, m_inputSourceStateIndex); 379 m_client.simulateKeyboardInteraction(m_page, KeyboardInteraction::KeyRelease, charKey, WTFMove(eventDispatchFinished)); 380 } 381 } 353 382 } else if (a.pressedVirtualKeys != b.pressedVirtualKeys) { 354 383 bool simulatedAnInteraction = false; … … 384 413 #endif // !ENABLE(WEBDRIVER_KEYBOARD_INTERACTIONS) 385 414 break; 415 } 386 416 case SimulatedInputSourceType::Wheel: 387 417 #if !ENABLE(WEBDRIVER_WHEEL_INTERACTIONS) -
trunk/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.h
r268858 r269035 33 33 #include <wtf/CompletionHandler.h> 34 34 #include <wtf/HashSet.h> 35 #include <wtf/ListHashSet.h> 35 36 #include <wtf/Optional.h> 36 37 #include <wtf/RefCounted.h> … … 60 61 using VirtualKeyMap = HashMap<VirtualKey, VirtualKey, WTF::IntHash<VirtualKey>, WTF::StrongEnumHashTraits<VirtualKey>>; 61 62 using CharKey = UChar32; 63 using CharKeySet = ListHashSet<CharKey>; 62 64 using MouseButton = Inspector::Protocol::Automation::MouseButton; 63 65 using MouseInteraction = Inspector::Protocol::Automation::MouseInteraction; … … 79 81 80 82 struct SimulatedInputSourceState { 81 Optional<CharKey> pressedCharKey;83 CharKeySet pressedCharKeys; 82 84 VirtualKeyMap pressedVirtualKeys; 83 85 Optional<MouseButton> pressedMouseButton; -
trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
r268793 r269035 2086 2086 auto pressedCharKeyString = stateObject->getString("pressedCharKey"_s); 2087 2087 if (!!pressedCharKeyString) 2088 sourceState.pressedCharKey = pressedCharKeyString.characterAt(0);2088 sourceState.pressedCharKeys.add(pressedCharKeyString.characterAt(0)); 2089 2089 2090 2090 if (auto pressedVirtualKeysArray = stateObject->getArray("pressedVirtualKeys"_s)) { -
trunk/WebDriverTests/ChangeLog
r268858 r269035 1 2020-10-27 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 WebDriver: sequence of char key press is not supported 4 https://bugs.webkit.org/show_bug.cgi?id=217951 5 6 Reviewed by Brian Burg. 7 8 Remove expectations for test that is now passing. 9 10 * TestExpectations.json: 11 1 12 2020-10-22 Carlos Garcia Campos <cgarcia@igalia.com> 2 13 -
trunk/WebDriverTests/TestExpectations.json
r268858 r269035 389 389 "test_special_key_sends_keydown[SEPARATOR-expected63]": { 390 390 "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/184967"}} 391 },392 "test_sequence_of_keydown_printable_keys_sends_events": {393 "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/184967"}}394 391 } 395 392 }
Note: See TracChangeset
for help on using the changeset viewer.