Chromium Code Reviews| Index: Source/core/events/DragEvent.cpp |
| diff --git a/Source/core/events/DragEvent.cpp b/Source/core/events/DragEvent.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..262cde5116aab2523ae864ed79237f3174ffccd5 |
| --- /dev/null |
| +++ b/Source/core/events/DragEvent.cpp |
| @@ -0,0 +1,67 @@ |
| +// 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. |
| + |
| +#include "config.h" |
| +#include "core/events/DragEvent.h" |
| + |
| +#include "core/clipboard/DataTransfer.h" |
| +#include "core/dom/Element.h" |
| +#include "core/events/EventDispatcher.h" |
| + |
| +namespace blink { |
| + |
| +DragEvent::DragEvent() |
| + : m_dataTransfer(nullptr) |
| +{ |
| +} |
| + |
| +DragEvent::DragEvent(DataTransfer* dataTransfer) |
| + : m_dataTransfer(dataTransfer) |
| +{ |
| +} |
| + |
| +DragEvent::DragEvent(const AtomicString& type, const DragEventInit& initializer) |
| + : MouseEvent(type, initializer) |
| + , m_dataTransfer(initializer.dataTransfer()) |
| +{ |
| +} |
| + |
| +DEFINE_TRACE(DragEvent) |
| +{ |
| + visitor->trace(m_dataTransfer); |
| + MouseEvent::trace(visitor); |
| +} |
| + |
| +PassRefPtrWillBeRawPtr<DragEventDispatchMediator> DragEventDispatchMediator::create(PassRefPtrWillBeRawPtr<DragEvent> dragEvent) |
| +{ |
| + return adoptRefWillBeNoop(new DragEventDispatchMediator(dragEvent)); |
| +} |
| + |
| +bool DragEvent::isDragEvent() const |
| +{ |
| + return true; |
| +} |
| + |
| +bool DragEvent::isMouseEvent() const |
|
Rick Byers
2015/08/06 14:22:31
Why do you want isMouseEvent to be true for DragEv
Jimmy Jo
2015/08/07 02:42:02
Done.
|
| +{ |
| + return false; |
| +} |
| + |
| +DragEventDispatchMediator::DragEventDispatchMediator(PassRefPtrWillBeRawPtr<DragEvent> dragEvent) |
| + : EventDispatchMediator(dragEvent) |
| +{ |
| +} |
| + |
| +DragEvent& DragEventDispatchMediator::event() const |
| +{ |
| + return toDragEvent(EventDispatchMediator::event()); |
| +} |
| + |
| +bool DragEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) const |
| +{ |
| + event().eventPath().adjustForRelatedTarget(dispatcher.node(), event().relatedTarget()); |
| + return EventDispatchMediator::dispatchEvent(dispatcher); |
| +} |
| + |
| +} // namespace blink |