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

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

Issue 1227363006: Virtualize EventDispatchMediator creation and cleanup calling. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master_event_trusted_main
Patch Set: Rebase Created 5 years, 5 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/input/EventHandler.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 12 matching lines...) Expand all
23 23
24 #include "config.h" 24 #include "config.h"
25 #include "core/events/WheelEvent.h" 25 #include "core/events/WheelEvent.h"
26 26
27 #include "core/clipboard/DataTransfer.h" 27 #include "core/clipboard/DataTransfer.h"
28 #include "platform/PlatformMouseEvent.h" 28 #include "platform/PlatformMouseEvent.h"
29 #include "platform/PlatformWheelEvent.h" 29 #include "platform/PlatformWheelEvent.h"
30 30
31 namespace blink { 31 namespace blink {
32 32
33 inline static unsigned convertDeltaMode(const PlatformWheelEvent& event)
34 {
35 return event.granularity() == ScrollByPageWheelEvent ? WheelEvent::DOM_DELTA _PAGE : WheelEvent::DOM_DELTA_PIXEL;
36 }
37
38 PassRefPtrWillBeRawPtr<WheelEvent> WheelEvent::create(const PlatformWheelEvent& event, PassRefPtrWillBeRawPtr<AbstractView> view)
39 {
40 return adoptRefWillBeNoop(new WheelEvent(FloatPoint(event.wheelTicksX(), eve nt.wheelTicksY()), FloatPoint(event.deltaX(), event.deltaY()),
41 convertDeltaMode(event), view, event.globalPosition(), event.position(),
42 event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(),
43 MouseEvent::platformModifiersToButtons(event.modifiers()),
44 event.canScroll(), event.hasPreciseScrollingDeltas(),
45 static_cast<Event::RailsMode>(event.railsMode())));
46 }
47
33 WheelEvent::WheelEvent() 48 WheelEvent::WheelEvent()
34 : m_deltaX(0) 49 : m_deltaX(0)
35 , m_deltaY(0) 50 , m_deltaY(0)
36 , m_deltaZ(0) 51 , m_deltaZ(0)
37 , m_deltaMode(DOM_DELTA_PIXEL) 52 , m_deltaMode(DOM_DELTA_PIXEL)
38 , m_canScroll(true) 53 , m_canScroll(true)
39 , m_hasPreciseScrollingDeltas(false) 54 , m_hasPreciseScrollingDeltas(false)
40 , m_railsMode(RailsModeFree) 55 , m_railsMode(RailsModeFree)
41 { 56 {
42 } 57 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 bool WheelEvent::isMouseEvent() const 94 bool WheelEvent::isMouseEvent() const
80 { 95 {
81 return false; 96 return false;
82 } 97 }
83 98
84 bool WheelEvent::isWheelEvent() const 99 bool WheelEvent::isWheelEvent() const
85 { 100 {
86 return true; 101 return true;
87 } 102 }
88 103
104 PassRefPtrWillBeRawPtr<EventDispatchMediator> WheelEvent::createMediator()
105 {
106 return WheelEventDispatchMediator::create(this);
107 }
108
89 DEFINE_TRACE(WheelEvent) 109 DEFINE_TRACE(WheelEvent)
90 { 110 {
91 MouseEvent::trace(visitor); 111 MouseEvent::trace(visitor);
92 } 112 }
93 113
94 inline static unsigned deltaMode(const PlatformWheelEvent& event) 114 PassRefPtrWillBeRawPtr<WheelEventDispatchMediator> WheelEventDispatchMediator::c reate(PassRefPtrWillBeRawPtr<WheelEvent> event)
95 { 115 {
96 return event.granularity() == ScrollByPageWheelEvent ? WheelEvent::DOM_DELTA _PAGE : WheelEvent::DOM_DELTA_PIXEL; 116 return adoptRefWillBeNoop(new WheelEventDispatchMediator(event));
97 } 117 }
98 118
99 PassRefPtrWillBeRawPtr<WheelEventDispatchMediator> WheelEventDispatchMediator::c reate(const PlatformWheelEvent& event, PassRefPtrWillBeRawPtr<AbstractView> view ) 119 WheelEventDispatchMediator::WheelEventDispatchMediator(PassRefPtrWillBeRawPtr<Wh eelEvent> event)
120 : EventDispatchMediator(event)
100 { 121 {
101 return adoptRefWillBeNoop(new WheelEventDispatchMediator(event, view));
102 }
103
104 WheelEventDispatchMediator::WheelEventDispatchMediator(const PlatformWheelEvent& event, PassRefPtrWillBeRawPtr<AbstractView> view)
105 {
106 setEvent(WheelEvent::create(FloatPoint(event.wheelTicksX(), event.wheelTicks Y()), FloatPoint(event.deltaX(), event.deltaY()),
107 deltaMode(event), view, event.globalPosition(), event.position(),
108 event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(),
109 MouseEvent::platformModifiersToButtons(event.modifiers()),
110 event.canScroll(), event.hasPreciseScrollingDeltas(),
111 static_cast<Event::RailsMode>(event.railsMode())));
112 } 122 }
113 123
114 WheelEvent& WheelEventDispatchMediator::event() const 124 WheelEvent& WheelEventDispatchMediator::event() const
115 { 125 {
116 return toWheelEvent(EventDispatchMediator::event()); 126 return toWheelEvent(EventDispatchMediator::event());
117 } 127 }
118 128
119 bool WheelEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) cons t 129 bool WheelEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) cons t
120 { 130 {
121 if (!(event().deltaX() || event().deltaY())) 131 if (!(event().deltaX() || event().deltaY()))
122 return true; 132 return true;
123 return EventDispatchMediator::dispatchEvent(dispatcher) && !event().defaultH andled(); 133 return EventDispatchMediator::dispatchEvent(dispatcher) && !event().defaultH andled();
124 } 134 }
125 135
126 } // namespace blink 136 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/events/WheelEvent.h ('k') | Source/core/input/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698