Bug 96049

Summary: Chromium: Scrollbar with tickmarks doesn't respond to clicks
Product: WebKit Reporter: Sailesh Agrawal <sail>
Component: New BugsAssignee: Sailesh Agrawal <sail>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, dglazkov, gtk-ews, gustavo, jamesr, peter+ews, philn, thakis, webkit.review.bot, xan.lopez
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch for landing
none
Patch for landing
none
Patch for landing
none
Patch for landing none

Description Sailesh Agrawal 2012-09-06 18:23:56 PDT
Chromium: Scrollbar with tickmarks doesn't respond to clicks
Comment 1 Sailesh Agrawal 2012-09-06 18:32:34 PDT
Created attachment 162641 [details]
Patch
Comment 2 Build Bot 2012-09-06 22:07:40 PDT
Comment on attachment 162641 [details]
Patch

Attachment 162641 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/13775613
Comment 3 Nico Weber 2012-09-06 22:11:46 PDT
Does the apple port have this problem too? Does this patch fix things there as well?

Is it possible to test this?
Comment 4 Sailesh Agrawal 2012-09-07 09:52:27 PDT
> Does the apple port have this problem too? Does this patch fix things there as well?
The apple port doesn't draw tickmarks on the scrollbar.

> Is it possible to test this?
I'm not sure if there's a way to add tickmarks from a test. Looking into it right now.
Comment 5 Nico Weber 2012-09-07 09:53:25 PDT
There is, see the test I added here: https://bugs.webkit.org/show_bug.cgi?id=91949
Comment 6 Sailesh Agrawal 2012-09-07 10:48:58 PDT
Just talked to Nico offline. Current there's no way to force the scrollbar code to draw in overlay mode. This means that this fix isn't testable right now.

I'll check with dpranke to see if we have 10.7/10.8 bots running chromium layout tests. If we do I'll send out a separate patch to add the testing infrastructure and add a test for this.
Comment 7 Sailesh Agrawal 2012-09-07 11:06:15 PDT
Created attachment 162821 [details]
Patch
Comment 8 Sailesh Agrawal 2012-09-07 17:21:36 PDT
Created attachment 162917 [details]
Patch
Comment 9 Sailesh Agrawal 2012-09-07 17:36:21 PDT
Actually, adding the test infrastructure turned out the be fairly simple. I've included it with this patch.
On my 10.8 box, the test fails without my fix and passes with my fix.

I've kicked

Let me know if this looks ok and I'll add Beth and other folks to the review.

Thanks
Comment 10 kov's GTK+ EWS bot 2012-09-07 17:36:58 PDT
Comment on attachment 162917 [details]
Patch

Attachment 162917 [details] did not pass gtk-ews (gtk):
Output: http://queues.webkit.org/results/13774962
Comment 11 Sailesh Agrawal 2012-09-07 17:55:53 PDT
Created attachment 162922 [details]
Patch
Comment 12 Sailesh Agrawal 2012-09-07 18:26:17 PDT
Created attachment 162927 [details]
Patch
Comment 13 Sailesh Agrawal 2012-09-07 18:29:59 PDT
Created attachment 162928 [details]
Patch
Comment 14 Sailesh Agrawal 2012-09-07 18:30:47 PDT
> After reading the ChangeLog entry, I would've expected this to set the locked alpha to oldTrackAlpha, not 1.
> It looks like the lockedalpha is always either 0 or 1 (right?), so maybe it could just be a bool instead?

Done. Changed to a bool.

> one ; should be enough

Done.

> How do async tests work? Do they fail if finishJSTests() isn't called after a timeout? Or after the event loop doesn't have any events left?

It fails after a timeout.
Comment 15 Build Bot 2012-09-07 19:09:10 PDT
Comment on attachment 162928 [details]
Patch

Attachment 162928 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/13795027
Comment 16 Build Bot 2012-09-07 21:18:18 PDT
Comment on attachment 162928 [details]
Patch

Attachment 162928 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/13786756
Comment 17 Sailesh Agrawal 2012-09-08 13:08:18 PDT
Created attachment 162965 [details]
Patch
Comment 18 Build Bot 2012-09-08 13:39:28 PDT
Comment on attachment 162965 [details]
Patch

Attachment 162965 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/13799287
Comment 19 Sailesh Agrawal 2012-09-08 14:48:16 PDT
Created attachment 162967 [details]
Patch
Comment 20 Build Bot 2012-09-08 14:59:19 PDT
Comment on attachment 162967 [details]
Patch

Attachment 162967 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/13792442
Comment 21 Sailesh Agrawal 2012-09-08 15:09:15 PDT
Created attachment 162968 [details]
Patch
Comment 22 Build Bot 2012-09-08 15:39:24 PDT
Comment on attachment 162968 [details]
Patch

Attachment 162968 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/13797299
Comment 23 Sailesh Agrawal 2012-09-08 17:29:38 PDT
Created attachment 162970 [details]
Patch
Comment 24 Sailesh Agrawal 2012-09-10 10:02:08 PDT
Hi Beth, could you please take a look. Thanks!
Comment 25 Beth Dakin 2012-09-10 11:43:48 PDT
Comment on attachment 162970 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=162970&action=review

> Source/WebCore/platform/mac/ScrollbarThemeMac.mm:216
> +    NSNumber* number = objc_getAssociatedObject(painter, &gLockedAlphaKey);

This definitely does not seem like the right approach. If you want to call NSScrollerImp API, you should not use objc_getAssociatedObject/objc_setAssociatedObject. You should call it the same way we call all of the other NSScrollerImp APIs, by declaring it in NSScrollerImpDetails.h

> Source/WebCore/platform/mac/ScrollbarThemeMac.mm:225
> +    objc_setAssociatedObject(painter, &gLockedAlphaKey, [NSNumber numberWithBool:isLocked], OBJC_ASSOCIATION_RETAIN);

Same as above.
Comment 26 Sailesh Agrawal 2012-09-10 12:33:56 PDT
(In reply to comment #25)
> (From update of attachment 162970 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=162970&action=review
> 
> > Source/WebCore/platform/mac/ScrollbarThemeMac.mm:216
> > +    NSNumber* number = objc_getAssociatedObject(painter, &gLockedAlphaKey);
> 
> This definitely does not seem like the right approach. If you want to call NSScrollerImp API, you should not use objc_getAssociatedObject/objc_setAssociatedObject. You should call it the same way we call all of the other NSScrollerImp APIs, by declaring it in NSScrollerImpDetails.h

Hi Beth, this actually doesn't call NSScrollerImp APIs. Instead it just associates some data with the instance of NSScrollerImp.

Another way to do this would be to keep a std::map<NSScrollerImp, bool> but using objc_getAssociatedObject() is much more straight forward.
Comment 27 Beth Dakin 2012-09-10 12:35:39 PDT
(In reply to comment #26)
> (In reply to comment #25)
> > (From update of attachment 162970 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=162970&action=review
> > 
> > > Source/WebCore/platform/mac/ScrollbarThemeMac.mm:216
> > > +    NSNumber* number = objc_getAssociatedObject(painter, &gLockedAlphaKey);
> > 
> > This definitely does not seem like the right approach. If you want to call NSScrollerImp API, you should not use objc_getAssociatedObject/objc_setAssociatedObject. You should call it the same way we call all of the other NSScrollerImp APIs, by declaring it in NSScrollerImpDetails.h
> 
> Hi Beth, this actually doesn't call NSScrollerImp APIs. Instead it just associates some data with the instance of NSScrollerImp.
> 
> Another way to do this would be to keep a std::map<NSScrollerImp, bool> but using objc_getAssociatedObject() is much more straight forward.

Why does the data need to be associated with the NSScrollerImp instead of a WebCore object?
Comment 28 Sailesh Agrawal 2012-09-10 12:39:12 PDT
(In reply to comment #27)
> (In reply to comment #26)
> > (In reply to comment #25)
> > > (From update of attachment 162970 [details] [details] [details])
> > > View in context: https://bugs.webkit.org/attachment.cgi?id=162970&action=review
> > > 
> > > > Source/WebCore/platform/mac/ScrollbarThemeMac.mm:216
> > > > +    NSNumber* number = objc_getAssociatedObject(painter, &gLockedAlphaKey);
> > > 
> > > This definitely does not seem like the right approach. If you want to call NSScrollerImp API, you should not use objc_getAssociatedObject/objc_setAssociatedObject. You should call it the same way we call all of the other NSScrollerImp APIs, by declaring it in NSScrollerImpDetails.h
> > 
> > Hi Beth, this actually doesn't call NSScrollerImp APIs. Instead it just associates some data with the instance of NSScrollerImp.
> > 
> > Another way to do this would be to keep a std::map<NSScrollerImp, bool> but using objc_getAssociatedObject() is much more straight forward.
> 
> Why does the data need to be associated with the NSScrollerImp instead of a WebCore object?

Either one will work.

Associating the data with NSScrollerImp is direct.

Associating the data with ScrollbarThemeClient involves piping a lot of call out to Source/WebKit/*.
Comment 29 Beth Dakin 2012-09-10 12:42:39 PDT
(In reply to comment #28)
> (In reply to comment #27)
> > (In reply to comment #26)
> > > (In reply to comment #25)
> > > > (From update of attachment 162970 [details] [details] [details] [details])
> > > > View in context: https://bugs.webkit.org/attachment.cgi?id=162970&action=review
> > > > 
> > > > > Source/WebCore/platform/mac/ScrollbarThemeMac.mm:216
> > > > > +    NSNumber* number = objc_getAssociatedObject(painter, &gLockedAlphaKey);
> > > > 
> > > > This definitely does not seem like the right approach. If you want to call NSScrollerImp API, you should not use objc_getAssociatedObject/objc_setAssociatedObject. You should call it the same way we call all of the other NSScrollerImp APIs, by declaring it in NSScrollerImpDetails.h
> > > 
> > > Hi Beth, this actually doesn't call NSScrollerImp APIs. Instead it just associates some data with the instance of NSScrollerImp.
> > > 
> > > Another way to do this would be to keep a std::map<NSScrollerImp, bool> but using objc_getAssociatedObject() is much more straight forward.
> > 
> > Why does the data need to be associated with the NSScrollerImp instead of a WebCore object?
> 
> Either one will work.
> 
> Associating the data with NSScrollerImp is direct.
> 
> Associating the data with ScrollbarThemeClient involves piping a lot of call out to Source/WebKit/*.

I really don't like the idea of adding data members to an AppKit object. I think we should stick to WebCore objects here. Can you associate it with Scrollbar instead of ScrollbarThemeClient?
Comment 30 Sailesh Agrawal 2012-09-10 12:54:30 PDT
(In reply to comment #29)
> (In reply to comment #28)
> > (In reply to comment #27)
> > > (In reply to comment #26)
> > > > (In reply to comment #25)
> > > > > (From update of attachment 162970 [details] [details] [details] [details] [details])
> > > > > View in context: https://bugs.webkit.org/attachment.cgi?id=162970&action=review
> > > > > 
> > > > > > Source/WebCore/platform/mac/ScrollbarThemeMac.mm:216
> > > > > > +    NSNumber* number = objc_getAssociatedObject(painter, &gLockedAlphaKey);
> > > > > 
> > > > > This definitely does not seem like the right approach. If you want to call NSScrollerImp API, you should not use objc_getAssociatedObject/objc_setAssociatedObject. You should call it the same way we call all of the other NSScrollerImp APIs, by declaring it in NSScrollerImpDetails.h
> > > > 
> > > > Hi Beth, this actually doesn't call NSScrollerImp APIs. Instead it just associates some data with the instance of NSScrollerImp.
> > > > 
> > > > Another way to do this would be to keep a std::map<NSScrollerImp, bool> but using objc_getAssociatedObject() is much more straight forward.
> > > 
> > > Why does the data need to be associated with the NSScrollerImp instead of a WebCore object?
> > 
> > Either one will work.
> > 
> > Associating the data with NSScrollerImp is direct.
> > 
> > Associating the data with ScrollbarThemeClient involves piping a lot of call out to Source/WebKit/*.
> 
> I really don't like the idea of adding data members to an AppKit object. I think we should stick to WebCore objects here. Can you associate it with Scrollbar instead of ScrollbarThemeClient?

Currently ScrollbarThemeMac only has access to ScrollbarThemeClient, which is an abstract class.

Would it be ok to store it in a std::map instead?
Comment 31 Beth Dakin 2012-09-11 12:28:00 PDT
(In reply to comment #30)
> 
> Currently ScrollbarThemeMac only has access to ScrollbarThemeClient, which is an abstract class.
> 
> Would it be ok to store it in a std::map instead?

Can you add a data member to ScrollbarThemeClient?
Comment 32 Beth Dakin 2012-09-11 12:33:40 PDT
(In reply to comment #31)
> (In reply to comment #30)
> > 
> > Currently ScrollbarThemeMac only has access to ScrollbarThemeClient, which is an abstract class.
> > 
> > Would it be ok to store it in a std::map instead?
> 
> Can you add a data member to ScrollbarThemeClient?

Well, I guess you would still be adding the data to Scrollbar, but with pure virtual accessors on ScrollbarThemeClient. Would that work?
Comment 33 Sailesh Agrawal 2012-09-11 12:34:53 PDT
(In reply to comment #32)
> (In reply to comment #31)
> > (In reply to comment #30)
> > > 
> > > Currently ScrollbarThemeMac only has access to ScrollbarThemeClient, which is an abstract class.
> > > 
> > > Would it be ok to store it in a std::map instead?
> > 
> > Can you add a data member to ScrollbarThemeClient?
> 
> Well, I guess you would still be adding the data to Scrollbar, but with pure virtual accessors on ScrollbarThemeClient. Would that work?

Yep, sounds good. I'll give it a try. Thanks!
Comment 34 Sailesh Agrawal 2012-09-12 17:49:46 PDT
Created attachment 163747 [details]
Patch
Comment 35 Sailesh Agrawal 2012-09-12 17:50:21 PDT
(In reply to comment #32)
> (In reply to comment #31)
> > (In reply to comment #30)
> > > 
> > > Currently ScrollbarThemeMac only has access to ScrollbarThemeClient, which is an abstract class.
> > > 
> > > Would it be ok to store it in a std::map instead?
> > 
> > Can you add a data member to ScrollbarThemeClient?
> 
> Well, I guess you would still be adding the data to Scrollbar, but with pure virtual accessors on ScrollbarThemeClient. Would that work?

Done! Please take another look. Thanks.
Comment 36 Beth Dakin 2012-09-13 15:35:14 PDT
Comment on attachment 163747 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=163747&action=review

Looks good!

> Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm:138
> +        } else {

You should remove the curly braces for the else since it only has only line.
Comment 37 Sailesh Agrawal 2012-09-13 20:23:03 PDT
Created attachment 164038 [details]
Patch for landing
Comment 38 Sailesh Agrawal 2012-09-14 10:30:43 PDT
(In reply to comment #36)
> (From update of attachment 163747 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=163747&action=review
> 
> Looks good!
> 
> > Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm:138
> > +        } else {
> 
> You should remove the curly braces for the else since it only has only line.

Updated patch. Could you c+?

Thanks!
Comment 39 WebKit Review Bot 2012-09-14 11:05:17 PDT
Comment on attachment 164038 [details]
Patch for landing

Rejecting attachment 164038 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2

Last 500 characters of output:
ilter
Hunk #1 succeeded at 154 (offset 1 line).
patching file LayoutTests/ChangeLog
Hunk #1 succeeded at 1 with fuzz 3.
patching file LayoutTests/fast/scrolling/scrollbar-tickmarks-hittest-expected.txt
patching file LayoutTests/fast/scrolling/scrollbar-tickmarks-hittest.html
patching file ChangeLog
Hunk #1 succeeded at 1 with fuzz 3.

Failed to run "[u'/mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply', u'--force', u'--reviewer', u'Beth Dakin']" exit_code: 1 cwd: /mnt/git/webkit-commit-queue

Full output: http://queues.webkit.org/results/13844755
Comment 40 Sailesh Agrawal 2012-09-14 13:30:55 PDT
Created attachment 164215 [details]
Patch for landing
Comment 41 WebKit Review Bot 2012-09-14 13:54:12 PDT
Comment on attachment 164215 [details]
Patch for landing

Attachment 164215 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13852554
Comment 42 Sailesh Agrawal 2012-09-18 13:33:38 PDT
Created attachment 164612 [details]
Patch for landing
Comment 43 WebKit Review Bot 2012-09-18 13:48:00 PDT
Comment on attachment 164612 [details]
Patch for landing

Attachment 164612 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13892308
Comment 44 Peter Beverloo (cr-android ews) 2012-09-18 14:11:29 PDT
Comment on attachment 164612 [details]
Patch for landing

Attachment 164612 [details] did not pass cr-android-ews (chromium-android):
Output: http://queues.webkit.org/results/13900298
Comment 45 Sailesh Agrawal 2012-09-18 15:35:51 PDT
Created attachment 164631 [details]
Patch for landing
Comment 46 Sailesh Agrawal 2012-09-18 15:38:44 PDT
Looks like the changes to CCScrollbarLayerImpl.h requires a 3 sided patch.
+jamesr to confirm
Comment 47 James Robinson 2012-09-18 15:41:41 PDT
I don't think you should need to touch CCScrollbarLayerImpl.  We don't do mouse hit testing on that object at any point.
Comment 48 Sailesh Agrawal 2012-09-18 19:22:37 PDT
Hi Beth, could I get another r+/c+? The try bots are all green now. Thanks!
Comment 49 WebKit Review Bot 2012-09-18 20:38:41 PDT
Comment on attachment 164631 [details]
Patch for landing

Clearing flags on attachment: 164631

Committed r128963: <http://trac.webkit.org/changeset/128963>
Comment 50 WebKit Review Bot 2012-09-18 20:38:47 PDT
All reviewed patches have been landed.  Closing bug.