OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/events/PointerEvent.h" | 6 #include "core/events/PointerEvent.h" |
7 | 7 |
| 8 #include "core/dom/Element.h" |
| 9 #include "core/events/EventDispatcher.h" |
| 10 |
8 namespace blink { | 11 namespace blink { |
9 | 12 |
10 PointerEvent::PointerEvent() | 13 PointerEvent::PointerEvent() |
11 : m_pointerId(0) | 14 : m_pointerId(0) |
12 , m_width(0) | 15 , m_width(0) |
13 , m_height(0) | 16 , m_height(0) |
14 , m_pressure(0) | 17 , m_pressure(0) |
15 , m_tiltX(0) | 18 , m_tiltX(0) |
16 , m_tiltY(0) | 19 , m_tiltY(0) |
17 , m_isPrimary(false) | 20 , m_isPrimary(false) |
(...skipping 21 matching lines...) Expand all Loading... |
39 if (initializer.hasTiltX()) | 42 if (initializer.hasTiltX()) |
40 m_tiltX = initializer.tiltX(); | 43 m_tiltX = initializer.tiltX(); |
41 if (initializer.hasTiltY()) | 44 if (initializer.hasTiltY()) |
42 m_tiltY = initializer.tiltY(); | 45 m_tiltY = initializer.tiltY(); |
43 if (initializer.hasPointerType()) | 46 if (initializer.hasPointerType()) |
44 m_pointerType = initializer.pointerType(); | 47 m_pointerType = initializer.pointerType(); |
45 if (initializer.hasIsPrimary()) | 48 if (initializer.hasIsPrimary()) |
46 m_isPrimary = initializer.isPrimary(); | 49 m_isPrimary = initializer.isPrimary(); |
47 } | 50 } |
48 | 51 |
| 52 bool PointerEvent::isMouseEvent() const |
| 53 { |
| 54 return false; |
| 55 } |
| 56 |
49 bool PointerEvent::isPointerEvent() const | 57 bool PointerEvent::isPointerEvent() const |
50 { | 58 { |
51 return true; | 59 return true; |
52 } | 60 } |
53 | 61 |
54 DEFINE_TRACE(PointerEvent) | 62 DEFINE_TRACE(PointerEvent) |
55 { | 63 { |
56 MouseEvent::trace(visitor); | 64 MouseEvent::trace(visitor); |
57 } | 65 } |
58 | 66 |
| 67 PassRefPtrWillBeRawPtr<PointerEventDispatchMediator> PointerEventDispatchMediato
r::create(PassRefPtrWillBeRawPtr<PointerEvent> pointerEvent) |
| 68 { |
| 69 return adoptRefWillBeNoop(new PointerEventDispatchMediator(pointerEvent)); |
| 70 } |
| 71 |
| 72 PointerEventDispatchMediator::PointerEventDispatchMediator(PassRefPtrWillBeRawPt
r<PointerEvent> pointerEvent) |
| 73 : EventDispatchMediator(pointerEvent) |
| 74 { |
| 75 } |
| 76 |
| 77 PointerEvent& PointerEventDispatchMediator::event() const |
| 78 { |
| 79 return toPointerEvent(EventDispatchMediator::event()); |
| 80 } |
| 81 |
| 82 bool PointerEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) co
nst |
| 83 { |
| 84 if (isDisabledFormControl(&dispatcher.node())) |
| 85 return false; |
| 86 |
| 87 if (event().type().isEmpty()) |
| 88 return true; // Shouldn't happen. |
| 89 |
| 90 ASSERT(!event().target() || event().target() != event().relatedTarget()); |
| 91 |
| 92 EventTarget* relatedTarget = event().relatedTarget(); |
| 93 event().eventPath().adjustForRelatedTarget(dispatcher.node(), relatedTarget)
; |
| 94 |
| 95 dispatcher.dispatch(); |
| 96 return !event().defaultHandled() && !event().defaultPrevented(); |
| 97 } |
| 98 |
59 } // namespace blink | 99 } // namespace blink |
OLD | NEW |