Changeset 163558 in webkit


Ignore:
Timestamp:
Feb 6, 2014 12:43:56 PM (10 years ago)
Author:
Brent Fulgham
Message:

Wheel events don't latch to inner scrollable elements
https://bugs.webkit.org/show_bug.cgi?id=128225

Reviewed by Beth Dakin.

  • page/EventHandler.cpp:

(WebCore::EventHandler::handleWheelEvent): Identify the case
where we have hit the end of a scroll, and treat that as a
valid 'handled' case. If the scroll event is just starting,
treat end-of-scroll as unhandled so the parent element can
handle things.

  • page/WheelEventDeltaTracker.h:

(WebCore::WheelEventDeltaTracker::isFirstWheelEvent): Added.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r163556 r163558  
     12014-02-05  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Wheel events don't latch to inner scrollable elements
     4        https://bugs.webkit.org/show_bug.cgi?id=128225
     5
     6        Reviewed by Beth Dakin.
     7
     8        * page/EventHandler.cpp:
     9        (WebCore::EventHandler::handleWheelEvent): Identify the case
     10        where we have hit the end of a scroll, and treat that as a
     11        valid 'handled' case. If the scroll event is just starting,
     12        treat end-of-scroll as unhandled so the parent element can
     13        handle things.
     14        * page/WheelEventDeltaTracker.h:
     15        (WebCore::WheelEventDeltaTracker::isFirstWheelEvent): Added.
     16
    1172014-02-06  Commit Queue  <commit-queue@webkit.org>
    218
  • trunk/Source/WebCore/page/EventHandler.cpp

    r163440 r163558  
    11/*
    2  * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2013, 2014 Apple Inc. All rights reserved.
    33 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
    44 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
     
    25292529    // We do another check on the frame view because the event handler can run JS which results in the frame getting destroyed.
    25302530    view = m_frame.view();
     2531   
     2532#if PLATFORM(MAC)
     2533    if (useLatchedWheelEventElement && m_latchedWheelEventElement == element) {
     2534        bool enclosingFrameIsMainFrame = view ? view->frame().isMainFrame() : false;
     2535
     2536        // If we are latched, and have nowhere to scroll, treat the scroll event as ended so that we don't
     2537        // cause the scroll to break free of the current scrolling widget.
     2538        if (!enclosingFrameIsMainFrame) {
     2539            bool didHandleWheelEvent = view ? view->wheelEvent(event) : false;
     2540            if (!didHandleWheelEvent) {
     2541                // If we are just starting a scroll event, and have nowhere left to scroll, allow
     2542                // the enclosing frame to handle the scroll.
     2543                didHandleWheelEvent = !m_recentWheelEventDeltaTracker->isFirstWheelEvent();
     2544            }
     2545
     2546            m_isHandlingWheelEvent = false;
     2547            return didHandleWheelEvent;
     2548        }
     2549
     2550        if (!m_recentWheelEventDeltaTracker->isFirstWheelEvent()) {
     2551            // When the main frame is our parent, and we have been scrolling within this region, we do not
     2552            // want to have the main frame consume any remaining scroll events. Keep them latched to this
     2553            // element.
     2554            m_isHandlingWheelEvent = false;
     2555            return true;
     2556        }
     2557    }
     2558#endif
     2559
    25312560    bool didHandleEvent = view ? view->wheelEvent(event) : false;
    25322561    m_isHandlingWheelEvent = false;
  • trunk/Source/WebCore/page/WheelEventDeltaTracker.h

    r163180 r163558  
    5252
    5353    bool isTrackingDeltas() const { return m_isTrackingDeltas; }
     54    bool isFirstWheelEvent() const { return m_recentWheelEventDeltas.size() <= 1; }
    5455
    5556    void recordWheelEventDelta(const PlatformWheelEvent&);
Note: See TracChangeset for help on using the changeset viewer.