Bug 80536

Summary: REGRESSION: When Safari is not frontmost, pages should not get mouse moves or hover
Product: WebKit Reporter: Beth Dakin <bdakin>
Component: UI EventsAssignee: Beth Dakin <bdakin>
Status: RESOLVED FIXED    
Severity: Normal CC: adele, bdakin, jeremya, jeremya, rniwa, simon.fraser
Priority: P2 Keywords: InRadar, Regression
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: OS X 10.7   
Attachments:
Description Flags
Patch
adele: review+
Test none

Description Beth Dakin 2012-03-07 13:33:37 PST
On Lion with legacy-style scrollbars enabled in System Preferences, load http://www.webkit.org/ in a window in Safari, then bring another app to the front, but leave the Safari window visible. Now hover over the Safari window; you'll see that the links show hover feedback. This should not happen; pages in the background should not be able to spy on my mouse movement.

This regressed with http://trac.webkit.org/changeset/101619/trunk which removed code from EventHandler to perform a read only hit test when onlyUpdateScrollbars is true

<rdar://problem/10940970>
Comment 1 Jeremy Apthorp 2012-03-07 14:09:14 PST
Is it possible to add a failing test for this?
Comment 2 Beth Dakin 2012-03-07 14:17:17 PST
(In reply to comment #1)
> Is it possible to add a failing test for this?

Off the top of my head I am not sure how to test this, but there may very well be a way.
Comment 3 Ryosuke Niwa 2012-03-07 14:24:36 PST
(In reply to comment #2)
> (In reply to comment #1)
> > Is it possible to add a failing test for this?
> 
> Off the top of my head I am not sure how to test this, but there may very well be a way.

Can we add layoutTestController or internals method to emulate this situation?
Comment 4 Beth Dakin 2012-03-07 15:15:20 PST
(In reply to comment #3)
> (In reply to comment #2)
> > (In reply to comment #1)
> > > Is it possible to add a failing test for this?
> > 
> > Off the top of my head I am not sure how to test this, but there may very well be a way.
> 
> Can we add layoutTestController or internals method to emulate this situation?

(In reply to comment #3)
> (In reply to comment #2)
> > (In reply to comment #1)
> > > Is it possible to add a failing test for this?
> > 
> > Off the top of my head I am not sure how to test this, but there may very well be a way.
> 
> Can we add layoutTestController or internals method to emulate this situation?

Well the situation should be emulated if you can make a test have legacy style scrollbars (which I think they all do by default still anyway), and if you can make the window the test is in not key. From there, you would want to hover the mouse over something that would normally change if the window were key and test whether or not it changed. I do not know which of these things currently is or is not possible in the tests.
Comment 5 Adele Peterson 2012-04-05 23:06:59 PDT
Jeremy, any progress on resolving this regression?
Comment 6 Jeremy Apthorp 2012-04-17 10:54:00 PDT
Does this also happen on Snow Leopard?
Comment 7 Beth Dakin 2012-04-17 10:58:59 PDT
(In reply to comment #6)
> Does this also happen on Snow Leopard?

No. It affects Lion and post-Lion only.
Comment 8 Beth Dakin 2012-04-19 11:15:32 PDT
Created attachment 137929 [details]
Patch

Unfortunately this is tricky to test in the test harness, but this is the fix.
Comment 9 Adele Peterson 2012-04-19 11:33:36 PDT
Comment on attachment 137929 [details]
Patch

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

> Source/WebCore/ChangeLog:10
> +

extra line here?
Comment 10 Simon Fraser (smfr) 2012-04-19 11:34:46 PDT
Is this testable?
Comment 11 Beth Dakin 2012-04-19 11:52:42 PDT
http://trac.webkit.org/changeset/114661

In answer to Simon's question, so far I have been unsuccessful at creating a test, but it really should be possible. We need a test that has legacy scrollbars with a window that is not key. Then we need hover-able elements, and we need to hover them, and then we need to detect if they changed hover appearance or not. So, lots of moving parts, but it is theoretically possible.
Comment 12 Beth Dakin 2012-04-19 14:29:00 PDT
Ooo, I think I made a test!
Comment 13 Beth Dakin 2012-04-19 14:43:27 PDT
Created attachment 137979 [details]
Test

Test!
Comment 14 Beth Dakin 2012-04-19 14:47:14 PDT
Comment on attachment 137979 [details]
Test

nm, this fails in WK2