OLD | NEW |
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 28 matching lines...) Expand all Loading... |
39 DEFINE_WRAPPERTYPEINFO(); | 39 DEFINE_WRAPPERTYPEINFO(); |
40 public: | 40 public: |
41 static PassRefPtrWillBeRawPtr<MouseEvent> create() | 41 static PassRefPtrWillBeRawPtr<MouseEvent> create() |
42 { | 42 { |
43 return adoptRefWillBeNoop(new MouseEvent); | 43 return adoptRefWillBeNoop(new MouseEvent); |
44 } | 44 } |
45 | 45 |
46 static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& type, b
ool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>, | 46 static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& type, b
ool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>, |
47 int detail, int screenX, int screenY, int windowX, int windowY, | 47 int detail, int screenX, int screenY, int windowX, int windowY, |
48 int movementX, int movementY, | 48 int movementX, int movementY, |
49 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short b
utton, unsigned short buttons, | 49 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, short button, un
signed short buttons, |
50 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, DataTransfer*, | 50 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, DataTransfer*, |
51 bool isSimulated = false, PlatformMouseEvent::SyntheticEventType = Platf
ormMouseEvent::RealOrIndistinguishable, | 51 bool isSimulated = false, PlatformMouseEvent::SyntheticEventType = Platf
ormMouseEvent::RealOrIndistinguishable, |
52 double uiCreateTime = 0); | 52 double uiCreateTime = 0); |
53 | 53 |
54 static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& eventTy
pe, PassRefPtrWillBeRawPtr<AbstractView>, const PlatformMouseEvent&, int detail,
PassRefPtrWillBeRawPtr<Node> relatedTarget); | 54 static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& eventTy
pe, PassRefPtrWillBeRawPtr<AbstractView>, const PlatformMouseEvent&, int detail,
PassRefPtrWillBeRawPtr<Node> relatedTarget); |
55 | 55 |
56 static PassRefPtrWillBeRawPtr<MouseEvent> create(ScriptState*, const AtomicS
tring& eventType, const MouseEventInit&); | 56 static PassRefPtrWillBeRawPtr<MouseEvent> create(ScriptState*, const AtomicS
tring& eventType, const MouseEventInit&); |
57 | 57 |
58 virtual ~MouseEvent(); | 58 virtual ~MouseEvent(); |
59 | 59 |
60 static unsigned short platformModifiersToButtons(unsigned modifiers); | 60 static unsigned short platformModifiersToButtons(unsigned modifiers); |
61 | 61 |
62 void initMouseEvent(ScriptState*, const AtomicString& type, bool canBubble,
bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>, | 62 void initMouseEvent(ScriptState*, const AtomicString& type, bool canBubble,
bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>, |
63 int detail, int screenX, int screenY, int clientX, int clientY, | 63 int detail, int screenX, int screenY, int clientX, int clientY, |
64 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, | 64 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, |
65 unsigned short button, PassRefPtrWillBeRawPtr<EventTarget> relatedTarget
, unsigned short buttons = 0); | 65 short button, PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, unsigne
d short buttons = 0); |
66 | 66 |
67 // WinIE uses 1,4,2 for left/middle/right but not for click (just for moused
own/up, maybe others), | 67 // WinIE uses 1,4,2 for left/middle/right but not for click (just for moused
own/up, maybe others), |
68 // but we will match the standard DOM. | 68 // but we will match the standard DOM. |
69 unsigned short button() const { return m_button; } | 69 short button() const { return m_button == -1 ? 0 : m_button; } |
70 unsigned short buttons() const { return m_buttons; } | 70 unsigned short buttons() const { return m_buttons; } |
71 bool buttonDown() const { return m_buttonDown; } | 71 bool buttonDown() const { return m_button != -1; } |
72 EventTarget* relatedTarget() const { return m_relatedTarget.get(); } | 72 EventTarget* relatedTarget() const { return m_relatedTarget.get(); } |
73 void setRelatedTarget(PassRefPtrWillBeRawPtr<EventTarget> relatedTarget) { m
_relatedTarget = relatedTarget; } | 73 void setRelatedTarget(PassRefPtrWillBeRawPtr<EventTarget> relatedTarget) { m
_relatedTarget = relatedTarget; } |
74 | 74 |
75 Node* toElement() const; | 75 Node* toElement() const; |
76 Node* fromElement() const; | 76 Node* fromElement() const; |
77 | 77 |
78 DataTransfer* dataTransfer() const { return isDragEvent() ? m_dataTransfer.g
et() : 0; } | 78 DataTransfer* dataTransfer() const { return isDragEvent() ? m_dataTransfer.g
et() : 0; } |
79 | 79 |
80 bool fromTouch() const { return m_syntheticEventType == PlatformMouseEvent::
FromTouch; } | 80 bool fromTouch() const { return m_syntheticEventType == PlatformMouseEvent::
FromTouch; } |
81 | 81 |
82 virtual const AtomicString& interfaceName() const override; | 82 virtual const AtomicString& interfaceName() const override; |
83 | 83 |
84 virtual bool isMouseEvent() const override; | 84 virtual bool isMouseEvent() const override; |
85 virtual bool isDragEvent() const override final; | 85 virtual bool isDragEvent() const override final; |
86 virtual int which() const override final; | 86 virtual int which() const override final; |
87 | 87 |
88 DECLARE_VIRTUAL_TRACE(); | 88 DECLARE_VIRTUAL_TRACE(); |
89 | 89 |
90 protected: | 90 protected: |
91 MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRe
fPtrWillBeRawPtr<AbstractView>, | 91 MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRe
fPtrWillBeRawPtr<AbstractView>, |
92 int detail, int screenX, int screenY, int windowX, int windowY, | 92 int detail, int screenX, int screenY, int windowX, int windowY, |
93 int movementX, int movementY, | 93 int movementX, int movementY, |
94 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short b
utton, unsigned short buttons, | 94 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, short button, un
signed short buttons, |
95 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, DataTransfer*, | 95 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, DataTransfer*, |
96 bool isSimulated, PlatformMouseEvent::SyntheticEventType, double uiCreat
eTime = 0); | 96 bool isSimulated, PlatformMouseEvent::SyntheticEventType, double uiCreat
eTime = 0); |
97 | 97 |
98 MouseEvent(const AtomicString& type, const MouseEventInit&); | 98 MouseEvent(const AtomicString& type, const MouseEventInit&); |
99 | 99 |
100 MouseEvent(); | 100 MouseEvent(); |
101 | 101 |
102 private: | 102 private: |
103 unsigned short m_button; | 103 short m_button; |
104 unsigned short m_buttons; | 104 unsigned short m_buttons; |
105 bool m_buttonDown; | |
106 RefPtrWillBeMember<EventTarget> m_relatedTarget; | 105 RefPtrWillBeMember<EventTarget> m_relatedTarget; |
107 PersistentWillBeMember<DataTransfer> m_dataTransfer; | 106 PersistentWillBeMember<DataTransfer> m_dataTransfer; |
108 PlatformMouseEvent::SyntheticEventType m_syntheticEventType; | 107 PlatformMouseEvent::SyntheticEventType m_syntheticEventType; |
109 }; | 108 }; |
110 | 109 |
111 class SimulatedMouseEvent final : public MouseEvent { | 110 class SimulatedMouseEvent final : public MouseEvent { |
112 public: | 111 public: |
113 static PassRefPtrWillBeRawPtr<SimulatedMouseEvent> create(const AtomicString
& eventType, PassRefPtrWillBeRawPtr<AbstractView>, PassRefPtrWillBeRawPtr<Event>
underlyingEvent); | 112 static PassRefPtrWillBeRawPtr<SimulatedMouseEvent> create(const AtomicString
& eventType, PassRefPtrWillBeRawPtr<AbstractView>, PassRefPtrWillBeRawPtr<Event>
underlyingEvent); |
114 virtual ~SimulatedMouseEvent(); | 113 virtual ~SimulatedMouseEvent(); |
115 | 114 |
(...skipping 15 matching lines...) Expand all Loading... |
131 virtual bool dispatchEvent(EventDispatcher&) const override; | 130 virtual bool dispatchEvent(EventDispatcher&) const override; |
132 bool isSyntheticMouseEvent() const { return m_mouseEventType == SyntheticMou
seEvent; } | 131 bool isSyntheticMouseEvent() const { return m_mouseEventType == SyntheticMou
seEvent; } |
133 MouseEventType m_mouseEventType; | 132 MouseEventType m_mouseEventType; |
134 }; | 133 }; |
135 | 134 |
136 DEFINE_EVENT_TYPE_CASTS(MouseEvent); | 135 DEFINE_EVENT_TYPE_CASTS(MouseEvent); |
137 | 136 |
138 } // namespace blink | 137 } // namespace blink |
139 | 138 |
140 #endif // MouseEvent_h | 139 #endif // MouseEvent_h |
OLD | NEW |