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

Unified Diff: Source/core/events/DragEvent.h

Issue 1232003009: Implement DragEvent and move MouseEvent.dataTransfer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase and add layoutTest 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/events/DragEvent.h
diff --git a/Source/core/events/DragEvent.h b/Source/core/events/DragEvent.h
new file mode 100644
index 0000000000000000000000000000000000000000..a2573c2ea2e89cff4909f8d5024e0efc450d08c7
--- /dev/null
+++ b/Source/core/events/DragEvent.h
@@ -0,0 +1,63 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DragEvent_h
+#define DragEvent_h
+
+#include "core/events/DragEventInit.h"
+#include "core/events/MouseEvent.h"
+
+namespace blink {
+
+class DataTransfer;
+
+class DragEvent final : public MouseEvent {
+ DEFINE_WRAPPERTYPEINFO();
+
+public:
+ static PassRefPtrWillBeRawPtr<DragEvent> create()
+ {
+ return adoptRefWillBeNoop(new DragEvent);
+ }
+
+ static PassRefPtrWillBeRawPtr<DragEvent> create(DataTransfer* dataTransfer)
+ {
+ return adoptRefWillBeNoop(new DragEvent(dataTransfer));
+ }
+
+ static PassRefPtrWillBeRawPtr<DragEvent> create(const AtomicString& type, const DragEventInit& initializer)
+ {
+ return adoptRefWillBeNoop(new DragEvent(type, initializer));
+ }
+
+ DataTransfer* dataTransfer() const override { return isDragEvent() ? m_dataTransfer.get() : 0; }
+
+ bool isDragEvent() const override;
+ bool isMouseEvent() const override;
+
+ DECLARE_VIRTUAL_TRACE();
+
+private:
+ DragEvent();
+ DragEvent(DataTransfer*);
+ DragEvent(const AtomicString& type, const DragEventInit&);
+
+ PersistentWillBeMember<DataTransfer> m_dataTransfer;
+};
+
+class DragEventDispatchMediator final : public EventDispatchMediator {
+public:
+ static PassRefPtrWillBeRawPtr<DragEventDispatchMediator> create(PassRefPtrWillBeRawPtr<DragEvent>);
+
+private:
+ explicit DragEventDispatchMediator(PassRefPtrWillBeRawPtr<DragEvent>);
+ DragEvent& event() const;
+ bool dispatchEvent(EventDispatcher&) const override;
+};
+
+DEFINE_EVENT_TYPE_CASTS(DragEvent);
+
+} // namespace blink
+
+#endif // DragEvent_h

Powered by Google App Engine
This is Rietveld 408576698