Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: Source/core/events/WheelEvent.cpp

Issue 1018183002: Add rails to input wheel events. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More plumbing and tests Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/events/WheelEvent.h ('k') | Source/core/frame/PinchViewport.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 19 matching lines...) Expand all
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 , m_hasPreciseScrollingDeltas(false)
40 , m_railsMode(RailsModeFree)
40 { 41 {
41 } 42 }
42 43
43 WheelEvent::WheelEvent(const AtomicString& type, const WheelEventInit& initializ er) 44 WheelEvent::WheelEvent(const AtomicString& type, const WheelEventInit& initializ er)
44 : MouseEvent(type, initializer) 45 : MouseEvent(type, initializer)
45 , m_wheelDelta(initializer.wheelDeltaX() ? initializer.wheelDeltaX() : -init ializer.deltaX(), initializer.wheelDeltaY() ? initializer.wheelDeltaY() : -initi alizer.deltaY()) 46 , m_wheelDelta(initializer.wheelDeltaX() ? initializer.wheelDeltaX() : -init ializer.deltaX(), initializer.wheelDeltaY() ? initializer.wheelDeltaY() : -initi alizer.deltaY())
46 , m_deltaX(initializer.deltaX() ? initializer.deltaX() : -initializer.wheelD eltaX()) 47 , m_deltaX(initializer.deltaX() ? initializer.deltaX() : -initializer.wheelD eltaX())
47 , m_deltaY(initializer.deltaY() ? initializer.deltaY() : -initializer.wheelD eltaY()) 48 , m_deltaY(initializer.deltaY() ? initializer.deltaY() : -initializer.wheelD eltaY())
48 , m_deltaZ(initializer.deltaZ()) 49 , m_deltaZ(initializer.deltaZ())
49 , m_deltaMode(initializer.deltaMode()) 50 , m_deltaMode(initializer.deltaMode())
50 , m_canScroll(true) 51 , m_canScroll(true)
51 , m_hasPreciseScrollingDeltas(false) 52 , m_hasPreciseScrollingDeltas(false)
53 , m_railsMode(RailsModeFree)
52 { 54 {
53 } 55 }
54 56
55 WheelEvent::WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, unsigned deltaMode, 57 WheelEvent::WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, unsigned deltaMode,
56 PassRefPtrWillBeRawPtr<AbstractView> view, const IntPoint& screenLocation, c onst IntPoint& windowLocation, 58 PassRefPtrWillBeRawPtr<AbstractView> view, const IntPoint& screenLocation, c onst IntPoint& windowLocation,
57 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short butto ns, bool canScroll, bool hasPreciseScrollingDeltas) 59 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short butto ns, bool canScroll, bool hasPreciseScrollingDeltas, RailsMode railsMode)
58 : MouseEvent(EventTypeNames::wheel, true, true, view, 0, screenLocation.x(), screenLocation.y(), 60 : MouseEvent(EventTypeNames::wheel, true, true, view, 0, screenLocation.x(), screenLocation.y(),
59 windowLocation.x(), windowLocation.y(), 0, 0, ctrlKey, altKey, shiftKey, metaKey, 0, buttons, 61 windowLocation.x(), windowLocation.y(), 0, 0, ctrlKey, altKey, shiftKey, metaKey, 0, buttons,
60 nullptr, nullptr, false, PlatformMouseEvent::RealOrIndistinguishable) 62 nullptr, nullptr, false, PlatformMouseEvent::RealOrIndistinguishable)
61 , m_wheelDelta(wheelTicks.x() * TickMultiplier, wheelTicks.y() * TickMultipl ier) 63 , m_wheelDelta(wheelTicks.x() * TickMultiplier, wheelTicks.y() * TickMultipl ier)
62 , m_deltaX(-rawDelta.x()) 64 , m_deltaX(-rawDelta.x())
63 , m_deltaY(-rawDelta.y()) 65 , m_deltaY(-rawDelta.y())
64 , m_deltaZ(0) 66 , m_deltaZ(0)
65 , m_deltaMode(deltaMode) 67 , m_deltaMode(deltaMode)
66 , m_canScroll(canScroll) 68 , m_canScroll(canScroll)
67 , m_hasPreciseScrollingDeltas(hasPreciseScrollingDeltas) 69 , m_hasPreciseScrollingDeltas(hasPreciseScrollingDeltas)
70 , m_railsMode(railsMode)
68 { 71 {
69 } 72 }
70 73
71 const AtomicString& WheelEvent::interfaceName() const 74 const AtomicString& WheelEvent::interfaceName() const
72 { 75 {
73 return EventNames::WheelEvent; 76 return EventNames::WheelEvent;
74 } 77 }
75 78
76 bool WheelEvent::isMouseEvent() const 79 bool WheelEvent::isMouseEvent() const
77 { 80 {
(...skipping 19 matching lines...) Expand all
97 { 100 {
98 return adoptRefWillBeNoop(new WheelEventDispatchMediator(event, view)); 101 return adoptRefWillBeNoop(new WheelEventDispatchMediator(event, view));
99 } 102 }
100 103
101 WheelEventDispatchMediator::WheelEventDispatchMediator(const PlatformWheelEvent& event, PassRefPtrWillBeRawPtr<AbstractView> view) 104 WheelEventDispatchMediator::WheelEventDispatchMediator(const PlatformWheelEvent& event, PassRefPtrWillBeRawPtr<AbstractView> view)
102 { 105 {
103 setEvent(WheelEvent::create(FloatPoint(event.wheelTicksX(), event.wheelTicks Y()), FloatPoint(event.deltaX(), event.deltaY()), 106 setEvent(WheelEvent::create(FloatPoint(event.wheelTicksX(), event.wheelTicks Y()), FloatPoint(event.deltaX(), event.deltaY()),
104 deltaMode(event), view, event.globalPosition(), event.position(), 107 deltaMode(event), view, event.globalPosition(), event.position(),
105 event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), 108 event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(),
106 MouseEvent::platformModifiersToButtons(event.modifiers()), 109 MouseEvent::platformModifiersToButtons(event.modifiers()),
107 event.canScroll(), event.hasPreciseScrollingDeltas())); 110 event.canScroll(), event.hasPreciseScrollingDeltas(),
111 static_cast<Event::RailsMode>(event.railsMode())));
108 } 112 }
109 113
110 WheelEvent& WheelEventDispatchMediator::event() const 114 WheelEvent& WheelEventDispatchMediator::event() const
111 { 115 {
112 return toWheelEvent(EventDispatchMediator::event()); 116 return toWheelEvent(EventDispatchMediator::event());
113 } 117 }
114 118
115 bool WheelEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) cons t 119 bool WheelEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) cons t
116 { 120 {
117 if (!(event().deltaX() || event().deltaY())) 121 if (!(event().deltaX() || event().deltaY()))
118 return true; 122 return true;
119 return EventDispatchMediator::dispatchEvent(dispatcher) && !event().defaultH andled(); 123 return EventDispatchMediator::dispatchEvent(dispatcher) && !event().defaultH andled();
120 } 124 }
121 125
122 } // namespace blink 126 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/events/WheelEvent.h ('k') | Source/core/frame/PinchViewport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698