OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 2639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2650 | 2650 |
2651 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); | 2651 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); |
2652 layer_impl; | 2652 layer_impl; |
2653 layer_impl = layer_impl->parent()) { | 2653 layer_impl = layer_impl->parent()) { |
2654 if (!layer_impl->scrollable()) | 2654 if (!layer_impl->scrollable()) |
2655 continue; | 2655 continue; |
2656 | 2656 |
2657 if (!layer_impl->HasScrollbar(VERTICAL)) | 2657 if (!layer_impl->HasScrollbar(VERTICAL)) |
2658 continue; | 2658 continue; |
2659 | 2659 |
2660 float height = layer_impl->clip_height(); | 2660 float height = layer_impl->scroll_clip_layer() |
| 2661 ? layer_impl->scroll_clip_layer()->bounds().height() |
| 2662 : 0; |
2661 | 2663 |
2662 // These magical values match WebKit and are designed to scroll nearly the | 2664 // These magical values match WebKit and are designed to scroll nearly the |
2663 // entire visible content height but leave a bit of overlap. | 2665 // entire visible content height but leave a bit of overlap. |
2664 float page = std::max(height * 0.875f, 1.f); | 2666 float page = std::max(height * 0.875f, 1.f); |
2665 if (direction == SCROLL_BACKWARD) | 2667 if (direction == SCROLL_BACKWARD) |
2666 page = -page; | 2668 page = -page; |
2667 | 2669 |
2668 gfx::Vector2dF delta = gfx::Vector2dF(0.f, page); | 2670 gfx::Vector2dF delta = gfx::Vector2dF(0.f, page); |
2669 | 2671 |
2670 gfx::Vector2dF applied_delta = ScrollLayerWithLocalDelta(layer_impl, delta); | 2672 gfx::Vector2dF applied_delta = ScrollLayerWithLocalDelta(layer_impl, delta); |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3375 } | 3377 } |
3376 | 3378 |
3377 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3379 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3378 std::vector<PictureLayerImpl*>::iterator it = | 3380 std::vector<PictureLayerImpl*>::iterator it = |
3379 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3381 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3380 DCHECK(it != picture_layers_.end()); | 3382 DCHECK(it != picture_layers_.end()); |
3381 picture_layers_.erase(it); | 3383 picture_layers_.erase(it); |
3382 } | 3384 } |
3383 | 3385 |
3384 } // namespace cc | 3386 } // namespace cc |
OLD | NEW |