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

Side by Side Diff: Source/core/events/TouchEvent.cpp

Issue 247483002: Allow touch events to be uncancelable (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix build on some platforms Created 6 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
« no previous file with comments | « Source/core/events/TouchEvent.h ('k') | Source/core/page/EventHandler.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2008, The Android Open Source Project 2 * Copyright 2008, The Android Open Source Project
3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. 3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
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 copyright 10 * * Redistributions in binary form must reproduce the above copyright
(...skipping 22 matching lines...) Expand all
33 namespace WebCore { 33 namespace WebCore {
34 34
35 TouchEvent::TouchEvent() 35 TouchEvent::TouchEvent()
36 { 36 {
37 ScriptWrappable::init(this); 37 ScriptWrappable::init(this);
38 } 38 }
39 39
40 TouchEvent::TouchEvent(TouchList* touches, TouchList* targetTouches, 40 TouchEvent::TouchEvent(TouchList* touches, TouchList* targetTouches,
41 TouchList* changedTouches, const AtomicString& type, 41 TouchList* changedTouches, const AtomicString& type,
42 PassRefPtrWillBeRawPtr<AbstractView> view, int screenX, int screenY, int pageX, int pageY, 42 PassRefPtrWillBeRawPtr<AbstractView> view, int screenX, int screenY, int pageX, int pageY,
43 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) 43 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool cancelable)
44 : MouseRelatedEvent(type, true, true, view, 0, IntPoint(screenX, screenY), 44 : MouseRelatedEvent(type, true, cancelable, view, 0, IntPoint(screenX, scree nY),
45 IntPoint(pageX, pageY), 45 IntPoint(pageX, pageY),
46 IntPoint(0, 0), 46 IntPoint(0, 0),
47 ctrlKey, altKey, shiftKey, metaKey) 47 ctrlKey, altKey, shiftKey, metaKey)
48 , m_touches(touches) 48 , m_touches(touches)
49 , m_targetTouches(targetTouches) 49 , m_targetTouches(targetTouches)
50 , m_changedTouches(changedTouches) 50 , m_changedTouches(changedTouches)
51 { 51 {
52 ScriptWrappable::init(this); 52 ScriptWrappable::init(this);
53 } 53 }
54 54
55 TouchEvent::~TouchEvent() 55 TouchEvent::~TouchEvent()
56 { 56 {
57 } 57 }
58 58
59 void TouchEvent::initTouchEvent(TouchList* touches, TouchList* targetTouches, 59 void TouchEvent::initTouchEvent(TouchList* touches, TouchList* targetTouches,
60 TouchList* changedTouches, const AtomicString& type, 60 TouchList* changedTouches, const AtomicString& type,
61 PassRefPtrWillBeRawPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY, 61 PassRefPtrWillBeRawPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY,
62 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) 62 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
63 { 63 {
64 if (dispatched()) 64 if (dispatched())
65 return; 65 return;
66 66
67 initUIEvent(type, true, true, view, 0); 67 bool cancelable = true;
68 if (type == EventTypeNames::touchcancel)
69 cancelable = false;
70
71 initUIEvent(type, true, cancelable, view, 0);
68 72
69 m_touches = touches; 73 m_touches = touches;
70 m_targetTouches = targetTouches; 74 m_targetTouches = targetTouches;
71 m_changedTouches = changedTouches; 75 m_changedTouches = changedTouches;
72 m_screenLocation = IntPoint(screenX, screenY); 76 m_screenLocation = IntPoint(screenX, screenY);
73 m_ctrlKey = ctrlKey; 77 m_ctrlKey = ctrlKey;
74 m_altKey = altKey; 78 m_altKey = altKey;
75 m_shiftKey = shiftKey; 79 m_shiftKey = shiftKey;
76 m_metaKey = metaKey; 80 m_metaKey = metaKey;
77 initCoordinates(IntPoint(clientX, clientY)); 81 initCoordinates(IntPoint(clientX, clientY));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 return toTouchEvent(EventDispatchMediator::event()); 114 return toTouchEvent(EventDispatchMediator::event());
111 } 115 }
112 116
113 bool TouchEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) cons t 117 bool TouchEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) cons t
114 { 118 {
115 event()->eventPath().adjustForTouchEvent(dispatcher->node(), *event()); 119 event()->eventPath().adjustForTouchEvent(dispatcher->node(), *event());
116 return dispatcher->dispatch(); 120 return dispatcher->dispatch();
117 } 121 }
118 122
119 } // namespace WebCore 123 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/events/TouchEvent.h ('k') | Source/core/page/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698