Index: cc/layers/layer_impl.cc |
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc |
index 29bdfe778fdf522fc9a3a8f97d74ef4adb90b71c..bc8f8f3b049327e662d3d142d9509f2fee607278 100644 |
--- a/cc/layers/layer_impl.cc |
+++ b/cc/layers/layer_impl.cc |
@@ -1275,27 +1275,28 @@ void LayerImpl::SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer, |
current_offset.Scale(layer_tree_impl()->total_page_scale_factor()); |
} |
- bool scrollbar_needs_animation = false; |
- scrollbar_needs_animation |= scrollbar_layer->SetVerticalAdjust( |
+ bool did_scrollbar_position_changed = false; |
+ bool did_scrollbar_resize = false; |
+ did_scrollbar_position_changed |= scrollbar_layer->SetVerticalAdjust( |
scrollbar_clip_layer->bounds_delta().y()); |
if (scrollbar_layer->orientation() == HORIZONTAL) { |
float visible_ratio = clip_rect.width() / scroll_rect.width(); |
- scrollbar_needs_animation |= |
+ did_scrollbar_position_changed |= |
scrollbar_layer->SetCurrentPos(current_offset.x()); |
- scrollbar_needs_animation |= |
+ did_scrollbar_resize |= |
scrollbar_layer->SetMaximum(scroll_rect.width() - clip_rect.width()); |
- scrollbar_needs_animation |= |
+ did_scrollbar_resize |= |
scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio); |
} else { |
float visible_ratio = clip_rect.height() / scroll_rect.height(); |
- scrollbar_needs_animation |= |
+ did_scrollbar_position_changed |= |
scrollbar_layer->SetCurrentPos(current_offset.y()); |
- scrollbar_needs_animation |= |
+ did_scrollbar_resize |= |
scrollbar_layer->SetMaximum(scroll_rect.height() - clip_rect.height()); |
- scrollbar_needs_animation |= |
+ did_scrollbar_resize |= |
scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio); |
} |
- if (scrollbar_needs_animation) { |
+ if (did_scrollbar_position_changed || did_scrollbar_resize) { |
layer_tree_impl()->set_needs_update_draw_properties(); |
// TODO(wjmaclean) The scrollbar animator for the pinch-zoom scrollbars |
// should activate for every scroll on the main frame, not just the |
@@ -1311,7 +1312,7 @@ void LayerImpl::SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer, |
layer_tree_impl()->min_page_scale_factor()) || |
!layer_tree_impl()->settings().use_pinch_zoom_scrollbars); |
if (is_animatable_scrollbar) |
- scrollbar_animation_controller_->DidScrollUpdate(); |
+ scrollbar_animation_controller_->DidScrollUpdate(did_scrollbar_resize); |
} |
} |
} |