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 5ac9de0dd96cd20cdc1b9a0df7524ce1bf754341..8a5b549ebe9ff9ae66b937e6e0549349861d9eed 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
@@ -645,7 +645,8 @@ void LayoutBox::ScrollRectToVisible(const LayoutRect& rect, |
const ScrollAlignment& align_x, |
const ScrollAlignment& align_y, |
ScrollType scroll_type, |
- bool make_visible_in_visual_viewport) { |
+ bool make_visible_in_visual_viewport, |
+ ScrollBehavior scroll_behavior) { |
DCHECK(scroll_type == kProgrammaticScroll || scroll_type == kUserScroll); |
// Presumably the same issue as in setScrollTop. See crbug.com/343132. |
DisableCompositingQueryAsserts disabler; |
@@ -666,14 +667,21 @@ void LayoutBox::ScrollRectToVisible(const LayoutRect& rect, |
!ContainingBlock()->Style()->LineClamp().IsNone(); |
} |
+ bool is_smooth = false; |
+ if (scroll_behavior == kScrollBehaviorSmooth || |
+ (scroll_behavior == kScrollBehaviorAuto && |
+ Style()->GetScrollBehavior() == kScrollBehaviorSmooth)) { |
+ is_smooth = true; |
+ } |
+ |
if (HasOverflowClip() && !restricted_by_line_clamp) { |
// Don't scroll to reveal an overflow layer that is restricted by the |
// -webkit-line-clamp property. This will prevent us from revealing text |
// hidden by the slider in Safari RSS. |
// TODO(eae): We probably don't need this any more as we don't share any |
// code with the Safari RSS reeder. |
- new_rect = GetScrollableArea()->ScrollIntoView(rect_to_scroll, align_x, |
- align_y, scroll_type); |
+ new_rect = GetScrollableArea()->ScrollIntoView( |
+ rect_to_scroll, align_x, align_y, scroll_type, is_smooth); |
if (new_rect.IsEmpty()) |
return; |
} else if (!parent_box && CanBeProgramaticallyScrolled()) { |
@@ -682,10 +690,10 @@ void LayoutBox::ScrollRectToVisible(const LayoutRect& rect, |
if (!IsDisallowedAutoscroll(owner_element, frame_view)) { |
if (make_visible_in_visual_viewport) { |
frame_view->GetScrollableArea()->ScrollIntoView( |
- rect_to_scroll, align_x, align_y, scroll_type); |
+ rect_to_scroll, align_x, align_y, scroll_type, is_smooth); |
} else { |
frame_view->LayoutViewportScrollableArea()->ScrollIntoView( |
- rect_to_scroll, align_x, align_y, scroll_type); |
+ rect_to_scroll, align_x, align_y, scroll_type, is_smooth); |
} |
if (owner_element && owner_element->GetLayoutObject()) { |
if (frame_view->SafeToPropagateScrollToParent()) { |
@@ -715,9 +723,11 @@ void LayoutBox::ScrollRectToVisible(const LayoutRect& rect, |
if (GetFrame()->GetPage()->GetAutoscrollController().AutoscrollInProgress()) |
parent_box = EnclosingScrollableBox(); |
- if (parent_box) |
+ if (parent_box) { |
parent_box->ScrollRectToVisible(new_rect, align_x, align_y, scroll_type, |
- make_visible_in_visual_viewport); |
+ make_visible_in_visual_viewport, |
+ scroll_behavior); |
+ } |
} |
void LayoutBox::AbsoluteRects(Vector<IntRect>& rects, |