RESOLVED FIXED 94356
Respect system setting for rubber-banding in ScrollAnimatorMac.
https://bugs.webkit.org/show_bug.cgi?id=94356
Summary Respect system setting for rubber-banding in ScrollAnimatorMac.
asvitkine
Reported 2012-08-17 09:51:06 PDT
[chromium/mac] Respect system setting for rubber-banding.
Attachments
Patch (2.74 KB, patch)
2012-08-17 10:32 PDT, asvitkine
no flags
Patch (2.69 KB, patch)
2012-08-20 11:28 PDT, asvitkine
no flags
Patch (2.78 KB, patch)
2012-08-21 11:38 PDT, asvitkine
no flags
Patch (2.79 KB, patch)
2012-08-21 12:35 PDT, asvitkine
no flags
asvitkine
Comment 1 2012-08-17 10:32:12 PDT
asvitkine
Comment 2 2012-08-17 10:32:49 PDT
asvitkine
Comment 3 2012-08-17 10:33:31 PDT
Nico: Please review.
Nico Weber
Comment 4 2012-08-17 11:16:39 PDT
Comment on attachment 159156 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=159156&action=review > Source/WebCore/platform/mac/ScrollAnimatorMac.mm:661 > +#else Does the apple port get this for free somehow?
asvitkine
Comment 5 2012-08-17 11:17:56 PDT
(In reply to comment #4) > (From update of attachment 159156 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=159156&action=review > > > Source/WebCore/platform/mac/ScrollAnimatorMac.mm:661 > > +#else > > Does the apple port get this for free somehow? No, they don't respect the setting, as far as I could tell.
Nico Weber
Comment 6 2012-08-17 13:00:42 PDT
Hi Beth, it looks like the rest of OS X honors this setting. Is the apple port interested in honoring it too? If so, we can remove the ifdef. Nico
Beth Dakin
Comment 7 2012-08-17 13:04:37 PDT
(In reply to comment #6) > Hi Beth, > > it looks like the rest of OS X honors this setting. Is the apple port interested in honoring it too? If so, we can remove the ifdef. > > Nico Hmm, maybe! Sam, what do you think?
Sam Weinig
Comment 8 2012-08-18 15:45:57 PDT
Seems reasonable to support. If you are ever considering making something like this Chromium only in WebCore, don't! Please add a test.
asvitkine
Comment 9 2012-08-19 08:57:03 PDT
(In reply to comment #8) > Please add a test. Do you have a suggestion of how to go about writing a test for this? This relies on both system settings and platform-specific wheel events and timings. I'm not sure what the convention is for testing such changes. Can you point me in the right direction?
Sam Weinig
Comment 10 2012-08-19 16:49:45 PDT
(In reply to comment #9) > (In reply to comment #8) > > Please add a test. > > Do you have a suggestion of how to go about writing a test for this? > > This relies on both system settings and platform-specific wheel events and timings. I'm not sure what the convention is for testing such changes. Can you point me in the right direction? Beth, what is the current story with rubber-band testing? Is it non-existent?
Beth Dakin
Comment 11 2012-08-20 11:03:47 PDT
(In reply to comment #10) > (In reply to comment #9) > > (In reply to comment #8) > > > Please add a test. > > > > Do you have a suggestion of how to go about writing a test for this? > > > > This relies on both system settings and platform-specific wheel events and timings. I'm not sure what the convention is for testing such changes. Can you point me in the right direction? > > Beth, what is the current story with rubber-band testing? Is it non-existent? Yeah, I don't think we ever devised a way to test this.
asvitkine
Comment 12 2012-08-20 11:28:11 PDT
asvitkine
Comment 13 2012-08-20 11:28:53 PDT
(In reply to comment #12) > Created an attachment (id=159478) [details] > Patch Updated patch removes the CHROMIUM ifdefs so that the behavior applies to the Mac port too.
Nico Weber
Comment 14 2012-08-20 14:10:04 PDT
Comment on attachment 159478 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=159478&action=review > Source/WebCore/platform/mac/ScrollAnimatorMac.mm:657 > + initialized = true; NSUserDefaults usually are supposed to be "live", you shouldn't have to restart your browser after you changed them. Is this method hot? If so, maybe you could give WebScrollAnimationHelperDelegate a +initialize method and call registerDefaults: from there?
asvitkine
Comment 15 2012-08-20 14:17:26 PDT
Comment on attachment 159478 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=159478&action=review >> Source/WebCore/platform/mac/ScrollAnimatorMac.mm:657 >> + initialized = true; > > NSUserDefaults usually are supposed to be "live", you shouldn't have to restart your browser after you changed them. > > Is this method hot? If so, maybe you could give WebScrollAnimationHelperDelegate a +initialize method and call registerDefaults: from there? For this particular setting, other applications require a restart for the setting to take effect. Regarding whether the method is hot: it's invoked for every mouse wheel event - so perhaps warm, but not hot?
Nico Weber
Comment 16 2012-08-20 14:20:24 PDT
Comment on attachment 159478 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=159478&action=review >>> Source/WebCore/platform/mac/ScrollAnimatorMac.mm:657 >>> + initialized = true; >> >> NSUserDefaults usually are supposed to be "live", you shouldn't have to restart your browser after you changed them. >> >> Is this method hot? If so, maybe you could give WebScrollAnimationHelperDelegate a +initialize method and call registerDefaults: from there? > > For this particular setting, other applications require a restart for the setting to take effect. > > Regarding whether the method is hot: it's invoked for every mouse wheel event - so perhaps warm, but not hot? If it's consistent with other apps, then I guess it's fine. "// Other apps like XXX require a restart after changing this default." makes a better comment than "// If the key hasn't been set, default to enabling rubber banding." which doesn't add much. With that, LGTM. (I'm not a review though.)
Nico Weber
Comment 17 2012-08-20 15:27:23 PDT
> With that, LGTM. (I'm not a review though.) *not a reviewer. Though I'm not a review either.
Beth Dakin
Comment 18 2012-08-20 17:51:24 PDT
Comment on attachment 159478 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=159478&action=review I think this patch is close, but I would like to see the things I commented on cleaned up. > Source/WebCore/platform/mac/ScrollAnimatorMac.mm:651 > + NSString* key = @"NSScrollViewRubberbanding"; For Objective-C objects, our style guide dictates that the * should go next to the variable name, not the type name. In other words, this should be: NSString *key… > Source/WebCore/platform/mac/ScrollAnimatorMac.mm:652 > + NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; Same as above. > Source/WebCore/platform/mac/ScrollAnimatorMac.mm:654 > + id value = [defaults objectForKey:key]; Can you just use boolForKey here instead of objectForKey? And then avoid all of the conversions below?
Beth Dakin
Comment 19 2012-08-20 17:54:10 PDT
(In reply to comment #18) > (From update of attachment 159478 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=159478&action=review > > I think this patch is close, but I would like to see the things I commented on cleaned up. > > > Source/WebCore/platform/mac/ScrollAnimatorMac.mm:651 > > + NSString* key = @"NSScrollViewRubberbanding"; > Actually, there is no need to have a variable for the key here anyway. You can collapse these three lines of code into: enabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"NSScrollViewRubberbanding"];
Nico Weber
Comment 20 2012-08-20 17:54:36 PDT
Comment on attachment 159478 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=159478&action=review >> Source/WebCore/platform/mac/ScrollAnimatorMac.mm:654 >> + id value = [defaults objectForKey:key]; > > Can you just use boolForKey here instead of objectForKey? And then avoid all of the conversions below? boolForKey defaults to NO for values that are not present. This wants to default to YES instead (see my suggestion about registerDefaults: above)
Beth Dakin
Comment 21 2012-08-20 17:56:48 PDT
(In reply to comment #20) > (From update of attachment 159478 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=159478&action=review > > >> Source/WebCore/platform/mac/ScrollAnimatorMac.mm:654 > >> + id value = [defaults objectForKey:key]; > > > > Can you just use boolForKey here instead of objectForKey? And then avoid all of the conversions below? > > boolForKey defaults to NO for values that are not present. This wants to default to YES instead (see my suggestion about registerDefaults: above) Oh, that makes sense.
asvitkine
Comment 22 2012-08-21 11:38:45 PDT
asvitkine
Comment 23 2012-08-21 11:40:54 PDT
(In reply to comment #22) > Created an attachment (id=159731) [details] > Patch I've updated the patch to add a comment per Nico's suggestion and to inline some things per Beth's suggestion. I've kept (and clarified) the comment about the default value and why the code doesn't use -boolForKey:. Please take another look.
Nico Weber
Comment 24 2012-08-21 12:20:31 PDT
Comment on attachment 159731 [details] Patch lgtm
Nico Weber
Comment 25 2012-08-21 12:20:53 PDT
Comment on attachment 159731 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=159731&action=review > Source/WebCore/ChangeLog:3 > + [chromium/mac] Respect system setting for rubber-banding. (nit: Remove [chromium/mac] here)
asvitkine
Comment 26 2012-08-21 12:35:07 PDT
asvitkine
Comment 27 2012-08-21 12:35:49 PDT
(In reply to comment #25) > (From update of attachment 159731 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=159731&action=review > > > Source/WebCore/ChangeLog:3 > > + [chromium/mac] Respect system setting for rubber-banding. > > (nit: Remove [chromium/mac] here) Done.
James Robinson
Comment 28 2012-08-22 10:43:02 PDT
Comment on attachment 159739 [details] Patch R=me
WebKit Review Bot
Comment 29 2012-08-22 10:59:04 PDT
Comment on attachment 159739 [details] Patch Clearing flags on attachment: 159739 Committed r126321: <http://trac.webkit.org/changeset/126321>
WebKit Review Bot
Comment 30 2012-08-22 10:59:08 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.