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

Unified Diff: base/mac/scoped_smooth_scrolling_disabler_mac.mm

Issue 7693019: Enable smooth scrolling on mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ppapi test Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: base/mac/scoped_smooth_scrolling_disabler_mac.mm
diff --git a/base/mac/scoped_smooth_scrolling_disabler_mac.mm b/base/mac/scoped_smooth_scrolling_disabler_mac.mm
new file mode 100644
index 0000000000000000000000000000000000000000..57c1e723d88f7a6a4b7a01ef3fc43fcdc4208ad2
--- /dev/null
+++ b/base/mac/scoped_smooth_scrolling_disabler_mac.mm
@@ -0,0 +1,26 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/mac/scoped_smooth_scrolling_disabler_mac.h"
+
+#include <Cocoa/Cocoa.h>
+
+namespace base {
+
+ScopedSmoothScrollingDisabler::ScopedSmoothScrollingDisabler(
+ bool actually_disable) {
+ if (actually_disable) {
+ // With smooth scrolling, cmd-down et al send many small scroll events on a
+ // timer, which is problematic for some tests.
+ [[NSUserDefaults standardUserDefaults]
+ setBool:NO forKey:@"AppleScrollAnimationEnabled"];
Mark Mentovai 2011/08/31 02:59:57 These suck because they leave bad prefs on the dis
Nico 2011/08/31 03:30:51 I couldn't think of one; this is how Apple's DRT d
Mark Mentovai 2011/08/31 03:39:01 My concern is actually the confluence of (a) and (
+ }
+}
+
+ScopedSmoothScrollingDisabler::~ScopedSmoothScrollingDisabler() {
+ [[NSUserDefaults standardUserDefaults]
+ removeObjectForKey:@"AppleScrollAnimationEnabled"];
+}
+
+} // namespace base

Powered by Google App Engine
This is Rietveld 408576698