Handling autoscroll in EventHandler should be re-factor
authoryosin@chromium.org <yosin@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2012 08:32:28 +0000 (08:32 +0000)
committeryosin@chromium.org <yosin@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2012 08:32:28 +0000 (08:32 +0000)
commitc09a05c211d8524e9d1ee7db58c92def05fd39c3
treeb731e82e08591695950f6000e45fe4b87d5e35ab
parent9c9ed5465b2368256b9b319241c3860ba9cf41b5
Handling autoscroll in EventHandler should be re-factor
https://bugs.webkit.org/show_bug.cgi?id=104764

Reviewed by Hajime Morita.

This patch introduces new class AutoscrollController for moving autoscroll
and panscroll from EventHandler class for ease of maintenance of
EventHandler and ease of adding autoscroll related features, e.g. autoscroll
during drag-and-drop, autoscoll by gesture.

No new tests. This patch doesn't change behavior.

* CMakeLists.txt: Changed to add page/AutoscrollController.cpp
* GNUmakefile.list.am:  Changed to add page/AutoscrollController.{cpp,h}
* Target.pri:  Changed to add page/AutoscrollController.cpp
* WebCore.gypi: Changed to add page/AutoscrollController.{cpp,h}
* WebCore.vcproj/WebCore.vcproj: Changed to add page/AutoscrollController.{cpp,h}
* WebCore.xcodeproj/project.pbxproj: Changed to add page/AutoscrollController.{cpp,h}
* page/AutoscrollController.cpp: Added.
(WebCore::getMainFrame): Helper function.
(WebCore::AutoscrollController::AutoscrollController): Moved from EventHandler.
(WebCore::AutoscrollController::autoscrollRenderer): Moved from EventHandler.
(WebCore::AutoscrollController::autoscrollInProgress): Moved from EventHandler.
(WebCore::AutoscrollController::startAutoscrollForSelection): Replacement of EventHandler::handleAutoscroll().
(WebCore::AutoscrollController::stopAutoscrollTimer): Moveed from EventHandler.
(WebCore::AutoscrollController::updateAutoscrollRenderer): ditto
(WebCore::AutoscrollController::didPanScrollStart): Added for updating pan scrolling status of main frame.
(WebCore::AutoscrollController::didPanScrollStop): ditto
(WebCore::AutoscrollController::handleMouseReleaseEvent): Extracted from EventHandler.
(WebCore::AutoscrollController::panScrollInProgress): Replacement of EventHandler::m_panScrollInProgress.
(WebCore::AutoscrollController::startPanScrolling): Moved from EventHandler::startPanScrolling()
(WebCore::AutoscrollController::autoscrollTimerFired): Moved from EventHandler::autoscrollTimerFired().
(WebCore::AutoscrollController::startAutoscrollTimer): Moved from EventHandler::startAutoscrollTimer().
(WebCore::AutoscrollController::updatePanScrollState): Moved from EventHandler::updatePanScrollState().
* page/AutoscrollController.h: Added.
(AutoscrollController):
* page/EventHandler.cpp:
(WebCore::EventHandler::EventHandler): Changed autoscroll and panscroll related member variable initializations to m_autoscrollController initialization.
(WebCore::EventHandler::handleMouseDraggedEvent): Changed to call AutoscrollController::startAutoscrollForSelection().
(WebCore::EventHandler::handleMouseReleaseEvent): Changed to remove m_autoscrollInProgress reference.
(WebCore::EventHandler::didPanScrollStart): Added for updating pan scrolling status of main frame.
(WebCore::EventHandler::didPanScrollStop): ditto
(WebCore::EventHandler::startPanScrolling): Changed to call AutoscrollController::startPanScrolling().
(WebCore::EventHandler::autoscrollRenderer): Changed to use AutoscrollController.
(WebCore::EventHandler::updateAutoscrollRenderer): ditto
(WebCore::EventHandler::autoscrollInProgress): ditto
(WebCore::EventHandler::panScrollInProgress): Added to replace m_panScrollInProgress.
(WebCore::EventHandler::stopAutoscrollTimer): Changed to use AutoscrollController.
(WebCore::EventHandler::selectCursor): Changed to use panScrollInProgress().
(WebCore::EventHandler::handleMousePressEvent): Chagned to call AutoscrollController::handleMousePressEvent().
(WebCore::EventHandler::keyEvent): Changed to use panScrollInProgress().
* page/EventHandler.h:
(WebCore::EventHandler::autoscrollController): Added for using main frame's panScrollInProgress().
(WebCore::EventHandler::mouseDownWasInSubframe): Added for AutoscrollController.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::canAutoscroll): Moved from EventHandler.cpp.
(WebCore::RenderBox::findAutoscrollable): Moved from EventHandler.cpp.
* rendering/RenderBox.h:
(RenderBox): Added new functions canAutoscroll() and findAutoscrollable().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137726 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/page/AutoscrollController.cpp [new file with mode: 0644]
Source/WebCore/page/AutoscrollController.h [new file with mode: 0644]
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/EventHandler.h
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h