Commit 39ed951a authored by bdakin@apple.com's avatar bdakin@apple.com
Browse files

ScrollbarPainterController should adopt the api to lock overlay scrollbar state

https://bugs.webkit.org/show_bug.cgi?id=121928

Reviewed by Sam Weinig.

Source/WebCore: 

ScrollbarPainterController should adopt the api to lock overlay scrollbar state. 
This will allow the ScrollbarPainterController and ScrollAnimatorMac to have 
control over knowing whether or not the scrollbars are currently active, which 
will allow us to remove a bunch of functions previously implemented in 
ScrollableArea subclasses to answer that question.

ScrollableArea::scrollbarsCanBeActive() is not longer virtual. It used to 
implemented on ScrollableArea subclasses, but now ScrollableArea can just get the 
information from the ScrollAnimator.
* WebCore.exp.in:

When ScrollableArea subclasses implemented scrollbarsCanBeActive(), they would 
check to see if the document was in the page cache. Instead of that model, this 
patch adopts a model where ScrollbarPainterController is told directly whether or 
not it is active via shouldLockOverlayScrollbarsToHidden(bool).
* dom/Document.cpp:
(WebCore::Document::setInPageCache):

setAnimatorsAreActive() is no longer necessary. The functionality can be bundled 
into shouldLockOverlayScrollbarsToHidden(bool).
(WebCore::Document::documentDidResumeFromPageCache):

Remove implementations of scrollbarsCanBeActive(), setAnimatorsAreActive(), and 
scrollbarAnimationsAreSuppressed(). 
* page/FrameView.cpp:
(WebCore::FrameView::notifyPageThatContentAreaWillPaint):
* page/FrameView.h:

setShouldSuppressScrollbarAnimations(bool) now calls 
setShouldLockOverlayScrollbars(bool). 
* page/Page.cpp:
(WebCore::Page::setShouldSuppressScrollbarAnimations):
(WebCore::Page::setShouldLockOverlayScrollbars):
* page/Page.h:

setIsActive() is now implemented in the ScrollAnimator instead of ScrollableArea 
subclasses. finishCurrentScrollAnimations() is replaced by 
lockOverlayScrollbarStateToHidden(bool).
* platform/ScrollAnimator.h:
(WebCore::ScrollAnimator::lockOverlayScrollbarStateToHidden):
(WebCore::ScrollAnimator::scrollbarsCanBeActive):

New enum ScrollbarOverlayState.
* platform/ScrollTypes.h:

Go to the animator for both of these functions.
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::lockOverlayScrollbarStateToHidden):
(WebCore::ScrollableArea::scrollbarsCanBeActive):
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::setVisibleScrollerThumbRect):

Three new pieces of ScrollbarPainterController api.
* platform/mac/NSScrollerImpDetails.h:

Instead of asking the ScrollableArea if scrollbars can be active, just find out if 
the ScrollbarPaintController has been locked.
* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(-[WebScrollbarPainterControllerDelegate scrollerImpPair:setContentAreaNeedsDisplayInRect:]):
(-[WebScrollbarPainterDelegate scrollerImp:animateKnobAlphaTo:duration:]):
(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::ScrollAnimatorMac::lockOverlayScrollbarStateToHidden):
(WebCore::ScrollAnimatorMac::scrollbarsCanBeActive):
(WebCore::ScrollAnimatorMac::notifyContentAreaScrolled):
(WebCore::ScrollAnimatorMac::updateScrollerStyle):

Remove implementations of scrollbarsCanBeActive() and 
scrollbarAnimationsAreSuppressed().
* rendering/RenderLayer.cpp:
* rendering/RenderLayer.h:
* rendering/RenderListBox.cpp:
* rendering/RenderListBox.h:

Source/WebKit2: 

This function no longer needs to be implemented by ScrollablArea subclasses.
* WebProcess/Plugins/PDF/PDFPlugin.h:
* WebProcess/Plugins/PDF/PDFPlugin.mm:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156558 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3cd5c771
2013-09-27 Beth Dakin <bdakin@apple.com>
ScrollbarPainterController should adopt the api to lock overlay scrollbar state
https://bugs.webkit.org/show_bug.cgi?id=121928
Reviewed by Sam Weinig.
ScrollbarPainterController should adopt the api to lock overlay scrollbar state.
This will allow the ScrollbarPainterController and ScrollAnimatorMac to have
control over knowing whether or not the scrollbars are currently active, which
will allow us to remove a bunch of functions previously implemented in
ScrollableArea subclasses to answer that question.
ScrollableArea::scrollbarsCanBeActive() is not longer virtual. It used to
implemented on ScrollableArea subclasses, but now ScrollableArea can just get the
information from the ScrollAnimator.
* WebCore.exp.in:
When ScrollableArea subclasses implemented scrollbarsCanBeActive(), they would
check to see if the document was in the page cache. Instead of that model, this
patch adopts a model where ScrollbarPainterController is told directly whether or
not it is active via shouldLockOverlayScrollbarsToHidden(bool).
* dom/Document.cpp:
(WebCore::Document::setInPageCache):
setAnimatorsAreActive() is no longer necessary. The functionality can be bundled
into shouldLockOverlayScrollbarsToHidden(bool).
(WebCore::Document::documentDidResumeFromPageCache):
Remove implementations of scrollbarsCanBeActive(), setAnimatorsAreActive(), and
scrollbarAnimationsAreSuppressed().
* page/FrameView.cpp:
(WebCore::FrameView::notifyPageThatContentAreaWillPaint):
* page/FrameView.h:
setShouldSuppressScrollbarAnimations(bool) now calls
setShouldLockOverlayScrollbars(bool).
* page/Page.cpp:
(WebCore::Page::setShouldSuppressScrollbarAnimations):
(WebCore::Page::setShouldLockOverlayScrollbars):
* page/Page.h:
setIsActive() is now implemented in the ScrollAnimator instead of ScrollableArea
subclasses. finishCurrentScrollAnimations() is replaced by
lockOverlayScrollbarStateToHidden(bool).
* platform/ScrollAnimator.h:
(WebCore::ScrollAnimator::lockOverlayScrollbarStateToHidden):
(WebCore::ScrollAnimator::scrollbarsCanBeActive):
New enum ScrollbarOverlayState.
* platform/ScrollTypes.h:
Go to the animator for both of these functions.
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::lockOverlayScrollbarStateToHidden):
(WebCore::ScrollableArea::scrollbarsCanBeActive):
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::setVisibleScrollerThumbRect):
Three new pieces of ScrollbarPainterController api.
* platform/mac/NSScrollerImpDetails.h:
Instead of asking the ScrollableArea if scrollbars can be active, just find out if
the ScrollbarPaintController has been locked.
* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(-[WebScrollbarPainterControllerDelegate scrollerImpPair:setContentAreaNeedsDisplayInRect:]):
(-[WebScrollbarPainterDelegate scrollerImp:animateKnobAlphaTo:duration:]):
(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::ScrollAnimatorMac::lockOverlayScrollbarStateToHidden):
(WebCore::ScrollAnimatorMac::scrollbarsCanBeActive):
(WebCore::ScrollAnimatorMac::notifyContentAreaScrolled):
(WebCore::ScrollAnimatorMac::updateScrollerStyle):
Remove implementations of scrollbarsCanBeActive() and
scrollbarAnimationsAreSuppressed().
* rendering/RenderLayer.cpp:
* rendering/RenderLayer.h:
* rendering/RenderListBox.cpp:
* rendering/RenderListBox.h:
2013-09-27 David Hyatt <hyatt@apple.com>
 
Move line grid functionality from RenderBlock into RenderBlockFlow.
......@@ -1437,6 +1437,7 @@ __ZNK7WebCore14ScrollableArea14scrollAnimatorEv
__ZNK7WebCore14ScrollableArea17totalContentsSizeEv
__ZNK7WebCore14ScrollableArea20contentAreaWillPaintEv
__ZNK7WebCore14ScrollableArea21mouseEnteredScrollbarEPNS_9ScrollbarE
__ZNK7WebCore14ScrollableArea21scrollbarsCanBeActiveEv
__ZNK7WebCore14ScrollableArea22mouseExitedContentAreaEv
__ZNK7WebCore14ScrollableArea23mouseEnteredContentAreaEv
__ZNK7WebCore14ScrollableArea23mouseMovedInContentAreaEv
......
......@@ -3999,6 +3999,9 @@ void Document::setInPageCache(bool flag)
FrameView* v = view();
Page* page = this->page();
if (page)
page->lockAllOverlayScrollbarsToHidden(flag);
if (flag) {
ASSERT(!m_savedRenderView);
m_savedRenderView = renderView();
......@@ -4066,8 +4069,8 @@ void Document::documentDidResumeFromPageCache()
renderView()->setIsInWindow(true);
#endif
if (FrameView* frameView = view())
frameView->setAnimatorsAreActive();
ASSERT(page());
page()->lockAllOverlayScrollbarsToHidden(false);
ASSERT(m_frame);
m_frame->loader().client().dispatchDidBecomeFrameset(isFrameSet());
......
......@@ -887,13 +887,6 @@ GraphicsLayer* FrameView::setWantsLayerForBottomOverHangArea(bool wantsLayer) co
#endif // ENABLE(RUBBER_BANDING)
bool FrameView::scrollbarAnimationsAreSuppressed() const
{
if (Page* page = frame().page())
return page->shouldSuppressScrollbarAnimations();
return true;
}
bool FrameView::flushCompositingStateForThisFrame(Frame* rootFrameForFlush)
{
RenderView* renderView = this->renderView();
......@@ -3104,22 +3097,6 @@ void FrameView::setVisibleScrollerThumbRect(const IntRect& scrollerThumb)
frame().page()->chrome().client().notifyScrollerThumbIsVisibleInRect(scrollerThumb);
}
bool FrameView::scrollbarsCanBeActive() const
{
if (frame().view() != this)
return false;
if (Page* page = frame().page()) {
if (page->shouldSuppressScrollbarAnimations())
return false;
}
if (Document* document = frame().document())
return !document->inPageCache();
return false;
}
ScrollableArea* FrameView::enclosingScrollableArea() const
{
// FIXME: Walk up the frame tree and look for a scrollable parent frame or RenderLayer.
......@@ -3195,26 +3172,6 @@ void FrameView::scrollbarStyleChanged(int newStyle, bool forceUpdate)
ScrollView::scrollbarStyleChanged(newStyle, forceUpdate);
}
void FrameView::setAnimatorsAreActive()
{
Page* page = frame().page();
if (!page)
return;
if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
scrollAnimator->setIsActive();
if (!m_scrollableAreas)
return;
for (HashSet<ScrollableArea*>::const_iterator it = m_scrollableAreas->begin(), end = m_scrollableAreas->end(); it != end; ++it) {
ScrollableArea* scrollableArea = *it;
ASSERT(scrollableArea->scrollbarsCanBeActive());
scrollableArea->scrollAnimator()->setIsActive();
}
}
void FrameView::notifyPageThatContentAreaWillPaint() const
{
Page* page = frame().page();
......@@ -3228,10 +3185,6 @@ void FrameView::notifyPageThatContentAreaWillPaint() const
for (HashSet<ScrollableArea*>::const_iterator it = m_scrollableAreas->begin(), end = m_scrollableAreas->end(); it != end; ++it) {
ScrollableArea* scrollableArea = *it;
if (!scrollableArea->scrollbarsCanBeActive())
continue;
scrollableArea->contentAreaWillPaint();
}
}
......
......@@ -356,16 +356,12 @@ public:
virtual bool isHandlingWheelEvent() const OVERRIDE;
bool shouldSetCursor() const;
virtual bool scrollbarsCanBeActive() const OVERRIDE;
// FIXME: Remove this method once plugin loading is decoupled from layout.
void flushAnyPendingPostLayoutTasks();
virtual bool shouldSuspendScrollAnimations() const OVERRIDE;
virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate) OVERRIDE;
void setAnimatorsAreActive();
RenderBox* embeddedContentBox() const;
void setTracksRepaints(bool);
......@@ -423,10 +419,6 @@ public:
virtual void willStartLiveResize() OVERRIDE;
virtual void willEndLiveResize() OVERRIDE;
#if USE(ACCELERATED_COMPOSITING)
virtual bool scrollbarAnimationsAreSuppressed() const OVERRIDE;
#endif
void addPaintPendingMilestones(LayoutMilestones);
void firePaintRelatedMilestones();
LayoutMilestones milestonesPendingPaint() const { return m_milestonesPendingPaint; }
......
......@@ -816,20 +816,17 @@ void Page::setShouldSuppressScrollbarAnimations(bool suppressAnimations)
if (suppressAnimations == m_suppressScrollbarAnimations)
return;
if (!suppressAnimations) {
// If animations are not going to be suppressed anymore, then there is nothing to do here but
// change the cached value.
m_suppressScrollbarAnimations = suppressAnimations;
return;
}
lockAllOverlayScrollbarsToHidden(suppressAnimations);
m_suppressScrollbarAnimations = suppressAnimations;
}
// On the other hand, if we are going to start suppressing animations, then we need to make sure we
// finish any current scroll animations first.
void Page::lockAllOverlayScrollbarsToHidden(bool lockOverlayScrollbars)
{
FrameView* view = mainFrame().view();
if (!view)
return;
view->finishCurrentScrollAnimations();
view->lockOverlayScrollbarStateToHidden(lockOverlayScrollbars);
for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
FrameView* frameView = frame->view();
......@@ -842,13 +839,9 @@ void Page::setShouldSuppressScrollbarAnimations(bool suppressAnimations)
for (HashSet<ScrollableArea*>::const_iterator it = scrollableAreas->begin(), end = scrollableAreas->end(); it != end; ++it) {
ScrollableArea* scrollableArea = *it;
ASSERT(scrollableArea->scrollbarsCanBeActive());
scrollableArea->finishCurrentScrollAnimations();
scrollableArea->lockOverlayScrollbarStateToHidden(lockOverlayScrollbars);
}
}
m_suppressScrollbarAnimations = suppressAnimations;
}
bool Page::rubberBandsAtBottom()
......
......@@ -283,6 +283,7 @@ public:
bool shouldSuppressScrollbarAnimations() const { return m_suppressScrollbarAnimations; }
void setShouldSuppressScrollbarAnimations(bool suppressAnimations);
void lockAllOverlayScrollbarsToHidden(bool lockOverlayScrollbars);
bool rubberBandsAtBottom();
void setRubberBandsAtBottom(bool);
......
......@@ -60,8 +60,6 @@ public:
ScrollableArea* scrollableArea() const { return m_scrollableArea; }
virtual void setIsActive() { }
virtual bool handleWheelEvent(const PlatformWheelEvent&);
#if PLATFORM(MAC)
......@@ -86,7 +84,8 @@ public:
virtual void contentAreaDidShow() const { }
virtual void contentAreaDidHide() const { }
virtual void finishCurrentScrollAnimations() { }
virtual void lockOverlayScrollbarStateToHidden(bool) { }
virtual bool scrollbarsCanBeActive() const { return true; }
virtual void didAddVerticalScrollbar(Scrollbar*) { }
virtual void willRemoveVerticalScrollbar(Scrollbar*) { }
......
......@@ -156,7 +156,14 @@ namespace WebCore {
ScrollbarOverlayStyleDark,
ScrollbarOverlayStyleLight
};
enum ScrollbarOverlayState {
ScrollbarOverlayStateHidden,
ScrollbarOverlayStateThumbShown,
ScrollbarOverlayStateAllShown,
ScrollbarOverlayStatePulseThumb
};
typedef unsigned ScrollbarControlPartMask;
enum ScrollPinningBehavior {
......
......@@ -254,10 +254,17 @@ void ScrollableArea::contentAreaDidHide() const
scrollAnimator->contentAreaDidHide();
}
void ScrollableArea::finishCurrentScrollAnimations() const
void ScrollableArea::lockOverlayScrollbarStateToHidden(bool shouldLockState) const
{
if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
scrollAnimator->finishCurrentScrollAnimations();
scrollAnimator->lockOverlayScrollbarStateToHidden(shouldLockState);
}
bool ScrollableArea::scrollbarsCanBeActive() const
{
if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
return scrollAnimator->scrollbarsCanBeActive();
return true;
}
void ScrollableArea::didAddScrollbar(Scrollbar* scrollbar, ScrollbarOrientation orientation)
......
......@@ -81,8 +81,8 @@ public:
void contentAreaDidShow() const;
void contentAreaDidHide() const;
void finishCurrentScrollAnimations() const;
virtual bool scrollbarAnimationsAreSuppressed() const { return false; }
void lockOverlayScrollbarStateToHidden(bool shouldLockState) const;
bool scrollbarsCanBeActive() const;
virtual void didAddScrollbar(Scrollbar*, ScrollbarOrientation);
virtual void willRemoveScrollbar(Scrollbar*, ScrollbarOrientation);
......@@ -155,8 +155,6 @@ public:
virtual bool shouldSuspendScrollAnimations() const { return true; }
virtual void scrollbarStyleChanged(int /*newStyle*/, bool /*forceUpdate*/) { }
virtual void setVisibleScrollerThumbRect(const IntRect&) { }
virtual bool scrollbarsCanBeActive() const = 0;
// Note that this only returns scrollable areas that can actually be scrolled.
virtual ScrollableArea* enclosingScrollableArea() const = 0;
......
......@@ -67,6 +67,9 @@
- (void)setDelegate:(id)delegate;
- (void)hideOverlayScrollers;
- (void)flashScrollers;
- (void)lockOverlayScrollerState:(NSUInteger)state;
- (BOOL)overlayScrollerStateIsLocked;
- (void)unlockOverlayScrollerState;
- (id)horizontalScrollerImp;
- (void)setHorizontalScrollerImp:(id)horizontal;
- (id)verticalScrollerImp;
......
......@@ -67,6 +67,8 @@ public:
void setVisibleScrollerThumbRect(const IntRect&);
virtual bool scrollbarsCanBeActive() const OVERRIDE FINAL;
private:
RetainPtr<id> m_scrollAnimationHelper;
RetainPtr<WebScrollAnimationHelperDelegate> m_scrollAnimationHelperDelegate;
......@@ -93,7 +95,6 @@ private:
virtual void handleWheelEventPhase(PlatformWheelEventPhase) OVERRIDE;
virtual void cancelAnimations();
virtual void setIsActive();
virtual void notifyPositionChanged(const FloatSize& delta);
virtual void contentAreaWillPaint() const;
......@@ -111,7 +112,7 @@ private:
void didEndScrollGesture() const;
void mayBeginScrollGesture() const;
virtual void finishCurrentScrollAnimations();
virtual void lockOverlayScrollbarStateToHidden(bool shouldLockState) OVERRIDE FINAL;
virtual void didAddVerticalScrollbar(Scrollbar*);
virtual void willRemoveVerticalScrollbar(Scrollbar*);
......
......@@ -267,7 +267,7 @@ static NSSize abs(NSSize size)
if (!_scrollableArea)
return;
if (!_scrollableArea->scrollbarsCanBeActive())
if ([scrollerImpPair overlayScrollerStateIsLocked])
return;
_scrollableArea->scrollAnimator()->contentAreaWillPaint();
......@@ -500,7 +500,7 @@ enum FeatureToAnimate {
ASSERT(scrollerImp == scrollbarPainterForScrollbar(_scrollbar));
ScrollbarPainter scrollerPainter = (ScrollbarPainter)scrollerImp;
if (_scrollbar->scrollableArea()->scrollbarAnimationsAreSuppressed()) {
if (![self scrollAnimator]->scrollbarsCanBeActive()) {
[scrollerImp setKnobAlpha:0];
_scrollbar->invalidate();
return;
......@@ -748,7 +748,7 @@ void ScrollAnimatorMac::notifyPositionChanged(const FloatSize& delta)
void ScrollAnimatorMac::contentAreaWillPaint() const
{
if (!scrollableArea()->scrollbarsCanBeActive())
if ([m_scrollbarPainterController overlayScrollerStateIsLocked])
return;
[m_scrollbarPainterController contentAreaWillDraw];
......@@ -756,7 +756,7 @@ void ScrollAnimatorMac::contentAreaWillPaint() const
void ScrollAnimatorMac::mouseEnteredContentArea() const
{
if (!scrollableArea()->scrollbarsCanBeActive())
if ([m_scrollbarPainterController overlayScrollerStateIsLocked])
return;
[m_scrollbarPainterController mouseEnteredContentArea];
......@@ -764,7 +764,7 @@ void ScrollAnimatorMac::mouseEnteredContentArea() const
void ScrollAnimatorMac::mouseExitedContentArea() const
{
if (!scrollableArea()->scrollbarsCanBeActive())
if ([m_scrollbarPainterController overlayScrollerStateIsLocked])
return;
[m_scrollbarPainterController mouseExitedContentArea];
......@@ -772,7 +772,7 @@ void ScrollAnimatorMac::mouseExitedContentArea() const
void ScrollAnimatorMac::mouseMovedInContentArea() const
{
if (!scrollableArea()->scrollbarsCanBeActive())
if ([m_scrollbarPainterController overlayScrollerStateIsLocked])
return;
[m_scrollbarPainterController mouseMovedInContentArea];
......@@ -784,7 +784,7 @@ void ScrollAnimatorMac::mouseEnteredScrollbar(Scrollbar* scrollbar) const
if (recommendedScrollerStyle() != NSScrollerStyleLegacy)
return;
if (!scrollableArea()->scrollbarsCanBeActive())
if ([m_scrollbarPainterController overlayScrollerStateIsLocked])
return;
if (!supportsUIStateTransitionProgress())
......@@ -799,7 +799,7 @@ void ScrollAnimatorMac::mouseExitedScrollbar(Scrollbar* scrollbar) const
if (recommendedScrollerStyle() != NSScrollerStyleLegacy)
return;
if (!scrollableArea()->scrollbarsCanBeActive())
if ([m_scrollbarPainterController overlayScrollerStateIsLocked])
return;
if (!supportsUIStateTransitionProgress())
......@@ -810,7 +810,7 @@ void ScrollAnimatorMac::mouseExitedScrollbar(Scrollbar* scrollbar) const
void ScrollAnimatorMac::willStartLiveResize()
{
if (!scrollableArea()->scrollbarsCanBeActive())
if ([m_scrollbarPainterController overlayScrollerStateIsLocked])
return;
[m_scrollbarPainterController startLiveResize];
......@@ -818,7 +818,7 @@ void ScrollAnimatorMac::willStartLiveResize()
void ScrollAnimatorMac::contentsResized() const
{
if (!scrollableArea()->scrollbarsCanBeActive())
if ([m_scrollbarPainterController overlayScrollerStateIsLocked])
return;
[m_scrollbarPainterController contentAreaDidResize];
......@@ -826,7 +826,7 @@ void ScrollAnimatorMac::contentsResized() const
void ScrollAnimatorMac::willEndLiveResize()
{
if (!scrollableArea()->scrollbarsCanBeActive())
if ([m_scrollbarPainterController overlayScrollerStateIsLocked])
return;
[m_scrollbarPainterController endLiveResize];
......@@ -834,7 +834,7 @@ void ScrollAnimatorMac::willEndLiveResize()
void ScrollAnimatorMac::contentAreaDidShow() const
{
if (!scrollableArea()->scrollbarsCanBeActive())
if ([m_scrollbarPainterController overlayScrollerStateIsLocked])
return;
[m_scrollbarPainterController windowOrderedIn];
......@@ -842,7 +842,7 @@ void ScrollAnimatorMac::contentAreaDidShow() const
void ScrollAnimatorMac::contentAreaDidHide() const
{
if (!scrollableArea()->scrollbarsCanBeActive())
if ([m_scrollbarPainterController overlayScrollerStateIsLocked])
return;
[m_scrollbarPainterController windowOrderedOut];
......@@ -850,7 +850,7 @@ void ScrollAnimatorMac::contentAreaDidHide() const
void ScrollAnimatorMac::didBeginScrollGesture() const
{
if (!scrollableArea()->scrollbarsCanBeActive())
if ([m_scrollbarPainterController overlayScrollerStateIsLocked])
return;
[m_scrollbarPainterController beginScrollGesture];
......@@ -858,7 +858,7 @@ void ScrollAnimatorMac::didBeginScrollGesture() const
void ScrollAnimatorMac::didEndScrollGesture() const
{
if (!scrollableArea()->scrollbarsCanBeActive())
if ([m_scrollbarPainterController overlayScrollerStateIsLocked])
return;
[m_scrollbarPainterController endScrollGesture];
......@@ -866,18 +866,30 @@ void ScrollAnimatorMac::didEndScrollGesture() const
void ScrollAnimatorMac::mayBeginScrollGesture() const
{
if (!scrollableArea()->scrollbarsCanBeActive())
if ([m_scrollbarPainterController overlayScrollerStateIsLocked])
return;
[m_scrollbarPainterController beginScrollGesture];
[m_scrollbarPainterController contentAreaScrolled];
}
void ScrollAnimatorMac::finishCurrentScrollAnimations()
void ScrollAnimatorMac::lockOverlayScrollbarStateToHidden(bool shouldLockState)
{
cancelAnimations();
if (shouldLockState)
[m_scrollbarPainterController lockOverlayScrollerState:ScrollbarOverlayStateHidden];
else {
[m_scrollbarPainterController unlockOverlayScrollerState];
[m_scrollbarPainterController hideOverlayScrollers];
// We never update scroller style for PainterControllers that are locked. If we have a pending
// need to update the style, do it once we've unlocked the scroller state.
if (m_needsScrollerStyleUpdate)
updateScrollerStyle();
}
}
bool ScrollAnimatorMac::scrollbarsCanBeActive() const
{
return ![m_scrollbarPainterController overlayScrollerStateIsLocked];
}
void ScrollAnimatorMac::didAddVerticalScrollbar(Scrollbar* scrollbar)
......@@ -959,7 +971,7 @@ void ScrollAnimatorMac::notifyContentAreaScrolled(const FloatSize& delta)
// This function is called when a page is going into the page cache, but the page
// isn't really scrolling in that case. We should only pass the message on to the
// ScrollbarPainterController when we're really scrolling on an active page.
if (!scrollableArea()->scrollbarsCanBeActive())
if ([m_scrollbarPainterController overlayScrollerStateIsLocked])
return;
if (m_scrollableArea->isHandlingWheelEvent())
......@@ -1154,17 +1166,9 @@ void ScrollAnimatorMac::snapRubberBandTimerFired(Timer<ScrollAnimatorMac>*)
}
#endif
void ScrollAnimatorMac::setIsActive()
{
if (!m_needsScrollerStyleUpdate)
return;
updateScrollerStyle();
}
void ScrollAnimatorMac::updateScrollerStyle()
{
if (!scrollableArea()->scrollbarsCanBeActive()) {
if ([m_scrollbarPainterController overlayScrollerStateIsLocked]) {
m_needsScrollerStyleUpdate = true;
return;
}
......
......@@ -751,11 +751,6 @@ IntSize PopupMenuWin::contentsSize() const
return m_windowRect.size();
}
bool PopupMenuWin::scrollbarsCanBeActive() const
{
return m_showPopup;
}
IntRect PopupMenuWin::scrollableAreaBoundingBox() const
{
return m_windowRect;
......
......@@ -104,7 +104,6 @@ private:
virtual int visibleHeight() const OVERRIDE;
virtual int visibleWidth() const OVERRIDE;
virtual IntSize contentsSize() const OVERRIDE;
virtual bool scrollbarsCanBeActive() const OVERRIDE;