Index: Source/core/rendering/RenderLayerScrollableArea.cpp |
diff --git a/Source/core/rendering/RenderLayerScrollableArea.cpp b/Source/core/rendering/RenderLayerScrollableArea.cpp |
index ec64730d6dcc59174e89a37116f63c6143d1631d..c3cb85c70cae888718de9b0732dd61f7c73ee78e 100644 |
--- a/Source/core/rendering/RenderLayerScrollableArea.cpp |
+++ b/Source/core/rendering/RenderLayerScrollableArea.cpp |
@@ -53,6 +53,7 @@ |
#include "core/page/FocusController.h" |
#include "core/frame/Frame.h" |
#include "core/frame/FrameView.h" |
+#include "core/frame/Settings.h" |
#include "core/page/Page.h" |
#include "core/page/scrolling/ScrollingCoordinator.h" |
#include "core/rendering/CompositedLayerMapping.h" |
@@ -111,6 +112,7 @@ RenderLayerScrollableArea::~RenderLayerScrollableArea() |
if (Frame* frame = m_box->frame()) { |
if (FrameView* frameView = frame->view()) { |
frameView->removeScrollableArea(this); |
Ian Vollick
2014/02/06 16:02:31
Can't we just removeAnimationScrollableArea from r
|
+ frameView->removeAnimatingScrollableArea(this); |
} |
} |
@@ -510,6 +512,39 @@ int RenderLayerScrollableArea::pageStep(ScrollbarOrientation orientation) const |
return max(pageStep, 1); |
} |
+bool RenderLayerScrollableArea::registerForAnimation() |
+{ |
+ if (Frame* frame = m_box->frame()) { |
+ if (FrameView* frameView = frame->view()) |
+ return frameView->addAnimatingScrollableArea(this); |
+ } |
+ return false; |
+} |
+ |
+void RenderLayerScrollableArea::deregisterForAnimation() |
+{ |
+ if (Frame* frame = m_box->frame()) { |
+ if (FrameView* frameView = frame->view()) |
+ frameView->removeAnimatingScrollableArea(this); |
+ } |
+} |
+ |
+bool RenderLayerScrollableArea::scheduleAnimation() |
+{ |
+ if (Frame* frame = m_box->frame()) { |
+ if (FrameView* frameView = frame->view()) |
+ return frameView->scheduleAnimation(); |
+ } |
+ return false; |
+} |
+ |
+bool RenderLayerScrollableArea::compositedScrollAnimationsEnabled() const |
+{ |
+ if (Settings* settings = m_box->document().settings()) |
+ return settings->compositorDrivenScrollAnimationsEnabled(); |
+ return false; |
+} |
+ |
RenderLayer* RenderLayerScrollableArea::layer() const |
{ |
return m_box->layer(); |
@@ -541,11 +576,18 @@ void RenderLayerScrollableArea::computeScrollDimensions() |
setScrollOrigin(IntPoint(-scrollableLeftOverflow, -scrollableTopOverflow)); |
} |
-void RenderLayerScrollableArea::scrollToOffset(const IntSize& scrollOffset, ScrollOffsetClamping clamp) |
+void RenderLayerScrollableArea::scrollToOffset(const IntSize& scrollOffset, ScrollOffsetClamping clamp, ScrollBehavior scrollBehavior) |
{ |
+ cancelProgrammaticScrollAnimation(); |
IntSize newScrollOffset = clamp == ScrollOffsetClamped ? clampScrollOffset(scrollOffset) : scrollOffset; |
- if (newScrollOffset != adjustedScrollOffset()) |
- scrollToOffsetWithoutAnimation(-scrollOrigin() + newScrollOffset); |
+ if (scrollBehavior == ScrollBehaviorAuto) |
+ scrollBehavior = m_box->style()->scrollBehavior(); |
+ if (newScrollOffset != adjustedScrollOffset()) { |
+ if (scrollBehavior == ScrollBehaviorSmooth) |
+ programmaticallyScrollSmoothlyToOffset(-scrollOrigin() + newScrollOffset); |
+ else |
+ scrollToOffsetWithoutAnimation(-scrollOrigin() + newScrollOffset); |
+ } |
} |
void RenderLayerScrollableArea::updateAfterLayout() |
@@ -1332,6 +1374,7 @@ void RenderLayerScrollableArea::resize(const PlatformEvent& evt, const LayoutSiz |
LayoutRect RenderLayerScrollableArea::exposeRect(const LayoutRect& rect, const ScrollAlignment& alignX, const ScrollAlignment& alignY) |
{ |
+ cancelProgrammaticScrollAnimation(); |
LayoutRect localExposeRect(m_box->absoluteToLocalQuad(FloatQuad(FloatRect(rect)), UseTransforms).boundingBox()); |
LayoutRect layerBounds(0, 0, m_box->clientWidth(), m_box->clientHeight()); |
LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect, alignX, alignY); |