Changeset 107013 in webkit


Ignore:
Timestamp:
Feb 7, 2012 5:00:06 PM (12 years ago)
Author:
andersca@apple.com
Message:

Use the non-fast-scrollable region to detect when we can't do fast scrolling
https://bugs.webkit.org/show_bug.cgi?id=78056
<rdar://problem/10247932>

Reviewed by Sam Weinig.

  • page/scrolling/ScrollingCoordinator.cpp:

(WebCore::ScrollingCoordinator::frameViewLayoutUpdated):
Actually set the non-fast scrollable region on the scrolling tree state.

  • page/scrolling/ScrollingTree.cpp:

(WebCore::ScrollingTree::tryToHandleWheelEvent):
Check if the wheel event's position is inside the non-fast-scrollable region
and return false if it is.

(WebCore::ScrollingTree::updateMainFrameScrollPosition):
Store the cached main frame scroll position so we can use it in tryToHandleWheelEvent.

  • platform/graphics/Region.cpp:
  • platform/graphics/Region.h:

Add a simple contains(const IntPoint&) member function.

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r107012 r107013  
     12012-02-07  Anders Carlsson  <andersca@apple.com>
     2
     3        Use the non-fast-scrollable region to detect when we can't do fast scrolling
     4        https://bugs.webkit.org/show_bug.cgi?id=78056
     5        <rdar://problem/10247932>
     6
     7        Reviewed by Sam Weinig.
     8
     9        * page/scrolling/ScrollingCoordinator.cpp:
     10        (WebCore::ScrollingCoordinator::frameViewLayoutUpdated):
     11        Actually set the non-fast scrollable region on the scrolling tree state.
     12
     13        * page/scrolling/ScrollingTree.cpp:
     14        (WebCore::ScrollingTree::tryToHandleWheelEvent):
     15        Check if the wheel event's position is inside the non-fast-scrollable region
     16        and return false if it is.
     17
     18        (WebCore::ScrollingTree::updateMainFrameScrollPosition):
     19        Store the cached main frame scroll position so we can use it in tryToHandleWheelEvent.
     20
     21        * platform/graphics/Region.cpp:
     22        * platform/graphics/Region.h:
     23        Add a simple contains(const IntPoint&) member function.
     24
    1252012-02-07  Dan Bernstein  <mitz@apple.com>
    226
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp

    r107001 r107013  
    118118    m_scrollingTreeState->setViewportRect(IntRect(IntPoint(), frameView->visibleContentRect().size()));
    119119    m_scrollingTreeState->setContentsSize(frameView->contentsSize());
     120    m_scrollingTreeState->setNonFastScrollableRegion(nonScrollableRegion);
    120121    scheduleTreeStateCommit();
    121122}
  • trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp

    r107001 r107013  
    6262        if (m_hasWheelEventHandlers)
    6363            return false;
     64
     65        if (!m_nonFastScrollableRegion.isEmpty()) {
     66            // FIXME: This is not correct for non-default scroll origins.
     67            IntPoint position = wheelEvent.position();
     68            position.moveBy(m_mainFrameScrollPosition);
     69            if (m_nonFastScrollableRegion.contains(position))
     70                return false;
     71        }
    6472    }
    65 
    66     // FIXME: Check if we're over a subframe or overflow div.
    6773
    6874    ScrollingThread::dispatch(bind(&ScrollingTree::handleWheelEvent, this, wheelEvent));
     
    107113        return;
    108114
     115    {
     116        MutexLocker lock(m_mutex);
     117        m_mainFrameScrollPosition = scrollPosition;
     118    }
     119
    109120    callOnMainThread(bind(&ScrollingCoordinator::updateMainFrameScrollPosition, m_scrollingCoordinator.get(), scrollPosition));
    110121}
  • trunk/Source/WebCore/page/scrolling/ScrollingTree.h

    r107001 r107013  
    7474    Mutex m_mutex;
    7575    Region m_nonFastScrollableRegion;
     76    IntPoint m_mainFrameScrollPosition;
    7677    bool m_hasWheelEventHandlers;
    7778};
  • trunk/Source/WebCore/platform/graphics/Region.cpp

    r106893 r107013  
    7171}
    7272
     73bool Region::contains(const IntPoint& point) const
     74{
     75    // FIXME: This is inefficient. We should be able to iterate over the spans and find
     76    // out if the region contains the point.
     77    return contains(IntRect(point, IntSize(1, 1)));
     78}
     79
    7380Region::Shape::Shape()
    7481{
  • trunk/Source/WebCore/platform/graphics/Region.h

    r106893 r107013  
    5050    // Returns true if the query region is a subset of this region.
    5151    bool contains(const Region&) const;
     52
     53    bool contains(const IntPoint&) const;
    5254
    5355#ifndef NDEBUG
Note: See TracChangeset for help on using the changeset viewer.