Title: [167700] trunk/Source
Revision
167700
Author
rn...@webkit.org
Date
2014-04-22 23:11:22 -0700 (Tue, 22 Apr 2014)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (167699 => 167700)


--- trunk/Source/WebCore/ChangeLog	2014-04-23 05:59:34 UTC (rev 167699)
+++ trunk/Source/WebCore/ChangeLog	2014-04-23 06:11:22 UTC (rev 167700)
@@ -1,3 +1,19 @@
+2014-04-22  Ryosuke Niwa  <rn...@webkit.org>
+
+        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.
+
+        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):
+
 2014-04-22  Zalan Bujtas  <za...@apple.com>
 
         Do not paint border image when the border rect is empty.

Modified: trunk/Source/WebCore/page/EventHandler.cpp (167699 => 167700)


--- trunk/Source/WebCore/page/EventHandler.cpp	2014-04-23 05:59:34 UTC (rev 167699)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2014-04-23 06:11:22 UTC (rev 167700)
@@ -1311,10 +1311,7 @@
 #endif
 
     Node* node = result.targetNode();
-    if (!node)
-        return NoCursorChange;
-
-    auto renderer = node->renderer();
+    auto renderer = node ? node->renderer() : 0;
     RenderStyle* style = renderer ? &renderer->style() : nullptr;
     bool horizontalText = !style || style->isHorizontalWritingMode();
     const Cursor& iBeam = horizontalText ? iBeamCursor() : verticalTextCursor();
@@ -1386,7 +1383,7 @@
 
     switch (style ? style->cursor() : CURSOR_AUTO) {
     case CURSOR_AUTO: {
-        bool editable = node->hasEditableStyle();
+        bool editable = node && node->hasEditableStyle();
 
         if (useHandCursor(node, result.isOverLink(), shiftKey))
             return handCursor();

Modified: trunk/Source/WebKit/mac/ChangeLog (167699 => 167700)


--- trunk/Source/WebKit/mac/ChangeLog	2014-04-23 05:59:34 UTC (rev 167699)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-04-23 06:11:22 UTC (rev 167700)
@@ -1,3 +1,21 @@
+2014-04-22  Ryosuke Niwa  <rn...@webkit.org>
+
+        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.
+
+        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):
+
 2014-04-22  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r167674.

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm (167699 => 167700)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm	2014-04-23 05:59:34 UTC (rev 167699)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm	2014-04-23 06:11:22 UTC (rev 167700)
@@ -773,12 +773,9 @@
         return;
 
     NSWindow *window = [m_webView window];
-    if (!window)
+    if (!window || ![window isKeyWindow])
         return;
 
-    if ([window windowNumber] != [NSWindow windowNumberAtPoint:[NSEvent mouseLocation] belowWindowWithWindowNumber:0])
-        return;
-
     NSCursor *platformCursor = cursor.platformCursor();
     if ([NSCursor currentCursor] == platformCursor)
         return;

Modified: trunk/Source/WebKit2/ChangeLog (167699 => 167700)


--- trunk/Source/WebKit2/ChangeLog	2014-04-23 05:59:34 UTC (rev 167699)
+++ trunk/Source/WebKit2/ChangeLog	2014-04-23 06:11:22 UTC (rev 167700)
@@ -1,3 +1,21 @@
+2014-04-22  Ryosuke Niwa  <rn...@webkit.org>
+
+        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.
+
+        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):
+
 2014-04-22  Yongjun Zhang  <yongjun_zh...@apple.com>
 
         Add SPI to expose provisional URL from Frame.

Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (167699 => 167700)


--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2014-04-23 05:59:34 UTC (rev 167699)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2014-04-23 06:11:22 UTC (rev 167700)
@@ -324,12 +324,9 @@
         return;
 
     NSWindow *window = [m_wkView window];
-    if (!window)
+    if (!window || ![window isKeyWindow])
         return;
 
-    if ([window windowNumber] != [NSWindow windowNumberAtPoint:[NSEvent mouseLocation] belowWindowWithWindowNumber:0])
-        return;
-
     NSCursor *platformCursor = cursor.platformCursor();
     if ([NSCursor currentCursor] == platformCursor)
         return;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to