Commit 858c9c88 authored by andersca@apple.com's avatar andersca@apple.com

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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107013 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 83ff1e35
2012-02-07 Anders Carlsson <andersca@apple.com>
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.
2012-02-07 Dan Bernstein <mitz@apple.com>
<rdar://problem/10475450> Synthetic bold is illegible under some scaling transforms
......@@ -117,6 +117,7 @@ void ScrollingCoordinator::frameViewLayoutUpdated(FrameView* frameView)
m_scrollingTreeState->setViewportRect(IntRect(IntPoint(), frameView->visibleContentRect().size()));
m_scrollingTreeState->setContentsSize(frameView->contentsSize());
m_scrollingTreeState->setNonFastScrollableRegion(nonScrollableRegion);
scheduleTreeStateCommit();
}
......
......@@ -61,9 +61,15 @@ bool ScrollingTree::tryToHandleWheelEvent(const PlatformWheelEvent& wheelEvent)
if (m_hasWheelEventHandlers)
return false;
}
// FIXME: Check if we're over a subframe or overflow div.
if (!m_nonFastScrollableRegion.isEmpty()) {
// FIXME: This is not correct for non-default scroll origins.
IntPoint position = wheelEvent.position();
position.moveBy(m_mainFrameScrollPosition);
if (m_nonFastScrollableRegion.contains(position))
return false;
}
}
ScrollingThread::dispatch(bind(&ScrollingTree::handleWheelEvent, this, wheelEvent));
return true;
......@@ -106,6 +112,11 @@ void ScrollingTree::updateMainFrameScrollPosition(const IntPoint& scrollPosition
if (!m_scrollingCoordinator)
return;
{
MutexLocker lock(m_mutex);
m_mainFrameScrollPosition = scrollPosition;
}
callOnMainThread(bind(&ScrollingCoordinator::updateMainFrameScrollPosition, m_scrollingCoordinator.get(), scrollPosition));
}
......
......@@ -73,6 +73,7 @@ private:
Mutex m_mutex;
Region m_nonFastScrollableRegion;
IntPoint m_mainFrameScrollPosition;
bool m_hasWheelEventHandlers;
};
......
......@@ -70,6 +70,13 @@ bool Region::contains(const Region& region) const
return WebCore::intersect(region, *this) == region;
}
bool Region::contains(const IntPoint& point) const
{
// FIXME: This is inefficient. We should be able to iterate over the spans and find
// out if the region contains the point.
return contains(IntRect(point, IntSize(1, 1)));
}
Region::Shape::Shape()
{
}
......
......@@ -50,6 +50,8 @@ public:
// Returns true if the query region is a subset of this region.
bool contains(const Region&) const;
bool contains(const IntPoint&) const;
#ifndef NDEBUG
void dump() const;
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment