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

Side by Side Diff: sky/engine/core/events/GestureEvent.cpp

Issue 880473003: sky-scrollable should use a reasonable fling curve (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Now with heights Created 5 years, 11 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sky/engine/config.h" 5 #include "sky/engine/config.h"
6 #include "sky/engine/core/dom/Element.h" 6 #include "sky/engine/core/dom/Element.h"
7 #include "sky/engine/core/events/GestureEvent.h" 7 #include "sky/engine/core/events/GestureEvent.h"
8 #include "sky/engine/wtf/text/AtomicString.h" 8 #include "sky/engine/wtf/text/AtomicString.h"
9 9
10 namespace blink { 10 namespace blink {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 GestureEvent::GestureEvent(const WebGestureEvent& event) 68 GestureEvent::GestureEvent(const WebGestureEvent& event)
69 : Event(stringForType(event.type), true, true) 69 : Event(stringForType(event.type), true, true)
70 , m_x(event.x) 70 , m_x(event.x)
71 , m_y(event.y) 71 , m_y(event.y)
72 , m_dx(0) 72 , m_dx(0)
73 , m_dy(0) 73 , m_dy(0)
74 , m_velocityX(0) 74 , m_velocityX(0)
75 , m_velocityY(0) 75 , m_velocityY(0)
76 { 76 {
77 m_timeStamp = event.timeStampMS;
78
77 if (event.type == WebInputEvent::GestureFlingStart) { 79 if (event.type == WebInputEvent::GestureFlingStart) {
78 m_velocityX = event.data.flingStart.velocityX; 80 m_velocityX = event.data.flingStart.velocityX;
79 m_velocityY = event.data.flingStart.velocityY; 81 m_velocityY = event.data.flingStart.velocityY;
80 } else if (event.type == WebInputEvent::GestureScrollUpdate 82 } else if (event.type == WebInputEvent::GestureScrollUpdate
81 || event.type == WebInputEvent::GestureScrollUpdateWithoutPropagatio n) { 83 || event.type == WebInputEvent::GestureScrollUpdateWithoutPropagatio n) {
82 m_dx = event.data.scrollUpdate.deltaX; 84 m_dx = event.data.scrollUpdate.deltaX;
83 m_dy = event.data.scrollUpdate.deltaY; 85 m_dy = event.data.scrollUpdate.deltaY;
84 m_velocityX = event.data.scrollUpdate.velocityX; 86 m_velocityX = event.data.scrollUpdate.velocityX;
85 m_velocityY = event.data.scrollUpdate.velocityY; 87 m_velocityY = event.data.scrollUpdate.velocityY;
86 } 88 }
87 } 89 }
88 90
89 GestureEvent::GestureEvent(const AtomicString& type, const GestureEventInit& ini tializer) 91 GestureEvent::GestureEvent(const AtomicString& type, const GestureEventInit& ini tializer)
90 : Event(type, initializer) 92 : Event(type, initializer)
91 , m_x(initializer.x) 93 , m_x(initializer.x)
92 , m_y(initializer.y) 94 , m_y(initializer.y)
93 , m_dx(initializer.dx) 95 , m_dx(initializer.dx)
94 , m_dy(initializer.dy) 96 , m_dy(initializer.dy)
95 , m_velocityX(initializer.velocityX) 97 , m_velocityX(initializer.velocityX)
96 , m_velocityY(initializer.velocityY) 98 , m_velocityY(initializer.velocityY)
97 { 99 {
98 } 100 }
99 101
100 } // namespace blink 102 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698