| Index: Source/core/frame/FrameView.cpp
|
| diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp
|
| index 4531ee4e637ff563196e553b7d56f66621303165..08134addfd6408c5e3a90a1d9475bcfa6e6aa06f 100644
|
| --- a/Source/core/frame/FrameView.cpp
|
| +++ b/Source/core/frame/FrameView.cpp
|
| @@ -78,6 +78,7 @@
|
| #include "platform/geometry/FloatRect.h"
|
| #include "platform/graphics/GraphicsContext.h"
|
| #include "platform/graphics/GraphicsLayerDebugInfo.h"
|
| +#include "platform/scroll/ProgrammaticScrollAnimator.h"
|
| #include "platform/scroll/ScrollAnimator.h"
|
| #include "platform/scroll/ScrollbarTheme.h"
|
| #include "platform/text/TextStream.h"
|
| @@ -263,6 +264,7 @@ void FrameView::prepareForDetach()
|
|
|
| if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
|
| scrollAnimator->cancelAnimations();
|
| + cancelProgrammaticScrollAnimation();
|
|
|
| detachCustomScrollbars();
|
| // When the view is no longer associated with a frame, it needs to be removed from the ax object cache
|
| @@ -390,6 +392,21 @@ bool FrameView::scheduleAnimation()
|
| return false;
|
| }
|
|
|
| +void FrameView::serviceScrollAnimations(double monotonicTime)
|
| +{
|
| + ScrollableArea::serviceScrollAnimations(monotonicTime);
|
| +
|
| + if (!m_animatingScrollableAreas || m_animatingScrollableAreas->isEmpty())
|
| + return;
|
| +
|
| + // We need to iterate over a copy of m_animatingScrollableAreas, since ScrollableAreas
|
| + // may deregister themselves during the iteration.
|
| + Vector<ScrollableArea*> animatingScrollableAreas;
|
| + copyToVector(*m_animatingScrollableAreas, animatingScrollableAreas);
|
| + for (size_t i = 0; i < animatingScrollableAreas.size(); ++i)
|
| + animatingScrollableAreas[i]->serviceScrollAnimations(monotonicTime);
|
| +}
|
| +
|
| Page* FrameView::page() const
|
| {
|
| return frame().page();
|
| @@ -1569,8 +1586,9 @@ void FrameView::scrollElementToRect(Element* element, const IntRect& rect)
|
| }
|
| }
|
|
|
| -void FrameView::setScrollPosition(const IntPoint& scrollPoint)
|
| +void FrameView::setScrollPosition(const IntPoint& scrollPoint, ScrollBehavior scrollBehavior)
|
| {
|
| + cancelProgrammaticScrollAnimation();
|
| TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, true);
|
| m_maintainScrollPositionAnchor = nullptr;
|
|
|
| @@ -1579,7 +1597,9 @@ void FrameView::setScrollPosition(const IntPoint& scrollPoint)
|
| if (newScrollPosition == scrollPosition())
|
| return;
|
|
|
| - ScrollView::setScrollPosition(newScrollPosition);
|
| + if (scrollBehavior == ScrollBehaviorAuto)
|
| + scrollBehavior = m_frame->document()->documentElement()->renderer()->style()->scrollBehavior();
|
| + ScrollView::setScrollPosition(newScrollPosition, scrollBehavior);
|
| }
|
|
|
| void FrameView::setScrollPositionNonProgrammatically(const IntPoint& scrollPoint)
|
| @@ -3186,6 +3206,27 @@ void FrameView::removeScrollableArea(ScrollableArea* scrollableArea)
|
| m_scrollableAreas->remove(scrollableArea);
|
| }
|
|
|
| +bool FrameView::addAnimatingScrollableArea(ScrollableArea* scrollableArea)
|
| +{
|
| + ASSERT(scrollableArea);
|
| + if (!m_animatingScrollableAreas)
|
| + m_animatingScrollableAreas = adoptPtr(new ScrollableAreaSet);
|
| + return m_animatingScrollableAreas->add(scrollableArea).isNewEntry;
|
| +}
|
| +
|
| +bool FrameView::removeAnimatingScrollableArea(ScrollableArea* scrollableArea)
|
| +{
|
| + if (!m_animatingScrollableAreas)
|
| + return false;
|
| +
|
| + ScrollableAreaSet::iterator it = m_animatingScrollableAreas->find(scrollableArea);
|
| + if (it == m_animatingScrollableAreas->end())
|
| + return false;
|
| +
|
| + m_animatingScrollableAreas->remove(it);
|
| + return true;
|
| +}
|
| +
|
| void FrameView::removeChild(Widget* widget)
|
| {
|
| if (widget->isFrameView())
|
|
|