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