Title: [167547] trunk/Source
Revision
167547
Author
[email protected]
Date
2014-04-19 14:11:06 -0700 (Sat, 19 Apr 2014)

Log Message

[Mac] WebView adjusts the cursor even when another window is in front
https://bugs.webkit.org/show_bug.cgi?id=131898
rdar://problem/14619911

Reviewed by Dan Bernstein.

Source/WebKit/mac:
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::setCursor): Added a check that the window is under the cursor
and do nothing if it's not.

Source/WebKit2:
* UIProcess/API/mac/WKView.mm:
(-[WKView _setCursor:]): Deleted. Moved the code all into PageClientImpl, since none of it
interacts with anything special about a WKView.

* UIProcess/API/mac/WKViewInternal.h: Deleted the _setCursor: method.

* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::setCursor): Added a check that the window is under the cursor
and do nothing if it's not.

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (167546 => 167547)


--- trunk/Source/WebKit/mac/ChangeLog	2014-04-19 20:41:16 UTC (rev 167546)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-04-19 21:11:06 UTC (rev 167547)
@@ -1,3 +1,15 @@
+2014-04-19  Darin Adler  <[email protected]>
+
+        [Mac] WebView adjusts the cursor even when another window is in front
+        https://bugs.webkit.org/show_bug.cgi?id=131898
+        rdar://problem/14619911
+
+        Reviewed by Dan Bernstein.
+
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::setCursor): Added a check that the window is under the cursor
+        and do nothing if it's not.
+
 2014-04-18  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r167527.

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm (167546 => 167547)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm	2014-04-19 20:41:16 UTC (rev 167546)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm	2014-04-19 21:11:06 UTC (rev 167547)
@@ -761,14 +761,28 @@
 }
 
 #if !PLATFORM(IOS)
+
 void WebChromeClient::setCursor(const WebCore::Cursor& cursor)
 {
+    // FIXME: Would be nice to share this code with WebKit2's PageClientImpl.
+
     if ([NSApp _cursorRectCursor])
         return;
 
+    if (!m_webView)
+        return;
+
+    NSWindow *window = [m_webView window];
+    if (!window)
+        return;
+
+    if ([window windowNumber] != [NSWindow windowNumberAtPoint:[NSEvent mouseLocation] belowWindowWithWindowNumber:0])
+        return;
+
     NSCursor *platformCursor = cursor.platformCursor();
     if ([NSCursor currentCursor] == platformCursor)
         return;
+
     [platformCursor set];
 }
 
@@ -776,6 +790,7 @@
 {
     [NSCursor setHiddenUntilMouseMoves:hiddenUntilMouseMoves];
 }
+
 #endif
 
 KeyboardUIMode WebChromeClient::keyboardUIMode()

Modified: trunk/Source/WebKit2/ChangeLog (167546 => 167547)


--- trunk/Source/WebKit2/ChangeLog	2014-04-19 20:41:16 UTC (rev 167546)
+++ trunk/Source/WebKit2/ChangeLog	2014-04-19 21:11:06 UTC (rev 167547)
@@ -1,3 +1,21 @@
+2014-04-19  Darin Adler  <[email protected]>
+
+        [Mac] WebView adjusts the cursor even when another window is in front
+        https://bugs.webkit.org/show_bug.cgi?id=131898
+        rdar://problem/14619911
+
+        Reviewed by Dan Bernstein.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _setCursor:]): Deleted. Moved the code all into PageClientImpl, since none of it
+        interacts with anything special about a WKView.
+
+        * UIProcess/API/mac/WKViewInternal.h: Deleted the _setCursor: method.
+
+        * UIProcess/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::setCursor): Added a check that the window is under the cursor
+        and do nothing if it's not.
+
 2014-04-19  Dan Bernstein  <[email protected]>
 
         Use XPC services in the iOS Simulator, but not in Mountain Lion

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (167546 => 167547)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2014-04-19 20:41:16 UTC (rev 167546)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2014-04-19 21:11:06 UTC (rev 167547)
@@ -2775,13 +2775,6 @@
         [self _updateWindowAndViewFrames];
 }
 
-- (void)_setCursor:(NSCursor *)cursor
-{
-    if ([NSCursor currentCursor] == cursor)
-        return;
-    [cursor set];
-}
-
 - (void)_setUserInterfaceItemState:(NSString *)commandName enabled:(BOOL)isEnabled state:(int)newState
 {
     ValidationVector items = _data->_validationMap.take(commandName);

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (167546 => 167547)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h	2014-04-19 20:41:16 UTC (rev 167546)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h	2014-04-19 21:11:06 UTC (rev 167547)
@@ -71,7 +71,6 @@
 - (void)_didRelaunchProcess;
 - (void)_preferencesDidChange;
 - (void)_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip;
-- (void)_setCursor:(NSCursor *)cursor;
 - (void)_setUserInterfaceItemState:(NSString *)commandName enabled:(BOOL)isEnabled state:(int)newState;
 - (void)_doneWithKeyEvent:(NSEvent *)event eventWasHandled:(BOOL)eventWasHandled;
 - (bool)_executeSavedCommandBySelector:(SEL)selector;

Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (167546 => 167547)


--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2014-04-19 20:41:16 UTC (rev 167546)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2014-04-19 21:11:06 UTC (rev 167547)
@@ -315,8 +315,26 @@
 
 void PageClientImpl::setCursor(const WebCore::Cursor& cursor)
 {
-    if (![NSApp _cursorRectCursor])
-        [m_wkView _setCursor:cursor.platformCursor()];
+    // FIXME: Would be nice to share this code with WebKit1's WebChromeClient.
+
+    if ([NSApp _cursorRectCursor])
+        return;
+
+    if (!m_wkView)
+        return;
+
+    NSWindow *window = [m_wkView window];
+    if (!window)
+        return;
+
+    if ([window windowNumber] != [NSWindow windowNumberAtPoint:[NSEvent mouseLocation] belowWindowWithWindowNumber:0])
+        return;
+
+    NSCursor *platformCursor = cursor.platformCursor();
+    if ([NSCursor currentCursor] == platformCursor)
+        return;
+
+    [platformCursor set];
 }
 
 void PageClientImpl::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to