| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) |
| 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) | 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) |
| 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 5 * Copyright (C) 2003, 2005, 2006, 2008, 2010 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2005, 2006, 2008, 2010 Apple Inc. All rights reserved. |
| 6 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 6 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "platform/PlatformWheelEvent.h" | 29 #include "platform/PlatformWheelEvent.h" |
| 30 | 30 |
| 31 namespace blink { | 31 namespace blink { |
| 32 | 32 |
| 33 WheelEvent::WheelEvent() | 33 WheelEvent::WheelEvent() |
| 34 : m_deltaX(0) | 34 : m_deltaX(0) |
| 35 , m_deltaY(0) | 35 , m_deltaY(0) |
| 36 , m_deltaZ(0) | 36 , m_deltaZ(0) |
| 37 , m_deltaMode(DOM_DELTA_PIXEL) | 37 , m_deltaMode(DOM_DELTA_PIXEL) |
| 38 , m_canScroll(true) | 38 , m_canScroll(true) |
| 39 , m_hasPreciseScrollingDeltas(false) |
| 39 { | 40 { |
| 40 } | 41 } |
| 41 | 42 |
| 42 WheelEvent::WheelEvent(const AtomicString& type, const WheelEventInit& initializ
er) | 43 WheelEvent::WheelEvent(const AtomicString& type, const WheelEventInit& initializ
er) |
| 43 : MouseEvent(type, initializer) | 44 : MouseEvent(type, initializer) |
| 44 , m_wheelDelta(initializer.wheelDeltaX() ? initializer.wheelDeltaX() : -init
ializer.deltaX(), initializer.wheelDeltaY() ? initializer.wheelDeltaY() : -initi
alizer.deltaY()) | 45 , m_wheelDelta(initializer.wheelDeltaX() ? initializer.wheelDeltaX() : -init
ializer.deltaX(), initializer.wheelDeltaY() ? initializer.wheelDeltaY() : -initi
alizer.deltaY()) |
| 45 , m_deltaX(initializer.deltaX() ? initializer.deltaX() : -initializer.wheelD
eltaX()) | 46 , m_deltaX(initializer.deltaX() ? initializer.deltaX() : -initializer.wheelD
eltaX()) |
| 46 , m_deltaY(initializer.deltaY() ? initializer.deltaY() : -initializer.wheelD
eltaY()) | 47 , m_deltaY(initializer.deltaY() ? initializer.deltaY() : -initializer.wheelD
eltaY()) |
| 47 , m_deltaZ(initializer.deltaZ()) | 48 , m_deltaZ(initializer.deltaZ()) |
| 48 , m_deltaMode(initializer.deltaMode()) | 49 , m_deltaMode(initializer.deltaMode()) |
| 49 , m_canScroll(true) | 50 , m_canScroll(true) |
| 51 , m_hasPreciseScrollingDeltas(false) |
| 50 { | 52 { |
| 51 } | 53 } |
| 52 | 54 |
| 53 WheelEvent::WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta,
unsigned deltaMode, | 55 WheelEvent::WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta,
unsigned deltaMode, |
| 54 PassRefPtrWillBeRawPtr<AbstractView> view, const IntPoint& screenLocation, c
onst IntPoint& windowLocation, | 56 PassRefPtrWillBeRawPtr<AbstractView> view, const IntPoint& screenLocation, c
onst IntPoint& windowLocation, |
| 55 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short butto
ns, bool canScroll) | 57 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short butto
ns, bool canScroll, bool hasPreciseScrollingDeltas) |
| 56 : MouseEvent(EventTypeNames::wheel, true, true, view, 0, screenLocation.x(),
screenLocation.y(), | 58 : MouseEvent(EventTypeNames::wheel, true, true, view, 0, screenLocation.x(),
screenLocation.y(), |
| 57 windowLocation.x(), windowLocation.y(), 0, 0, ctrlKey, altKey, shiftKey,
metaKey, 0, buttons, | 59 windowLocation.x(), windowLocation.y(), 0, 0, ctrlKey, altKey, shiftKey,
metaKey, 0, buttons, |
| 58 nullptr, nullptr, false, PlatformMouseEvent::RealOrIndistinguishable) | 60 nullptr, nullptr, false, PlatformMouseEvent::RealOrIndistinguishable) |
| 59 , m_wheelDelta(wheelTicks.x() * TickMultiplier, wheelTicks.y() * TickMultipl
ier) | 61 , m_wheelDelta(wheelTicks.x() * TickMultiplier, wheelTicks.y() * TickMultipl
ier) |
| 60 , m_deltaX(-rawDelta.x()) | 62 , m_deltaX(-rawDelta.x()) |
| 61 , m_deltaY(-rawDelta.y()) | 63 , m_deltaY(-rawDelta.y()) |
| 62 , m_deltaZ(0) | 64 , m_deltaZ(0) |
| 63 , m_deltaMode(deltaMode) | 65 , m_deltaMode(deltaMode) |
| 64 , m_canScroll(canScroll) | 66 , m_canScroll(canScroll) |
| 67 , m_hasPreciseScrollingDeltas(hasPreciseScrollingDeltas) |
| 65 { | 68 { |
| 66 } | 69 } |
| 67 | 70 |
| 68 const AtomicString& WheelEvent::interfaceName() const | 71 const AtomicString& WheelEvent::interfaceName() const |
| 69 { | 72 { |
| 70 return EventNames::WheelEvent; | 73 return EventNames::WheelEvent; |
| 71 } | 74 } |
| 72 | 75 |
| 73 bool WheelEvent::isMouseEvent() const | 76 bool WheelEvent::isMouseEvent() const |
| 74 { | 77 { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 94 { | 97 { |
| 95 return adoptRefWillBeNoop(new WheelEventDispatchMediator(event, view)); | 98 return adoptRefWillBeNoop(new WheelEventDispatchMediator(event, view)); |
| 96 } | 99 } |
| 97 | 100 |
| 98 WheelEventDispatchMediator::WheelEventDispatchMediator(const PlatformWheelEvent&
event, PassRefPtrWillBeRawPtr<AbstractView> view) | 101 WheelEventDispatchMediator::WheelEventDispatchMediator(const PlatformWheelEvent&
event, PassRefPtrWillBeRawPtr<AbstractView> view) |
| 99 { | 102 { |
| 100 setEvent(WheelEvent::create(FloatPoint(event.wheelTicksX(), event.wheelTicks
Y()), FloatPoint(event.deltaX(), event.deltaY()), | 103 setEvent(WheelEvent::create(FloatPoint(event.wheelTicksX(), event.wheelTicks
Y()), FloatPoint(event.deltaX(), event.deltaY()), |
| 101 deltaMode(event), view, event.globalPosition(), event.position(), | 104 deltaMode(event), view, event.globalPosition(), event.position(), |
| 102 event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), | 105 event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), |
| 103 MouseEvent::platformModifiersToButtons(event.modifiers()), | 106 MouseEvent::platformModifiersToButtons(event.modifiers()), |
| 104 event.canScroll())); | 107 event.canScroll(), event.hasPreciseScrollingDeltas())); |
| 105 } | 108 } |
| 106 | 109 |
| 107 WheelEvent& WheelEventDispatchMediator::event() const | 110 WheelEvent& WheelEventDispatchMediator::event() const |
| 108 { | 111 { |
| 109 return toWheelEvent(EventDispatchMediator::event()); | 112 return toWheelEvent(EventDispatchMediator::event()); |
| 110 } | 113 } |
| 111 | 114 |
| 112 bool WheelEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) cons
t | 115 bool WheelEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) cons
t |
| 113 { | 116 { |
| 114 if (!(event().deltaX() || event().deltaY())) | 117 if (!(event().deltaX() || event().deltaY())) |
| 115 return true; | 118 return true; |
| 116 return EventDispatchMediator::dispatchEvent(dispatcher) && !event().defaultH
andled(); | 119 return EventDispatchMediator::dispatchEvent(dispatcher) && !event().defaultH
andled(); |
| 117 } | 120 } |
| 118 | 121 |
| 119 } // namespace blink | 122 } // namespace blink |
| OLD | NEW |