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/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/numerics/safe_conversions.h" | 8 #include "base/numerics/safe_conversions.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 } else { | 1514 } else { |
1515 float visible_ratio = clip_rect.height() / scroll_rect.height(); | 1515 float visible_ratio = clip_rect.height() / scroll_rect.height(); |
1516 bool y_offset_did_change = | 1516 bool y_offset_did_change = |
1517 scrollbar_layer->SetCurrentPos(current_offset.y()); | 1517 scrollbar_layer->SetCurrentPos(current_offset.y()); |
1518 scrollbar_needs_animation |= y_offset_did_change; | 1518 scrollbar_needs_animation |= y_offset_did_change; |
1519 scrollbar_needs_animation |= | 1519 scrollbar_needs_animation |= |
1520 scrollbar_layer->SetMaximum(scroll_rect.height() - clip_rect.height()); | 1520 scrollbar_layer->SetMaximum(scroll_rect.height() - clip_rect.height()); |
1521 scrollbar_needs_animation |= | 1521 scrollbar_needs_animation |= |
1522 scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio); | 1522 scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio); |
1523 if (y_offset_did_change && layer_tree_impl()->IsActiveTree() && | 1523 if (y_offset_did_change && layer_tree_impl()->IsActiveTree() && |
1524 this == layer_tree_impl()->InnerViewportScrollLayer()) { | 1524 this == layer_tree_impl()->OuterViewportScrollLayer()) { |
1525 TRACE_COUNTER_ID1("cc", "scroll_offset_y", this->id(), | 1525 TRACE_COUNTER_ID1("cc", "scroll_offset_y", this->id(), |
1526 current_offset.y()); | 1526 current_offset.y()); |
1527 } | 1527 } |
1528 } | 1528 } |
1529 if (scrollbar_needs_animation) { | 1529 if (scrollbar_needs_animation) { |
1530 layer_tree_impl()->set_needs_update_draw_properties(); | 1530 layer_tree_impl()->set_needs_update_draw_properties(); |
1531 // TODO(wjmaclean) The scrollbar animator for the pinch-zoom scrollbars | 1531 // TODO(wjmaclean) The scrollbar animator for the pinch-zoom scrollbars |
1532 // should activate for every scroll on the main frame, not just the | 1532 // should activate for every scroll on the main frame, not just the |
1533 // scrolls that move the pinch virtual viewport (i.e. trigger from | 1533 // scrolls that move the pinch virtual viewport (i.e. trigger from |
1534 // either inner or outer viewport). | 1534 // either inner or outer viewport). |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1834 } | 1834 } |
1835 | 1835 |
1836 // TODO(enne): the transform needs to come from property trees instead of | 1836 // TODO(enne): the transform needs to come from property trees instead of |
1837 // draw properties. | 1837 // draw properties. |
1838 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( | 1838 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( |
1839 draw_properties().target_space_transform, default_scale); | 1839 draw_properties().target_space_transform, default_scale); |
1840 return std::max(transform_scales.x(), transform_scales.y()); | 1840 return std::max(transform_scales.x(), transform_scales.y()); |
1841 } | 1841 } |
1842 | 1842 |
1843 } // namespace cc | 1843 } // namespace cc |
OLD | NEW |