| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file contains the definition for EventSendingController. | 5 // This file contains the definition for EventSendingController. |
| 6 // | 6 // |
| 7 // Some notes about drag and drop handling: | 7 // Some notes about drag and drop handling: |
| 8 // Windows drag and drop goes through a system call to DoDragDrop. At that | 8 // Windows drag and drop goes through a system call to DoDragDrop. At that |
| 9 // point, program control is given to Windows which then periodically makes | 9 // point, program control is given to Windows which then periodically makes |
| 10 // callbacks into the webview. This won't work for layout tests, so instead, | 10 // callbacks into the webview. This won't work for layout tests, so instead, |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 DCHECK(code_str.length() == 1); | 575 DCHECK(code_str.length() == 1); |
| 576 text = code = code_str[0]; | 576 text = code = code_str[0]; |
| 577 needs_shift_key_modifier = NeedsShiftModifier(code); | 577 needs_shift_key_modifier = NeedsShiftModifier(code); |
| 578 if ((code & 0xFF) >= 'a' && (code & 0xFF) <= 'z') | 578 if ((code & 0xFF) >= 'a' && (code & 0xFF) <= 'z') |
| 579 code -= 'a' - 'A'; | 579 code -= 'a' - 'A'; |
| 580 generate_char = true; | 580 generate_char = true; |
| 581 } | 581 } |
| 582 } | 582 } |
| 583 | 583 |
| 584 // For one generated keyboard event, we need to generate a keyDown/keyUp | 584 // For one generated keyboard event, we need to generate a keyDown/keyUp |
| 585 // pair; refer to EventSender.cpp in WebKit/WebKitTools/DumpRenderTree/win. | 585 // pair; refer to EventSender.cpp in WebKit/Tools/DumpRenderTree/win. |
| 586 // On Windows, we might also need to generate a char event to mimic the | 586 // On Windows, we might also need to generate a char event to mimic the |
| 587 // Windows event flow; on other platforms we create a merged event and test | 587 // Windows event flow; on other platforms we create a merged event and test |
| 588 // the event flow that that platform provides. | 588 // the event flow that that platform provides. |
| 589 WebKeyboardEvent event_down, event_char, event_up; | 589 WebKeyboardEvent event_down, event_char, event_up; |
| 590 event_down.type = WebInputEvent::RawKeyDown; | 590 event_down.type = WebInputEvent::RawKeyDown; |
| 591 event_down.modifiers = 0; | 591 event_down.modifiers = 0; |
| 592 event_down.windowsKeyCode = code; | 592 event_down.windowsKeyCode = code; |
| 593 if (generate_char) { | 593 if (generate_char) { |
| 594 event_down.text[0] = text; | 594 event_down.text[0] = text; |
| 595 event_down.unmodifiedText[0] = text; | 595 event_down.unmodifiedText[0] = text; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 NULL, msg, args[1].ToInt32(), lparam)); | 662 NULL, msg, args[1].ToInt32(), lparam)); |
| 663 } else { | 663 } else { |
| 664 NOTREACHED() << L"Wrong number of arguments"; | 664 NOTREACHED() << L"Wrong number of arguments"; |
| 665 } | 665 } |
| 666 #endif | 666 #endif |
| 667 } | 667 } |
| 668 | 668 |
| 669 bool EventSendingController::NeedsShiftModifier(int key_code) { | 669 bool EventSendingController::NeedsShiftModifier(int key_code) { |
| 670 // If code is an uppercase letter, assign a SHIFT key to | 670 // If code is an uppercase letter, assign a SHIFT key to |
| 671 // event_down.modifier, this logic comes from | 671 // event_down.modifier, this logic comes from |
| 672 // WebKit/WebKitTools/DumpRenderTree/Win/EventSender.cpp | 672 // WebKit/Tools/DumpRenderTree/Win/EventSender.cpp |
| 673 if ((key_code & 0xFF) >= 'A' && (key_code & 0xFF) <= 'Z') | 673 if ((key_code & 0xFF) >= 'A' && (key_code & 0xFF) <= 'Z') |
| 674 return true; | 674 return true; |
| 675 return false; | 675 return false; |
| 676 } | 676 } |
| 677 | 677 |
| 678 void EventSendingController::leapForward( | 678 void EventSendingController::leapForward( |
| 679 const CppArgumentList& args, CppVariant* result) { | 679 const CppArgumentList& args, CppVariant* result) { |
| 680 result->SetNull(); | 680 result->SetNull(); |
| 681 | 681 |
| 682 if (args.size() <1 || !args[0].isNumber()) | 682 if (args.size() <1 || !args[0].isNumber()) |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 | 1070 |
| 1071 void EventSendingController::fireKeyboardEventsToElement( | 1071 void EventSendingController::fireKeyboardEventsToElement( |
| 1072 const CppArgumentList& args, CppVariant* result) { | 1072 const CppArgumentList& args, CppVariant* result) { |
| 1073 result->SetNull(); | 1073 result->SetNull(); |
| 1074 } | 1074 } |
| 1075 | 1075 |
| 1076 void EventSendingController::clearKillRing( | 1076 void EventSendingController::clearKillRing( |
| 1077 const CppArgumentList& args, CppVariant* result) { | 1077 const CppArgumentList& args, CppVariant* result) { |
| 1078 result->SetNull(); | 1078 result->SetNull(); |
| 1079 } | 1079 } |
| OLD | NEW |