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 24e8029cd76195d5c3b2fcb13c43c455ff6dd9f9..766f618c37a0c4ee06e9259a7fa985664f561674 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
@@ -630,7 +630,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; |
@@ -650,6 +651,12 @@ void LayoutBox::scrollRectToVisible(const LayoutRect& rect, |
restrictedByLineClamp = !containingBlock()->style()->lineClamp().isNone(); |
} |
+ ScrollBehavior behavior = ScrollBehaviorAuto; |
+ if (style()->getScrollBehavior() == ScrollBehaviorSmooth || |
bokan
2017/02/02 22:51:50
Does the spec mention what should happen when the
sunyunjia
2017/02/10 23:25:20
Thanks and yes. Updated according to the spec http
|
+ scrollBehavior == ScrollBehaviorSmooth) { |
+ behavior = ScrollBehaviorSmooth; |
+ } |
+ |
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 |
@@ -657,7 +664,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, behavior); |
if (newRect.isEmpty()) |
return; |
} else if (!parentBox && canBeProgramaticallyScrolled()) { |
@@ -665,11 +672,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, behavior); |
} else { |
frameView->layoutViewportScrollableArea()->scrollIntoView( |
- rectToScroll, alignX, alignY, scrollType); |
+ rectToScroll, alignX, alignY, scrollType, behavior); |
} |
if (ownerElement && ownerElement->layoutObject()) { |
if (frameView->safeToPropagateScrollToParent()) { |
@@ -699,9 +706,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, |