Cleanup Scrollbar/ScrollbarClient relationship
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Jan 2011 23:14:47 +0000 (23:14 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Jan 2011 23:14:47 +0000 (23:14 +0000)
commit4876ff46df3e9d727ab4c15b5336c123ffc2f830
treeeaa57f7f0b765c7ad20efcc9433560827275388f
parent1240cc43278be702ac16927fd7027635960ba729
Cleanup Scrollbar/ScrollbarClient relationship
https://bugs.webkit.org/show_bug.cgi?id=52779

Reviewed by Dave Hyatt.

Source/WebCore:

Pipe all scrolling through the ScrollbarClient/ScrollAnimator
rather than through the Scrollbar. The Scrollbar now is just
a "view" on the scroll position of the scrollable area it is
attached to.

There are now two ways to scroll a scrollable area:
- ScrollbarClient::scroll()
- ScrollbarClient::scrollToOffsetWithoutAnimation()

Both of these go through the ScrollAnimator (updating its state
or starting an animation). The ScrollAnimator, in turn, now calls
ScrollbarClient::setScrollOffsetFromAnimation, which tells the
Scrollbars to pull a new offset (via Scrollbar::offsetDidChange)
and tells the class that derives from ScrollbarClient to scroll
its contents (via ScrollbarClient::setScrollOffset).

* WebCore.xcodeproj/project.pbxproj:
Move Scrollbar.cpp to the right place.

* accessibility/AccessibilityScrollbar.cpp:
(WebCore::AccessibilityScrollbar::setValue):
Initiate the scroll through the scrollbar client, rather than the
scrollbar itself.

* page/FrameView.cpp:
(WebCore::FrameView::scrollTo):
* page/FrameView.h:
Condense the two valueChanged overrides to a single override of the
scrollTo function.

* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::scroll):
(WebCore::ScrollAnimator::scrollToOffsetWithoutAnimation):
(WebCore::ScrollAnimator::currentPosition):
(WebCore::ScrollAnimator::notityPositionChanged):
* platform/ScrollAnimator.h:
* platform/ScrollAnimatorWin.cpp:
(WebCore::ScrollAnimatorWin::scrollToOffsetWithoutAnimation):
(WebCore::ScrollAnimatorWin::animateScroll):
* platform/ScrollAnimatorWin.h:
* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::scrollToOffsetWithoutAnimation):
(WebCore::ScrollAnimatorMac::immediateScrollToPoint):
Change setScrollPositionAndStopAnimation to scrollToOffsetWithoutAnimation
and bottleneck all client notification of changed position through a new
notityPositionChanged() function.

* platform/ScrollView.cpp:
(WebCore::ScrollView::setScrollOffset):
(WebCore::ScrollView::scrollTo):
(WebCore::ScrollView::scrollPosition):
(WebCore::ScrollView::scroll):
(WebCore::ScrollView::updateScrollbars):
(WebCore::ScrollView::wheelEvent):
* platform/ScrollView.h:
(WebCore::ScrollView::horizontalScrollbar):
(WebCore::ScrollView::verticalScrollbar):
Update to scroll via the ScrollbarClient rather than the Scrollbar.

* platform/Scrollbar.cpp:
(WebCore::Scrollbar::offsetDidChange):
(WebCore::Scrollbar::autoscrollPressedPart):
(WebCore::Scrollbar::moveThumb):
(WebCore::Scrollbar::mouseMoved):
* platform/Scrollbar.h:
(WebCore::Scrollbar::setPressedPos):
Change the scrollbar to only updates its offset in response to
an offsetDidChange call.

* platform/ScrollbarClient.cpp:
(WebCore::ScrollbarClient::scroll):
(WebCore::ScrollbarClient::scrollToOffsetWithoutAnimation):
(WebCore::ScrollbarClient::scrollToXOffsetWithoutAnimation):
(WebCore::ScrollbarClient::scrollToYOffsetWithoutAnimation):
(WebCore::ScrollbarClient::setScrollOffsetFromAnimation):
* platform/ScrollbarClient.h:
(WebCore::ScrollbarClient::horizontalScrollbar):
(WebCore::ScrollbarClient::verticalScrollbar):
Make the increasingly misnamed ScrollbarClient responsible for
scrolling.

* platform/efl/ScrollbarEfl.cpp:
(scrollbarEflEdjeMessage):
* platform/gtk/MainFrameScrollbarGtk.cpp:
(MainFrameScrollbarGtk::gtkValueChanged):
* platform/qt/ScrollbarQt.cpp:
(WebCore::Scrollbar::contextMenu):
Update to move scrolling through the client.

* platform/win/PopupMenuWin.cpp:
(WebCore::PopupMenuWin::scrollToRevealSelection):
(WebCore::PopupMenuWin::scrollPosition):
(WebCore::PopupMenuWin::setScrollOffset):
(WebCore::PopupMenuWin::scrollTo):
(WebCore::PopupMenuWin::wndProc):
* platform/win/PopupMenuWin.h:
(WebCore::PopupMenuWin::verticalScrollbar):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollToOffset):
(WebCore::RenderLayer::scrollTo):
(WebCore::RenderLayer::setScrollOffset):
(WebCore::RenderLayer::scrollPosition):
(WebCore::RenderLayer::updateScrollInfoAfterLayout):
(WebCore::RenderLayer::scroll):
* rendering/RenderLayer.h:
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::scrollToRevealElementAtListIndex):
(WebCore::RenderListBox::scroll):
(WebCore::RenderListBox::logicalScroll):
(WebCore::RenderListBox::scrollPosition):
(WebCore::RenderListBox::setScrollOffset):
(WebCore::RenderListBox::scrollTo):
(WebCore::RenderListBox::setScrollTop):
* rendering/RenderListBox.h:
(WebCore::RenderListBox::verticalScrollbar):
Update to scroll via the ScrollbarClient rather than the Scrollbar.

* rendering/RenderMarquee.cpp:
(WebCore::RenderMarquee::start):
Simplify initial paint to just do an immediate scroll to the position.

Source/WebKit/chromium:

* src/WebScrollbarImpl.cpp:
(WebKit::WebScrollbarImpl::WebScrollbarImpl):
(WebKit::WebScrollbarImpl::value):
(WebKit::WebScrollbarImpl::setValue):
(WebKit::WebScrollbarImpl::scroll):
(WebKit::WebScrollbarImpl::onMouseDown):
(WebKit::WebScrollbarImpl::onMouseMove):
(WebKit::WebScrollbarImpl::onMouseWheel):
(WebKit::WebScrollbarImpl::onKeyDown):
(WebKit::WebScrollbarImpl::scrollPosition):
(WebKit::WebScrollbarImpl::setScrollOffset):
* src/WebScrollbarImpl.h:

Source/WebKit/qt:

* Api/qwebframe.cpp:
(QWebFrame::setScrollBarValue):

Source/WebKit/win:

* WebScrollBar.cpp:
(WebScrollBar::WebScrollBar):
(WebScrollBar::setValue):
(WebScrollBar::value):
(WebScrollBar::scroll):
(WebScrollBar::scrollPosition):
(WebScrollBar::setScrollOffset):
* WebScrollBar.h:

Source/WebKit2:

* UIProcess/win/WebPopupMenuProxyWin.cpp:
(WebKit::WebPopupMenuProxyWin::scrollPosition):
(WebKit::WebPopupMenuProxyWin::setScrollOffset):
(WebKit::WebPopupMenuProxyWin::scrollTo):
(WebKit::WebPopupMenuProxyWin::onMouseWheel):
(WebKit::WebPopupMenuProxyWin::scrollToRevealSelection):
* UIProcess/win/WebPopupMenuProxyWin.h:
(WebKit::WebPopupMenuProxyWin::verticalScrollbar):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@76291 268f45cc-cd09-0410-ab3c-d52691b4dbfc
38 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/accessibility/AccessibilityScrollbar.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/platform/ScrollAnimator.cpp
Source/WebCore/platform/ScrollAnimator.h
Source/WebCore/platform/ScrollAnimatorWin.cpp
Source/WebCore/platform/ScrollAnimatorWin.h
Source/WebCore/platform/ScrollView.cpp
Source/WebCore/platform/ScrollView.h
Source/WebCore/platform/Scrollbar.cpp
Source/WebCore/platform/Scrollbar.h
Source/WebCore/platform/ScrollbarClient.cpp
Source/WebCore/platform/ScrollbarClient.h
Source/WebCore/platform/efl/ScrollbarEfl.cpp
Source/WebCore/platform/gtk/MainFrameScrollbarGtk.cpp
Source/WebCore/platform/mac/ScrollAnimatorMac.h
Source/WebCore/platform/mac/ScrollAnimatorMac.mm
Source/WebCore/platform/qt/ScrollbarQt.cpp
Source/WebCore/platform/win/PopupMenuWin.cpp
Source/WebCore/platform/win/PopupMenuWin.h
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderListBox.h
Source/WebCore/rendering/RenderMarquee.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebScrollbarImpl.cpp
Source/WebKit/chromium/src/WebScrollbarImpl.h
Source/WebKit/qt/Api/qwebframe.cpp
Source/WebKit/qt/ChangeLog
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebScrollBar.cpp
Source/WebKit/win/WebScrollBar.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp
Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h