Changeset 19166

Show
Ignore:
Timestamp:
01/26/07 16:03:56 (22 months 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.
Location:
trunk/WebCore
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r19164 r19166  
     12007-01-26  Beth Dakin  <bdakin@apple.com> 
     2 
     3        Reviewed by Darin. 
     4 
     5        Fix for <rdar://problem/4956565> REGRESSION: After scrolling frame,  
     6        hovering over link in this frame doesn't change cursor to pointing  
     7        hand 
     8 
     9        The mouseMove event was not being propagated correctly after using  
     10        the mouse to scroll the frame because m_mousePressed was never  
     11        getting set to false. 
     12 
     13        * page/EventHandler.cpp: 
     14        (WebCore::EventHandler::handleMousePressEvent): This code does not  
     15        belong here. 
     16        * page/EventHandler.h: lastEventIsMouseUp() is only ever relevant  
     17        in EventHandlerMac, so it can just be a static function there. 
     18        * page/mac/EventHandlerMac.mm: 
     19        (WebCore::lastEventIsMouseUp): Make this static. 
     20        (WebCore::EventHandler::passMouseDownEventToWidget): Here is where  
     21        we need to set m_mousePressed to false if lastEventIsMouseUp() is  
     22        true. 
     23 
    1242007-01-26  David Hyatt  <hyatt@apple.com> 
    225 
  • trunk/WebCore/page/EventHandler.cpp

    r19158 r19166  
    748748        else 
    749749            swallowEvent = handleMousePressEvent(mev); 
    750          
    751         // Many AK widgets run their own event loops and consume events while the mouse is down. 
    752         // When they finish, currentEvent is the mouseUp that they exited on.  We need to update 
    753         // the khtml state with this mouseUp, which khtml never saw. 
    754         // If this event isn't a mouseUp, we assume that the mouseUp will be coming later.  There 
    755         // is a hole here if the widget consumes the mouseUp and subsequent events. 
    756         if (lastEventIsMouseUp()) 
    757             m_mousePressed = false; 
    758750    } 
    759751 
  • trunk/WebCore/page/EventHandler.h

    r19108 r19166  
    167167    void hoverTimerFired(Timer<EventHandler>*); 
    168168 
    169     bool lastEventIsMouseUp() const; 
    170  
    171169    static bool canMouseDownStartSelect(Node*); 
    172170 
  • 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