Title: [126321] trunk/Source/WebCore
- Revision
- 126321
- Author
- [email protected]
- Date
- 2012-08-22 10:59:26 -0700 (Wed, 22 Aug 2012)
Log Message
Respect system setting for rubber-banding in ScrollAnimatorMac.
https://bugs.webkit.org/show_bug.cgi?id=94356
Patch by Alexei Svitkine <[email protected]> on 2012-08-22
Reviewed by James Robinson.
Respects user defaults setting of NSScrollViewRubberbanding,
which controls rubber-banding in other Mac OS X applications.
If NSScrollViewRubberbanding is not set, defaults to enabling
rubber banding. Otherwise, rubber banding is disabled if the
value is 0 and enabled otherwise.
No new tests since the behavior depends on system settings.
* platform/mac/ScrollAnimatorMac.mm:
(WebCore):
(WebCore::rubberBandingEnabledForSystem):
(WebCore::ScrollAnimatorMac::handleWheelEvent):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (126320 => 126321)
--- trunk/Source/WebCore/ChangeLog 2012-08-22 17:56:48 UTC (rev 126320)
+++ trunk/Source/WebCore/ChangeLog 2012-08-22 17:59:26 UTC (rev 126321)
@@ -1,3 +1,24 @@
+2012-08-22 Alexei Svitkine <[email protected]>
+
+ Respect system setting for rubber-banding in ScrollAnimatorMac.
+ https://bugs.webkit.org/show_bug.cgi?id=94356
+
+ Reviewed by James Robinson.
+
+ Respects user defaults setting of NSScrollViewRubberbanding,
+ which controls rubber-banding in other Mac OS X applications.
+
+ If NSScrollViewRubberbanding is not set, defaults to enabling
+ rubber banding. Otherwise, rubber banding is disabled if the
+ value is 0 and enabled otherwise.
+
+ No new tests since the behavior depends on system settings.
+
+ * platform/mac/ScrollAnimatorMac.mm:
+ (WebCore):
+ (WebCore::rubberBandingEnabledForSystem):
+ (WebCore::ScrollAnimatorMac::handleWheelEvent):
+
2012-08-22 James Robinson <[email protected]>
[chromium/mac] Remove unnecessary checks for OS version <= 10.5. We don't support those
Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (126320 => 126321)
--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2012-08-22 17:56:48 UTC (rev 126320)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2012-08-22 17:59:26 UTC (rev 126321)
@@ -642,6 +642,24 @@
#endif
}
+#if ENABLE(RUBBER_BANDING)
+static bool rubberBandingEnabledForSystem()
+{
+ static bool initialized = false;
+ static bool enabled = true;
+ // Caches the result, which is consistent with other apps like the Finder, which all
+ // require a restart after changing this default.
+ if (!initialized) {
+ // Uses -objectForKey: and not -boolForKey: in order to default to true if the value wasn't set.
+ id value = [[NSUserDefaults standardUserDefaults] objectForKey:@"NSScrollViewRubberbanding"];
+ if ([value isKindOfClass:[NSNumber class]])
+ enabled = [value boolValue];
+ initialized = true;
+ }
+ return enabled;
+}
+#endif
+
bool ScrollAnimatorMac::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier)
{
m_haveScrolledSincePageLoad = true;
@@ -981,7 +999,7 @@
{
m_haveScrolledSincePageLoad = true;
- if (!wheelEvent.hasPreciseScrollingDeltas())
+ if (!wheelEvent.hasPreciseScrollingDeltas() || !rubberBandingEnabledForSystem())
return ScrollAnimator::handleWheelEvent(wheelEvent);
// FIXME: This is somewhat roundabout hack to allow forwarding wheel events
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes