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

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

Issue 857533002: Add support for GestureEvents to Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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
« no previous file with comments | « sky/engine/core/dom/Node.cpp ('k') | sky/engine/core/events/GestureEvent.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 (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 14 matching lines...) Expand all
25 25
26 #ifndef SKY_ENGINE_CORE_EVENTS_GESTUREEVENT_H_ 26 #ifndef SKY_ENGINE_CORE_EVENTS_GESTUREEVENT_H_
27 #define SKY_ENGINE_CORE_EVENTS_GESTUREEVENT_H_ 27 #define SKY_ENGINE_CORE_EVENTS_GESTUREEVENT_H_
28 28
29 #include "sky/engine/core/events/EventDispatcher.h" 29 #include "sky/engine/core/events/EventDispatcher.h"
30 #include "sky/engine/core/events/MouseRelatedEvent.h" 30 #include "sky/engine/core/events/MouseRelatedEvent.h"
31 #include "sky/engine/platform/PlatformGestureEvent.h" 31 #include "sky/engine/platform/PlatformGestureEvent.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 struct GestureEventInit : public UIEventInit {
36 int screenX = 0;
37 int screenY = 0;
38 int clientX = 0;
39 int clientY = 0;
40 bool ctrlKey = false;
41 bool altKey = false;
42 bool shiftKey = false;
43 bool metaKey = false;;
44 double deltaX = 0;
45 double deltaY = 0;
46 double velocityX = 0;
47 double velocityY = 0;
48 };
49
35 class GestureEvent final : public MouseRelatedEvent { 50 class GestureEvent final : public MouseRelatedEvent {
51 DEFINE_WRAPPERTYPEINFO();
36 public: 52 public:
37 virtual ~GestureEvent() { } 53 virtual ~GestureEvent() { }
38 54
55 static PassRefPtr<GestureEvent> create() { return adoptRef(new GestureEvent) ; }
39 static PassRefPtr<GestureEvent> create(PassRefPtr<AbstractView>, const Platf ormGestureEvent&); 56 static PassRefPtr<GestureEvent> create(PassRefPtr<AbstractView>, const Platf ormGestureEvent&);
57 static PassRefPtr<GestureEvent> create(const AtomicString& type, const Gestu reEventInit&);
40 58
41 virtual bool isGestureEvent() const override; 59 bool isGestureEvent() const override;
42 60
43 virtual const AtomicString& interfaceName() const override; 61 const AtomicString& interfaceName() const override;
44 62
45 float deltaX() const { return m_deltaX; } 63 float deltaX() const { return m_deltaX; }
46 float deltaY() const { return m_deltaY; } 64 float deltaY() const { return m_deltaY; }
47 65
66 float velocityX() const { return m_velocityX; }
67 float velocityY() const { return m_velocityY; }
68
48 private: 69 private:
49 GestureEvent(); 70 GestureEvent();
50 GestureEvent(const AtomicString& type, PassRefPtr<AbstractView>, int screenX , int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKe y, bool metaKey, float deltaX, float deltaY); 71 GestureEvent(const AtomicString& type, const GestureEventInit&);
72 GestureEvent(const AtomicString& type, PassRefPtr<AbstractView>, int screenX , int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKe y, bool metaKey, float deltaX, float deltaY, float velocityX, float velocityY);
51 73
52 float m_deltaX; 74 float m_deltaX;
53 float m_deltaY; 75 float m_deltaY;
76
77 float m_velocityX;
78 float m_velocityY;
54 }; 79 };
55 80
56 class GestureEventDispatchMediator final : public EventDispatchMediator { 81 class GestureEventDispatchMediator final : public EventDispatchMediator {
57 public: 82 public:
58 static PassRefPtr<GestureEventDispatchMediator> create(PassRefPtr<GestureEve nt> gestureEvent) 83 static PassRefPtr<GestureEventDispatchMediator> create(PassRefPtr<GestureEve nt> gestureEvent)
59 { 84 {
60 return adoptRef(new GestureEventDispatchMediator(gestureEvent)); 85 return adoptRef(new GestureEventDispatchMediator(gestureEvent));
61 } 86 }
62 87
63 private: 88 private:
64 explicit GestureEventDispatchMediator(PassRefPtr<GestureEvent>); 89 explicit GestureEventDispatchMediator(PassRefPtr<GestureEvent>);
65 90
66 GestureEvent* event() const; 91 GestureEvent* event() const;
67 92
68 virtual bool dispatchEvent(EventDispatcher*) const override; 93 virtual bool dispatchEvent(EventDispatcher*) const override;
69 }; 94 };
70 95
71 DEFINE_EVENT_TYPE_CASTS(GestureEvent); 96 DEFINE_EVENT_TYPE_CASTS(GestureEvent);
72 97
73 } // namespace blink 98 } // namespace blink
74 99
75 #endif // SKY_ENGINE_CORE_EVENTS_GESTUREEVENT_H_ 100 #endif // SKY_ENGINE_CORE_EVENTS_GESTUREEVENT_H_
OLDNEW
« no previous file with comments | « sky/engine/core/dom/Node.cpp ('k') | sky/engine/core/events/GestureEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698