Index: Source/core/rendering/RenderLayerScrollableArea.cpp |
diff --git a/Source/core/rendering/RenderLayerScrollableArea.cpp b/Source/core/rendering/RenderLayerScrollableArea.cpp |
index db17dc86836e0e73505ae696e504cc2e811dff1c..587575edc38b027a23c3ffad0f6881cc2bcdd5ae 100644 |
--- a/Source/core/rendering/RenderLayerScrollableArea.cpp |
+++ b/Source/core/rendering/RenderLayerScrollableArea.cpp |
@@ -50,6 +50,7 @@ |
#include "core/editing/FrameSelection.h" |
#include "core/frame/FrameView.h" |
#include "core/frame/LocalFrame.h" |
+#include "core/frame/Settings.h" |
#include "core/html/HTMLFrameOwnerElement.h" |
#include "core/inspector/InspectorInstrumentation.h" |
#include "core/inspector/InspectorTraceEvents.h" |
@@ -111,6 +112,7 @@ RenderLayerScrollableArea::~RenderLayerScrollableArea() |
if (LocalFrame* frame = box().frame()) { |
if (FrameView* frameView = frame->view()) { |
frameView->removeScrollableArea(this); |
+ frameView->removeAnimatingScrollableArea(this); |
} |
} |
@@ -518,6 +520,23 @@ int RenderLayerScrollableArea::pageStep(ScrollbarOrientation orientation) const |
return max(pageStep, 1); |
} |
+void RenderLayerScrollableArea::registerForAnimation() |
+{ |
+ box().frameView()->addAnimatingScrollableArea(this); |
+} |
+ |
+void RenderLayerScrollableArea::deregisterForAnimation() |
+{ |
+ if (FrameView* frameView = box().frameView()) { |
+ frameView->removeAnimatingScrollableArea(this); |
+ } |
+} |
+ |
+bool RenderLayerScrollableArea::scheduleAnimation() |
+{ |
+ return box().frameView()->scheduleAnimation(); |
+} |
+ |
RenderBox& RenderLayerScrollableArea::box() const |
{ |
return *m_layer.renderBox(); |
@@ -564,11 +583,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 = box().style()->scrollBehavior(); |
+ if (newScrollOffset != adjustedScrollOffset()) { |
+ if (scrollBehavior == ScrollBehaviorSmooth) |
+ programmaticallyScrollSmoothlyToOffset(-scrollOrigin() + newScrollOffset); |
+ else |
+ scrollToOffsetWithoutAnimation(-scrollOrigin() + newScrollOffset); |
+ } |
} |
void RenderLayerScrollableArea::updateAfterLayout() |
@@ -1383,6 +1409,7 @@ void RenderLayerScrollableArea::resize(const PlatformEvent& evt, const LayoutSiz |
LayoutRect RenderLayerScrollableArea::exposeRect(const LayoutRect& rect, const ScrollAlignment& alignX, const ScrollAlignment& alignY) |
{ |
+ cancelProgrammaticScrollAnimation(); |
LayoutRect localExposeRect(box().absoluteToLocalQuad(FloatQuad(FloatRect(rect)), UseTransforms).boundingBox()); |
LayoutRect layerBounds(0, 0, box().clientWidth(), box().clientHeight()); |
LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect, alignX, alignY); |