| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/layers/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/debug/trace_event_argument.h" | 8 #include "base/debug/trace_event_argument.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1324 scrollbar_needs_animation |= | 1324 scrollbar_needs_animation |= |
| 1325 scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio); | 1325 scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio); |
| 1326 } | 1326 } |
| 1327 if (scrollbar_needs_animation) { | 1327 if (scrollbar_needs_animation) { |
| 1328 layer_tree_impl()->set_needs_update_draw_properties(); | 1328 layer_tree_impl()->set_needs_update_draw_properties(); |
| 1329 // TODO(wjmaclean) The scrollbar animator for the pinch-zoom scrollbars | 1329 // TODO(wjmaclean) The scrollbar animator for the pinch-zoom scrollbars |
| 1330 // should activate for every scroll on the main frame, not just the | 1330 // should activate for every scroll on the main frame, not just the |
| 1331 // scrolls that move the pinch virtual viewport (i.e. trigger from | 1331 // scrolls that move the pinch virtual viewport (i.e. trigger from |
| 1332 // either inner or outer viewport). | 1332 // either inner or outer viewport). |
| 1333 if (scrollbar_animation_controller_) { | 1333 if (scrollbar_animation_controller_) { |
| 1334 // When both non-overlay and overlay scrollbars are both present, don't | 1334 // Non-overlay scrollbars shouldn't trigger animations. |
| 1335 // animate the overlay scrollbars when page scale factor is at the min. | 1335 if (scrollbar_layer->is_overlay_scrollbar()) |
| 1336 // Non-overlay scrollbars also shouldn't trigger animations. | |
| 1337 bool is_animatable_scrollbar = | |
| 1338 scrollbar_layer->is_overlay_scrollbar() && | |
| 1339 ((layer_tree_impl()->current_page_scale_factor() > | |
| 1340 layer_tree_impl()->min_page_scale_factor()) || | |
| 1341 !layer_tree_impl()->settings().use_pinch_zoom_scrollbars); | |
| 1342 if (is_animatable_scrollbar) | |
| 1343 scrollbar_animation_controller_->DidScrollUpdate(on_resize); | 1336 scrollbar_animation_controller_->DidScrollUpdate(on_resize); |
| 1344 } | 1337 } |
| 1345 } | 1338 } |
| 1346 } | 1339 } |
| 1347 | 1340 |
| 1348 void LayerImpl::DidBecomeActive() { | 1341 void LayerImpl::DidBecomeActive() { |
| 1349 if (layer_tree_impl_->settings().scrollbar_animator == | 1342 if (layer_tree_impl_->settings().scrollbar_animator == |
| 1350 LayerTreeSettings::NoAnimator) { | 1343 LayerTreeSettings::NoAnimator) { |
| 1351 return; | 1344 return; |
| 1352 } | 1345 } |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1595 SetNeedsPushProperties(); | 1588 SetNeedsPushProperties(); |
| 1596 layer_tree_impl()->set_needs_update_draw_properties(); | 1589 layer_tree_impl()->set_needs_update_draw_properties(); |
| 1597 if (should_have_render_surface) { | 1590 if (should_have_render_surface) { |
| 1598 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this)); | 1591 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this)); |
| 1599 return; | 1592 return; |
| 1600 } | 1593 } |
| 1601 render_surface_.reset(); | 1594 render_surface_.reset(); |
| 1602 } | 1595 } |
| 1603 | 1596 |
| 1604 } // namespace cc | 1597 } // namespace cc |
| OLD | NEW |