Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / events / PointerEvent.cpp
blob12021030fb65340ac38563a44369f26a4aa5b25b
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.
5 #include "config.h"
6 #include "core/events/PointerEvent.h"
8 #include "core/dom/Element.h"
9 #include "core/events/EventDispatcher.h"
11 namespace blink {
13 PointerEvent::PointerEvent()
14 : m_pointerId(0)
15 , m_width(0)
16 , m_height(0)
17 , m_pressure(0)
18 , m_tiltX(0)
19 , m_tiltY(0)
20 , m_isPrimary(false)
24 PointerEvent::PointerEvent(const AtomicString& type, const PointerEventInit& initializer)
25 : MouseEvent(type, initializer)
26 , m_pointerId(0)
27 , m_width(0)
28 , m_height(0)
29 , m_pressure(0)
30 , m_tiltX(0)
31 , m_tiltY(0)
32 , m_isPrimary(false)
34 if (initializer.hasPointerId())
35 m_pointerId = initializer.pointerId();
36 if (initializer.hasWidth())
37 m_width = initializer.width();
38 if (initializer.hasHeight())
39 m_height = initializer.height();
40 if (initializer.hasPressure())
41 m_pressure = initializer.pressure();
42 if (initializer.hasTiltX())
43 m_tiltX = initializer.tiltX();
44 if (initializer.hasTiltY())
45 m_tiltY = initializer.tiltY();
46 if (initializer.hasPointerType())
47 m_pointerType = initializer.pointerType();
48 if (initializer.hasIsPrimary())
49 m_isPrimary = initializer.isPrimary();
52 bool PointerEvent::isMouseEvent() const
54 return false;
57 bool PointerEvent::isPointerEvent() const
59 return true;
62 PassRefPtrWillBeRawPtr<EventDispatchMediator> PointerEvent::createMediator()
64 return PointerEventDispatchMediator::create(this);
67 DEFINE_TRACE(PointerEvent)
69 MouseEvent::trace(visitor);
72 PassRefPtrWillBeRawPtr<PointerEventDispatchMediator> PointerEventDispatchMediator::create(PassRefPtrWillBeRawPtr<PointerEvent> pointerEvent)
74 return adoptRefWillBeNoop(new PointerEventDispatchMediator(pointerEvent));
77 PointerEventDispatchMediator::PointerEventDispatchMediator(PassRefPtrWillBeRawPtr<PointerEvent> pointerEvent)
78 : EventDispatchMediator(pointerEvent)
82 PointerEvent& PointerEventDispatchMediator::event() const
84 return toPointerEvent(EventDispatchMediator::event());
87 bool PointerEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) const
89 if (isDisabledFormControl(&dispatcher.node()))
90 return false;
92 if (event().type().isEmpty())
93 return true; // Shouldn't happen.
95 ASSERT(!event().target() || event().target() != event().relatedTarget());
97 EventTarget* relatedTarget = event().relatedTarget();
98 event().eventPath().adjustForRelatedTarget(dispatcher.node(), relatedTarget);
100 dispatcher.dispatch();
101 return !event().defaultHandled() && !event().defaultPrevented();
104 } // namespace blink