Changeset 46273 in webkit


Ignore:
Timestamp:
Jul 23, 2009 9:55:55 AM (15 years ago)
Author:
treat@webkit.org
Message:

WebCore:
2009-07-22 Viet-Trung Luu <viettrungluu@gmail.com>

Reviewed by David Hyatt.

https://bugs.webkit.org/show_bug.cgi?id=27289
When a mouse click occurs on a scrollbar without a preceding mouse move
onto it, the release isn't handled correctly (since
EventHandler::m_lastScrollbarUnderMouse isn't set on mouse down, but
only on mouse move). (Side comment: That scrollbar-handling code
in EventHandler is ugly. It should be fixed properly.)

Tests: scrollbars/scrollbar-miss-mousemove.html

scrollbars/scrollbar-miss-mousemove-disabled.html

  • page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::handleMouseMoveEvent): (WebCore::EventHandler::updateLastScrollbarUnderMouse):
  • page/EventHandler.h:

LayoutTests:
2009-07-22 Viet-Trung Luu <viettrungluu@gmail.com>

Reviewed by David Hyatt.

https://bugs.webkit.org/show_bug.cgi?id=27289
Tests that mouse clicks/releases are handled properly on scrollbars
even when there is no mouse move onto the scrollbar (two cases: enabled
and disabled controls).

  • scrollbars/scrollbar-miss-mousemove-disabled-expected.txt: Added.
  • scrollbars/scrollbar-miss-mousemove-disabled.html: Added.
  • scrollbars/scrollbar-miss-mousemove-expected.txt: Added.
  • scrollbars/scrollbar-miss-mousemove.html: Added.
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r46263 r46273  
     12009-07-22  Viet-Trung Luu  <viettrungluu@gmail.com>
     2
     3        Reviewed by David Hyatt.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=27289
     6        Tests that mouse clicks/releases are handled properly on scrollbars
     7        even when there is no mouse move onto the scrollbar (two cases: enabled
     8        and disabled controls).
     9
     10        * scrollbars/scrollbar-miss-mousemove-disabled-expected.txt: Added.
     11        * scrollbars/scrollbar-miss-mousemove-disabled.html: Added.
     12        * scrollbars/scrollbar-miss-mousemove-expected.txt: Added.
     13        * scrollbars/scrollbar-miss-mousemove.html: Added.
     14
    1152009-07-23  Simon Hausmann  <simon.hausmann@nokia.com>
    216
  • trunk/WebCore/ChangeLog

    r46272 r46273  
     12009-07-22  Viet-Trung Luu  <viettrungluu@gmail.com>
     2
     3        Reviewed by David Hyatt.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=27289
     6        When a mouse click occurs on a scrollbar without a preceding mouse move
     7        onto it, the release isn't handled correctly (since
     8        EventHandler::m_lastScrollbarUnderMouse isn't set on mouse down, but
     9        only on mouse move). (Side comment: That scrollbar-handling code
     10        in EventHandler is ugly. It should be fixed properly.)
     11
     12        Tests: scrollbars/scrollbar-miss-mousemove.html
     13               scrollbars/scrollbar-miss-mousemove-disabled.html
     14
     15        * page/EventHandler.cpp:
     16        (WebCore::EventHandler::handleMousePressEvent):
     17        (WebCore::EventHandler::handleMouseMoveEvent):
     18        (WebCore::EventHandler::updateLastScrollbarUnderMouse):
     19        * page/EventHandler.h:
     20
    1212009-07-23  Mike Fenton  <mike.fenton@torchmobile.com>
    222
  • trunk/WebCore/page/EventHandler.cpp

    r45747 r46273  
    11961196    if (swallowEvent) {
    11971197        // scrollbars should get events anyway, even disabled controls might be scrollable
    1198         if (mev.scrollbar())
    1199             passMousePressEventToScrollbar(mev, mev.scrollbar());
     1198        Scrollbar* scrollbar = mev.scrollbar();
     1199
     1200        updateLastScrollbarUnderMouse(scrollbar, true);
     1201
     1202        if (scrollbar)
     1203            passMousePressEventToScrollbar(mev, scrollbar);
    12001204    } else {
    12011205        // Refetch the event target node if it currently is the shadow node inside an <input> element.
     
    12121216        if (!scrollbar)
    12131217            scrollbar = mev.scrollbar();
     1218
     1219        updateLastScrollbarUnderMouse(scrollbar, true);
     1220
    12141221        if (scrollbar && passMousePressEventToScrollbar(mev, scrollbar))
    12151222            swallowEvent = true;
     
    13281335            scrollbar = mev.scrollbar();
    13291336
    1330         if (m_lastScrollbarUnderMouse != scrollbar) {
    1331             // Send mouse exited to the old scrollbar.
    1332             if (m_lastScrollbarUnderMouse)
    1333                 m_lastScrollbarUnderMouse->mouseExited();
    1334             m_lastScrollbarUnderMouse = m_mousePressed ? 0 : scrollbar;
    1335         }
     1337        updateLastScrollbarUnderMouse(scrollbar, !m_mousePressed);
    13361338    }
    13371339
     
    24232425}
    24242426
    2425 }
     2427// If scrollbar (under mouse) is different from last, send a mouse exited. Set
     2428// last to scrollbar if setLast is true; else set last to 0.
     2429void EventHandler::updateLastScrollbarUnderMouse(Scrollbar* scrollbar, bool setLast)
     2430{
     2431    if (m_lastScrollbarUnderMouse != scrollbar) {
     2432        // Send mouse exited to the old scrollbar.
     2433        if (m_lastScrollbarUnderMouse)
     2434            m_lastScrollbarUnderMouse->mouseExited();
     2435        m_lastScrollbarUnderMouse = setLast ? scrollbar : 0;
     2436    }
     2437}
     2438
     2439}
  • trunk/WebCore/page/EventHandler.h

    r45891 r46273  
    272272    void updateSelectionForMouseDrag(Node* targetNode, const IntPoint& localPoint);
    273273
     274    void updateLastScrollbarUnderMouse(Scrollbar*, bool);
     275
    274276    bool capturesDragging() const { return m_capturesDragging; }
    275277
Note: See TracChangeset for help on using the changeset viewer.