Title: [195451] trunk/Source
Revision
195451
Author
[email protected]
Date
2016-01-22 08:50:17 -0800 (Fri, 22 Jan 2016)

Log Message

[Mac] Tooltips do not honor some types of obscuring windows
https://bugs.webkit.org/show_bug.cgi?id=153263
<rdar://problem/21423972>

Reviewed by Simon Fraser.

Source/WebKit/mac:

* WebView/WebHTMLView.mm:
(-[WebHTMLView _updateMouseoverWithEvent:]): When the WebView is not the key window, don't
display tooltips.

Source/WebKit2:

Recognize that the current WebView is obscured by comparing the current event's Window Number against
the Window Number of the current WebView. If they don't match, something is in the way.

* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::windowIsFrontWindowUnderMouse): Added.
* UIProcess/PageClient.h:
(WebKit::PageClient::windowIsFrontWindowUnderMouse):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleMouseEvent): Check if the current WebView is obscured. If it
is, clear the tooltip and return.
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::windowIsFrontWindowUnderMouse): Added.

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (195450 => 195451)


--- trunk/Source/WebKit/mac/ChangeLog	2016-01-22 14:51:16 UTC (rev 195450)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-01-22 16:50:17 UTC (rev 195451)
@@ -1,3 +1,15 @@
+2016-01-21  Brent Fulgham  <[email protected]>
+
+        [Mac] Tooltips do not honor some types of obscuring windows
+        https://bugs.webkit.org/show_bug.cgi?id=153263
+        <rdar://problem/21423972>
+
+        Reviewed by Simon Fraser.
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _updateMouseoverWithEvent:]): When the WebView is not the key window, don't
+        display tooltips.
+
 2016-01-19  Ada Chan  <[email protected]>
 
         Make it possible to enable VIDEO_PRESENTATION_MODE on other Cocoa platforms.

Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (195450 => 195451)


--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2016-01-22 14:51:16 UTC (rev 195450)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2016-01-22 16:50:17 UTC (rev 195451)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2005-2010, 2016 Apple Inc. All rights reserved.
  *           (C) 2006, 2007 Graham Dennis ([email protected])
  *
  * Redistribution and use in source and binary forms, with or without
@@ -2136,8 +2136,10 @@
 #endif
                 ) {
                 coreFrame->eventHandler().mouseMoved(event, [[self _webView] _pressureEvent]);
-            } else
+            } else {
+                [self removeAllToolTips];
                 coreFrame->eventHandler().passMouseMovedEventToScrollbars(event, [[self _webView] _pressureEvent]);
+            }
         }
 
         [view release];

Modified: trunk/Source/WebKit2/ChangeLog (195450 => 195451)


--- trunk/Source/WebKit2/ChangeLog	2016-01-22 14:51:16 UTC (rev 195450)
+++ trunk/Source/WebKit2/ChangeLog	2016-01-22 16:50:17 UTC (rev 195451)
@@ -1,3 +1,26 @@
+2016-01-21  Brent Fulgham  <[email protected]>
+
+        [Mac] Tooltips do not honor some types of obscuring windows
+        https://bugs.webkit.org/show_bug.cgi?id=153263
+        <rdar://problem/21423972>
+
+        Reviewed by Simon Fraser.
+
+        Recognize that the current WebView is obscured by comparing the current event's Window Number against
+        the Window Number of the current WebView. If they don't match, something is in the way.
+
+        * UIProcess/Cocoa/WebViewImpl.h:
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::windowIsFrontWindowUnderMouse): Added.
+        * UIProcess/PageClient.h:
+        (WebKit::PageClient::windowIsFrontWindowUnderMouse):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::handleMouseEvent): Check if the current WebView is obscured. If it
+        is, clear the tooltip and return.
+        * UIProcess/mac/PageClientImpl.h:
+        * UIProcess/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::windowIsFrontWindowUnderMouse): Added.
+
 2016-01-22  Youenn Fablet  <[email protected]>
 
         Remove PassRefPtr from ResourceRequest and FormData

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h (195450 => 195451)


--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h	2016-01-22 14:51:16 UTC (rev 195450)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h	2016-01-22 16:50:17 UTC (rev 195451)
@@ -478,6 +478,8 @@
     void showCandidates(NSArray *candidates, NSString *, NSRect rectOfTypedString, NSView *, void (^completionHandler)(NSTextCheckingResult *acceptedCandidate));
     void webViewImplAdditionsWillDestroyView();
 
+    bool windowIsFrontWindowUnderMouse(NSEvent *);
+
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 && USE(APPLE_INTERNAL_SDK)
 #import <WebKitAdditions/WebViewImplAdditions.h>
 #endif

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm (195450 => 195451)


--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm	2016-01-22 14:51:16 UTC (rev 195450)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm	2016-01-22 16:50:17 UTC (rev 195451)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -3972,6 +3972,15 @@
     mouseDraggedInternal(event);
 }
 
+bool WebViewImpl::windowIsFrontWindowUnderMouse(NSEvent *event)
+{
+    NSRect eventScreenPosition = [m_view.window convertRectToScreen:NSMakeRect(event.locationInWindow.x, event.locationInWindow.y, 0, 0)];
+    NSInteger eventWindowNumber = [NSWindow windowNumberAtPoint:eventScreenPosition.origin belowWindowWithWindowNumber:0];
+        
+    return m_view.window.windowNumber != eventWindowNumber;
+}
+
+    
 } // namespace WebKit
 
 #endif // PLATFORM(MAC)

Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (195450 => 195451)


--- trunk/Source/WebKit2/UIProcess/PageClient.h	2016-01-22 14:51:16 UTC (rev 195450)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h	2016-01-22 16:50:17 UTC (rev 195451)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -59,6 +59,7 @@
 
 class DrawingAreaProxy;
 class NativeWebKeyboardEvent;
+class NativeWebMouseEvent;
 class RemoteLayerTreeTransaction;
 class ViewSnapshot;
 class WebContextMenuProxy;
@@ -357,6 +358,8 @@
 #endif
 
     virtual void didRestoreScrollPosition() = 0;
+
+    virtual bool windowIsFrontWindowUnderMouse(const NativeWebMouseEvent&) { return false; }
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (195450 => 195451)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-01-22 14:51:16 UTC (rev 195450)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-01-22 16:50:17 UTC (rev 195451)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010, 2011, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2015-2016 Apple Inc. All rights reserved.
  * Copyright (C) 2012 Intel Corporation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -1667,6 +1667,9 @@
     if (!isValid())
         return;
 
+    if (m_pageClient.windowIsFrontWindowUnderMouse(event))
+        setToolTip(String());
+
     // NOTE: This does not start the responsiveness timer because mouse move should not indicate interaction.
     if (event.type() != WebEvent::MouseMove)
         m_process->responsivenessTimer().start();

Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (195450 => 195451)


--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2016-01-22 14:51:16 UTC (rev 195450)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2016-01-22 16:50:17 UTC (rev 195451)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -239,6 +239,7 @@
     virtual void derefView() override;
 
     virtual void didRestoreScrollPosition() override;
+    virtual bool windowIsFrontWindowUnderMouse(const NativeWebMouseEvent&) override;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (195450 => 195451)


--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2016-01-22 14:51:16 UTC (rev 195450)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2016-01-22 16:50:17 UTC (rev 195451)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -34,6 +34,7 @@
 #import "DownloadProxy.h"
 #import "NativeWebGestureEvent.h"
 #import "NativeWebKeyboardEvent.h"
+#import "NativeWebMouseEvent.h"
 #import "NativeWebWheelEvent.h"
 #import "NavigationState.h"
 #import "StringUtilities.h"
@@ -830,6 +831,11 @@
     m_impl->didRestoreScrollPosition();
 }
 
+bool PageClientImpl::windowIsFrontWindowUnderMouse(const NativeWebMouseEvent& event)
+{
+    return m_impl->windowIsFrontWindowUnderMouse(event.nativeEvent());
+}
+
 } // namespace WebKit
 
 #endif // PLATFORM(MAC)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to