summaryrefslogtreecommitdiff
path: root/UICaboodle
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2010-11-05 09:32:48 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2010-11-05 09:32:48 -0700
commit9c1605e2d99b216c21dbc6134dae0bc3bb02e38d (patch)
tree36d3e644024bdf012059d576aeba791a16d320d7 /UICaboodle
parent1671fa4e57bc813f7e0b4423662961d9e55d7d6e (diff)
Downgrade support for -[UIScrollView setDecelerationRate].
Diffstat (limited to 'UICaboodle')
-rw-r--r--UICaboodle/BrowserView.mm12
1 files changed, 10 insertions, 2 deletions
diff --git a/UICaboodle/BrowserView.mm b/UICaboodle/BrowserView.mm
index 8b361f5..90a584f 100644
--- a/UICaboodle/BrowserView.mm
+++ b/UICaboodle/BrowserView.mm
@@ -36,6 +36,8 @@ static inline void CYRelease(Type_ &value) {
}
}
+float CYScrollViewDecelerationRateNormal;
+
@interface WebView (Apple)
- (void) _setLayoutInterval:(float)interval;
@end
@@ -315,6 +317,11 @@ enum CYWebPolicyDecision {
+ (void) _initialize {
[WebPreferences _setInitialDefaultTextEncodingToSystemEncoding];
+
+ if (float *_UIScrollViewDecelerationRateNormal = reinterpret_cast<float *>(dlsym(RTLD_DEFAULT, "UIScrollViewDecelerationRateNormal")))
+ CYScrollViewDecelerationRateNormal = *_UIScrollViewDecelerationRateNormal;
+ else // XXX: this actually might be fast on some older systems: we should look into this
+ CYScrollViewDecelerationRateNormal = 0.998;
}
- (void) dealloc {
@@ -807,7 +814,7 @@ enum CYWebPolicyDecision {
scroller_ = [webview_ _scrollView];
[scroller_ setDirectionalLockEnabled:YES];
- [scroller_ setDecelerationRate:UIScrollViewDecelerationRateNormal];
+ [scroller_ setDecelerationRate:CYScrollViewDecelerationRateNormal];
[scroller_ setDelaysContentTouches:NO];
[scroller_ setCanCancelContentTouches:YES];
@@ -816,7 +823,8 @@ enum CYWebPolicyDecision {
scroller_ = (UIScrollView *) scroller;
[scroller setDirectionalScrolling:YES];
- [scroller setScrollDecelerationFactor:UIScrollViewDecelerationRateNormal]; /* 0.989324 */
+ // XXX: we might be better off /not/ setting this on older systems
+ [scroller setScrollDecelerationFactor:CYScrollViewDecelerationRateNormal]; /* 0.989324 */
[scroller setScrollHysteresis:0]; /* 8 */
[scroller setThumbDetectionEnabled:NO];