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

Side by Side Diff: third_party/WebKit/Source/web/WebInputEventConversion.cpp

Issue 1888163003: Articulate the cancel behavior in the WebTouchEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 PlatformTouchEventBuilder::PlatformTouchEventBuilder(Widget* widget, const WebTo uchEvent& event) 450 PlatformTouchEventBuilder::PlatformTouchEventBuilder(Widget* widget, const WebTo uchEvent& event)
451 { 451 {
452 m_type = toPlatformTouchEventType(event.type); 452 m_type = toPlatformTouchEventType(event.type);
453 m_modifiers = event.modifiers; 453 m_modifiers = event.modifiers;
454 m_timestamp = event.timeStampSeconds; 454 m_timestamp = event.timeStampSeconds;
455 m_causesScrollingIfUncanceled = event.movedBeyondSlopRegion; 455 m_causesScrollingIfUncanceled = event.movedBeyondSlopRegion;
456 456
457 for (unsigned i = 0; i < event.touchesLength; ++i) 457 for (unsigned i = 0; i < event.touchesLength; ++i)
458 m_touchPoints.append(PlatformTouchPointBuilder(widget, event.touches[i]) ); 458 m_touchPoints.append(PlatformTouchPointBuilder(widget, event.touches[i]) );
459 459
460 m_cancelable = event.cancelable; 460 m_cancelable = event.dispatchType == WebInputEvent::Blocking;
461 } 461 }
462 462
463 static FloatPoint convertAbsoluteLocationForLayoutObjectFloat(const LayoutPoint& location, const LayoutObject& layoutObject) 463 static FloatPoint convertAbsoluteLocationForLayoutObjectFloat(const LayoutPoint& location, const LayoutObject& layoutObject)
464 { 464 {
465 return layoutObject.absoluteToLocal(FloatPoint(location), UseTransforms); 465 return layoutObject.absoluteToLocal(FloatPoint(location), UseTransforms);
466 } 466 }
467 467
468 static IntPoint convertAbsoluteLocationForLayoutObject(const LayoutPoint& locati on, const LayoutObject& layoutObject) 468 static IntPoint convertAbsoluteLocationForLayoutObject(const LayoutPoint& locati on, const LayoutObject& layoutObject)
469 { 469 {
470 return roundedIntPoint(convertAbsoluteLocationForLayoutObjectFloat(location, layoutObject)); 470 return roundedIntPoint(convertAbsoluteLocationForLayoutObjectFloat(location, layoutObject));
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 else if (event.type() == EventTypeNames::touchcancel) 710 else if (event.type() == EventTypeNames::touchcancel)
711 type = TouchCancel; 711 type = TouchCancel;
712 else { 712 else {
713 NOTREACHED(); 713 NOTREACHED();
714 type = Undefined; 714 type = Undefined;
715 return; 715 return;
716 } 716 }
717 717
718 timeStampSeconds = event.platformTimeStamp(); 718 timeStampSeconds = event.platformTimeStamp();
719 modifiers = event.modifiers(); 719 modifiers = event.modifiers();
720 cancelable = event.cancelable(); 720 dispatchType = event.cancelable() ? WebInputEvent::Blocking : WebInputEvent: :NonBlocking;
721 movedBeyondSlopRegion = event.causesScrollingIfUncanceled(); 721 movedBeyondSlopRegion = event.causesScrollingIfUncanceled();
722 722
723 // Currently touches[] is empty, add stationary points as-is. 723 // Currently touches[] is empty, add stationary points as-is.
724 for (unsigned i = 0; i < event.touches()->length() && i < static_cast<unsign ed>(WebTouchEvent::touchesLengthCap); ++i) { 724 for (unsigned i = 0; i < event.touches()->length() && i < static_cast<unsign ed>(WebTouchEvent::touchesLengthCap); ++i) {
725 touches[i] = toWebTouchPoint(event.touches()->item(i), layoutObject, Web TouchPoint::StateStationary); 725 touches[i] = toWebTouchPoint(event.touches()->item(i), layoutObject, Web TouchPoint::StateStationary);
726 ++touchesLength; 726 ++touchesLength;
727 } 727 }
728 // If any existing points are also in the change list, we should update 728 // If any existing points are also in the change list, we should update
729 // their state, otherwise just add the new points. 729 // their state, otherwise just add the new points.
730 addTouchPointsUpdateStateIfNecessary(toWebTouchPointState(event.type()), eve nt.changedTouches(), touches, &touchesLength, layoutObject); 730 addTouchPointsUpdateStateIfNecessary(toWebTouchPointState(event.type()), eve nt.changedTouches(), touches, &touchesLength, layoutObject);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 break; 783 break;
784 case GestureSourceTouchscreen: 784 case GestureSourceTouchscreen:
785 sourceDevice = WebGestureDeviceTouchscreen; 785 sourceDevice = WebGestureDeviceTouchscreen;
786 break; 786 break;
787 case GestureSourceUninitialized: 787 case GestureSourceUninitialized:
788 NOTREACHED(); 788 NOTREACHED();
789 } 789 }
790 } 790 }
791 791
792 } // namespace blink 792 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698