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

Side by Side Diff: Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp

Issue 11369231: [Sanity Review] cc: Mark an event has not-handled if it didn't cause a scroll (Closed) Base URL: git://git.webkit.org/WebKit.git@master
Patch Set: Created 8 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 112 }
113 113
114 WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h andleInputEventInternal(const WebInputEvent& event) 114 WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h andleInputEventInternal(const WebInputEvent& event)
115 { 115 {
116 if (event.type == WebInputEvent::MouseWheel) { 116 if (event.type == WebInputEvent::MouseWheel) {
117 const WebMouseWheelEvent& wheelEvent = *static_cast<const WebMouseWheelE vent*>(&event); 117 const WebMouseWheelEvent& wheelEvent = *static_cast<const WebMouseWheelE vent*>(&event);
118 WebInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient- >scrollBegin(WebPoint(wheelEvent.x, wheelEvent.y), WebInputHandlerClient::Scroll InputTypeWheel); 118 WebInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient- >scrollBegin(WebPoint(wheelEvent.x, wheelEvent.y), WebInputHandlerClient::Scroll InputTypeWheel);
119 switch (scrollStatus) { 119 switch (scrollStatus) {
120 case WebInputHandlerClient::ScrollStatusStarted: { 120 case WebInputHandlerClient::ScrollStatusStarted: {
121 TRACE_EVENT_INSTANT2("cc", "WebCompositorInputHandlerImpl::handleInp ut wheel scroll", "deltaX", -wheelEvent.deltaX, "deltaY", -wheelEvent.deltaY); 121 TRACE_EVENT_INSTANT2("cc", "WebCompositorInputHandlerImpl::handleInp ut wheel scroll", "deltaX", -wheelEvent.deltaX, "deltaY", -wheelEvent.deltaY);
122 m_inputHandlerClient->scrollBy(WebPoint(wheelEvent.x, wheelEvent.y), IntSize(-wheelEvent.deltaX, -wheelEvent.deltaY)); 122 bool didScroll = m_inputHandlerClient->scrollBy(WebPoint(wheelEvent. x, wheelEvent.y), IntSize(-wheelEvent.deltaX, -wheelEvent.deltaY));
123 m_inputHandlerClient->scrollEnd(); 123 m_inputHandlerClient->scrollEnd();
124 return DidHandle; 124 return didScroll ? DidHandle : DropEvent;
125 } 125 }
126 case WebInputHandlerClient::ScrollStatusIgnored: 126 case WebInputHandlerClient::ScrollStatusIgnored:
127 // FIXME: This should be DropEvent, but in cases where we fail to pr operly sync scrollability it's safer to send the 127 // FIXME: This should be DropEvent, but in cases where we fail to pr operly sync scrollability it's safer to send the
128 // event to the main thread. Change back to DropEvent once we have s ynchronization bugs sorted out. 128 // event to the main thread. Change back to DropEvent once we have s ynchronization bugs sorted out.
129 return DidNotHandle; 129 return DidNotHandle;
130 case WebInputHandlerClient::ScrollStatusOnMainThread: 130 case WebInputHandlerClient::ScrollStatusOnMainThread:
131 return DidNotHandle; 131 return DidNotHandle;
132 } 132 }
133 } else if (event.type == WebInputEvent::GestureScrollBegin) { 133 } else if (event.type == WebInputEvent::GestureScrollBegin) {
134 ASSERT(!m_gestureScrollStarted); 134 ASSERT(!m_gestureScrollStarted);
(...skipping 12 matching lines...) Expand all
147 case WebInputHandlerClient::ScrollStatusIgnored: 147 case WebInputHandlerClient::ScrollStatusIgnored:
148 return DropEvent; 148 return DropEvent;
149 } 149 }
150 } else if (event.type == WebInputEvent::GestureScrollUpdate) { 150 } else if (event.type == WebInputEvent::GestureScrollUpdate) {
151 ASSERT(m_expectScrollUpdateEnd); 151 ASSERT(m_expectScrollUpdateEnd);
152 152
153 if (!m_gestureScrollStarted) 153 if (!m_gestureScrollStarted)
154 return DidNotHandle; 154 return DidNotHandle;
155 155
156 const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent *>(&event); 156 const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent *>(&event);
157 m_inputHandlerClient->scrollBy(WebPoint(gestureEvent.x, gestureEvent.y), 157 bool didScroll = m_inputHandlerClient->scrollBy(WebPoint(gestureEvent.x, gestureEvent.y),
158 IntSize(-gestureEvent.data.scrollUpdate.deltaX, -gestureEvent.data.s crollUpdate.deltaY)); 158 IntSize(-gestureEvent.data.scrollUpdate.deltaX, -gestureEvent.data.s crollUpdate.deltaY));
159 return DidHandle; 159 return didScroll ? DidHandle : DropEvent;
160 } else if (event.type == WebInputEvent::GestureScrollEnd) { 160 } else if (event.type == WebInputEvent::GestureScrollEnd) {
161 ASSERT(m_expectScrollUpdateEnd); 161 ASSERT(m_expectScrollUpdateEnd);
162 #ifndef NDEBUG 162 #ifndef NDEBUG
163 m_expectScrollUpdateEnd = false; 163 m_expectScrollUpdateEnd = false;
164 #endif 164 #endif
165 if (!m_gestureScrollStarted) 165 if (!m_gestureScrollStarted)
166 return DidNotHandle; 166 return DidNotHandle;
167 167
168 m_inputHandlerClient->scrollEnd(); 168 m_inputHandlerClient->scrollEnd();
169 m_gestureScrollStarted = false; 169 m_gestureScrollStarted = false;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // This can happen when flinging a page that contains a scrollable subar ea that we can't 305 // This can happen when flinging a page that contains a scrollable subar ea that we can't
306 // scroll on the thread if the fling starts outside the subarea but then is flung "under" the 306 // scroll on the thread if the fling starts outside the subarea but then is flung "under" the
307 // pointer. 307 // pointer.
308 m_client->transferActiveWheelFlingAnimation(m_wheelFlingParameters); 308 m_client->transferActiveWheelFlingAnimation(m_wheelFlingParameters);
309 cancelCurrentFling(); 309 cancelCurrentFling();
310 break; 310 break;
311 } 311 }
312 } 312 }
313 313
314 } 314 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698