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

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

Issue 134443003: Implement CSSOM Smooth Scroll API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months 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
« no previous file with comments | « Source/core/rendering/RenderListBox.h ('k') | Source/core/rendering/RenderTextControlSingleLine.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « Source/core/rendering/RenderListBox.h ('k') | Source/core/rendering/RenderTextControlSingleLine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698