Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1766)

Unified Diff: Source/core/rendering/RenderLayerScrollableArea.cpp

Issue 792513004: Implement CSSOM smooth scroll for Elements (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/RenderLayerScrollableArea.cpp
diff --git a/Source/core/rendering/RenderLayerScrollableArea.cpp b/Source/core/rendering/RenderLayerScrollableArea.cpp
index 0a6c15ecfbe1c43e2ad6d426c37fb1ceecfd4158..ae8ab73f0b6708a6dbce927898337ea874745554 100644
--- a/Source/core/rendering/RenderLayerScrollableArea.cpp
+++ b/Source/core/rendering/RenderLayerScrollableArea.cpp
@@ -115,6 +115,7 @@ RenderLayerScrollableArea::~RenderLayerScrollableArea()
if (LocalFrame* frame = box().frame()) {
if (FrameView* frameView = frame->view()) {
frameView->removeScrollableArea(this);
+ frameView->removeAnimatingScrollableArea(this);
}
}
@@ -501,6 +502,22 @@ IntRect RenderLayerScrollableArea::scrollableAreaBoundingBox() const
return box().absoluteBoundingBoxRect();
}
+void RenderLayerScrollableArea::registerForAnimation()
+{
+ if (LocalFrame* frame = box().frame()) {
+ if (FrameView* frameView = frame->view())
+ frameView->addAnimatingScrollableArea(this);
+ }
+}
+
+void RenderLayerScrollableArea::deregisterForAnimation()
+{
+ if (LocalFrame* frame = box().frame()) {
+ if (FrameView* frameView = frame->view())
+ frameView->removeAnimatingScrollableArea(this);
+ }
+}
+
bool RenderLayerScrollableArea::userInputScrollable(ScrollbarOrientation orientation) const
{
if (box().isIntristicallyScrollable(orientation))
@@ -572,13 +589,21 @@ void RenderLayerScrollableArea::computeScrollDimensions()
setScrollOrigin(IntPoint(-scrollableLeftOverflow, -scrollableTopOverflow));
}
-void RenderLayerScrollableArea::scrollToOffset(const DoubleSize& scrollOffset, ScrollOffsetClamping clamp)
+void RenderLayerScrollableArea::scrollToOffset(const DoubleSize& scrollOffset, ScrollOffsetClamping clamp, ScrollBehavior scrollBehavior)
{
+ cancelProgrammaticScrollAnimation();
DoubleSize newScrollOffset = clamp == ScrollOffsetClamped ? clampScrollOffset(scrollOffset) : scrollOffset;
if (newScrollOffset != adjustedScrollOffset()) {
+ if (scrollBehavior == ScrollBehaviorAuto)
+ scrollBehavior = box().style()->scrollBehavior();
DoublePoint origin(scrollOrigin());
- // FIXME: Make scrollToOffsetWithoutAnimation take DoublePoint. crbug.com/414283.
- scrollToOffsetWithoutAnimation(toFloatPoint(-origin + newScrollOffset));
+ if (scrollBehavior == ScrollBehaviorSmooth) {
+ // FIXME: Make programmaticallyScrollSmoothlyToOffset take DoublePoint. crbug.com/243871.
+ programmaticallyScrollSmoothlyToOffset(toFloatPoint(-origin + newScrollOffset));
+ } else {
+ // FIXME: Make scrollToOffsetWithoutAnimation take DoublePoint. crbug.com/414283.
+ scrollToOffsetWithoutAnimation(toFloatPoint(-origin + newScrollOffset));
+ }
}
}
« no previous file with comments | « Source/core/rendering/RenderLayerScrollableArea.h ('k') | Source/platform/scroll/ProgrammaticScrollAnimator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698