diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-24 16:36:50 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-24 16:36:50 +0100 |
commit | ad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (patch) | |
tree | b34b0daceb7c8e7fdde4b4ec43650ab7caadb0a9 /Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp | |
parent | 03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (diff) | |
download | qtwebkit-ad0d549d4cc13433f77c1ac8f0ab379c83d93f28.tar.gz |
Imported WebKit commit bb52bf3c0119e8a128cd93afe5572413a8617de9 (http://svn.webkit.org/repository/webkit/trunk@108790)
Diffstat (limited to 'Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp')
-rw-r--r-- | Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp b/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp index 7f3c08198..a53220610 100644 --- a/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp +++ b/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp @@ -37,6 +37,7 @@ #if ENABLE(THREADED_SCROLLING) #include <WebCore/ScrollingCoordinator.h> +#include <WebCore/ScrollingThread.h> #include <WebCore/ScrollingTree.h> #endif @@ -79,18 +80,29 @@ void EventDispatcher::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection } } -void EventDispatcher::wheelEvent(CoreIPC::Connection*, uint64_t pageID, const WebWheelEvent& wheelEvent) +void EventDispatcher::wheelEvent(CoreIPC::Connection*, uint64_t pageID, const WebWheelEvent& wheelEvent, bool canGoBack, bool canGoForward) { #if ENABLE(THREADED_SCROLLING) MutexLocker locker(m_scrollingTreesMutex); if (ScrollingTree* scrollingTree = m_scrollingTrees.get(pageID).get()) { PlatformWheelEvent platformWheelEvent = platform(wheelEvent); - if (scrollingTree->tryToHandleWheelEvent(platformWheelEvent)) { - sendDidHandleEvent(pageID, wheelEvent); + // FIXME: It's pretty horrible that we're updating the back/forward state here. + // WebCore should always know the current state and know when it changes so the + // scrolling tree can be notified. + // We only need to do this at the beginning of the gesture. + if (platformWheelEvent.phase() == PlatformWheelEventPhaseBegan) + ScrollingThread::dispatch(bind(&ScrollingTree::updateBackForwardState, scrollingTree, canGoBack, canGoForward)); + + ScrollingTree::EventResult result = scrollingTree->tryToHandleWheelEvent(platformWheelEvent); + if (result == ScrollingTree::DidHandleEvent || result == ScrollingTree::DidNotHandleEvent) { + sendDidReceiveEvent(pageID, wheelEvent, result == ScrollingTree::DidHandleEvent); return; } } +#else + UNUSED_PARAM(canGoBack); + UNUSED_PARAM(canGoForward); #endif RunLoop::main()->dispatch(bind(&EventDispatcher::dispatchWheelEvent, this, pageID, wheelEvent)); @@ -128,9 +140,9 @@ void EventDispatcher::dispatchGestureEvent(uint64_t pageID, const WebGestureEven #endif #if ENABLE(THREADED_SCROLLING) -void EventDispatcher::sendDidHandleEvent(uint64_t pageID, const WebEvent& event) +void EventDispatcher::sendDidReceiveEvent(uint64_t pageID, const WebEvent& event, bool didHandleEvent) { - WebProcess::shared().connection()->send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(event.type()), true), pageID); + WebProcess::shared().connection()->send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(event.type()), didHandleEvent), pageID); } #endif |