- Revision
- 107838
- Author
- [email protected]
- Date
- 2012-02-15 14:06:39 -0800 (Wed, 15 Feb 2012)
Log Message
Wheel events should be re-dispatched to the scrolling thread
https://bugs.webkit.org/show_bug.cgi?id=78731
<rdar://problem/10866144>
Reviewed by Sam Weinig.
When threaded scrolling is enabled, all the state is assumed to be kept in the scrolling tree,
on the scrolling thread. This means that even if we do end up processing an event on the main thread
(because of wheel event handlers for example), we still have to dispatch the wheel event back to the
scrolling thread.
* page/FrameView.cpp:
(WebCore::FrameView::wheelEvent):
Move wheelEvent from ScrollView and ask the scrolling coordinator to handle the wheel event.
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::handleWheelEvent):
Dispatch the event to the scrolling thread, unless it will start a gesture. In that case we'll return false
so that information will be passed back to the UI process.
(ScrollingCoordinator):
* platform/ScrollView.cpp:
* platform/ScrollView.h:
Move wheelEvent to FrameView.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (107837 => 107838)
--- trunk/Source/WebCore/ChangeLog 2012-02-15 21:59:36 UTC (rev 107837)
+++ trunk/Source/WebCore/ChangeLog 2012-02-15 22:06:39 UTC (rev 107838)
@@ -1,3 +1,30 @@
+2012-02-15 Anders Carlsson <[email protected]>
+
+ Wheel events should be re-dispatched to the scrolling thread
+ https://bugs.webkit.org/show_bug.cgi?id=78731
+ <rdar://problem/10866144>
+
+ Reviewed by Sam Weinig.
+
+ When threaded scrolling is enabled, all the state is assumed to be kept in the scrolling tree,
+ on the scrolling thread. This means that even if we do end up processing an event on the main thread
+ (because of wheel event handlers for example), we still have to dispatch the wheel event back to the
+ scrolling thread.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::wheelEvent):
+ Move wheelEvent from ScrollView and ask the scrolling coordinator to handle the wheel event.
+
+ * page/scrolling/ScrollingCoordinator.cpp:
+ (WebCore::ScrollingCoordinator::handleWheelEvent):
+ Dispatch the event to the scrolling thread, unless it will start a gesture. In that case we'll return false
+ so that information will be passed back to the UI process.
+
+ (ScrollingCoordinator):
+ * platform/ScrollView.cpp:
+ * platform/ScrollView.h:
+ Move wheelEvent to FrameView.
+
2012-02-15 Mark Hahnenberg <[email protected]>
RootObject::finalize can cause a crash in object->invalidate()
Modified: trunk/Source/WebCore/page/FrameView.cpp (107837 => 107838)
--- trunk/Source/WebCore/page/FrameView.cpp 2012-02-15 21:59:36 UTC (rev 107837)
+++ trunk/Source/WebCore/page/FrameView.cpp 2012-02-15 22:06:39 UTC (rev 107838)
@@ -3332,6 +3332,30 @@
ScrollView::removeChild(widget);
}
+bool FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent)
+{
+ // We don't allow mouse wheeling to happen in a ScrollView that has had its scrollbars explicitly disabled.
+ if (!canHaveScrollbars())
+ return false;
+
+#if !PLATFORM(WX)
+ if (platformWidget())
+ return false;
+#endif
+
+#if ENABLE(THREADED_SCROLLING)
+ if (Page* page = m_frame->page()) {
+ if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator()) {
+ if (scrollingCoordinator->coordinatesScrollingForFrameView(this))
+ return scrollingCoordinator->handleWheelEvent(this, wheelEvent);
+ }
+ }
+#endif
+
+ return ScrollableArea::handleWheelEvent(wheelEvent);
+}
+
+
bool FrameView::isVerticalDocument() const
{
RenderView* root = rootRenderer(this);
Modified: trunk/Source/WebCore/page/FrameView.h (107837 => 107838)
--- trunk/Source/WebCore/page/FrameView.h 2012-02-15 21:59:36 UTC (rev 107837)
+++ trunk/Source/WebCore/page/FrameView.h 2012-02-15 22:06:39 UTC (rev 107838)
@@ -316,6 +316,11 @@
virtual void addChild(PassRefPtr<Widget>) OVERRIDE;
virtual void removeChild(Widget*) OVERRIDE;
+ // This function exists for ports that need to handle wheel events manually.
+ // On Mac WebKit1 the underlying NSScrollView just does the scrolling, but on most other platforms
+ // we need this function in order to do the scroll ourselves.
+ bool wheelEvent(const PlatformWheelEvent&);
+
protected:
virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
virtual void scrollContentsSlowPath(const IntRect& updateRect);
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (107837 => 107838)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp 2012-02-15 21:59:36 UTC (rev 107837)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp 2012-02-15 22:06:39 UTC (rev 107838)
@@ -180,6 +180,18 @@
return true;
}
+bool ScrollingCoordinator::handleWheelEvent(FrameView*, const PlatformWheelEvent& wheelEvent)
+{
+ ASSERT(isMainThread());
+ ASSERT(m_page);
+
+ if (m_scrollingTree->willWheelEventStartSwipeGesture(wheelEvent))
+ return false;
+
+ ScrollingThread::dispatch(bind(&ScrollingTree::handleWheelEvent, m_scrollingTree.get(), wheelEvent));
+ return true;
+}
+
void ScrollingCoordinator::updateMainFrameScrollPosition(const IntPoint& scrollPosition)
{
ASSERT(isMainThread());
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (107837 => 107838)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2012-02-15 21:59:36 UTC (rev 107837)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2012-02-15 22:06:39 UTC (rev 107838)
@@ -93,6 +93,9 @@
// position will be updated asynchronously. If it returns false, the caller should update the scrolling position itself.
bool requestScrollPositionUpdate(FrameView*, const IntPoint&);
+ // Handle the wheel event on the scrolling thread. Returns whether the event was handled or not.
+ bool handleWheelEvent(FrameView*, const PlatformWheelEvent&);
+
// Dispatched by the scrolling tree whenever the main frame scroll position changes.
void updateMainFrameScrollPosition(const IntPoint&);
Modified: trunk/Source/WebCore/platform/ScrollView.cpp (107837 => 107838)
--- trunk/Source/WebCore/platform/ScrollView.cpp 2012-02-15 21:59:36 UTC (rev 107837)
+++ trunk/Source/WebCore/platform/ScrollView.cpp 2012-02-15 22:06:39 UTC (rev 107838)
@@ -845,20 +845,6 @@
platformSetScrollbarOverlayStyle(overlayStyle);
}
-bool ScrollView::wheelEvent(const PlatformWheelEvent& e)
-{
- // We don't allow mouse wheeling to happen in a ScrollView that has had its scrollbars explicitly disabled.
-#if PLATFORM(WX)
- if (!canHaveScrollbars()) {
-#else
- if (!canHaveScrollbars() || platformWidget()) {
-#endif
- return false;
- }
-
- return ScrollableArea::handleWheelEvent(e);
-}
-
void ScrollView::setFrameRect(const IntRect& newRect)
{
IntRect oldRect = frameRect();
Modified: trunk/Source/WebCore/platform/ScrollView.h (107837 => 107838)
--- trunk/Source/WebCore/platform/ScrollView.h 2012-02-15 21:59:36 UTC (rev 107837)
+++ trunk/Source/WebCore/platform/ScrollView.h 2012-02-15 22:06:39 UTC (rev 107838)
@@ -235,11 +235,6 @@
// For platforms that need to hit test scrollbars from within the engine's event handlers (like Win32).
Scrollbar* scrollbarAtPoint(const IntPoint& windowPoint);
- // This function exists for scrollviews that need to handle wheel events manually.
- // On Mac the underlying NSScrollView just does the scrolling, but on other platforms
- // (like Windows), we need this function in order to do the scroll ourselves.
- bool wheelEvent(const PlatformWheelEvent&);
-
IntPoint convertChildToSelf(const Widget* child, const IntPoint& point) const
{
IntPoint newPoint = point;