Index: Source/core/rendering/RenderListBox.cpp |
diff --git a/Source/core/rendering/RenderListBox.cpp b/Source/core/rendering/RenderListBox.cpp |
index 9eeace5b4a1747ffb2201bdbab836ce6f8187e44..4d36b699a0a402976d56b0d076ed68a7b27fe62f 100644 |
--- a/Source/core/rendering/RenderListBox.cpp |
+++ b/Source/core/rendering/RenderListBox.cpp |
@@ -99,8 +99,10 @@ RenderListBox::~RenderListBox() |
{ |
setHasVerticalScrollbar(false); |
- if (FrameView* frameView = frame()->view()) |
+ if (FrameView* frameView = frame()->view()) { |
frameView->removeScrollableArea(this); |
+ frameView->removeAnimatingScrollableArea(this); |
+ } |
} |
// FIXME: Instead of this hack we should add a ShadowRoot to <select> with no insertion point |
@@ -709,7 +711,7 @@ LayoutUnit RenderListBox::scrollLeft() const |
return 0; |
} |
-void RenderListBox::setScrollLeft(LayoutUnit) |
+void RenderListBox::setScrollLeft(LayoutUnit, ScrollBehavior) |
{ |
} |
@@ -718,14 +720,21 @@ LayoutUnit RenderListBox::scrollTop() const |
return m_indexOffset * itemHeight(); |
} |
-void RenderListBox::setScrollTop(LayoutUnit newTop) |
+void RenderListBox::setScrollTop(LayoutUnit newTop, ScrollBehavior scrollBehavior) |
{ |
+ cancelProgrammaticScrollAnimation(); |
+ |
// Determine an index and scroll to it. |
int index = newTop / itemHeight(); |
if (index < 0 || index >= numItems() || index == m_indexOffset) |
return; |
- scrollToOffsetWithoutAnimation(VerticalScrollbar, index); |
+ if (scrollBehavior == ScrollBehaviorAuto) |
+ scrollBehavior = style()->scrollBehavior(); |
+ if (scrollBehavior == ScrollBehaviorSmooth) |
+ programmaticallyScrollSmoothlyToOffset(FloatPoint(0, index)); |
+ else |
+ scrollToOffsetWithoutAnimation(VerticalScrollbar, index); |
} |
bool RenderListBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) |
@@ -885,6 +894,22 @@ bool RenderListBox::scrollbarsCanBeActive() const |
return view->frameView()->scrollbarsCanBeActive(); |
} |
+void RenderListBox::registerForAnimation() |
+{ |
+ frameView()->addAnimatingScrollableArea(this); |
+} |
+ |
+void RenderListBox::deregisterForAnimation() |
+{ |
+ if (FrameView* frameView = this->frameView()) |
+ frameView->removeAnimatingScrollableArea(this); |
+} |
+ |
+bool RenderListBox::scheduleAnimation() |
+{ |
+ return frameView()->scheduleAnimation(); |
+} |
+ |
IntPoint RenderListBox::minimumScrollPosition() const |
{ |
return IntPoint(); |