Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: cc/trees/layer_tree_host_unittest_scroll.cc

Issue 2720183003: Track the currently scrolling ScrollNode instead of the scrolling layer (Closed)
Patch Set: Rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 case 0: { 690 case 0: {
691 // GESTURE scroll on impl thread. Also tests that the last scrolled 691 // GESTURE scroll on impl thread. Also tests that the last scrolled
692 // layer id is stored even after the scrolling ends. 692 // layer id is stored even after the scrolling ends.
693 gfx::Point scroll_point = 693 gfx::Point scroll_point =
694 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() - 694 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() -
695 gfx::Vector2dF(0.5f, 0.5f)); 695 gfx::Vector2dF(0.5f, 0.5f));
696 InputHandler::ScrollStatus status = impl->ScrollBegin( 696 InputHandler::ScrollStatus status = impl->ScrollBegin(
697 BeginState(scroll_point).get(), InputHandler::TOUCHSCREEN); 697 BeginState(scroll_point).get(), InputHandler::TOUCHSCREEN);
698 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 698 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
699 impl->ScrollBy(UpdateState(gfx::Point(), scroll_amount_).get()); 699 impl->ScrollBy(UpdateState(gfx::Point(), scroll_amount_).get());
700 LayerImpl* scrolling_layer = impl->CurrentlyScrollingLayer(); 700 auto* scrolling_node = impl->CurrentlyScrollingNode();
701 CHECK(scrolling_layer); 701 CHECK(scrolling_node);
702 impl->ScrollEnd(EndState().get()); 702 impl->ScrollEnd(EndState().get());
703 CHECK(!impl->CurrentlyScrollingLayer()); 703 CHECK(!impl->CurrentlyScrollingNode());
704 EXPECT_EQ(scrolling_layer->id(), 704 EXPECT_EQ(scrolling_node->id,
705 impl->active_tree()->LastScrolledLayerId()); 705 impl->active_tree()->LastScrolledScrollNodeIndex());
706 706
707 // Check the scroll is applied as a delta. 707 // Check the scroll is applied as a delta.
708 EXPECT_VECTOR_EQ(initial_offset_, 708 EXPECT_VECTOR_EQ(initial_offset_,
709 ScrollTreeForLayer(expected_scroll_layer_impl) 709 ScrollTreeForLayer(expected_scroll_layer_impl)
710 ->GetScrollOffsetBaseForTesting( 710 ->GetScrollOffsetBaseForTesting(
711 expected_scroll_layer_impl->id())); 711 expected_scroll_layer_impl->id()));
712 EXPECT_VECTOR_EQ(scroll_amount_, 712 EXPECT_VECTOR_EQ(scroll_amount_,
713 ScrollDelta(expected_scroll_layer_impl)); 713 ScrollDelta(expected_scroll_layer_impl));
714 break; 714 break;
715 } 715 }
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 private: 2065 private:
2066 gfx::ScrollOffset initial_scroll_; 2066 gfx::ScrollOffset initial_scroll_;
2067 gfx::ScrollOffset second_scroll_; 2067 gfx::ScrollOffset second_scroll_;
2068 gfx::Vector2dF scroll_amount_; 2068 gfx::Vector2dF scroll_amount_;
2069 }; 2069 };
2070 2070
2071 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostScrollTestPropertyTreeUpdate); 2071 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostScrollTestPropertyTreeUpdate);
2072 2072
2073 } // namespace 2073 } // namespace
2074 } // namespace cc 2074 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698