OLD | NEW |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 struct timeval now; | 48 struct timeval now; |
49 if (boottime.tv_sec && -1 != gettimeofday(&now, 0)) { | 49 if (boottime.tv_sec && -1 != gettimeofday(&now, 0)) { |
50 struct timeval uptime; | 50 struct timeval uptime; |
51 timersub(&now, &boottime, &uptime); | 51 timersub(&now, &boottime, &uptime); |
52 NSTimeInterval result = uptime.tv_sec + (uptime.tv_usec / 1E+6); | 52 NSTimeInterval result = uptime.tv_sec + (uptime.tv_usec / 1E+6); |
53 return result; | 53 return result; |
54 } | 54 } |
55 return 0; | 55 return 0; |
56 } | 56 } |
57 | 57 |
58 namespace WebCore { | 58 namespace blink { |
59 | 59 |
60 static const float scrollVelocityZeroingTimeout = 0.10f; | 60 static const float scrollVelocityZeroingTimeout = 0.10f; |
61 static const float rubberbandDirectionLockStretchRatio = 1; | 61 static const float rubberbandDirectionLockStretchRatio = 1; |
62 static const float rubberbandMinimumRequiredDeltaBeforeStretch = 10; | 62 static const float rubberbandMinimumRequiredDeltaBeforeStretch = 10; |
63 | 63 |
64 static const float rubberbandStiffness = 20; | 64 static const float rubberbandStiffness = 20; |
65 static const float rubberbandAmplitude = 0.31f; | 65 static const float rubberbandAmplitude = 0.31f; |
66 static const float rubberbandPeriod = 1.6f; | 66 static const float rubberbandPeriod = 1.6f; |
67 | 67 |
68 static float elasticDeltaForTimeDelta(float initialPosition, float initialVeloci
ty, float elapsedTime) | 68 static float elasticDeltaForTimeDelta(float initialPosition, float initialVeloci
ty, float elapsedTime) |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 if (wheelEvent.deltaX() > 0 && !wheelEvent.canRubberbandLeft()) | 445 if (wheelEvent.deltaX() > 0 && !wheelEvent.canRubberbandLeft()) |
446 return false; | 446 return false; |
447 if (wheelEvent.deltaX() < 0 && !wheelEvent.canRubberbandRight()) | 447 if (wheelEvent.deltaX() < 0 && !wheelEvent.canRubberbandRight()) |
448 return false; | 448 return false; |
449 } | 449 } |
450 | 450 |
451 // The event is going to either cause scrolling or rubber banding. | 451 // The event is going to either cause scrolling or rubber banding. |
452 return true; | 452 return true; |
453 } | 453 } |
454 | 454 |
455 } // namespace WebCore | 455 } // namespace blink |
456 | 456 |
457 #endif // USE(RUBBER_BANDING) | 457 #endif // USE(RUBBER_BANDING) |
OLD | NEW |