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 2642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2653 | 2653 |
2654 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); | 2654 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); |
2655 layer_impl; | 2655 layer_impl; |
2656 layer_impl = layer_impl->parent()) { | 2656 layer_impl = layer_impl->parent()) { |
2657 if (!layer_impl->scrollable()) | 2657 if (!layer_impl->scrollable()) |
2658 continue; | 2658 continue; |
2659 | 2659 |
2660 if (!layer_impl->HasScrollbar(VERTICAL)) | 2660 if (!layer_impl->HasScrollbar(VERTICAL)) |
2661 continue; | 2661 continue; |
2662 | 2662 |
2663 float height = layer_impl->scroll_clip_layer() | 2663 float height = layer_impl->clip_height(); |
2664 ? layer_impl->scroll_clip_layer()->bounds().height() | |
2665 : 0; | |
2666 | 2664 |
2667 // These magical values match WebKit and are designed to scroll nearly the | 2665 // These magical values match WebKit and are designed to scroll nearly the |
2668 // entire visible content height but leave a bit of overlap. | 2666 // entire visible content height but leave a bit of overlap. |
2669 float page = std::max(height * 0.875f, 1.f); | 2667 float page = std::max(height * 0.875f, 1.f); |
2670 if (direction == SCROLL_BACKWARD) | 2668 if (direction == SCROLL_BACKWARD) |
2671 page = -page; | 2669 page = -page; |
2672 | 2670 |
2673 gfx::Vector2dF delta = gfx::Vector2dF(0.f, page); | 2671 gfx::Vector2dF delta = gfx::Vector2dF(0.f, page); |
2674 | 2672 |
2675 gfx::Vector2dF applied_delta = ScrollLayerWithLocalDelta(layer_impl, delta); | 2673 gfx::Vector2dF applied_delta = ScrollLayerWithLocalDelta(layer_impl, delta); |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3380 } | 3378 } |
3381 | 3379 |
3382 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3380 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3383 std::vector<PictureLayerImpl*>::iterator it = | 3381 std::vector<PictureLayerImpl*>::iterator it = |
3384 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3382 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3385 DCHECK(it != picture_layers_.end()); | 3383 DCHECK(it != picture_layers_.end()); |
3386 picture_layers_.erase(it); | 3384 picture_layers_.erase(it); |
3387 } | 3385 } |
3388 | 3386 |
3389 } // namespace cc | 3387 } // namespace cc |
OLD | NEW |