| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 case WebGestureDeviceTouchscreen: | 281 case WebGestureDeviceTouchscreen: |
| 282 m_source = PlatformGestureSourceTouchscreen; | 282 m_source = PlatformGestureSourceTouchscreen; |
| 283 break; | 283 break; |
| 284 case WebGestureDeviceUninitialized: | 284 case WebGestureDeviceUninitialized: |
| 285 ASSERT_NOT_REACHED(); | 285 ASSERT_NOT_REACHED(); |
| 286 } | 286 } |
| 287 } | 287 } |
| 288 | 288 |
| 289 // MakePlatformKeyboardEvent -------------------------------------------------- | 289 // MakePlatformKeyboardEvent -------------------------------------------------- |
| 290 | 290 |
| 291 inline PlatformEvent::Type toPlatformKeyboardEventType(WebInputEvent::Type type) | 291 inline PlatformEvent::EventType toPlatformKeyboardEventType(WebInputEvent::Type
type) |
| 292 { | 292 { |
| 293 switch (type) { | 293 switch (type) { |
| 294 case WebInputEvent::KeyUp: | 294 case WebInputEvent::KeyUp: |
| 295 return PlatformEvent::KeyUp; | 295 return PlatformEvent::KeyUp; |
| 296 case WebInputEvent::KeyDown: | 296 case WebInputEvent::KeyDown: |
| 297 return PlatformEvent::KeyDown; | 297 return PlatformEvent::KeyDown; |
| 298 case WebInputEvent::RawKeyDown: | 298 case WebInputEvent::RawKeyDown: |
| 299 return PlatformEvent::RawKeyDown; | 299 return PlatformEvent::RawKeyDown; |
| 300 case WebInputEvent::Char: | 300 case WebInputEvent::Char: |
| 301 return PlatformEvent::Char; | 301 return PlatformEvent::Char; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 315 m_isSystemKey = e.isSystemKey; | 315 m_isSystemKey = e.isSystemKey; |
| 316 // TODO: BUG482880 Fix this initialization to lazy initialization. | 316 // TODO: BUG482880 Fix this initialization to lazy initialization. |
| 317 m_code = Platform::current()->domCodeStringFromEnum(e.domCode); | 317 m_code = Platform::current()->domCodeStringFromEnum(e.domCode); |
| 318 m_key = Platform::current()->domKeyStringFromEnum(e.domKey); | 318 m_key = Platform::current()->domKeyStringFromEnum(e.domKey); |
| 319 | 319 |
| 320 m_modifiers = e.modifiers; | 320 m_modifiers = e.modifiers; |
| 321 m_timestamp = e.timeStampSeconds; | 321 m_timestamp = e.timeStampSeconds; |
| 322 m_windowsVirtualKeyCode = e.windowsKeyCode; | 322 m_windowsVirtualKeyCode = e.windowsKeyCode; |
| 323 } | 323 } |
| 324 | 324 |
| 325 void PlatformKeyboardEventBuilder::setKeyType(Type type) | 325 void PlatformKeyboardEventBuilder::setKeyType(EventType type) |
| 326 { | 326 { |
| 327 // According to the behavior of Webkit in Windows platform, | 327 // According to the behavior of Webkit in Windows platform, |
| 328 // we need to convert KeyDown to RawKeydown and Char events | 328 // we need to convert KeyDown to RawKeydown and Char events |
| 329 // See WebKit/WebKit/Win/WebView.cpp | 329 // See WebKit/WebKit/Win/WebView.cpp |
| 330 ASSERT(m_type == KeyDown); | 330 ASSERT(m_type == KeyDown); |
| 331 ASSERT(type == RawKeyDown || type == Char); | 331 ASSERT(type == RawKeyDown || type == Char); |
| 332 m_type = type; | 332 m_type = type; |
| 333 | 333 |
| 334 if (type == RawKeyDown) { | 334 if (type == RawKeyDown) { |
| 335 m_text = String(); | 335 m_text = String(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 346 bool PlatformKeyboardEventBuilder::isCharacterKey() const | 346 bool PlatformKeyboardEventBuilder::isCharacterKey() const |
| 347 { | 347 { |
| 348 switch (windowsVirtualKeyCode()) { | 348 switch (windowsVirtualKeyCode()) { |
| 349 case VKEY_BACK: | 349 case VKEY_BACK: |
| 350 case VKEY_ESCAPE: | 350 case VKEY_ESCAPE: |
| 351 return false; | 351 return false; |
| 352 } | 352 } |
| 353 return true; | 353 return true; |
| 354 } | 354 } |
| 355 | 355 |
| 356 inline PlatformEvent::Type toPlatformTouchEventType(const WebInputEvent::Type ty
pe) | 356 inline PlatformEvent::EventType toPlatformTouchEventType(const WebInputEvent::Ty
pe type) |
| 357 { | 357 { |
| 358 switch (type) { | 358 switch (type) { |
| 359 case WebInputEvent::TouchStart: | 359 case WebInputEvent::TouchStart: |
| 360 return PlatformEvent::TouchStart; | 360 return PlatformEvent::TouchStart; |
| 361 case WebInputEvent::TouchMove: | 361 case WebInputEvent::TouchMove: |
| 362 return PlatformEvent::TouchMove; | 362 return PlatformEvent::TouchMove; |
| 363 case WebInputEvent::TouchEnd: | 363 case WebInputEvent::TouchEnd: |
| 364 return PlatformEvent::TouchEnd; | 364 return PlatformEvent::TouchEnd; |
| 365 case WebInputEvent::TouchCancel: | 365 case WebInputEvent::TouchCancel: |
| 366 return PlatformEvent::TouchCancel; | 366 return PlatformEvent::TouchCancel; |
| 367 default: | 367 default: |
| 368 ASSERT_NOT_REACHED(); | 368 ASSERT_NOT_REACHED(); |
| 369 } | 369 } |
| 370 return PlatformEvent::TouchStart; | 370 return PlatformEvent::TouchStart; |
| 371 } | 371 } |
| 372 | 372 |
| 373 inline PlatformTouchPoint::State toPlatformTouchPointState(const WebTouchPoint::
State state) | 373 inline PlatformTouchPoint::TouchState toPlatformTouchPointState(const WebTouchPo
int::State state) |
| 374 { | 374 { |
| 375 switch (state) { | 375 switch (state) { |
| 376 case WebTouchPoint::StateReleased: | 376 case WebTouchPoint::StateReleased: |
| 377 return PlatformTouchPoint::TouchReleased; | 377 return PlatformTouchPoint::TouchReleased; |
| 378 case WebTouchPoint::StatePressed: | 378 case WebTouchPoint::StatePressed: |
| 379 return PlatformTouchPoint::TouchPressed; | 379 return PlatformTouchPoint::TouchPressed; |
| 380 case WebTouchPoint::StateMoved: | 380 case WebTouchPoint::StateMoved: |
| 381 return PlatformTouchPoint::TouchMoved; | 381 return PlatformTouchPoint::TouchMoved; |
| 382 case WebTouchPoint::StateStationary: | 382 case WebTouchPoint::StateStationary: |
| 383 return PlatformTouchPoint::TouchStationary; | 383 return PlatformTouchPoint::TouchStationary; |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 domCode = Platform::current()->domEnumFromCodeString(event.keyEvent()->code(
)); | 600 domCode = Platform::current()->domEnumFromCodeString(event.keyEvent()->code(
)); |
| 601 domKey = Platform::current()->domKeyEnumFromString(event.keyEvent()->key()); | 601 domKey = Platform::current()->domKeyEnumFromString(event.keyEvent()->key()); |
| 602 unsigned numberOfCharacters = std::min(event.keyEvent()->text().length(), st
atic_cast<unsigned>(textLengthCap)); | 602 unsigned numberOfCharacters = std::min(event.keyEvent()->text().length(), st
atic_cast<unsigned>(textLengthCap)); |
| 603 for (unsigned i = 0; i < numberOfCharacters; ++i) { | 603 for (unsigned i = 0; i < numberOfCharacters; ++i) { |
| 604 text[i] = event.keyEvent()->text()[i]; | 604 text[i] = event.keyEvent()->text()[i]; |
| 605 unmodifiedText[i] = event.keyEvent()->unmodifiedText()[i]; | 605 unmodifiedText[i] = event.keyEvent()->unmodifiedText()[i]; |
| 606 } | 606 } |
| 607 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), event.keyIdentif
ier().length()); | 607 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), event.keyIdentif
ier().length()); |
| 608 } | 608 } |
| 609 | 609 |
| 610 WebInputEvent::Type toWebKeyboardEventType(PlatformEvent::Type type) | 610 WebInputEvent::Type toWebKeyboardEventType(PlatformEvent::EventType type) |
| 611 { | 611 { |
| 612 switch (type) { | 612 switch (type) { |
| 613 case PlatformEvent::KeyUp: | 613 case PlatformEvent::KeyUp: |
| 614 return WebInputEvent::KeyUp; | 614 return WebInputEvent::KeyUp; |
| 615 case PlatformEvent::KeyDown: | 615 case PlatformEvent::KeyDown: |
| 616 return WebInputEvent::KeyDown; | 616 return WebInputEvent::KeyDown; |
| 617 case PlatformEvent::RawKeyDown: | 617 case PlatformEvent::RawKeyDown: |
| 618 return WebInputEvent::RawKeyDown; | 618 return WebInputEvent::RawKeyDown; |
| 619 case PlatformEvent::Char: | 619 case PlatformEvent::Char: |
| 620 return WebInputEvent::Char; | 620 return WebInputEvent::Char; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 break; | 740 break; |
| 741 case GestureSourceTouchscreen: | 741 case GestureSourceTouchscreen: |
| 742 sourceDevice = WebGestureDeviceTouchscreen; | 742 sourceDevice = WebGestureDeviceTouchscreen; |
| 743 break; | 743 break; |
| 744 case GestureSourceUninitialized: | 744 case GestureSourceUninitialized: |
| 745 ASSERT_NOT_REACHED(); | 745 ASSERT_NOT_REACHED(); |
| 746 } | 746 } |
| 747 } | 747 } |
| 748 | 748 |
| 749 } // namespace blink | 749 } // namespace blink |
| OLD | NEW |