OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
347 | 347 |
348 if (type == RawKeyDown) { | 348 if (type == RawKeyDown) { |
349 m_text = String(); | 349 m_text = String(); |
350 m_unmodifiedText = String(); | 350 m_unmodifiedText = String(); |
351 } else { | 351 } else { |
352 m_keyIdentifier = String(); | 352 m_keyIdentifier = String(); |
353 m_windowsVirtualKeyCode = 0; | 353 m_windowsVirtualKeyCode = 0; |
354 } | 354 } |
355 } | 355 } |
356 | 356 |
357 void PlatformKeyboardEventBuilder::setDOMCode(const char* code) | |
Wez
2014/12/02 04:23:30
Could we add the code member to WebKeyboardEvent a
Habib Virji
2014/12/02 11:52:20
I was trying to avoid, as that will increase the s
| |
358 { | |
359 m_code = String(code); | |
360 } | |
361 | |
357 // Please refer to bug http://b/issue?id=961192, which talks about Webkit | 362 // Please refer to bug http://b/issue?id=961192, which talks about Webkit |
358 // keyboard event handling changes. It also mentions the list of keys | 363 // keyboard event handling changes. It also mentions the list of keys |
359 // which don't have associated character events. | 364 // which don't have associated character events. |
360 bool PlatformKeyboardEventBuilder::isCharacterKey() const | 365 bool PlatformKeyboardEventBuilder::isCharacterKey() const |
361 { | 366 { |
362 switch (windowsVirtualKeyCode()) { | 367 switch (windowsVirtualKeyCode()) { |
363 case VKEY_BACK: | 368 case VKEY_BACK: |
364 case VKEY_ESCAPE: | 369 case VKEY_ESCAPE: |
365 return false; | 370 return false; |
366 } | 371 } |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
675 modifiers |= WebInputEvent::IsRight; | 680 modifiers |= WebInputEvent::IsRight; |
676 | 681 |
677 timeStampSeconds = event.timeStamp() / millisPerSecond; | 682 timeStampSeconds = event.timeStamp() / millisPerSecond; |
678 windowsKeyCode = event.keyCode(); | 683 windowsKeyCode = event.keyCode(); |
679 | 684 |
680 // The platform keyevent does not exist if the event was created using | 685 // The platform keyevent does not exist if the event was created using |
681 // initKeyboardEvent. | 686 // initKeyboardEvent. |
682 if (!event.keyEvent()) | 687 if (!event.keyEvent()) |
683 return; | 688 return; |
684 nativeKeyCode = event.keyEvent()->nativeVirtualKeyCode(); | 689 nativeKeyCode = event.keyEvent()->nativeVirtualKeyCode(); |
690 | |
685 unsigned numberOfCharacters = std::min(event.keyEvent()->text().length(), st atic_cast<unsigned>(textLengthCap)); | 691 unsigned numberOfCharacters = std::min(event.keyEvent()->text().length(), st atic_cast<unsigned>(textLengthCap)); |
686 for (unsigned i = 0; i < numberOfCharacters; ++i) { | 692 for (unsigned i = 0; i < numberOfCharacters; ++i) { |
687 text[i] = event.keyEvent()->text()[i]; | 693 text[i] = event.keyEvent()->text()[i]; |
688 unmodifiedText[i] = event.keyEvent()->unmodifiedText()[i]; | 694 unmodifiedText[i] = event.keyEvent()->unmodifiedText()[i]; |
689 } | 695 } |
690 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), event.keyIdentif ier().length()); | 696 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), event.keyIdentif ier().length()); |
691 } | 697 } |
692 | 698 |
693 WebInputEvent::Type toWebKeyboardEventType(PlatformEvent::Type type) | 699 WebInputEvent::Type toWebKeyboardEventType(PlatformEvent::Type type) |
694 { | 700 { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
826 modifiers = getWebInputModifiers(event); | 832 modifiers = getWebInputModifiers(event); |
827 | 833 |
828 globalX = event.screenX(); | 834 globalX = event.screenX(); |
829 globalY = event.screenY(); | 835 globalY = event.screenY(); |
830 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL ocation(), *renderObject); | 836 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL ocation(), *renderObject); |
831 x = localPoint.x(); | 837 x = localPoint.x(); |
832 y = localPoint.y(); | 838 y = localPoint.y(); |
833 } | 839 } |
834 | 840 |
835 } // namespace blink | 841 } // namespace blink |
OLD | NEW |