Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: Source/WebKit/chromium/src/WebInputEventConversion.cpp

Issue 14280004: Revert removal of events (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 bool PlatformKeyboardEventBuilder::isCharacterKey() const 318 bool PlatformKeyboardEventBuilder::isCharacterKey() const
319 { 319 {
320 switch (windowsVirtualKeyCode()) { 320 switch (windowsVirtualKeyCode()) {
321 case VKEY_BACK: 321 case VKEY_BACK:
322 case VKEY_ESCAPE: 322 case VKEY_ESCAPE:
323 return false; 323 return false;
324 } 324 }
325 return true; 325 return true;
326 } 326 }
327 327
328 #if ENABLE(TOUCH_EVENTS)
328 inline PlatformEvent::Type toPlatformTouchEventType(const WebInputEvent::Type ty pe) 329 inline PlatformEvent::Type toPlatformTouchEventType(const WebInputEvent::Type ty pe)
329 { 330 {
330 switch (type) { 331 switch (type) {
331 case WebInputEvent::TouchStart: 332 case WebInputEvent::TouchStart:
332 return PlatformEvent::TouchStart; 333 return PlatformEvent::TouchStart;
333 case WebInputEvent::TouchMove: 334 case WebInputEvent::TouchMove:
334 return PlatformEvent::TouchMove; 335 return PlatformEvent::TouchMove;
335 case WebInputEvent::TouchEnd: 336 case WebInputEvent::TouchEnd:
336 return PlatformEvent::TouchEnd; 337 return PlatformEvent::TouchEnd;
337 case WebInputEvent::TouchCancel: 338 case WebInputEvent::TouchCancel:
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 if (event.modifiers & WebInputEvent::AltKey) 400 if (event.modifiers & WebInputEvent::AltKey)
400 m_modifiers |= PlatformEvent::AltKey; 401 m_modifiers |= PlatformEvent::AltKey;
401 if (event.modifiers & WebInputEvent::MetaKey) 402 if (event.modifiers & WebInputEvent::MetaKey)
402 m_modifiers |= PlatformEvent::MetaKey; 403 m_modifiers |= PlatformEvent::MetaKey;
403 404
404 m_timestamp = event.timeStampSeconds; 405 m_timestamp = event.timeStampSeconds;
405 406
406 for (unsigned i = 0; i < event.touchesLength; ++i) 407 for (unsigned i = 0; i < event.touchesLength; ++i)
407 m_touchPoints.append(PlatformTouchPointBuilder(widget, event.touches[i]) ); 408 m_touchPoints.append(PlatformTouchPointBuilder(widget, event.touches[i]) );
408 } 409 }
410 #endif
409 411
410 static int getWebInputModifiers(const UIEventWithKeyState& event) 412 static int getWebInputModifiers(const UIEventWithKeyState& event)
411 { 413 {
412 int modifiers = 0; 414 int modifiers = 0;
413 if (event.ctrlKey()) 415 if (event.ctrlKey())
414 modifiers |= WebInputEvent::ControlKey; 416 modifiers |= WebInputEvent::ControlKey;
415 if (event.shiftKey()) 417 if (event.shiftKey())
416 modifiers |= WebInputEvent::ShiftKey; 418 modifiers |= WebInputEvent::ShiftKey;
417 if (event.altKey()) 419 if (event.altKey())
418 modifiers |= WebInputEvent::AltKey; 420 modifiers |= WebInputEvent::AltKey;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 return; 570 return;
569 nativeKeyCode = event.keyEvent()->nativeVirtualKeyCode(); 571 nativeKeyCode = event.keyEvent()->nativeVirtualKeyCode();
570 unsigned numberOfCharacters = std::min(event.keyEvent()->text().length(), st atic_cast<unsigned>(textLengthCap)); 572 unsigned numberOfCharacters = std::min(event.keyEvent()->text().length(), st atic_cast<unsigned>(textLengthCap));
571 for (unsigned i = 0; i < numberOfCharacters; ++i) { 573 for (unsigned i = 0; i < numberOfCharacters; ++i) {
572 text[i] = event.keyEvent()->text()[i]; 574 text[i] = event.keyEvent()->text()[i];
573 unmodifiedText[i] = event.keyEvent()->unmodifiedText()[i]; 575 unmodifiedText[i] = event.keyEvent()->unmodifiedText()[i];
574 } 576 }
575 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), event.keyIdentif ier().length()); 577 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), event.keyIdentif ier().length());
576 } 578 }
577 579
580 #if ENABLE(TOUCH_EVENTS)
581
578 static void addTouchPoints(const Widget* widget, const AtomicString& touchType, TouchList* touches, WebTouchPoint* touchPoints, unsigned* touchPointsLength, con st WebCore::RenderObject* renderObject) 582 static void addTouchPoints(const Widget* widget, const AtomicString& touchType, TouchList* touches, WebTouchPoint* touchPoints, unsigned* touchPointsLength, con st WebCore::RenderObject* renderObject)
579 { 583 {
580 unsigned numberOfTouches = std::min(touches->length(), static_cast<unsigned> (WebTouchEvent::touchesLengthCap)); 584 unsigned numberOfTouches = std::min(touches->length(), static_cast<unsigned> (WebTouchEvent::touchesLengthCap));
581 for (unsigned i = 0; i < numberOfTouches; ++i) { 585 for (unsigned i = 0; i < numberOfTouches; ++i) {
582 const Touch* touch = touches->item(i); 586 const Touch* touch = touches->item(i);
583 587
584 WebTouchPoint point; 588 WebTouchPoint point;
585 point.id = touch->identifier(); 589 point.id = touch->identifier();
586 point.screenPosition = WebPoint(touch->screenX(), touch->screenY()); 590 point.screenPosition = WebPoint(touch->screenX(), touch->screenY());
587 point.position = convertAbsoluteLocationForRenderObject(touch->absoluteL ocation(), *renderObject); 591 point.position = convertAbsoluteLocationForRenderObject(touch->absoluteL ocation(), *renderObject);
(...skipping 25 matching lines...) Expand all
613 } 617 }
614 618
615 modifiers = getWebInputModifiers(event); 619 modifiers = getWebInputModifiers(event);
616 timeStampSeconds = event.timeStamp() / millisPerSecond; 620 timeStampSeconds = event.timeStamp() / millisPerSecond;
617 621
618 addTouchPoints(widget, event.type(), event.touches(), touches, &touchesLengt h, renderObject); 622 addTouchPoints(widget, event.type(), event.touches(), touches, &touchesLengt h, renderObject);
619 addTouchPoints(widget, event.type(), event.changedTouches(), changedTouches, &changedTouchesLength, renderObject); 623 addTouchPoints(widget, event.type(), event.changedTouches(), changedTouches, &changedTouchesLength, renderObject);
620 addTouchPoints(widget, event.type(), event.targetTouches(), targetTouches, & targetTouchesLength, renderObject); 624 addTouchPoints(widget, event.type(), event.targetTouches(), targetTouches, & targetTouchesLength, renderObject);
621 } 625 }
622 626
627 #endif // ENABLE(TOUCH_EVENTS)
628
623 WebGestureEventBuilder::WebGestureEventBuilder(const Widget* widget, const WebCo re::RenderObject* renderObject, const GestureEvent& event) 629 WebGestureEventBuilder::WebGestureEventBuilder(const Widget* widget, const WebCo re::RenderObject* renderObject, const GestureEvent& event)
624 { 630 {
625 if (event.type() == eventNames().gesturetapEvent) 631 if (event.type() == eventNames().gesturetapEvent)
626 type = GestureTap; 632 type = GestureTap;
627 else if (event.type() == eventNames().gesturetapdownEvent) 633 else if (event.type() == eventNames().gesturetapdownEvent)
628 type = GestureTapDown; 634 type = GestureTapDown;
629 else if (event.type() == eventNames().gesturescrollstartEvent) 635 else if (event.type() == eventNames().gesturescrollstartEvent)
630 type = GestureScrollBegin; 636 type = GestureScrollBegin;
631 else if (event.type() == eventNames().gesturescrollendEvent) 637 else if (event.type() == eventNames().gesturescrollendEvent)
632 type = GestureScrollEnd; 638 type = GestureScrollEnd;
633 else if (event.type() == eventNames().gesturescrollupdateEvent) { 639 else if (event.type() == eventNames().gesturescrollupdateEvent) {
634 type = GestureScrollUpdate; 640 type = GestureScrollUpdate;
635 data.scrollUpdate.deltaX = event.deltaX(); 641 data.scrollUpdate.deltaX = event.deltaX();
636 data.scrollUpdate.deltaY = event.deltaY(); 642 data.scrollUpdate.deltaY = event.deltaY();
637 } 643 }
638 644
639 timeStampSeconds = event.timeStamp() / millisPerSecond; 645 timeStampSeconds = event.timeStamp() / millisPerSecond;
640 modifiers = getWebInputModifiers(event); 646 modifiers = getWebInputModifiers(event);
641 647
642 globalX = event.screenX(); 648 globalX = event.screenX();
643 globalY = event.screenY(); 649 globalY = event.screenY();
644 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL ocation(), *renderObject); 650 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL ocation(), *renderObject);
645 x = localPoint.x(); 651 x = localPoint.x();
646 y = localPoint.y(); 652 y = localPoint.y();
647 } 653 }
648 654
649 } // namespace WebKit 655 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/src/WebInputEventConversion.h ('k') | Source/WebKit/chromium/src/WebPagePopupImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698