https://bugs.webkit.org/show_bug.cgi?id=96158
Need API to suppress scrollbar animations
-and corresponding-
<rdar://problem/12210972>

Reviewed by Sam Weinig.

Source/WebCore: 

This patch re-names ScrollableAre::isOnActivePage() to 
ScrollableArea::scrollbarsCanBeActive(). The new name better reflects 
how the function is actually used, and it allows us to use the same 
function for the new API that has been added to WebKit2. Now when a 
client has used that API to indicate that scrollbars should be 
suppressed, ScrollableArea::scrollbarsCanBeActive() will return 
false.

Page has a new member variable which indicated whether scrollbar 
animations for all scrollbars associated with that page should be 
suppressed. Whenever it is set to true (meaning the animations 
should be suppressed), Page iterates through all of the 
ScrollableAreas to tell each one to finishCurrentScrollAnimations().
* WebCore.exp.in:
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::setShouldSuppressScrollbarAnimations):
(WebCore):
* page/Page.h:
(WebCore::Page::shouldSuppressScrollbarAnimations):
(Page):

FrameView::isOnActivePage() is renamed to scrollbarsCanBeActive () 
and it will now return false if the Page says that scrollbar 
animations should be suppressed. 
* page/FrameView.cpp:
(WebCore::FrameView::scrollbarsCanBeActive):

scrollbarsCanBeActive() must now be a public member of FrameView so  
that it can be called from RenderLayer and RenderListBox.
* page/FrameView.h:
(FrameView):

New ScrollAnimator function calls hideOverlayScrollers.
* platform/ScrollAnimator.h:
(WebCore::ScrollAnimator::finishCurrentScrollAnimations):
(ScrollAnimator):
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::finishCurrentScrollAnimations):
(WebCore):
* platform/ScrollableArea.h:
(ScrollableArea):
* platform/mac/ScrollAnimatorMac.h:
(ScrollAnimatorMac):
(WebCore::ScrollAnimatorMac::finishCurrentScrollAnimations):

Re-name. isOnActivePage() -> scrollbarsCanBeActive()
(WebCore::FrameView::setAnimatorsAreActive):
(WebCore::FrameView::notifyPageThatContentAreaWillPaint):
* platform/mac/ScrollAnimatorMac.mm:
(-[WebScrollbarPainterControllerDelegate scrollerImpPair:setContentAreaNeedsDisplayInRect:]):
(WebCore::ScrollAnimatorMac::contentAreaWillPaint):
(WebCore::ScrollAnimatorMac::mouseEnteredContentArea):
(WebCore::ScrollAnimatorMac::mouseExitedContentArea):
(WebCore::ScrollAnimatorMac::mouseMovedInContentArea):
(WebCore::ScrollAnimatorMac::mouseEnteredScrollbar):
(WebCore::ScrollAnimatorMac::mouseExitedScrollbar):
(WebCore::ScrollAnimatorMac::willStartLiveResize):
(WebCore::ScrollAnimatorMac::contentsResized):
(WebCore::ScrollAnimatorMac::willEndLiveResize):
(WebCore::ScrollAnimatorMac::contentAreaDidShow):
(WebCore::ScrollAnimatorMac::contentAreaDidHide):
(WebCore::ScrollAnimatorMac::didBeginScrollGesture):
(WebCore::ScrollAnimatorMac::didEndScrollGesture):
(WebCore::ScrollAnimatorMac::mayBeginScrollGesture):
(WebCore):
(WebCore::ScrollAnimatorMac::notifyContentAreaScrolled):
(WebCore::ScrollAnimatorMac::updateScrollerStyle):
* rendering/RenderLayer.cpp:

RenderLayer and RenderListBox should call into FrameView's 
scrollbarsCanBeActive() so that they also return false when Page:: 
shouldSuppressScrollbarAnimations() is true.
(WebCore::RenderLayer::scrollbarsCanBeActive):
* rendering/RenderLayer.h:
(RenderLayer):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::scrollbarsCanBeActive):
* rendering/RenderListBox.h:

This is the one caller of ScrollableArea:: scrollbarsCanBeActive() 
that needs to distinguish between the scrollbar-suppressing scenario 
and the in-the-page-cache scenario.
* page/FocusController.cpp:
(WebCore::FocusController::setContainingWindowIsVisible):

Source/WebKit/chromium: 

ScrollableArea::isOnActivePage() has been re-named to
ScrollableArea:: scrollbarsCanBeActive().
* src/ScrollbarGroup.cpp:
(WebKit::ScrollbarGroup::scrollbarsCanBeActive):
* src/ScrollbarGroup.h:
* tests/GraphicsLayerChromiumTest.cpp:
* tests/ScrollAnimatorNoneTest.cpp:
(MockScrollableArea):

Source/WebKit/win: 

ScrollableArea::isOnActivePage() has been re-named to
ScrollableArea:: scrollbarsCanBeActive().
* WebScrollBar.cpp:
(WebScrollBar::scrollbarsCanBeActive):
* WebScrollBar.h:
(WebScrollBar):

Source/WebKit2: 

Add suppressScrollbarAnimations as a WebCreationParameter.
* Shared/WebPageCreationParameters.h:
(WebPageCreationParameters):

New API. Calls into the web process for the setter but not the 
getter.
* UIProcess/API/C/WKPage.cpp:
(WKPageSetSuppressScrollbarAnimations):
(WKPageAreScrollbarAnimationsSuppressed):
* UIProcess/API/C/WKPage.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::setSuppressScrollbarAnimations):
(WebKit):
(WebKit::WebPageProxy::creationParameters):
* UIProcess/WebPageProxy.h:
(WebPageProxy):
(WebKit::WebPageProxy::areScrollbarAnimationsSuppressed):
* WebProcess/WebPage/WebPage.messages.in:

Call into WebCore.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setSuppressScrollbarAnimations):
(WebKit):
* WebProcess/WebPage/WebPage.h:
(WebPage):

This ScrollableArea area function is re-named by this patch in 
WebCore.
* WebProcess/Plugins/PDF/BuiltInPDFView.h:
* WebProcess/Plugins/PDF/BuiltInPDFView.mm:
(WebKit::BuiltInPDFView::scrollbarsCanBeActive):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@128134 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/platform/ScrollableArea.h b/Source/WebCore/platform/ScrollableArea.h
index ce255b1..c744af6 100644
--- a/Source/WebCore/platform/ScrollableArea.h
+++ b/Source/WebCore/platform/ScrollableArea.h
@@ -81,6 +81,8 @@
     void contentAreaDidShow() const;
     void contentAreaDidHide() const;
 
+    void finishCurrentScrollAnimations() const;
+
     void didAddVerticalScrollbar(Scrollbar*);
     void willRemoveVerticalScrollbar(Scrollbar*);
     virtual void didAddHorizontalScrollbar(Scrollbar*);
@@ -147,7 +149,7 @@
     virtual void scrollbarStyleChanged(int /*newStyle*/, bool /*forceUpdate*/) { }
     virtual void setVisibleScrollerThumbRect(const IntRect&) { }
 
-    virtual bool isOnActivePage() const = 0;
+    virtual bool scrollbarsCanBeActive() const = 0;
     
     // Note that this only returns scrollable areas that can actually be scrolled.
     virtual ScrollableArea* enclosingScrollableArea() const = 0;