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 <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 void PostAnimationEventsToMainThreadOnImplThread( | 138 void PostAnimationEventsToMainThreadOnImplThread( |
139 scoped_ptr<AnimationEventsVector> events) override {} | 139 scoped_ptr<AnimationEventsVector> events) override {} |
140 bool ReduceContentsTextureMemoryOnImplThread(size_t limit_bytes, | 140 bool ReduceContentsTextureMemoryOnImplThread(size_t limit_bytes, |
141 int priority_cutoff) override { | 141 int priority_cutoff) override { |
142 current_limit_bytes_ = limit_bytes; | 142 current_limit_bytes_ = limit_bytes; |
143 current_priority_cutoff_value_ = priority_cutoff; | 143 current_priority_cutoff_value_ = priority_cutoff; |
144 return reduce_memory_result_; | 144 return reduce_memory_result_; |
145 } | 145 } |
146 bool IsInsideDraw() override { return false; } | 146 bool IsInsideDraw() override { return false; } |
147 void RenewTreePriority() override {} | 147 void RenewTreePriority() override {} |
148 void PostDelayedScrollbarFadeOnImplThread(const base::Closure& start_fade, | 148 void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, |
149 base::TimeDelta delay) override { | 149 base::TimeDelta delay) override { |
150 scrollbar_fade_start_ = start_fade; | 150 animation_task_ = task; |
151 requested_scrollbar_animation_delay_ = delay; | 151 requested_animation_delay_ = delay; |
152 } | 152 } |
153 void DidActivateSyncTree() override {} | 153 void DidActivateSyncTree() override {} |
154 void DidPrepareTiles() override {} | 154 void DidPrepareTiles() override {} |
155 void DidCompletePageScaleAnimationOnImplThread() override { | 155 void DidCompletePageScaleAnimationOnImplThread() override { |
156 did_complete_page_scale_animation_ = true; | 156 did_complete_page_scale_animation_ = true; |
157 } | 157 } |
158 | 158 |
159 void set_reduce_memory_result(bool reduce_memory_result) { | 159 void set_reduce_memory_result(bool reduce_memory_result) { |
160 reduce_memory_result_ = reduce_memory_result; | 160 reduce_memory_result_ = reduce_memory_result; |
161 } | 161 } |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 scoped_ptr<LayerTreeHostImpl> host_impl_; | 394 scoped_ptr<LayerTreeHostImpl> host_impl_; |
395 FakeRenderingStatsInstrumentation stats_instrumentation_; | 395 FakeRenderingStatsInstrumentation stats_instrumentation_; |
396 bool on_can_draw_state_changed_called_; | 396 bool on_can_draw_state_changed_called_; |
397 bool did_notify_ready_to_activate_; | 397 bool did_notify_ready_to_activate_; |
398 bool did_request_commit_; | 398 bool did_request_commit_; |
399 bool did_request_redraw_; | 399 bool did_request_redraw_; |
400 bool did_request_animate_; | 400 bool did_request_animate_; |
401 bool did_request_prepare_tiles_; | 401 bool did_request_prepare_tiles_; |
402 bool did_complete_page_scale_animation_; | 402 bool did_complete_page_scale_animation_; |
403 bool reduce_memory_result_; | 403 bool reduce_memory_result_; |
404 base::Closure scrollbar_fade_start_; | 404 base::Closure animation_task_; |
405 base::TimeDelta requested_scrollbar_animation_delay_; | 405 base::TimeDelta requested_animation_delay_; |
406 size_t current_limit_bytes_; | 406 size_t current_limit_bytes_; |
407 int current_priority_cutoff_value_; | 407 int current_priority_cutoff_value_; |
408 }; | 408 }; |
409 | 409 |
410 TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) { | 410 TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) { |
411 bool always_draw = false; | 411 bool always_draw = false; |
412 CheckNotifyCalledIfCanDrawChanged(always_draw); | 412 CheckNotifyCalledIfCanDrawChanged(always_draw); |
413 } | 413 } |
414 | 414 |
415 TEST_F(LayerTreeHostImplTest, CanDrawIncompleteFrames) { | 415 TEST_F(LayerTreeHostImplTest, CanDrawIncompleteFrames) { |
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 TEST_F(LayerTreeHostImplTest, ScrollbarLinearFadeScheduling) { | 1609 TEST_F(LayerTreeHostImplTest, ScrollbarLinearFadeScheduling) { |
1610 LayerTreeSettings settings; | 1610 LayerTreeSettings settings; |
1611 settings.scrollbar_animator = LayerTreeSettings::LINEAR_FADE; | 1611 settings.scrollbar_animator = LayerTreeSettings::LINEAR_FADE; |
1612 settings.scrollbar_fade_delay_ms = 20; | 1612 settings.scrollbar_fade_delay_ms = 20; |
1613 settings.scrollbar_fade_duration_ms = 20; | 1613 settings.scrollbar_fade_duration_ms = 20; |
1614 | 1614 |
1615 SETUP_LAYERS_FOR_SCROLLBAR_ANIMATION_TEST(); | 1615 SETUP_LAYERS_FOR_SCROLLBAR_ANIMATION_TEST(); |
1616 | 1616 |
1617 base::TimeTicks fake_now = gfx::FrameTime::Now(); | 1617 base::TimeTicks fake_now = gfx::FrameTime::Now(); |
1618 | 1618 |
1619 EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_); | 1619 EXPECT_FALSE(did_request_animate_); |
1620 EXPECT_FALSE(did_request_redraw_); | 1620 EXPECT_FALSE(did_request_redraw_); |
| 1621 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); |
| 1622 EXPECT_TRUE(animation_task_.Equals(base::Closure())); |
1621 | 1623 |
1622 // If no scroll happened during a scroll gesture, it should have no effect. | 1624 // If no scroll happened during a scroll gesture, it should have no effect. |
1623 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL); | 1625 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL); |
1624 host_impl_->ScrollEnd(); | 1626 host_impl_->ScrollEnd(); |
1625 EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_); | 1627 EXPECT_FALSE(did_request_animate_); |
1626 EXPECT_FALSE(did_request_redraw_); | 1628 EXPECT_FALSE(did_request_redraw_); |
1627 EXPECT_TRUE(scrollbar_fade_start_.Equals(base::Closure())); | 1629 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); |
| 1630 EXPECT_TRUE(animation_task_.Equals(base::Closure())); |
1628 | 1631 |
1629 // After a scroll, a fade animation should be scheduled about 20ms from now. | 1632 // After a scroll, a fade animation should be scheduled about 20ms from now. |
1630 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL); | 1633 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL); |
1631 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 5)); | 1634 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 5)); |
| 1635 EXPECT_FALSE(did_request_animate_); |
| 1636 EXPECT_TRUE(did_request_redraw_); |
| 1637 did_request_redraw_ = false; |
| 1638 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); |
| 1639 EXPECT_TRUE(animation_task_.Equals(base::Closure())); |
| 1640 |
1632 host_impl_->ScrollEnd(); | 1641 host_impl_->ScrollEnd(); |
1633 did_request_redraw_ = false; | 1642 EXPECT_FALSE(did_request_animate_); |
| 1643 EXPECT_FALSE(did_request_redraw_); |
| 1644 EXPECT_EQ(base::TimeDelta::FromMilliseconds(20), requested_animation_delay_); |
| 1645 EXPECT_FALSE(animation_task_.Equals(base::Closure())); |
| 1646 |
| 1647 fake_now += requested_animation_delay_; |
| 1648 requested_animation_delay_ = base::TimeDelta(); |
| 1649 animation_task_.Run(); |
| 1650 animation_task_ = base::Closure(); |
| 1651 EXPECT_TRUE(did_request_animate_); |
1634 did_request_animate_ = false; | 1652 did_request_animate_ = false; |
1635 EXPECT_LT(base::TimeDelta::FromMilliseconds(19), | |
1636 requested_scrollbar_animation_delay_); | |
1637 EXPECT_FALSE(did_request_redraw_); | 1653 EXPECT_FALSE(did_request_redraw_); |
1638 EXPECT_FALSE(did_request_animate_); | |
1639 requested_scrollbar_animation_delay_ = base::TimeDelta(); | |
1640 scrollbar_fade_start_.Run(); | |
1641 host_impl_->Animate(fake_now); | |
1642 | 1654 |
1643 // After the fade begins, we should start getting redraws instead of a | 1655 // After the fade begins, we should start getting redraws instead of a |
1644 // scheduled animation. | 1656 // scheduled animation. |
1645 fake_now += base::TimeDelta::FromMilliseconds(25); | 1657 host_impl_->Animate(fake_now); |
1646 EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_); | |
1647 EXPECT_TRUE(did_request_animate_); | 1658 EXPECT_TRUE(did_request_animate_); |
1648 did_request_animate_ = false; | 1659 did_request_animate_ = false; |
| 1660 EXPECT_TRUE(did_request_redraw_); |
| 1661 did_request_redraw_ = false; |
| 1662 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); |
| 1663 EXPECT_TRUE(animation_task_.Equals(base::Closure())); |
1649 | 1664 |
1650 // Setting the scroll offset outside a scroll should also cause the scrollbar | 1665 // Setting the scroll offset outside a scroll should also cause the scrollbar |
1651 // to appear and to schedule a fade. | 1666 // to appear and to schedule a fade. |
1652 host_impl_->InnerViewportScrollLayer()->PushScrollOffsetFromMainThread( | 1667 host_impl_->InnerViewportScrollLayer()->PushScrollOffsetFromMainThread( |
1653 gfx::ScrollOffset(5, 5)); | 1668 gfx::ScrollOffset(5, 5)); |
1654 EXPECT_LT(base::TimeDelta::FromMilliseconds(19), | 1669 EXPECT_FALSE(did_request_animate_); |
1655 requested_scrollbar_animation_delay_); | |
1656 EXPECT_FALSE(did_request_redraw_); | 1670 EXPECT_FALSE(did_request_redraw_); |
1657 EXPECT_FALSE(did_request_animate_); | 1671 EXPECT_EQ(base::TimeDelta::FromMilliseconds(20), requested_animation_delay_); |
1658 requested_scrollbar_animation_delay_ = base::TimeDelta(); | 1672 EXPECT_FALSE(animation_task_.Equals(base::Closure())); |
| 1673 requested_animation_delay_ = base::TimeDelta(); |
| 1674 animation_task_ = base::Closure(); |
1659 | 1675 |
1660 // Unnecessarily Fade animation of solid color scrollbar is not triggered. | 1676 // Unnecessarily Fade animation of solid color scrollbar is not triggered. |
1661 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL); | 1677 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL); |
1662 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0)); | 1678 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0)); |
| 1679 EXPECT_FALSE(did_request_animate_); |
| 1680 EXPECT_TRUE(did_request_redraw_); |
| 1681 did_request_redraw_ = false; |
| 1682 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); |
| 1683 EXPECT_TRUE(animation_task_.Equals(base::Closure())); |
| 1684 |
1663 host_impl_->ScrollEnd(); | 1685 host_impl_->ScrollEnd(); |
1664 EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_); | 1686 EXPECT_FALSE(did_request_animate_); |
| 1687 EXPECT_FALSE(did_request_redraw_); |
| 1688 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); |
| 1689 EXPECT_TRUE(animation_task_.Equals(base::Closure())); |
1665 } | 1690 } |
1666 | 1691 |
1667 TEST_F(LayerTreeHostImplTest, ScrollbarFadePinchZoomScrollbars) { | 1692 TEST_F(LayerTreeHostImplTest, ScrollbarFadePinchZoomScrollbars) { |
1668 LayerTreeSettings settings; | 1693 LayerTreeSettings settings; |
1669 settings.scrollbar_animator = LayerTreeSettings::LINEAR_FADE; | 1694 settings.scrollbar_animator = LayerTreeSettings::LINEAR_FADE; |
1670 settings.scrollbar_fade_delay_ms = 20; | 1695 settings.scrollbar_fade_delay_ms = 20; |
1671 settings.scrollbar_fade_duration_ms = 20; | 1696 settings.scrollbar_fade_duration_ms = 20; |
1672 settings.use_pinch_zoom_scrollbars = true; | 1697 settings.use_pinch_zoom_scrollbars = true; |
1673 | 1698 |
1674 SETUP_LAYERS_FOR_SCROLLBAR_ANIMATION_TEST(); | 1699 SETUP_LAYERS_FOR_SCROLLBAR_ANIMATION_TEST(); |
1675 | 1700 |
1676 base::TimeTicks fake_now = gfx::FrameTime::Now(); | 1701 base::TimeTicks fake_now = gfx::FrameTime::Now(); |
1677 | 1702 |
1678 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f); | 1703 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f); |
1679 | 1704 |
1680 EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_); | 1705 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); |
1681 EXPECT_FALSE(did_request_animate_); | 1706 EXPECT_FALSE(did_request_animate_); |
1682 | 1707 |
1683 // If no scroll happened during a scroll gesture, it should have no effect. | 1708 // If no scroll happened during a scroll gesture, it should have no effect. |
1684 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL); | 1709 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL); |
1685 host_impl_->ScrollEnd(); | 1710 host_impl_->ScrollEnd(); |
1686 EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_); | 1711 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); |
1687 EXPECT_FALSE(did_request_animate_); | 1712 EXPECT_FALSE(did_request_animate_); |
1688 EXPECT_TRUE(scrollbar_fade_start_.Equals(base::Closure())); | 1713 EXPECT_TRUE(animation_task_.Equals(base::Closure())); |
1689 | 1714 |
1690 // After a scroll, no fade animation should be scheduled. | 1715 // After a scroll, no fade animation should be scheduled. |
1691 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL); | 1716 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL); |
1692 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0)); | 1717 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0)); |
1693 host_impl_->ScrollEnd(); | 1718 host_impl_->ScrollEnd(); |
1694 did_request_redraw_ = false; | 1719 did_request_redraw_ = false; |
1695 EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_); | 1720 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); |
1696 EXPECT_FALSE(did_request_animate_); | 1721 EXPECT_FALSE(did_request_animate_); |
1697 requested_scrollbar_animation_delay_ = base::TimeDelta(); | 1722 requested_animation_delay_ = base::TimeDelta(); |
1698 | 1723 |
1699 // We should not see any draw requests. | 1724 // We should not see any draw requests. |
1700 fake_now += base::TimeDelta::FromMilliseconds(25); | 1725 fake_now += base::TimeDelta::FromMilliseconds(25); |
1701 EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_); | 1726 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); |
1702 EXPECT_FALSE(did_request_animate_); | 1727 EXPECT_FALSE(did_request_animate_); |
1703 | 1728 |
1704 // Make page scale > min so that subsequent scrolls will trigger fades. | 1729 // Make page scale > min so that subsequent scrolls will trigger fades. |
1705 host_impl_->SetPageScaleOnActiveTree(1.1f); | 1730 host_impl_->SetPageScaleOnActiveTree(1.1f); |
1706 | 1731 |
1707 // After a scroll, a fade animation should be scheduled about 20ms from now. | 1732 // After a scroll, a fade animation should be scheduled about 20ms from now. |
1708 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL); | 1733 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL); |
1709 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0)); | 1734 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0)); |
1710 host_impl_->ScrollEnd(); | 1735 host_impl_->ScrollEnd(); |
1711 did_request_redraw_ = false; | 1736 did_request_redraw_ = false; |
1712 EXPECT_LT(base::TimeDelta::FromMilliseconds(19), | 1737 EXPECT_LT(base::TimeDelta::FromMilliseconds(19), requested_animation_delay_); |
1713 requested_scrollbar_animation_delay_); | |
1714 EXPECT_FALSE(did_request_animate_); | 1738 EXPECT_FALSE(did_request_animate_); |
1715 requested_scrollbar_animation_delay_ = base::TimeDelta(); | 1739 requested_animation_delay_ = base::TimeDelta(); |
1716 scrollbar_fade_start_.Run(); | 1740 animation_task_.Run(); |
1717 | 1741 |
1718 // After the fade begins, we should start getting redraws instead of a | 1742 // After the fade begins, we should start getting redraws instead of a |
1719 // scheduled animation. | 1743 // scheduled animation. |
1720 fake_now += base::TimeDelta::FromMilliseconds(25); | 1744 fake_now += base::TimeDelta::FromMilliseconds(25); |
1721 host_impl_->Animate(fake_now); | 1745 host_impl_->Animate(fake_now); |
1722 EXPECT_TRUE(did_request_animate_); | 1746 EXPECT_TRUE(did_request_animate_); |
1723 } | 1747 } |
1724 | 1748 |
1725 void LayerTreeHostImplTest::SetupMouseMoveAtWithDeviceScale( | 1749 void LayerTreeHostImplTest::SetupMouseMoveAtWithDeviceScale( |
1726 float device_scale_factor) { | 1750 float device_scale_factor) { |
(...skipping 5905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7632 | 7656 |
7633 float new_offset = | 7657 float new_offset = |
7634 host_impl_->top_controls_manager()->ControlsTopOffset(); | 7658 host_impl_->top_controls_manager()->ControlsTopOffset(); |
7635 | 7659 |
7636 if (new_offset != old_offset) { | 7660 if (new_offset != old_offset) { |
7637 EXPECT_TRUE(did_request_redraw_); | 7661 EXPECT_TRUE(did_request_redraw_); |
7638 EXPECT_TRUE(did_request_commit_); | 7662 EXPECT_TRUE(did_request_commit_); |
7639 } | 7663 } |
7640 } | 7664 } |
7641 EXPECT_FALSE(host_impl_->top_controls_manager()->animation()); | 7665 EXPECT_FALSE(host_impl_->top_controls_manager()->animation()); |
| 7666 EXPECT_EQ(-top_controls_height_, |
| 7667 host_impl_->top_controls_manager()->ControlsTopOffset()); |
7642 } | 7668 } |
7643 | 7669 |
7644 TEST_F(LayerTreeHostImplWithTopControlsTest, | 7670 TEST_F(LayerTreeHostImplWithTopControlsTest, |
| 7671 TopControlsAnimationAfterMainThreadFlingStopped) { |
| 7672 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 200)); |
| 7673 host_impl_->SetViewportSize(gfx::Size(100, 100)); |
| 7674 host_impl_->top_controls_manager()->UpdateTopControlsState(BOTH, SHOWN, |
| 7675 false); |
| 7676 float initial_scroll_offset = 50; |
| 7677 scroll_layer->PushScrollOffsetFromMainThread( |
| 7678 gfx::ScrollOffset(0, initial_scroll_offset)); |
| 7679 DrawFrame(); |
| 7680 |
| 7681 EXPECT_EQ(InputHandler::SCROLL_STARTED, |
| 7682 host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE)); |
| 7683 EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset()); |
| 7684 EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(), |
| 7685 scroll_layer->CurrentScrollOffset().ToString()); |
| 7686 |
| 7687 // Scroll the top controls partially. |
| 7688 const float residue = 15; |
| 7689 float offset = top_controls_height_ - residue; |
| 7690 EXPECT_TRUE( |
| 7691 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll); |
| 7692 EXPECT_EQ(-offset, host_impl_->top_controls_manager()->ControlsTopOffset()); |
| 7693 EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(), |
| 7694 scroll_layer->CurrentScrollOffset().ToString()); |
| 7695 |
| 7696 did_request_redraw_ = false; |
| 7697 did_request_animate_ = false; |
| 7698 did_request_commit_ = false; |
| 7699 |
| 7700 // End the fling while the controls are still offset from the limit. |
| 7701 host_impl_->MainThreadHasStoppedFlinging(); |
| 7702 ASSERT_TRUE(host_impl_->top_controls_manager()->animation()); |
| 7703 EXPECT_TRUE(did_request_animate_); |
| 7704 EXPECT_TRUE(did_request_redraw_); |
| 7705 EXPECT_FALSE(did_request_commit_); |
| 7706 |
| 7707 // Animate the top controls to the limit. |
| 7708 base::TimeTicks animation_time = gfx::FrameTime::Now(); |
| 7709 while (did_request_animate_) { |
| 7710 did_request_redraw_ = false; |
| 7711 did_request_animate_ = false; |
| 7712 did_request_commit_ = false; |
| 7713 |
| 7714 float old_offset = host_impl_->top_controls_manager()->ControlsTopOffset(); |
| 7715 |
| 7716 animation_time += base::TimeDelta::FromMilliseconds(5); |
| 7717 host_impl_->Animate(animation_time); |
| 7718 |
| 7719 float new_offset = host_impl_->top_controls_manager()->ControlsTopOffset(); |
| 7720 |
| 7721 if (new_offset != old_offset) { |
| 7722 EXPECT_TRUE(did_request_redraw_); |
| 7723 EXPECT_TRUE(did_request_commit_); |
| 7724 } |
| 7725 } |
| 7726 EXPECT_FALSE(host_impl_->top_controls_manager()->animation()); |
| 7727 EXPECT_EQ(-top_controls_height_, |
| 7728 host_impl_->top_controls_manager()->ControlsTopOffset()); |
| 7729 } |
| 7730 |
| 7731 TEST_F(LayerTreeHostImplWithTopControlsTest, |
7645 TopControlsScrollDeltaInOverScroll) { | 7732 TopControlsScrollDeltaInOverScroll) { |
7646 // test varifies that the overscroll delta should not have accumulated in | 7733 // test varifies that the overscroll delta should not have accumulated in |
7647 // the top controls if we do a hide and show without releasing finger. | 7734 // the top controls if we do a hide and show without releasing finger. |
7648 | 7735 |
7649 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 200)); | 7736 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 200)); |
7650 host_impl_->SetViewportSize(gfx::Size(100, 100)); | 7737 host_impl_->SetViewportSize(gfx::Size(100, 100)); |
7651 host_impl_->top_controls_manager()->UpdateTopControlsState(BOTH, SHOWN, | 7738 host_impl_->top_controls_manager()->UpdateTopControlsState(BOTH, SHOWN, |
7652 false); | 7739 false); |
7653 DrawFrame(); | 7740 DrawFrame(); |
7654 | 7741 |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8361 // surface. | 8448 // surface. |
8362 EXPECT_EQ(0, num_lost_surfaces_); | 8449 EXPECT_EQ(0, num_lost_surfaces_); |
8363 host_impl_->DidLoseOutputSurface(); | 8450 host_impl_->DidLoseOutputSurface(); |
8364 EXPECT_EQ(1, num_lost_surfaces_); | 8451 EXPECT_EQ(1, num_lost_surfaces_); |
8365 host_impl_->DidLoseOutputSurface(); | 8452 host_impl_->DidLoseOutputSurface(); |
8366 EXPECT_LE(1, num_lost_surfaces_); | 8453 EXPECT_LE(1, num_lost_surfaces_); |
8367 } | 8454 } |
8368 | 8455 |
8369 } // namespace | 8456 } // namespace |
8370 } // namespace cc | 8457 } // namespace cc |
OLD | NEW |