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

Side by Side Diff: Source/core/events/DragEvent.cpp

Issue 1232003009: Implement DragEvent and move MouseEvent.dataTransfer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix plugin failure of LayoutTest Created 5 years, 4 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/DragEvent.h ('k') | Source/core/events/DragEvent.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/events/DragEvent.h"
7
8 #include "core/clipboard/DataTransfer.h"
9 #include "core/dom/Element.h"
10 #include "core/events/EventDispatcher.h"
11
12 namespace blink {
13
14 PassRefPtrWillBeRawPtr<DragEvent> DragEvent::create(const AtomicString& type, bo ol canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view,
15 int detail, int screenX, int screenY, int windowX, int windowY,
16 int movementX, int movementY,
17 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
18 short button, unsigned short buttons,
19 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, DataTransfer* dataTransfe r, bool isSimulated, PlatformMouseEvent::SyntheticEventType syntheticEventType,
20 double uiCreateTime)
21 {
22 return adoptRefWillBeNoop(new DragEvent(type, canBubble, cancelable, view,
23 detail, screenX, screenY, windowX, windowY,
24 movementX, movementY,
25 ctrlKey, altKey, shiftKey, metaKey, button, buttons, relatedTarget, data Transfer, isSimulated, syntheticEventType, uiCreateTime));
26 }
27
28
29 DragEvent::DragEvent()
30 : m_dataTransfer(nullptr)
31 {
32 }
33
34 DragEvent::DragEvent(DataTransfer* dataTransfer)
35 : m_dataTransfer(dataTransfer)
36 {
37 }
38
39 DragEvent::DragEvent(const AtomicString& eventType, bool canBubble, bool cancela ble, PassRefPtrWillBeRawPtr<AbstractView> view,
40 int detail, int screenX, int screenY, int windowX, int windowY,
41 int movementX, int movementY,
42 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
43 short button, unsigned short buttons, PassRefPtrWillBeRawPtr<EventTarget> re latedTarget,
44 DataTransfer* dataTransfer, bool isSimulated, PlatformMouseEvent::SyntheticE ventType syntheticEventType,
45 double uiCreateTime)
46 : MouseEvent(eventType, canBubble, cancelable, view, detail, screenX, screen Y,
47 windowX, windowY, movementX, movementY, ctrlKey, altKey, shiftKey, metaK ey, button, buttons, relatedTarget,
48 isSimulated, syntheticEventType, uiCreateTime)
49 , m_dataTransfer(dataTransfer)
50
51 {
52 }
53
54 DragEvent::DragEvent(const AtomicString& type, const DragEventInit& initializer)
55 : MouseEvent(type, initializer)
56 , m_dataTransfer(initializer.dataTransfer())
57 {
58 }
59
60 bool DragEvent::isDragEvent() const
61 {
62 return true;
63 }
64
65 bool DragEvent::isMouseEvent() const
66 {
67 return false;
68 }
69
70 PassRefPtrWillBeRawPtr<EventDispatchMediator> DragEvent::createMediator()
71 {
72 return DragEventDispatchMediator::create(this);
73 }
74
75 DEFINE_TRACE(DragEvent)
76 {
77 visitor->trace(m_dataTransfer);
78 MouseEvent::trace(visitor);
79 }
80
81 PassRefPtrWillBeRawPtr<DragEventDispatchMediator> DragEventDispatchMediator::cre ate(PassRefPtrWillBeRawPtr<DragEvent> dragEvent)
82 {
83 return adoptRefWillBeNoop(new DragEventDispatchMediator(dragEvent));
84 }
85
86 DragEventDispatchMediator::DragEventDispatchMediator(PassRefPtrWillBeRawPtr<Drag Event> dragEvent)
87 : EventDispatchMediator(dragEvent)
88 {
89 }
90
91 DragEvent& DragEventDispatchMediator::event() const
92 {
93 return toDragEvent(EventDispatchMediator::event());
94 }
95
96 bool DragEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) const
97 {
98 event().eventPath().adjustForRelatedTarget(dispatcher.node(), event().relate dTarget());
99 return EventDispatchMediator::dispatchEvent(dispatcher);
100 }
101
102 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/events/DragEvent.h ('k') | Source/core/events/DragEvent.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698