Cursor doesn't change back to pointer when leaving the Safari window
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Apr 2014 06:11:22 +0000 (06:11 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Apr 2014 06:11:22 +0000 (06:11 +0000)
commit8dfe4fd5748be8fc5a48eca7e8b685f895254c07
tree11bf4d416f84b0025a9f713d76637099bceedecf
parentd538f03df9ca5a74cbb5283add76d698ad5d8490
Cursor doesn't change back to pointer when leaving the Safari window
https://bugs.webkit.org/show_bug.cgi?id=132038

Reviewed by Alexey Proskuryakov.

Source/WebCore:
r147739 incorrectly added an early exit in EventHandler::selectCursor when hit test result didn't have
any node associated with it. Since we will hit this code when the cursor is outside of the WebView,
we still need to take the CURSOR_AUTO path as did the code before r147739.

No new test is added since this behavior can't be tested in DRT or WTR.

* page/EventHandler.cpp:
(WebCore::EventHandler::selectCursor):

Source/WebKit/mac:
Since the cursor type is now updated asynchronously after r147739,
[window windowNumber] != [NSWindow windowNumberAtPoint:[NSEvent mouseLocation] belowWindowWithWindowNumber:0]
evalutes to false depending on how fast cursor is moving.

Instead, check whether the NSWindow of the WebView is the key window or not since
key window appears to control the cursor style in Cocoa as far as I've tested:
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/WinPanel/Concepts/ChangingMainKeyWindow.html

* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::setCursor):

Source/WebKit2:
Since the cursor type is now updated asynchronously after r147739,
[window windowNumber] != [NSWindow windowNumberAtPoint:[NSEvent mouseLocation] belowWindowWithWindowNumber:0]
evalutes to false depending on how fast cursor is moving.

Instead, check whether the NSWindow of the WebView is the key window or not since
key window appears to control the cursor style in Cocoa as far as I've tested:
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/WinPanel/Concepts/ChangingMainKeyWindow.html

* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::setCursor):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167700 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/page/EventHandler.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/mac/PageClientImpl.mm