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, 2005, 2006, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 MouseEvent::MouseEvent() | 30 MouseEvent::MouseEvent() |
31 : m_button(0) | 31 : m_button(0) |
32 , m_buttonDown(false) | 32 , m_buttonDown(false) |
33 { | 33 { |
34 } | 34 } |
35 | 35 |
36 MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cance
lable, PassRefPtr<AbstractView> view, | 36 MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cance
lable, PassRefPtr<AbstractView> view, |
37 int detail, int screenX, int screenY, int pageX, int page
Y, | 37 int detail, int screenX, int screenY, int pageX, int page
Y, |
38 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, | 38 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, |
39 unsigned short button, PassRefPtr<EventTarget> relatedTar
get, | 39 unsigned short button, PassRefPtr<EventTargetNode> relate
dTarget, |
40 PassRefPtr<Clipboard> clipboard, bool isSimulated) | 40 PassRefPtr<Clipboard> clipboard, bool isSimulated) |
41 : MouseRelatedEvent(eventType, canBubble, cancelable, view, detail, screenX,
screenY, | 41 : MouseRelatedEvent(eventType, canBubble, cancelable, view, detail, screenX,
screenY, |
42 pageX, pageY, ctrlKey, altKey, shiftKey, metaKey, isSimu
lated) | 42 pageX, pageY, ctrlKey, altKey, shiftKey, metaKey, isSimu
lated) |
43 , m_button(button == (unsigned short)-1 ? 0 : button) | 43 , m_button(button == (unsigned short)-1 ? 0 : button) |
44 , m_buttonDown(button != (unsigned short)-1) | 44 , m_buttonDown(button != (unsigned short)-1) |
45 , m_relatedTarget(relatedTarget) | 45 , m_relatedTarget(relatedTarget) |
46 , m_clipboard(clipboard) | 46 , m_clipboard(clipboard) |
47 { | 47 { |
48 } | 48 } |
49 | 49 |
50 MouseEvent::~MouseEvent() | 50 MouseEvent::~MouseEvent() |
51 { | 51 { |
52 } | 52 } |
53 | 53 |
54 void MouseEvent::initMouseEvent(const AtomicString& type, bool canBubble, bool c
ancelable, PassRefPtr<AbstractView> view, | 54 void MouseEvent::initMouseEvent(const AtomicString& type, bool canBubble, bool c
ancelable, PassRefPtr<AbstractView> view, |
55 int detail, int screenX, int screenY, int client
X, int clientY, | 55 int detail, int screenX, int screenY, int client
X, int clientY, |
56 bool ctrlKey, bool altKey, bool shiftKey, bool m
etaKey, | 56 bool ctrlKey, bool altKey, bool shiftKey, bool m
etaKey, |
57 unsigned short button, PassRefPtr<EventTarget> r
elatedTarget) | 57 unsigned short button, PassRefPtr<EventTargetNod
e> relatedTarget) |
58 { | 58 { |
59 if (dispatched()) | 59 if (dispatched()) |
60 return; | 60 return; |
61 | 61 |
62 initUIEvent(type, canBubble, cancelable, view, detail); | 62 initUIEvent(type, canBubble, cancelable, view, detail); |
63 | 63 |
64 m_screenX = screenX; | 64 m_screenX = screenX; |
65 m_screenY = screenY; | 65 m_screenY = screenY; |
66 m_ctrlKey = ctrlKey; | 66 m_ctrlKey = ctrlKey; |
67 m_altKey = altKey; | 67 m_altKey = altKey; |
(...skipping 26 matching lines...) Expand all Loading... |
94 // For the DOM, the return values for left, middle and right mouse buttons a
re 0, 1, 2, respectively. | 94 // For the DOM, the return values for left, middle and right mouse buttons a
re 0, 1, 2, respectively. |
95 // For the Netscape "which" property, the return values for left, middle and
right mouse buttons are 1, 2, 3, respectively. | 95 // For the Netscape "which" property, the return values for left, middle and
right mouse buttons are 1, 2, 3, respectively. |
96 // So we must add 1. | 96 // So we must add 1. |
97 return m_button + 1; | 97 return m_button + 1; |
98 } | 98 } |
99 | 99 |
100 Node* MouseEvent::toElement() const | 100 Node* MouseEvent::toElement() const |
101 { | 101 { |
102 // MSIE extension - "the object toward which the user is moving the mouse po
inter" | 102 // MSIE extension - "the object toward which the user is moving the mouse po
inter" |
103 if (type() == eventNames().mouseoutEvent) | 103 if (type() == eventNames().mouseoutEvent) |
104 return relatedTarget() ? relatedTarget()->toNode() : 0; | 104 return relatedTarget(); |
105 | 105 |
106 return target() ? target()->toNode() : 0; | 106 return target() ? target()->toNode() : 0; |
107 } | 107 } |
108 | 108 |
109 Node* MouseEvent::fromElement() const | 109 Node* MouseEvent::fromElement() const |
110 { | 110 { |
111 // MSIE extension - "object from which activation or the mouse pointer is ex
iting during the event" (huh?) | 111 // MSIE extension - "object from which activation or the mouse pointer is ex
iting during the event" (huh?) |
112 if (type() != eventNames().mouseoutEvent) | 112 if (type() != eventNames().mouseoutEvent) |
113 return relatedTarget() ? relatedTarget()->toNode() : 0; | 113 return relatedTarget(); |
114 | 114 |
115 return target() ? target()->toNode() : 0; | 115 return target() ? target()->toNode() : 0; |
116 } | 116 } |
117 | 117 |
118 } // namespace WebCore | 118 } // namespace WebCore |
OLD | NEW |