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

Side by Side Diff: Source/core/events/MouseEvent.h

Issue 1227363006: Virtualize EventDispatchMediator creation and cleanup calling. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master_event_trusted_main
Patch Set: Created 5 years, 5 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 | « Source/core/events/KeyboardEvent.cpp ('k') | Source/core/events/MouseEvent.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) 2001 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 DataTransfer* dataTransfer() const { return isDragEvent() ? m_dataTransfer.g et() : 0; } 85 DataTransfer* dataTransfer() const { return isDragEvent() ? m_dataTransfer.g et() : 0; }
86 86
87 bool fromTouch() const { return m_syntheticEventType == PlatformMouseEvent:: FromTouch; } 87 bool fromTouch() const { return m_syntheticEventType == PlatformMouseEvent:: FromTouch; }
88 88
89 const AtomicString& interfaceName() const override; 89 const AtomicString& interfaceName() const override;
90 90
91 bool isMouseEvent() const override; 91 bool isMouseEvent() const override;
92 bool isDragEvent() const final; 92 bool isDragEvent() const final;
93 int which() const final; 93 int which() const final;
94 94
95 void setTrusted(bool trusted) { m_trusted = trusted; }
96 bool isTrusted() const { return m_trusted; }
97
98 PassRefPtrWillBeRawPtr<EventDispatchMediator> createMediator() override;
99
95 DECLARE_VIRTUAL_TRACE(); 100 DECLARE_VIRTUAL_TRACE();
96 101
97 protected: 102 protected:
98 MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRe fPtrWillBeRawPtr<AbstractView>, 103 MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRe fPtrWillBeRawPtr<AbstractView>,
99 int detail, int screenX, int screenY, int windowX, int windowY, 104 int detail, int screenX, int screenY, int windowX, int windowY,
100 int movementX, int movementY, 105 int movementX, int movementY,
101 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, short button, un signed short buttons, 106 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, short button, un signed short buttons,
102 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, DataTransfer*, 107 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, DataTransfer*,
103 bool isSimulated, PlatformMouseEvent::SyntheticEventType, double uiCreat eTime = 0); 108 bool isSimulated, PlatformMouseEvent::SyntheticEventType, double uiCreat eTime = 0);
104 109
105 MouseEvent(const AtomicString& type, const MouseEventInit&); 110 MouseEvent(const AtomicString& type, const MouseEventInit&);
106 111
107 MouseEvent(); 112 MouseEvent();
108 113
109 private: 114 private:
110 short m_button; 115 short m_button;
111 unsigned short m_buttons; 116 unsigned short m_buttons;
112 RefPtrWillBeMember<EventTarget> m_relatedTarget; 117 RefPtrWillBeMember<EventTarget> m_relatedTarget;
113 PersistentWillBeMember<DataTransfer> m_dataTransfer; 118 PersistentWillBeMember<DataTransfer> m_dataTransfer;
114 PlatformMouseEvent::SyntheticEventType m_syntheticEventType; 119 PlatformMouseEvent::SyntheticEventType m_syntheticEventType;
120 unsigned m_trusted : 1;
tkent 2015/07/15 00:09:16 The member name should be |m_isTrusted|.
dtapuska 2015/07/15 01:46:17 Done.
115 }; 121 };
116 122
117 class SimulatedMouseEvent final : public MouseEvent { 123 class SimulatedMouseEvent final : public MouseEvent {
118 public: 124 public:
119 static PassRefPtrWillBeRawPtr<SimulatedMouseEvent> create(const AtomicString & eventType, PassRefPtrWillBeRawPtr<AbstractView>, PassRefPtrWillBeRawPtr<Event> underlyingEvent); 125 static PassRefPtrWillBeRawPtr<SimulatedMouseEvent> create(const AtomicString & eventType, PassRefPtrWillBeRawPtr<AbstractView>, PassRefPtrWillBeRawPtr<Event> underlyingEvent);
120 ~SimulatedMouseEvent() override; 126 ~SimulatedMouseEvent() override;
121 127
122 DECLARE_VIRTUAL_TRACE(); 128 DECLARE_VIRTUAL_TRACE();
123 129
124 private: 130 private:
125 SimulatedMouseEvent(const AtomicString& eventType, PassRefPtrWillBeRawPtr<Ab stractView>, PassRefPtrWillBeRawPtr<Event> underlyingEvent); 131 SimulatedMouseEvent(const AtomicString& eventType, PassRefPtrWillBeRawPtr<Ab stractView>, PassRefPtrWillBeRawPtr<Event> underlyingEvent);
126 }; 132 };
127 133
128 class MouseEventDispatchMediator final : public EventDispatchMediator { 134 class MouseEventDispatchMediator final : public EventDispatchMediator {
129 public: 135 public:
130 enum MouseEventType { SyntheticMouseEvent, NonSyntheticMouseEvent}; 136 static PassRefPtrWillBeRawPtr<MouseEventDispatchMediator> create(PassRefPtrW illBeRawPtr<MouseEvent>);
131 static PassRefPtrWillBeRawPtr<MouseEventDispatchMediator> create(PassRefPtrW illBeRawPtr<MouseEvent>, MouseEventType = NonSyntheticMouseEvent);
132 137
133 private: 138 private:
134 explicit MouseEventDispatchMediator(PassRefPtrWillBeRawPtr<MouseEvent>, Mous eEventType); 139 explicit MouseEventDispatchMediator(PassRefPtrWillBeRawPtr<MouseEvent>);
135 MouseEvent& event() const; 140 MouseEvent& event() const;
136 141
137 bool dispatchEvent(EventDispatcher&) const override; 142 bool dispatchEvent(EventDispatcher&) const override;
138 bool isSyntheticMouseEvent() const { return m_mouseEventType == SyntheticMou seEvent; }
139 MouseEventType m_mouseEventType;
140 }; 143 };
141 144
142 DEFINE_EVENT_TYPE_CASTS(MouseEvent); 145 DEFINE_EVENT_TYPE_CASTS(MouseEvent);
143 146
144 } // namespace blink 147 } // namespace blink
145 148
146 #endif // MouseEvent_h 149 #endif // MouseEvent_h
OLDNEW
« no previous file with comments | « Source/core/events/KeyboardEvent.cpp ('k') | Source/core/events/MouseEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698