Index: Source/core/rendering/RenderListBox.cpp |
diff --git a/Source/core/rendering/RenderListBox.cpp b/Source/core/rendering/RenderListBox.cpp |
index 98e40b489503361520ebd2f17a0374170e44ac42..a630593c351269c4e9ce8fc103477fa926383391 100644 |
--- a/Source/core/rendering/RenderListBox.cpp |
+++ b/Source/core/rendering/RenderListBox.cpp |
@@ -100,8 +100,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 |
@@ -697,7 +699,7 @@ int RenderListBox::scrollLeft() const |
return 0; |
} |
-void RenderListBox::setScrollLeft(int) |
+void RenderListBox::setScrollLeft(int, ScrollBehavior) |
{ |
} |
@@ -706,14 +708,21 @@ int RenderListBox::scrollTop() const |
return m_indexOffset * itemHeight(); |
} |
-void RenderListBox::setScrollTop(int newTop) |
+void RenderListBox::setScrollTop(int 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) |
@@ -873,6 +882,26 @@ bool RenderListBox::scrollbarsCanBeActive() const |
return view->frameView()->scrollbarsCanBeActive(); |
} |
+bool RenderListBox::registerForAnimation() |
+{ |
+ if (FrameView* frameView = frame()->view()) |
+ return frameView->addAnimatingScrollableArea(this); |
+ return false; |
+} |
+ |
+void RenderListBox::deregisterForAnimation() |
+{ |
+ if (FrameView* frameView = frame()->view()) |
+ frameView->removeAnimatingScrollableArea(this); |
+} |
+ |
+bool RenderListBox::scheduleAnimation() |
+{ |
+ if (FrameView* frameView = frame()->view()) |
+ return frameView->scheduleAnimation(); |
+ return false; |
+} |
+ |
IntPoint RenderListBox::minimumScrollPosition() const |
{ |
return IntPoint(); |