| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 return adoptRefWillBeNoop(new MouseEvent); | 42 return adoptRefWillBeNoop(new MouseEvent); |
| 43 } | 43 } |
| 44 | 44 |
| 45 // TODO(mustaq): Should replace most/all of these params with a MouseEventIn
it. | 45 // TODO(mustaq): Should replace most/all of these params with a MouseEventIn
it. |
| 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, PlatformEvent::Modifiers, | 48 int movementX, int movementY, PlatformEvent::Modifiers, |
| 49 short button, unsigned short buttons, | 49 short button, unsigned short buttons, |
| 50 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, | 50 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, |
| 51 double platformTimeStamp, | 51 double platformTimeStamp, |
| 52 PlatformMouseEvent::SyntheticEventType = PlatformMouseEvent::RealOrIndis
tinguishable); | 52 PlatformMouseEvent::SyntheticEventType, |
| 53 const String& region); |
| 53 | 54 |
| 54 static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& eventTy
pe, PassRefPtrWillBeRawPtr<AbstractView>, const PlatformMouseEvent&, int detail,
PassRefPtrWillBeRawPtr<Node> relatedTarget); | 55 static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& eventTy
pe, PassRefPtrWillBeRawPtr<AbstractView>, const PlatformMouseEvent&, int detail,
PassRefPtrWillBeRawPtr<Node> relatedTarget); |
| 55 | 56 |
| 56 static PassRefPtrWillBeRawPtr<MouseEvent> create(ScriptState*, const AtomicS
tring& eventType, const MouseEventInit&); | 57 static PassRefPtrWillBeRawPtr<MouseEvent> create(ScriptState*, const AtomicS
tring& eventType, const MouseEventInit&); |
| 57 | 58 |
| 58 static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& eventTy
pe, PassRefPtrWillBeRawPtr<AbstractView>, PassRefPtrWillBeRawPtr<Event> underlyi
ngEvent, SimulatedClickCreationScope); | 59 static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& eventTy
pe, PassRefPtrWillBeRawPtr<AbstractView>, PassRefPtrWillBeRawPtr<Event> underlyi
ngEvent, SimulatedClickCreationScope); |
| 59 | 60 |
| 60 ~MouseEvent() override; | 61 ~MouseEvent() override; |
| 61 | 62 |
| 62 static unsigned short platformModifiersToButtons(unsigned modifiers); | 63 static unsigned short platformModifiersToButtons(unsigned modifiers); |
| 63 static unsigned short buttonToButtons(short button); | 64 static unsigned short buttonToButtons(short button); |
| 64 | 65 |
| 65 void initMouseEvent(ScriptState*, const AtomicString& type, bool canBubble,
bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>, | 66 void initMouseEvent(ScriptState*, const AtomicString& type, bool canBubble,
bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>, |
| 66 int detail, int screenX, int screenY, int clientX, int clientY, | 67 int detail, int screenX, int screenY, int clientX, int clientY, |
| 67 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, | 68 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, |
| 68 short button, PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, unsigne
d short buttons = 0); | 69 short button, PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, unsigne
d short buttons = 0); |
| 69 | 70 |
| 70 // WinIE uses 1,4,2 for left/middle/right but not for click (just for moused
own/up, maybe others), | 71 // WinIE uses 1,4,2 for left/middle/right but not for click (just for moused
own/up, maybe others), |
| 71 // but we will match the standard DOM. | 72 // but we will match the standard DOM. |
| 72 virtual short button() const { return m_button == -1 ? 0 : m_button; } | 73 virtual short button() const { return m_button == -1 ? 0 : m_button; } |
| 73 unsigned short buttons() const { return m_buttons; } | 74 unsigned short buttons() const { return m_buttons; } |
| 74 bool buttonDown() const { return m_button != -1; } | 75 bool buttonDown() const { return m_button != -1; } |
| 75 EventTarget* relatedTarget() const { return m_relatedTarget.get(); } | 76 EventTarget* relatedTarget() const { return m_relatedTarget.get(); } |
| 76 void setRelatedTarget(PassRefPtrWillBeRawPtr<EventTarget> relatedTarget) { m
_relatedTarget = relatedTarget; } | 77 void setRelatedTarget(PassRefPtrWillBeRawPtr<EventTarget> relatedTarget) { m
_relatedTarget = relatedTarget; } |
| 77 PlatformMouseEvent::SyntheticEventType getSyntheticEventType() const { retur
n m_syntheticEventType; } | 78 PlatformMouseEvent::SyntheticEventType getSyntheticEventType() const { retur
n m_syntheticEventType; } |
| 79 const String& region() const { return m_region; } |
| 80 void setRegion(const String& region) { m_region = region; } |
| 78 | 81 |
| 79 Node* toElement() const; | 82 Node* toElement() const; |
| 80 Node* fromElement() const; | 83 Node* fromElement() const; |
| 81 | 84 |
| 82 virtual DataTransfer* dataTransfer() const { return nullptr; } | 85 virtual DataTransfer* dataTransfer() const { return nullptr; } |
| 83 | 86 |
| 84 bool fromTouch() const { return m_syntheticEventType == PlatformMouseEvent::
FromTouch; } | 87 bool fromTouch() const { return m_syntheticEventType == PlatformMouseEvent::
FromTouch; } |
| 85 | 88 |
| 86 const AtomicString& interfaceName() const override; | 89 const AtomicString& interfaceName() const override; |
| 87 | 90 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 99 | 102 |
| 100 DECLARE_VIRTUAL_TRACE(); | 103 DECLARE_VIRTUAL_TRACE(); |
| 101 | 104 |
| 102 protected: | 105 protected: |
| 103 MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRe
fPtrWillBeRawPtr<AbstractView>, | 106 MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRe
fPtrWillBeRawPtr<AbstractView>, |
| 104 int detail, int screenX, int screenY, int windowX, int windowY, | 107 int detail, int screenX, int screenY, int windowX, int windowY, |
| 105 int movementX, int movementY, | 108 int movementX, int movementY, |
| 106 PlatformEvent::Modifiers, short button, unsigned short buttons, | 109 PlatformEvent::Modifiers, short button, unsigned short buttons, |
| 107 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, | 110 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, |
| 108 double platformTimeStamp, | 111 double platformTimeStamp, |
| 109 PlatformMouseEvent::SyntheticEventType); | 112 PlatformMouseEvent::SyntheticEventType, |
| 113 const String& region); |
| 110 | 114 |
| 111 MouseEvent(const AtomicString& type, const MouseEventInit&); | 115 MouseEvent(const AtomicString& type, const MouseEventInit&); |
| 112 | 116 |
| 113 MouseEvent(); | 117 MouseEvent(); |
| 114 | 118 |
| 115 short rawButton() const { return m_button; } | 119 short rawButton() const { return m_button; } |
| 116 | 120 |
| 117 private: | 121 private: |
| 118 friend class MouseEventDispatchMediator; | 122 friend class MouseEventDispatchMediator; |
| 119 void initMouseEventInternal(const AtomicString& type, bool canBubble, bool c
ancelable, PassRefPtrWillBeRawPtr<AbstractView>, | 123 void initMouseEventInternal(const AtomicString& type, bool canBubble, bool c
ancelable, PassRefPtrWillBeRawPtr<AbstractView>, |
| 120 int detail, int screenX, int screenY, int clientX, int clientY, | 124 int detail, int screenX, int screenY, int clientX, int clientY, |
| 121 PlatformEvent::Modifiers, | 125 PlatformEvent::Modifiers, |
| 122 short button, PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, InputDe
viceCapabilities* sourceCapabilities, unsigned short buttons = 0); | 126 short button, PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, InputDe
viceCapabilities* sourceCapabilities, unsigned short buttons = 0); |
| 123 | 127 |
| 124 short m_button; | 128 short m_button; |
| 125 unsigned short m_buttons; | 129 unsigned short m_buttons; |
| 126 RefPtrWillBeMember<EventTarget> m_relatedTarget; | 130 RefPtrWillBeMember<EventTarget> m_relatedTarget; |
| 127 PlatformMouseEvent::SyntheticEventType m_syntheticEventType; | 131 PlatformMouseEvent::SyntheticEventType m_syntheticEventType; |
| 132 String m_region; |
| 128 }; | 133 }; |
| 129 | 134 |
| 130 class MouseEventDispatchMediator final : public EventDispatchMediator { | 135 class MouseEventDispatchMediator final : public EventDispatchMediator { |
| 131 public: | 136 public: |
| 132 static PassRefPtrWillBeRawPtr<MouseEventDispatchMediator> create(PassRefPtrW
illBeRawPtr<MouseEvent>); | 137 static PassRefPtrWillBeRawPtr<MouseEventDispatchMediator> create(PassRefPtrW
illBeRawPtr<MouseEvent>); |
| 133 | 138 |
| 134 private: | 139 private: |
| 135 explicit MouseEventDispatchMediator(PassRefPtrWillBeRawPtr<MouseEvent>); | 140 explicit MouseEventDispatchMediator(PassRefPtrWillBeRawPtr<MouseEvent>); |
| 136 MouseEvent& event() const; | 141 MouseEvent& event() const; |
| 137 | 142 |
| 138 DispatchEventResult dispatchEvent(EventDispatcher&) const override; | 143 DispatchEventResult dispatchEvent(EventDispatcher&) const override; |
| 139 }; | 144 }; |
| 140 | 145 |
| 141 DEFINE_EVENT_TYPE_CASTS(MouseEvent); | 146 DEFINE_EVENT_TYPE_CASTS(MouseEvent); |
| 142 | 147 |
| 143 } // namespace blink | 148 } // namespace blink |
| 144 | 149 |
| 145 #endif // MouseEvent_h | 150 #endif // MouseEvent_h |
| OLD | NEW |