RESOLVED FIXED 39493
Touch events do not affect the :active CSS state
https://bugs.webkit.org/show_bug.cgi?id=39493
Summary Touch events do not affect the :active CSS state
Ben Murdoch
Reported 2010-05-21 09:04:42 PDT
When using touch events, clicking an element with an active state defined in CSS does not cause a transition into that state. I'm working on a patch for this.
Attachments
Proposed patch and test. (11.92 KB, patch)
2010-05-24 07:36 PDT, Ben Murdoch
no flags
Patch and layout test changes. (11.89 KB, patch)
2010-05-24 07:48 PDT, Ben Murdoch
no flags
Rebased patch / layout test. (10.02 KB, patch)
2010-07-20 05:55 PDT, Ben Murdoch
no flags
Rebased patch / layout test, fixed style error. (9.99 KB, patch)
2010-07-20 06:07 PDT, Ben Murdoch
steveblock: review+
benm: commit-queue-
Use a typedef as suggested. (3.68 KB, patch)
2010-07-21 11:59 PDT, Ben Murdoch
simon.fraser: review-
Patch with typedef. (5.88 KB, patch)
2010-07-21 12:53 PDT, Ben Murdoch
no flags
Ben Murdoch
Comment 1 2010-05-24 07:36:41 PDT
Created attachment 56884 [details] Proposed patch and test.
WebKit Review Bot
Comment 2 2010-05-24 07:41:55 PDT
Attachment 56884 [details] did not pass style-queue: Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1 WebCore/page/EventHandler.cpp:2771: A case label should not be indented, but line up with its switch statement. [whitespace/indent] [4] Total errors found: 1 in 9 files If any of these errors are false positives, please file a bug against check-webkit-style.
Ben Murdoch
Comment 3 2010-05-24 07:48:21 PDT
Created attachment 56886 [details] Patch and layout test changes. Correct style on switch statement.
Ben Murdoch
Comment 4 2010-06-07 05:02:20 PDT
ping .... thoughts anyone? :)
Kim Grönholm
Comment 5 2010-06-08 01:07:59 PDT
Hi Ben and sorry for late reply. I was thinking about the definition of the :active pseudo-class: "•The :active pseudo-class applies while an element is being activated by the user. For example, between the times the user presses the mouse button and releases it. On systems with more than one mouse button, :active applies only to the primary or primary activation button (typically the "left" mouse button), and any aliases thereof." (http://www.w3.org/TR/css3-selectors/#the-user-action-pseudo-classes-hover-act) Should we only do transition to the active state from left mouse button events since those are the ones that actually activate e.g. a link? And then mapping touch events to mouse events on system/whatever level makes the links work and also enable the active state transitions (since eventhandler thinks that left mouse button was used). This is just a thought, what do you think?
Ben Murdoch
Comment 6 2010-06-08 11:57:10 PDT
(In reply to comment #5) Hey Kim, Thanks for the comments. We don't convert the touches on android to mouse events until the touch sequence is complete - i.e. the finger is released again, by which time the active class wouldn't apply anymore. Although they are similar, I don't think mouse and touch events are the same enough to do conversion sooner than this. We don't know the intent of the user's touch until later - were they just meaning to pan the page or perform a long press for the context menu for example (in which case we wouldn't want to trigger links/send mouse events to webcore ... or set the active state). There's a good example of using active on divs with touch handlers at this page: http://xdev.org/anim/browser/ the divs should turn blue while you are touching them. The motivation behind trying to come up with a fix for this is to bring WebKit touch support in line with that of the iPhone :) Cheers, Ben
Kim Grönholm
Comment 7 2010-06-08 12:35:35 PDT
Ah.. Right, that's a good point, I see now :) And it is common not to send the left mouse button press immediately.. This is fine on my behalf.
Ben Murdoch
Comment 8 2010-07-12 03:17:12 PDT
Thanks for taking a look Kim. I suspect that I'll need to rebase this patch now but rather than just uploading a new rebased one I could also make any changes that reviewers suggest at the same time. Any thoughts guys? :) Thanks, Ben
Ben Murdoch
Comment 9 2010-07-20 05:55:51 PDT
Created attachment 62058 [details] Rebased patch / layout test.
WebKit Review Bot
Comment 10 2010-07-20 06:01:13 PDT
Attachment 62058 [details] did not pass style-queue: Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1 WebCore/page/EventHandler.cpp:2857: A case label should not be indented, but line up with its switch statement. [whitespace/indent] [4] Total errors found: 1 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Ben Murdoch
Comment 11 2010-07-20 06:07:29 PDT
Created attachment 62063 [details] Rebased patch / layout test, fixed style error.
Ben Murdoch
Comment 12 2010-07-20 07:26:31 PDT
Hmm, strange that the Mac EWS isn't happy - built fine for me locally. I'm trying a clean build locally to try and see what the problem is.
Ben Murdoch
Comment 13 2010-07-20 08:33:38 PDT
Hmm, built completely fine on my local machine. Perhaps some flakiness in the bot... doesn't seem to provide any extra information other than "fail"...
Steve Block
Comment 14 2010-07-20 08:48:16 PDT
Comment on attachment 62063 [details] Rebased patch / layout test, fixed style error. Kim's the expert here, but given his previous review, r=me
Ben Murdoch
Comment 15 2010-07-21 02:14:47 PDT
Comment on attachment 62063 [details] Rebased patch / layout test, fixed style error. I can't repro the Mac build problem, so going to try landing. Will watch the build pages carefully.
Ben Murdoch
Comment 16 2010-07-21 03:06:34 PDT
Patch landed as r63807; there was a break on Mac (not sure why it didn't repro on my local MacBook build though) and the fix for that break (simple xcodeproj update) landed in r63808.
Simon Fraser (smfr)
Comment 17 2010-07-21 09:55:26 PDT
Using an int for hitType is ugly. This should be a typedef.
Ben Murdoch
Comment 18 2010-07-21 11:59:43 PDT
Created attachment 62215 [details] Use a typedef as suggested.
Ben Murdoch
Comment 19 2010-07-21 12:01:10 PDT
Reopening based on SImon's comments.
Simon Fraser (smfr)
Comment 20 2010-07-21 12:05:19 PDT
Comment on attachment 62215 [details] Use a typedef as suggested. You should use the same type in HitTestRequest, like this: class HitTestRequest { public: enum RequestTypeFlags { ReadOnly = 1 << 1, ... }; typedef unsigned HitTestRequestType; HitTestRequest(HitTestRequestType requestType) ... private: HitTestRequestType m_requestType; } etc.
Ben Murdoch
Comment 21 2010-07-21 12:53:15 PDT
Created attachment 62222 [details] Patch with typedef. I couldn't find anywhere else in WebCore that is using an int/unsigned for this purpose that needed updating. WDYT? Thanks, Ben
Simon Fraser (smfr)
Comment 22 2010-07-21 13:34:53 PDT
Comment on attachment 62222 [details] Patch with typedef. r=me. Thanks for the cleanup!
WebKit Commit Bot
Comment 23 2010-07-22 07:07:33 PDT
Comment on attachment 62222 [details] Patch with typedef. Clearing flags on attachment: 62222 Committed r63888: <http://trac.webkit.org/changeset/63888>
Adam Barth
Comment 24 2010-08-10 22:42:11 PDT
This patch claims to have been landed.
Note You need to log in before you can comment on or make changes to this bug.