WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
57206
Don't apply :hover to elements that are :active, but don't contain the mouse
https://bugs.webkit.org/show_bug.cgi?id=57206
Summary
Don't apply :hover to elements that are :active, but don't contain the mouse
Shane Stephens
Reported
2011-03-27 22:58:05 PDT
Created
attachment 87101
[details]
test case for bug Content which has a :hover:active and an :active rule applied to it does not switch from the :hover:active state to the :active state when the mouse button is clicked while hovered over the content and then dragged out. the attached test case demonstrates this behaviour. A minimal reproduction is: <style> #button:hover:active {background: green;} #button:active {background: blue;} </style> <div id="button">Div button is div</div> After after clicking on this button, the background is (correctly) green, however on drag-out the background should be blue but remains green. Affects: Chrome 10, Safari 5 Does not affect: Firefox 4
Attachments
test case for bug
(411 bytes, text/html)
2011-03-27 22:58 PDT
,
Shane Stephens
no flags
Details
Patch
(6.43 KB, patch)
2011-07-11 22:32 PDT
,
Jeremy Apthorp
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ec2-cr-linux-03
(1.29 MB, application/zip)
2011-07-11 23:00 PDT
,
WebKit Review Bot
no flags
Details
Patch
(6.49 KB, patch)
2011-07-12 00:39 PDT
,
Jeremy Apthorp
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ec2-cr-linux-03
(1.33 MB, application/zip)
2011-07-12 00:56 PDT
,
WebKit Review Bot
no flags
Details
Patch
(6.30 KB, patch)
2011-07-17 21:29 PDT
,
Jeremy Apthorp
no flags
Details
Formatted Diff
Diff
Patch
(6.71 KB, patch)
2011-08-01 18:13 PDT
,
Jeremy Apthorp
no flags
Details
Formatted Diff
Diff
Patch
(7.33 KB, patch)
2011-09-12 12:00 PDT
,
Jeremy Apthorp
no flags
Details
Formatted Diff
Diff
Patch
(8.37 KB, patch)
2011-11-15 19:43 PST
,
Jeremy Apthorp
no flags
Details
Formatted Diff
Diff
Patch
(8.33 KB, patch)
2011-11-28 21:48 PST
,
Jeremy Apthorp
no flags
Details
Formatted Diff
Diff
Patch
(8.58 KB, patch)
2011-11-30 20:52 PST
,
Jeremy Apthorp
no flags
Details
Formatted Diff
Diff
Patch
(10.63 KB, patch)
2011-12-11 21:03 PST
,
Jeremy Apthorp
no flags
Details
Formatted Diff
Diff
Patch
(10.68 KB, patch)
2011-12-11 21:38 PST
,
Jeremy Apthorp
no flags
Details
Formatted Diff
Diff
Show Obsolete
(9)
View All
Add attachment
proposed patch, testcase, etc.
Kulanthaivel Palanichamy
Comment 1
2011-05-27 11:58:43 PDT
When the mouse button is pressed and dragged out, the mouse event HitTestRequest is explicitly made HitTestRequest::ReadOnly expecting some selection to happen as a result of this drag. So there won't any style change due to hover/active state change at this event. EventHandler.cpp, EventHandler::handleMouseMoveEvent() // Treat mouse move events while the mouse is pressed as "read-only" in prepareMouseEvent // if we are allowed to select. // This means that :hover and :active freeze in the state they were in when the mouse // was pressed, rather than updating for nodes the mouse moves over as you hold the mouse down. HitTestRequest::HitTestRequestType hitType = HitTestRequest::MouseMove; if (m_mousePressed && m_mouseDownMayStartSelect) hitType |= HitTestRequest::ReadOnly; if (m_mousePressed) hitType |= HitTestRequest::Active;
Shane Stephens
Comment 2
2011-07-04 18:16:04 PDT
It's not clear from the specification whether Firefox's behavior is correct, or Chrome/Safari's is. I'll request clarification from the CSSWG.
Shane Stephens
Comment 3
2011-07-06 18:32:44 PDT
From Tab Atkins on www-style@: "We defer to the host language to define what those actually mean, which HTML does in <
http://www.whatwg.org/specs/web-apps/current-work/complete/links.html#pseudo-classes
>. Webkit's doing it wrong." So we should fix this :)
Jeremy Apthorp
Comment 4
2011-07-11 22:32:56 PDT
Created
attachment 100438
[details]
Patch
WebKit Review Bot
Comment 5
2011-07-11 23:00:32 PDT
Comment on
attachment 100438
[details]
Patch
Attachment 100438
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/9018055
New failing tests: http/tests/misc/slow-loading-mask.html editing/pasteboard/drop-text-without-selection.html svg/transforms/text-with-mask-with-svg-transform.svg fast/blockflow/japanese-rl-selection.html fast/backgrounds/background-leakage.html fast/box-shadow/scaled-box-shadow.html fast/backgrounds/repeat/negative-offset-repeat.html svg/W3C-SVG-1.1/struct-use-01-t.svg transforms/2d/hindi-rotated.html svg/repaint/filter-repaint.svg fast/blockflow/japanese-lr-selection.html
WebKit Review Bot
Comment 6
2011-07-11 23:00:37 PDT
Created
attachment 100441
[details]
Archive of layout-test-results from ec2-cr-linux-03 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-03 Port: Chromium Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Jeremy Apthorp
Comment 7
2011-07-12 00:39:40 PDT
Created
attachment 100444
[details]
Patch
WebKit Review Bot
Comment 8
2011-07-12 00:56:25 PDT
Comment on
attachment 100444
[details]
Patch
Attachment 100444
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/9036001
New failing tests: http/tests/misc/slow-loading-mask.html editing/pasteboard/drop-text-without-selection.html svg/transforms/text-with-mask-with-svg-transform.svg fast/blockflow/japanese-rl-selection.html fast/backgrounds/background-leakage.html fast/box-shadow/scaled-box-shadow.html fast/backgrounds/repeat/negative-offset-repeat.html svg/W3C-SVG-1.1/struct-use-01-t.svg transforms/2d/hindi-rotated.html svg/repaint/filter-repaint.svg fast/blockflow/japanese-lr-selection.html
WebKit Review Bot
Comment 9
2011-07-12 00:56:29 PDT
Created
attachment 100446
[details]
Archive of layout-test-results from ec2-cr-linux-03 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-03 Port: Chromium Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Jeremy Apthorp
Comment 10
2011-07-17 21:29:34 PDT
Created
attachment 101124
[details]
Patch
Jeremy Apthorp
Comment 11
2011-07-19 18:02:52 PDT
Short patch-- Simon/Eric, I'm told you guys know this code :)
Ryosuke Niwa
Comment 12
2011-07-20 21:48:50 PDT
+darin because the line being deleted was added by
http://trac.webkit.org/changeset/5343
. +hyatt since he appears to be the reviewer for that patch.
Darin Adler
Comment 13
2011-07-22 07:37:45 PDT
Comment on
attachment 101124
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=101124&action=review
> Source/WebCore/page/EventHandler.cpp:-1600 > - // This means that :hover and :active freeze in the state they were in when the mouse > - // was pressed, rather than updating for nodes the mouse moves over as you hold the mouse down.
Here is the bug I was fixing 8 years ago with this change: 1. go to www.google.com (or probably any page) 2. Press on one of the underlined links (e.g. "Advertise with Us") Note that the pressed-link feedback appears but then vanishes an instant later, though the mouse is still down over the link. Releasing the mouse in this state looks like it will do nothing, since the link isn't drawn highlighted, but in fact it visits the link.
Jeremy Apthorp
Comment 14
2011-07-24 17:18:20 PDT
(In reply to
comment #13
)
> (From update of
attachment 101124
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=101124&action=review
> > > Source/WebCore/page/EventHandler.cpp:-1600 > > - // This means that :hover and :active freeze in the state they were in when the mouse > > - // was pressed, rather than updating for nodes the mouse moves over as you hold the mouse down. > > Here is the bug I was fixing 8 years ago with this change: > > 1. go to www.google.com (or probably any page) > 2. Press on one of the underlined links (e.g. "Advertise with Us") > > Note that the pressed-link feedback appears but then vanishes an instant later, though the mouse is still down over the link. Releasing the mouse in this state looks like it will do nothing, since the link isn't drawn highlighted, but in fact it visits the link.
I can't see any difference in behaviour between a tip of tree Mac Chromium with my patch applied and Chrome 12 when I follow those steps. I presume the bug has been fixed elsewhere? I'm not sure I could write a test for this, since I don't know how to get it to fail (and DumpRenderTree's event handling is still a bit of a mystery to me...) (recent google.com front pages don't appear to have a different style for :active links, so I used
http://google.com/privacy
to test)
Darin Adler
Comment 15
2011-07-24 17:29:16 PDT
You may have to test with Safari instead, since Chrome did not exist back when I fixed this bug. Chrome may do something differently.
Jeremy Apthorp
Comment 16
2011-07-24 17:46:03 PDT
I can't reproduce it in Safari either.
Jeremy Apthorp
Comment 17
2011-07-24 20:48:39 PDT
(In reply to
comment #16
)
> I can't reproduce it in Safari either.
To clarify: I built WebKit with my patch applied and ran it with ./Tools/Scripts/run-webkit, and couldn't see any difference between the patched Safari and Safari 5.0.5.
Darin Adler
Comment 18
2011-07-25 14:52:27 PDT
Sounds like bug that was the original reason for doing this is gone.
Jeremy Apthorp
Comment 19
2011-08-01 18:13:56 PDT
Created
attachment 102605
[details]
Patch
Eric Seidel (no email)
Comment 20
2011-09-09 11:48:17 PDT
Comment on
attachment 102605
[details]
Patch You'll need ChangeLogs if you want this reviewed. :( see
http://www.webkit.org/coding/contributing.html
Or use webkit-patch upload (it will prompt you to create the ChangeLogs). The ChangeLogs would explain what your doing and why (for posterity as well as for reviewers when reviewing your patch).
Simon Fraser (smfr)
Comment 21
2011-09-09 15:29:17 PDT
The title of this bug should be more explicit about the actual issue.
Jeremy Apthorp
Comment 22
2011-09-12 12:00:12 PDT
Created
attachment 107071
[details]
Patch
Jeremy Apthorp
Comment 23
2011-09-12 12:20:32 PDT
I did use webkit-patch upload... it doesn't prompt me for a LayoutTests/ ChangeLog update. (There's already a Source/WebCore ChangeLog update in here.) Strange! Anyway, I've uploaded a new patch with updated changelogs.
Darin Adler
Comment 24
2011-09-12 16:30:57 PDT
Comment on
attachment 107071
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=107071&action=review
> LayoutTests/ChangeLog:10 > + * fast/css/hover-active-drag.html: Added.
Does this single test case cover all the branches in all the changes? If you leave each part of your patch out, does a test fail?
> LayoutTests/fast/css/hover-active-drag.html:32 > + var background = window.getComputedStyle(box, null).getPropertyValue("background-color")
For future reference, you typically only need "window." when you are accessing something that might not be defined. You can just call getComputedStyle without the window. part.
Jeremy Apthorp
Comment 25
2011-11-15 19:43:35 PST
Created
attachment 115303
[details]
Patch
Jeremy Apthorp
Comment 26
2011-11-15 19:44:29 PST
(In reply to
comment #24
)
> (From update of
attachment 107071
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=107071&action=review
> > > LayoutTests/ChangeLog:10 > > + * fast/css/hover-active-drag.html: Added. > > Does this single test case cover all the branches in all the changes? If you leave each part of your patch out, does a test fail?
With the most recent patch, yes.
> > LayoutTests/fast/css/hover-active-drag.html:32 > > + var background = window.getComputedStyle(box, null).getPropertyValue("background-color") > > For future reference, you typically only need "window." when you are accessing something that might not be defined. You can just call getComputedStyle without the window. part.
Done.
Ryosuke Niwa
Comment 27
2011-11-28 17:07:00 PST
Comment on
attachment 115303
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=115303&action=review
Looks sane. Please fix the nits before you land.
> Source/WebCore/ChangeLog:4 > + When the mouse is dragged out of an :active element, it should lose > + :hover.
Please fit these two lines in one line to avoid the awkward line break.
> Source/WebCore/ChangeLog:13 > + (WebCore::EventHandler::handleMouseMoveEvent): > + Don't mark mouse-drag hit tests read-only, since they no longer are.
We typically put the description after : followed by one space.
> Source/WebCore/ChangeLog:15 > + (WebCore::EventHandler::dragSourceEndedAt): > + Send a hit test request when the mouse goes up after a drag, so
Ditto.
> Source/WebCore/ChangeLog:19 > + (WebCore::RenderLayer::updateHoverActiveState): > + Only allow the :active state to change on mouse down or mouse up.
Ditto.
> LayoutTests/ChangeLog:4 > + When the mouse is dragged out of an :active element, it should lose > + :hover.
Ditto.
Jeremy Apthorp
Comment 28
2011-11-28 21:48:17 PST
Created
attachment 116888
[details]
Patch
Jeremy Apthorp
Comment 29
2011-11-28 21:49:47 PST
(In reply to
comment #27
)
> (From update of
attachment 115303
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=115303&action=review
> > Looks sane. Please fix the nits before you land. > > > Source/WebCore/ChangeLog:4 > > + When the mouse is dragged out of an :active element, it should lose > > + :hover. > > Please fit these two lines in one line to avoid the awkward line break.
Done.
> > Source/WebCore/ChangeLog:13 > > + (WebCore::EventHandler::handleMouseMoveEvent): > > + Don't mark mouse-drag hit tests read-only, since they no longer are. > > We typically put the description after : followed by one space.
Done, though it looks like that varies wildly.
> > Source/WebCore/ChangeLog:15 > > + (WebCore::EventHandler::dragSourceEndedAt): > > + Send a hit test request when the mouse goes up after a drag, so > > Ditto.
Done.
> > Source/WebCore/ChangeLog:19 > > + (WebCore::RenderLayer::updateHoverActiveState): > > + Only allow the :active state to change on mouse down or mouse up. > > Ditto.
Done.
> > LayoutTests/ChangeLog:4 > > + When the mouse is dragged out of an :active element, it should lose > > + :hover. > > Ditto.
Done.
WebKit Review Bot
Comment 30
2011-11-30 18:12:44 PST
Comment on
attachment 116888
[details]
Patch Rejecting
attachment 116888
[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: rce/WebCore/rendering/RenderLayer.cpp Hunk #1 succeeded at 3951 (offset 15 lines). Hunk #2 succeeded at 3970 (offset 15 lines). Hunk #3 succeeded at 4015 (offset 15 lines). patching file LayoutTests/ChangeLog Hunk #1 succeeded at 1 with fuzz 3. patching file LayoutTests/fast/css/hover-active-drag-expected.txt patching file LayoutTests/fast/css/hover-active-drag.html Failed to run "[u'/mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply', u'--reviewer', u'Ryosuke Niwa', u'--for..." exit_code: 1 Full output:
http://queues.webkit.org/results/10697385
Jeremy Apthorp
Comment 31
2011-11-30 20:52:50 PST
Created
attachment 117321
[details]
Patch
WebKit Review Bot
Comment 32
2011-11-30 23:21:14 PST
Comment on
attachment 117321
[details]
Patch Clearing flags on attachment: 117321 Committed
r101619
: <
http://trac.webkit.org/changeset/101619
>
WebKit Review Bot
Comment 33
2011-11-30 23:21:26 PST
All reviewed patches have been landed. Closing bug.
Eric Seidel (no email)
Comment 34
2011-12-02 13:03:43 PST
This is causing a failure on lion:
http://build.webkit.org/results/Lion%20Intel%20Release%20(Tests)/r101621%20(3109)/fast/css/hover-active-drag-pretty-diff.html
Jeremy Apthorp
Comment 35
2011-12-11 21:03:46 PST
Reopening to attach new patch.
Jeremy Apthorp
Comment 36
2011-12-11 21:03:53 PST
Created
attachment 118727
[details]
Patch
Ryosuke Niwa
Comment 37
2011-12-11 21:15:28 PST
Comment on
attachment 118727
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=118727&action=review
> LayoutTests/fast/css/hover-active-drag.html:38 > + // This mouse click seems to be required for WebKit's event handling to > + // pick up the :hover class. > + eventSender.mouseDown() > + eventSender.mouseUp()
This doesn't look right. We should fix this bug first.
Jeremy Apthorp
Comment 38
2011-12-11 21:38:47 PST
Created
attachment 118732
[details]
Patch
WebKit Review Bot
Comment 39
2011-12-12 15:51:20 PST
Comment on
attachment 118732
[details]
Patch Clearing flags on attachment: 118732 Committed
r102632
: <
http://trac.webkit.org/changeset/102632
>
WebKit Review Bot
Comment 40
2011-12-12 15:51:31 PST
All reviewed patches have been landed. Closing bug.
Simon Fraser (smfr)
Comment 41
2012-02-27 15:16:25 PST
This caused pages in background Safari windows to continue to respond to hover, which is bad.
Beth Dakin
Comment 42
2012-03-07 13:35:39 PST
This patch caused a regression:
https://bugs.webkit.org/show_bug.cgi?id=80536
Adele Peterson
Comment 43
2012-04-14 10:58:32 PDT
Should we consider rolling this out?
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug