Index: third_party/WebKit/Source/core/layout/LayoutBox.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
index 0f73e71f2bfdf2ea81033d14418d0ec145e8998f..b0b603b629c2c0af1a6e51d849d99a7c4dc350b5 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
@@ -639,7 +639,8 @@ void LayoutBox::scrollRectToVisible(const LayoutRect& rect, |
const ScrollAlignment& alignX, |
const ScrollAlignment& alignY, |
ScrollType scrollType, |
- bool makeVisibleInVisualViewport) { |
+ bool makeVisibleInVisualViewport, |
+ ScrollBehavior scrollBehavior) { |
ASSERT(scrollType == ProgrammaticScroll || scrollType == UserScroll); |
// Presumably the same issue as in setScrollTop. See crbug.com/343132. |
DisableCompositingQueryAsserts disabler; |
@@ -659,6 +660,13 @@ void LayoutBox::scrollRectToVisible(const LayoutRect& rect, |
restrictedByLineClamp = !containingBlock()->style()->lineClamp().isNone(); |
} |
+ bool isSmooth = false; |
+ if (scrollBehavior == ScrollBehaviorSmooth || |
+ (scrollBehavior == ScrollBehaviorAuto && |
+ style()->getScrollBehavior() == ScrollBehaviorSmooth)) { |
+ isSmooth = true; |
+ } |
+ |
if (hasOverflowClip() && !restrictedByLineClamp) { |
// Don't scroll to reveal an overflow layer that is restricted by the |
// -webkit-line-clamp property. This will prevent us from revealing text |
@@ -666,7 +674,7 @@ void LayoutBox::scrollRectToVisible(const LayoutRect& rect, |
// TODO(eae): We probably don't need this any more as we don't share any |
// code with the Safari RSS reeder. |
newRect = getScrollableArea()->scrollIntoView(rectToScroll, alignX, alignY, |
- scrollType); |
+ scrollType, isSmooth); |
if (newRect.isEmpty()) |
return; |
} else if (!parentBox && canBeProgramaticallyScrolled()) { |
@@ -674,11 +682,11 @@ void LayoutBox::scrollRectToVisible(const LayoutRect& rect, |
HTMLFrameOwnerElement* ownerElement = document().localOwner(); |
if (!isDisallowedAutoscroll(ownerElement, frameView)) { |
if (makeVisibleInVisualViewport) { |
- frameView->getScrollableArea()->scrollIntoView(rectToScroll, alignX, |
- alignY, scrollType); |
+ frameView->getScrollableArea()->scrollIntoView( |
+ rectToScroll, alignX, alignY, scrollType, isSmooth); |
} else { |
frameView->layoutViewportScrollableArea()->scrollIntoView( |
- rectToScroll, alignX, alignY, scrollType); |
+ rectToScroll, alignX, alignY, scrollType, isSmooth); |
} |
if (ownerElement && ownerElement->layoutObject()) { |
if (frameView->safeToPropagateScrollToParent()) { |
@@ -708,9 +716,10 @@ void LayoutBox::scrollRectToVisible(const LayoutRect& rect, |
if (frame()->page()->autoscrollController().autoscrollInProgress()) |
parentBox = enclosingScrollableBox(); |
- if (parentBox) |
+ if (parentBox) { |
parentBox->scrollRectToVisible(newRect, alignX, alignY, scrollType, |
- makeVisibleInVisualViewport); |
+ makeVisibleInVisualViewport, scrollBehavior); |
+ } |
} |
void LayoutBox::absoluteRects(Vector<IntRect>& rects, |