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_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "cc/animation/animation.h" | 8 #include "cc/animation/animation.h" |
9 #include "cc/animation/animation_id_provider.h" | 9 #include "cc/animation/animation_id_provider.h" |
10 #include "cc/animation/keyframed_animation_curve.h" | 10 #include "cc/animation/keyframed_animation_curve.h" |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 controller->AddAnimation(MakePinchZoomFadeAnimation(start_opacity, | 630 controller->AddAnimation(MakePinchZoomFadeAnimation(start_opacity, |
631 PinchZoomScrollbar::kDefaultOpacity)); | 631 PinchZoomScrollbar::kDefaultOpacity)); |
632 } | 632 } |
633 | 633 |
634 void LayerTreeImpl::FadeInPinchZoomScrollbars() { | 634 void LayerTreeImpl::FadeInPinchZoomScrollbars() { |
635 if (!HasPinchZoomScrollbars() || page_scale_factor_ == 1) | 635 if (!HasPinchZoomScrollbars() || page_scale_factor_ == 1) |
636 return; | 636 return; |
637 | 637 |
638 StartFadeInAnimation(PinchZoomScrollbarHorizontal()); | 638 StartFadeInAnimation(PinchZoomScrollbarHorizontal()); |
639 StartFadeInAnimation(PinchZoomScrollbarVertical()); | 639 StartFadeInAnimation(PinchZoomScrollbarVertical()); |
| 640 SetNeedsRedraw(); |
640 } | 641 } |
641 | 642 |
642 static void StartFadeOutAnimation(LayerImpl* layer) { | 643 static void StartFadeOutAnimation(LayerImpl* layer) { |
643 float opacity = layer->opacity(); | 644 float opacity = layer->opacity(); |
644 if (!opacity) | 645 if (!opacity) |
645 return; | 646 return; |
646 | 647 |
647 LayerAnimationController* controller = layer->layer_animation_controller(); | 648 LayerAnimationController* controller = layer->layer_animation_controller(); |
648 // TODO(wjmaclean) It shouldn't be necessary to manually remove the old | 649 // TODO(wjmaclean) It shouldn't be necessary to manually remove the old |
649 // animation. | 650 // animation. |
650 if (Animation* animation = controller->GetAnimation(Animation::Opacity)) | 651 if (Animation* animation = controller->GetAnimation(Animation::Opacity)) |
651 controller->RemoveAnimation(animation->id()); | 652 controller->RemoveAnimation(animation->id()); |
652 controller->AddAnimation(MakePinchZoomFadeAnimation(opacity, 0)); | 653 controller->AddAnimation(MakePinchZoomFadeAnimation(opacity, 0)); |
653 } | 654 } |
654 | 655 |
655 void LayerTreeImpl::FadeOutPinchZoomScrollbars() { | 656 void LayerTreeImpl::FadeOutPinchZoomScrollbars() { |
656 if (!HasPinchZoomScrollbars()) | 657 if (!HasPinchZoomScrollbars()) |
657 return; | 658 return; |
658 | 659 |
659 StartFadeOutAnimation(PinchZoomScrollbarHorizontal()); | 660 StartFadeOutAnimation(PinchZoomScrollbarHorizontal()); |
660 StartFadeOutAnimation(PinchZoomScrollbarVertical()); | 661 StartFadeOutAnimation(PinchZoomScrollbarVertical()); |
| 662 SetNeedsRedraw(); |
661 } | 663 } |
662 | 664 |
663 bool LayerTreeImpl::HasPinchZoomScrollbars() const { | 665 bool LayerTreeImpl::HasPinchZoomScrollbars() const { |
664 return pinch_zoom_scrollbar_horizontal_layer_id_ != Layer::INVALID_ID && | 666 return pinch_zoom_scrollbar_horizontal_layer_id_ != Layer::INVALID_ID && |
665 pinch_zoom_scrollbar_vertical_layer_id_ != Layer::INVALID_ID; | 667 pinch_zoom_scrollbar_vertical_layer_id_ != Layer::INVALID_ID; |
666 } | 668 } |
667 | 669 |
668 void LayerTreeImpl::UpdateRootScrollLayerSizeDelta() { | 670 void LayerTreeImpl::UpdateRootScrollLayerSizeDelta() { |
669 LayerImpl* root_scroll = RootScrollLayer(); | 671 LayerImpl* root_scroll = RootScrollLayer(); |
670 LayerImpl* root_clip = RootClipLayer(); | 672 LayerImpl* root_clip = RootClipLayer(); |
671 DCHECK(root_scroll); | 673 DCHECK(root_scroll); |
672 DCHECK(root_clip); | 674 DCHECK(root_clip); |
673 DCHECK(IsActiveTree()); | 675 DCHECK(IsActiveTree()); |
674 | 676 |
675 gfx::Vector2dF scrollable_viewport_size = | 677 gfx::Vector2dF scrollable_viewport_size = |
676 gfx::RectF(ScrollableViewportSize()).bottom_right() - gfx::PointF(); | 678 gfx::RectF(ScrollableViewportSize()).bottom_right() - gfx::PointF(); |
677 | 679 |
678 gfx::Vector2dF original_viewport_size = | 680 gfx::Vector2dF original_viewport_size = |
679 gfx::RectF(root_clip->bounds()).bottom_right() - | 681 gfx::RectF(root_clip->bounds()).bottom_right() - |
680 gfx::PointF(); | 682 gfx::PointF(); |
681 original_viewport_size.Scale(1 / page_scale_factor()); | 683 original_viewport_size.Scale(1 / page_scale_factor()); |
682 | 684 |
683 root_scroll->SetFixedContainerSizeDelta( | 685 root_scroll->SetFixedContainerSizeDelta( |
684 scrollable_viewport_size - original_viewport_size); | 686 scrollable_viewport_size - original_viewport_size); |
685 } | 687 } |
686 | 688 |
687 } // namespace cc | 689 } // namespace cc |
OLD | NEW |