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

Side by Side Diff: Source/platform/mac/ScrollElasticityController.mm

Issue 658953003: Remove redundant Mac event structures (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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/platform/PlatformWheelEvent.h ('k') | Source/web/WebInputEventConversion.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) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded) { 153 if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded) {
154 m_ignoreMomentumScrolls = false; 154 m_ignoreMomentumScrolls = false;
155 return true; 155 return true;
156 } 156 }
157 return false; 157 return false;
158 } 158 }
159 159
160 if (!shouldHandleEvent(wheelEvent)) 160 if (!shouldHandleEvent(wheelEvent))
161 return false; 161 return false;
162 162
163 float deltaX = m_overflowScrollDelta.width(); 163 float deltaX = m_overflowScrollDelta.width() - wheelEvent.deltaX();
164 float deltaY = m_overflowScrollDelta.height(); 164 float deltaY = m_overflowScrollDelta.height() - wheelEvent.deltaY();
165 float eventCoalescedDeltaX = -wheelEvent.deltaX();
166 float eventCoalescedDeltaY = -wheelEvent.deltaY();
165 167
166 // Reset overflow values because we may decide to remove delta at various po ints and put it into overflow. 168 // Reset overflow values because we may decide to remove delta at various po ints and put it into overflow.
167 m_overflowScrollDelta = FloatSize(); 169 m_overflowScrollDelta = FloatSize();
168 170
169 IntSize stretchAmount = m_client->stretchAmount(); 171 IntSize stretchAmount = m_client->stretchAmount();
170 bool isVerticallyStretched = stretchAmount.height(); 172 bool isVerticallyStretched = stretchAmount.height();
171 bool isHorizontallyStretched = stretchAmount.width(); 173 bool isHorizontallyStretched = stretchAmount.width();
172 174
173 float eventCoalescedDeltaX;
174 float eventCoalescedDeltaY;
175
176 if (isVerticallyStretched || isHorizontallyStretched) {
177 eventCoalescedDeltaX = -wheelEvent.unacceleratedScrollingDeltaX();
178 eventCoalescedDeltaY = -wheelEvent.unacceleratedScrollingDeltaY();
179 } else {
180 eventCoalescedDeltaX = -wheelEvent.deltaX();
181 eventCoalescedDeltaY = -wheelEvent.deltaY();
182 }
183
184 deltaX += eventCoalescedDeltaX;
185 deltaY += eventCoalescedDeltaY;
186
187 // Slightly prefer scrolling vertically by applying the = case to deltaY 175 // Slightly prefer scrolling vertically by applying the = case to deltaY
188 if (fabsf(deltaY) >= fabsf(deltaX)) 176 if (fabsf(deltaY) >= fabsf(deltaX))
189 deltaX = 0; 177 deltaX = 0;
190 else 178 else
191 deltaY = 0; 179 deltaY = 0;
192 180
193 bool shouldStretch = false; 181 bool shouldStretch = false;
194 182
195 PlatformWheelEventPhase momentumPhase = wheelEvent.momentumPhase(); 183 PlatformWheelEventPhase momentumPhase = wheelEvent.momentumPhase();
196 184
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 return false; 436 return false;
449 } 437 }
450 438
451 // The event is going to either cause scrolling or rubber banding. 439 // The event is going to either cause scrolling or rubber banding.
452 return true; 440 return true;
453 } 441 }
454 442
455 } // namespace blink 443 } // namespace blink
456 444
457 #endif // USE(RUBBER_BANDING) 445 #endif // USE(RUBBER_BANDING)
OLDNEW
« no previous file with comments | « Source/platform/PlatformWheelEvent.h ('k') | Source/web/WebInputEventConversion.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698