Index: Source/core/frame/FrameView.cpp |
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp |
index 5998bd43016cc0bd588537b3ad451b61ecef7ef4..8816dd2147c33b850a767f22848c7a0b0d49010d 100644 |
--- a/Source/core/frame/FrameView.cpp |
+++ b/Source/core/frame/FrameView.cpp |
@@ -76,6 +76,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" |
@@ -293,6 +294,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 |
@@ -400,6 +402,11 @@ void FrameView::setFrameRect(const IntRect& newRect) |
} |
} |
+bool FrameView::registerForAnimation() |
+{ |
+ return true; |
+} |
+ |
bool FrameView::scheduleAnimation() |
{ |
if (HostWindow* window = hostWindow()) { |
@@ -409,6 +416,26 @@ bool FrameView::scheduleAnimation() |
return false; |
} |
+void FrameView::serviceScrollAnimations(double monotonicTime) |
+{ |
+ ScrollableArea::serviceScrollAnimations(monotonicTime); |
+ |
+ if (!m_animatingScrollableAreas) |
+ return; |
+ |
+ for (HashSet<ScrollableArea*>::iterator it = m_animatingScrollableAreas->begin(), end = m_animatingScrollableAreas->end(); it != end; ++it) { |
+ ScrollableArea* scrollableArea = *it; |
+ scrollableArea->serviceScrollAnimations(monotonicTime); |
+ } |
+} |
+ |
+bool FrameView::compositedScrollAnimationsEnabled() const |
+{ |
+ if (Settings* settings = m_frame->settings()) |
+ return settings->compositorDrivenScrollAnimationsEnabled(); |
+ return false; |
+} |
+ |
RenderView* FrameView::renderView() const |
{ |
return frame().contentRenderer(); |
@@ -1625,8 +1652,9 @@ void FrameView::scrollElementToRect(Element* element, const IntRect& rect) |
setScrollPosition(IntPoint(bounds.x() - centeringOffsetX - rect.x(), bounds.y() - centeringOffsetY - rect.y())); |
} |
-void FrameView::setScrollPosition(const IntPoint& scrollPoint) |
+void FrameView::setScrollPosition(const IntPoint& scrollPoint, ScrollBehavior scrollBehavior) |
{ |
+ cancelProgrammaticScrollAnimation(); |
TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, true); |
m_maintainScrollPositionAnchor = 0; |
@@ -1635,7 +1663,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) |
@@ -1919,7 +1949,7 @@ void FrameView::unscheduleRelayout() |
void FrameView::serviceScriptedAnimations(double monotonicAnimationStartTime) |
{ |
for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree().traverseNext()) { |
- frame->view()->serviceScrollAnimations(); |
+ frame->view()->serviceScrollAnimations(monotonicAnimationStartTime); |
if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) |
frame->animation().serviceAnimations(); |
@@ -3150,6 +3180,27 @@ bool FrameView::removeScrollableArea(ScrollableArea* scrollableArea) |
return true; |
} |
+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; |
+} |
+ |
bool FrameView::containsScrollableArea(const ScrollableArea* scrollableArea) const |
{ |
ASSERT(scrollableArea); |