Show
Ignore:
Timestamp:
01/26/07 16:03:56 (2 years ago)
Author:
bdakin
Message:

Reviewed by Darin.

Fix for <rdar://problem/4956565> REGRESSION: After scrolling frame,
hovering over link in this frame doesn't change cursor to pointing
hand

The mouseMove event was not being propagated correctly after using
the mouse to scroll the frame because m_mousePressed was never
getting set to false.

  • page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): This code does not belong here.
  • page/EventHandler.h: lastEventIsMouseUp() is only ever relevant in EventHandlerMac, so it can just be a static function there.
  • page/mac/EventHandlerMac.mm: (WebCore::lastEventIsMouseUp): Make this static. (WebCore::EventHandler::passMouseDownEventToWidget): Here is where we need to set m_mousePressed to false if lastEventIsMouseUp() is true.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/page/mac/EventHandlerMac.mm

    r19108 r19166  
    203203} 
    204204 
     205static bool lastEventIsMouseUp() 
     206{ 
     207    // Many AK widgets run their own event loops and consume events while the mouse is down. 
     208    // When they finish, currentEvent is the mouseUp that they exited on.  We need to update 
     209    // the khtml state with this mouseUp, which khtml never saw.  This method lets us detect 
     210    // that state. 
     211 
     212    BEGIN_BLOCK_OBJC_EXCEPTIONS; 
     213    NSEvent *currentEventAfterHandlingMouseDown = [NSApp currentEvent]; 
     214    if (currentEvent != currentEventAfterHandlingMouseDown && 
     215        [currentEventAfterHandlingMouseDown type] == NSLeftMouseUp && 
     216        [currentEventAfterHandlingMouseDown timestamp] >= [currentEvent timestamp]) 
     217            return true; 
     218    END_BLOCK_OBJC_EXCEPTIONS; 
     219 
     220    return false; 
     221} 
     222 
    205223bool EventHandler::passMouseDownEventToWidget(Widget* widget) 
    206224{ 
     
    273291    m_mouseDownView = view; 
    274292    m_mouseDownWasInSubframe = false; 
     293     
     294    // Many AppKit widgets run their own event loops and consume events while the mouse is down. 
     295    // When they finish, currentEvent is the mouseUp that they exited on.  We need to update 
     296    // the EventHandler state with this mouseUp, which we never saw. 
     297    // If this event isn't a mouseUp, we assume that the mouseUp will be coming later.  There 
     298    // is a hole here if the widget consumes both the mouseUp and subsequent events. 
     299    if (lastEventIsMouseUp()) 
     300        m_mousePressed = false; 
    275301 
    276302    END_BLOCK_OBJC_EXCEPTIONS; 
    277303 
    278304    return true; 
    279 } 
    280  
    281 bool EventHandler::lastEventIsMouseUp() const 
    282 { 
    283     // Many AK widgets run their own event loops and consume events while the mouse is down. 
    284     // When they finish, currentEvent is the mouseUp that they exited on.  We need to update 
    285     // the khtml state with this mouseUp, which khtml never saw.  This method lets us detect 
    286     // that state. 
    287  
    288     BEGIN_BLOCK_OBJC_EXCEPTIONS; 
    289     NSEvent *currentEventAfterHandlingMouseDown = [NSApp currentEvent]; 
    290     if (currentEvent != currentEventAfterHandlingMouseDown && 
    291         [currentEventAfterHandlingMouseDown type] == NSLeftMouseUp && 
    292         [currentEventAfterHandlingMouseDown timestamp] >= [currentEvent timestamp]) 
    293             return true; 
    294     END_BLOCK_OBJC_EXCEPTIONS; 
    295  
    296     return false; 
    297305} 
    298306