Changeset 167547 in webkit


Ignore:
Timestamp:
Apr 19, 2014 2:11:06 PM (10 years ago)
Author:
Darin Adler
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.

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/mac/ChangeLog

    r167528 r167547  
     12014-04-19  Darin Adler  <darin@apple.com>
     2
     3        [Mac] WebView adjusts the cursor even when another window is in front
     4        https://bugs.webkit.org/show_bug.cgi?id=131898
     5        rdar://problem/14619911
     6
     7        Reviewed by Dan Bernstein.
     8
     9        * WebCoreSupport/WebChromeClient.mm:
     10        (WebChromeClient::setCursor): Added a check that the window is under the cursor
     11        and do nothing if it's not.
     12
    1132014-04-18  Commit Queue  <commit-queue@webkit.org>
    214
  • trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm

    r165676 r167547  
    762762
    763763#if !PLATFORM(IOS)
     764
    764765void WebChromeClient::setCursor(const WebCore::Cursor& cursor)
    765766{
     767    // FIXME: Would be nice to share this code with WebKit2's PageClientImpl.
     768
    766769    if ([NSApp _cursorRectCursor])
     770        return;
     771
     772    if (!m_webView)
     773        return;
     774
     775    NSWindow *window = [m_webView window];
     776    if (!window)
     777        return;
     778
     779    if ([window windowNumber] != [NSWindow windowNumberAtPoint:[NSEvent mouseLocation] belowWindowWithWindowNumber:0])
    767780        return;
    768781
     
    770783    if ([NSCursor currentCursor] == platformCursor)
    771784        return;
     785
    772786    [platformCursor set];
    773787}
     
    777791    [NSCursor setHiddenUntilMouseMoves:hiddenUntilMouseMoves];
    778792}
     793
    779794#endif
    780795
  • trunk/Source/WebKit2/ChangeLog

    r167543 r167547  
     12014-04-19  Darin Adler  <darin@apple.com>
     2
     3        [Mac] WebView adjusts the cursor even when another window is in front
     4        https://bugs.webkit.org/show_bug.cgi?id=131898
     5        rdar://problem/14619911
     6
     7        Reviewed by Dan Bernstein.
     8
     9        * UIProcess/API/mac/WKView.mm:
     10        (-[WKView _setCursor:]): Deleted. Moved the code all into PageClientImpl, since none of it
     11        interacts with anything special about a WKView.
     12
     13        * UIProcess/API/mac/WKViewInternal.h: Deleted the _setCursor: method.
     14
     15        * UIProcess/mac/PageClientImpl.mm:
     16        (WebKit::PageClientImpl::setCursor): Added a check that the window is under the cursor
     17        and do nothing if it's not.
     18
    1192014-04-19  Dan Bernstein  <mitz@apple.com>
    220
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r167253 r167547  
    27762776}
    27772777
    2778 - (void)_setCursor:(NSCursor *)cursor
    2779 {
    2780     if ([NSCursor currentCursor] == cursor)
    2781         return;
    2782     [cursor set];
    2783 }
    2784 
    27852778- (void)_setUserInterfaceItemState:(NSString *)commandName enabled:(BOOL)isEnabled state:(int)newState
    27862779{
  • trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h

    r166466 r167547  
    7272- (void)_preferencesDidChange;
    7373- (void)_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip;
    74 - (void)_setCursor:(NSCursor *)cursor;
    7574- (void)_setUserInterfaceItemState:(NSString *)commandName enabled:(BOOL)isEnabled state:(int)newState;
    7675- (void)_doneWithKeyEvent:(NSEvent *)event eventWasHandled:(BOOL)eventWasHandled;
  • trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm

    r167262 r167547  
    316316void PageClientImpl::setCursor(const WebCore::Cursor& cursor)
    317317{
    318     if (![NSApp _cursorRectCursor])
    319         [m_wkView _setCursor:cursor.platformCursor()];
     318    // FIXME: Would be nice to share this code with WebKit1's WebChromeClient.
     319
     320    if ([NSApp _cursorRectCursor])
     321        return;
     322
     323    if (!m_wkView)
     324        return;
     325
     326    NSWindow *window = [m_wkView window];
     327    if (!window)
     328        return;
     329
     330    if ([window windowNumber] != [NSWindow windowNumberAtPoint:[NSEvent mouseLocation] belowWindowWithWindowNumber:0])
     331        return;
     332
     333    NSCursor *platformCursor = cursor.platformCursor();
     334    if ([NSCursor currentCursor] == platformCursor)
     335        return;
     336
     337    [platformCursor set];
    320338}
    321339
Note: See TracChangeset for help on using the changeset viewer.