Changeset 167700 in webkit


Ignore:
Timestamp:
Apr 22, 2014 11:11:22 PM (10 years ago)
Author:
rniwa@webkit.org
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):

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r167694 r167700  
     12014-04-22  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Cursor doesn't change back to pointer when leaving the Safari window
     4        https://bugs.webkit.org/show_bug.cgi?id=132038
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        r147739 incorrectly added an early exit in EventHandler::selectCursor when hit test result didn't have
     9        any node associated with it. Since we will hit this code when the cursor is outside of the WebView,
     10        we still need to take the CURSOR_AUTO path as did the code before r147739.
     11
     12        No new test is added since this behavior can't be tested in DRT or WTR.
     13
     14        * page/EventHandler.cpp:
     15        (WebCore::EventHandler::selectCursor):
     16
    1172014-04-22  Zalan Bujtas  <zalan@apple.com>
    218
  • trunk/Source/WebCore/page/EventHandler.cpp

    r167688 r167700  
    13121312
    13131313    Node* node = result.targetNode();
    1314     if (!node)
    1315         return NoCursorChange;
    1316 
    1317     auto renderer = node->renderer();
     1314    auto renderer = node ? node->renderer() : 0;
    13181315    RenderStyle* style = renderer ? &renderer->style() : nullptr;
    13191316    bool horizontalText = !style || style->isHorizontalWritingMode();
     
    13871384    switch (style ? style->cursor() : CURSOR_AUTO) {
    13881385    case CURSOR_AUTO: {
    1389         bool editable = node->hasEditableStyle();
     1386        bool editable = node && node->hasEditableStyle();
    13901387
    13911388        if (useHandCursor(node, result.isOverLink(), shiftKey))
  • trunk/Source/WebKit/mac/ChangeLog

    r167686 r167700  
     12014-04-22  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Cursor doesn't change back to pointer when leaving the Safari window
     4        https://bugs.webkit.org/show_bug.cgi?id=132038
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Since the cursor type is now updated asynchronously after r147739,
     9        [window windowNumber] != [NSWindow windowNumberAtPoint:[NSEvent mouseLocation] belowWindowWithWindowNumber:0]
     10        evalutes to false depending on how fast cursor is moving.
     11
     12        Instead, check whether the NSWindow of the WebView is the key window or not since
     13        key window appears to control the cursor style in Cocoa as far as I've tested:
     14        https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/WinPanel/Concepts/ChangingMainKeyWindow.html
     15
     16        * WebCoreSupport/WebChromeClient.mm:
     17        (WebChromeClient::setCursor):
     18
    1192014-04-22  Commit Queue  <commit-queue@webkit.org>
    220
  • trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm

    r167547 r167700  
    774774
    775775    NSWindow *window = [m_webView window];
    776     if (!window)
    777         return;
    778 
    779     if ([window windowNumber] != [NSWindow windowNumberAtPoint:[NSEvent mouseLocation] belowWindowWithWindowNumber:0])
     776    if (!window || ![window isKeyWindow])
    780777        return;
    781778
  • trunk/Source/WebKit2/ChangeLog

    r167699 r167700  
     12014-04-22  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Cursor doesn't change back to pointer when leaving the Safari window
     4        https://bugs.webkit.org/show_bug.cgi?id=132038
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Since the cursor type is now updated asynchronously after r147739,
     9        [window windowNumber] != [NSWindow windowNumberAtPoint:[NSEvent mouseLocation] belowWindowWithWindowNumber:0]
     10        evalutes to false depending on how fast cursor is moving.
     11
     12        Instead, check whether the NSWindow of the WebView is the key window or not since
     13        key window appears to control the cursor style in Cocoa as far as I've tested:
     14        https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/WinPanel/Concepts/ChangingMainKeyWindow.html
     15
     16        * UIProcess/mac/PageClientImpl.mm:
     17        (WebKit::PageClientImpl::setCursor):
     18
    1192014-04-22  Yongjun Zhang  <yongjun_zhang@apple.com>
    220
  • trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm

    r167547 r167700  
    325325
    326326    NSWindow *window = [m_wkView window];
    327     if (!window)
    328         return;
    329 
    330     if ([window windowNumber] != [NSWindow windowNumberAtPoint:[NSEvent mouseLocation] belowWindowWithWindowNumber:0])
     327    if (!window || ![window isKeyWindow])
    331328        return;
    332329
Note: See TracChangeset for help on using the changeset viewer.