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

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

Issue 22859012: Add support for DOM Level 3 WheelEvent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Simplify test case Created 7 years, 4 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 | Annotate | Revision Log
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 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 12 matching lines...) Expand all
23 #include "config.h" 23 #include "config.h"
24 #include "core/dom/WheelEvent.h" 24 #include "core/dom/WheelEvent.h"
25 25
26 #include "core/dom/Clipboard.h" 26 #include "core/dom/Clipboard.h"
27 #include "core/dom/EventNames.h" 27 #include "core/dom/EventNames.h"
28 #include "core/platform/PlatformWheelEvent.h" 28 #include "core/platform/PlatformWheelEvent.h"
29 29
30 namespace WebCore { 30 namespace WebCore {
31 31
32 WheelEventInit::WheelEventInit() 32 WheelEventInit::WheelEventInit()
33 : wheelDeltaX(0) 33 : deltaX(0)
34 , wheelDeltaY(0) 34 , deltaY(0)
35 , deltaMode(WheelEvent::DOM_DELTA_PIXEL) 35 , deltaMode(WheelEvent::DOM_DELTA_PIXEL)
36 { 36 {
37 } 37 }
38 38
39 WheelEvent::WheelEvent() 39 WheelEvent::WheelEvent()
40 : m_deltaMode(DOM_DELTA_PIXEL) 40 : m_deltaMode(DOM_DELTA_PIXEL)
41 , m_directionInvertedFromDevice(false) 41 , m_directionInvertedFromDevice(false)
42 { 42 {
43 ScriptWrappable::init(this); 43 ScriptWrappable::init(this);
44 } 44 }
45 45
46 WheelEvent::WheelEvent(const AtomicString& type, const WheelEventInit& initializ er) 46 WheelEvent::WheelEvent(const AtomicString& type, const WheelEventInit& initializ er)
47 : MouseEvent(type, initializer) 47 : MouseEvent(type, initializer)
48 , m_wheelDelta(IntPoint(initializer.wheelDeltaX, initializer.wheelDeltaY)) 48 , m_wheelDelta(IntPoint(initializer.deltaX, initializer.deltaY))
49 , m_deltaMode(initializer.deltaMode) 49 , m_deltaMode(initializer.deltaMode)
50 { 50 {
51 ScriptWrappable::init(this); 51 ScriptWrappable::init(this);
52 } 52 }
53 53
54 WheelEvent::WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, unsigned deltaMode, 54 WheelEvent::WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, unsigned deltaMode,
55 PassRefPtr<AbstractView> view, const IntPoint& screenLocation, const IntPoin t& pageLocation, 55 PassRefPtr<AbstractView> view, const IntPoint& screenLocation, const IntPoin t& pageLocation,
56 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvert edFromDevice) 56 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvert edFromDevice)
57 : MouseEvent(eventNames().mousewheelEvent, 57 : MouseEvent(eventNames().wheelEvent,
58 true, true, view, 0, screenLocation.x(), screenLocation.y(), 58 true, true, view, 0, screenLocation.x(), screenLocation.y(),
59 pageLocation.x(), pageLocation.y(), 59 pageLocation.x(), pageLocation.y(),
60 0, 0, 60 0, 0,
61 ctrlKey, altKey, shiftKey, metaKey, 0, 0, 0, false) 61 ctrlKey, altKey, shiftKey, metaKey, 0, 0, 0, false)
62 , m_wheelDelta(IntPoint(static_cast<int>(wheelTicks.x() * TickMultiplier), s tatic_cast<int>(wheelTicks.y() * TickMultiplier))) 62 , m_wheelDelta(IntPoint(static_cast<int>(wheelTicks.x() * TickMultiplier), s tatic_cast<int>(wheelTicks.y() * TickMultiplier)))
63 , m_rawDelta(roundedIntPoint(rawDelta)) 63 , m_rawDelta(roundedIntPoint(rawDelta))
64 , m_deltaMode(deltaMode) 64 , m_deltaMode(deltaMode)
65 , m_directionInvertedFromDevice(directionInvertedFromDevice) 65 , m_directionInvertedFromDevice(directionInvertedFromDevice)
66 { 66 {
67 ScriptWrappable::init(this); 67 ScriptWrappable::init(this);
68 } 68 }
69 69
70 void WheelEvent::initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<Abstrac tView> view, 70 void WheelEvent::initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<Abstrac tView> view,
71 int screenX, int screenY, int pageX, int pageY, 71 int screenX, int screenY, int pageX, int pageY,
72 bool ctrlKey, bool altKey, bool shiftKey, bool m etaKey) 72 bool ctrlKey, bool altKey, bool shiftKey, bool m etaKey)
73 { 73 {
74 if (dispatched()) 74 if (dispatched())
75 return; 75 return;
76 76
77 initUIEvent(eventNames().mousewheelEvent, true, true, view, 0); 77 initUIEvent(eventNames().wheelEvent, true, true, view, 0);
78 78
79 m_screenLocation = IntPoint(screenX, screenY); 79 m_screenLocation = IntPoint(screenX, screenY);
80 m_ctrlKey = ctrlKey; 80 m_ctrlKey = ctrlKey;
81 m_altKey = altKey; 81 m_altKey = altKey;
82 m_shiftKey = shiftKey; 82 m_shiftKey = shiftKey;
83 m_metaKey = metaKey; 83 m_metaKey = metaKey;
84 84
85 // Normalize to the Windows 120 multiple 85 // Normalize to the Windows 120 multiple
86 m_wheelDelta = IntPoint(rawDeltaX * TickMultiplier, rawDeltaY * TickMultipli er); 86 m_wheelDelta = IntPoint(rawDeltaX * TickMultiplier, rawDeltaY * TickMultipli er);
87 87
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 return static_cast<WheelEvent*>(EventDispatchMediator::event()); 135 return static_cast<WheelEvent*>(EventDispatchMediator::event());
136 } 136 }
137 137
138 bool WheelEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) cons t 138 bool WheelEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) cons t
139 { 139 {
140 ASSERT(event()); 140 ASSERT(event());
141 return EventDispatchMediator::dispatchEvent(dispatcher) && !event()->default Handled(); 141 return EventDispatchMediator::dispatchEvent(dispatcher) && !event()->default Handled();
142 } 142 }
143 143
144 } // namespace WebCore 144 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698