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

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

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « cc/trees/layer_tree_host_unittest_no_message_loop.cc ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/memory/weak_ptr.h" 7 #include "base/memory/weak_ptr.h"
8 #include "cc/layers/layer.h" 8 #include "cc/layers/layer.h"
9 #include "cc/layers/layer_impl.h" 9 #include "cc/layers/layer_impl.h"
10 #include "cc/layers/picture_layer.h" 10 #include "cc/layers/picture_layer.h"
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 } 575 }
576 576
577 EXPECT_VECTOR_EQ(gfx::Vector2d(), root_impl->ScrollDelta()); 577 EXPECT_VECTOR_EQ(gfx::Vector2d(), root_impl->ScrollDelta());
578 EXPECT_VECTOR_EQ(gfx::Vector2d(), 578 EXPECT_VECTOR_EQ(gfx::Vector2d(),
579 expected_no_scroll_layer_impl->ScrollDelta()); 579 expected_no_scroll_layer_impl->ScrollDelta());
580 580
581 // Ensure device scale factor matches the active tree. 581 // Ensure device scale factor matches the active tree.
582 EXPECT_EQ(device_scale_factor_, impl->active_tree()->device_scale_factor()); 582 EXPECT_EQ(device_scale_factor_, impl->active_tree()->device_scale_factor());
583 switch (impl->active_tree()->source_frame_number()) { 583 switch (impl->active_tree()->source_frame_number()) {
584 case 0: { 584 case 0: {
585 // GESTURE scroll on impl thread. 585 // Gesture scroll on impl thread.
586 InputHandler::ScrollStatus status = impl->ScrollBegin( 586 InputHandler::ScrollStatus status = impl->ScrollBegin(
587 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() - 587 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() -
588 gfx::Vector2dF(0.5f, 0.5f)), 588 gfx::Vector2dF(0.5f, 0.5f)),
589 InputHandler::GESTURE); 589 InputHandler::Gesture);
590 EXPECT_EQ(InputHandler::SCROLL_STARTED, status); 590 EXPECT_EQ(InputHandler::ScrollStarted, status);
591 impl->ScrollBy(gfx::Point(), scroll_amount_); 591 impl->ScrollBy(gfx::Point(), scroll_amount_);
592 impl->ScrollEnd(); 592 impl->ScrollEnd();
593 593
594 // Check the scroll is applied as a delta. 594 // Check the scroll is applied as a delta.
595 EXPECT_VECTOR_EQ(initial_offset_, 595 EXPECT_VECTOR_EQ(initial_offset_,
596 expected_scroll_layer_impl->BaseScrollOffset()); 596 expected_scroll_layer_impl->BaseScrollOffset());
597 EXPECT_VECTOR_EQ(scroll_amount_, 597 EXPECT_VECTOR_EQ(scroll_amount_,
598 expected_scroll_layer_impl->ScrollDelta()); 598 expected_scroll_layer_impl->ScrollDelta());
599 break; 599 break;
600 } 600 }
601 case 1: { 601 case 1: {
602 // WHEEL scroll on impl thread. 602 // Wheel scroll on impl thread.
603 InputHandler::ScrollStatus status = impl->ScrollBegin( 603 InputHandler::ScrollStatus status = impl->ScrollBegin(
604 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() + 604 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() +
605 gfx::Vector2dF(0.5f, 0.5f)), 605 gfx::Vector2dF(0.5f, 0.5f)),
606 InputHandler::WHEEL); 606 InputHandler::Wheel);
607 EXPECT_EQ(InputHandler::SCROLL_STARTED, status); 607 EXPECT_EQ(InputHandler::ScrollStarted, status);
608 impl->ScrollBy(gfx::Point(), scroll_amount_); 608 impl->ScrollBy(gfx::Point(), scroll_amount_);
609 impl->ScrollEnd(); 609 impl->ScrollEnd();
610 610
611 // Check the scroll is applied as a delta. 611 // Check the scroll is applied as a delta.
612 EXPECT_VECTOR_EQ(javascript_scroll_, 612 EXPECT_VECTOR_EQ(javascript_scroll_,
613 expected_scroll_layer_impl->BaseScrollOffset()); 613 expected_scroll_layer_impl->BaseScrollOffset());
614 EXPECT_VECTOR_EQ(scroll_amount_, 614 EXPECT_VECTOR_EQ(scroll_amount_,
615 expected_scroll_layer_impl->ScrollDelta()); 615 expected_scroll_layer_impl->ScrollDelta());
616 break; 616 break;
617 } 617 }
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 1033
1034 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 1034 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
1035 LayerImpl* root = impl->active_tree()->root_layer(); 1035 LayerImpl* root = impl->active_tree()->root_layer();
1036 LayerImpl* scroll_layer = root->children()[0]; 1036 LayerImpl* scroll_layer = root->children()[0];
1037 scroll_layer->SetScrollClipLayer(root->id()); 1037 scroll_layer->SetScrollClipLayer(root->id());
1038 1038
1039 // Set max_scroll_offset = (100, 100). 1039 // Set max_scroll_offset = (100, 100).
1040 scroll_layer->SetBounds( 1040 scroll_layer->SetBounds(
1041 gfx::Size(root->bounds().width() + 100, root->bounds().height() + 100)); 1041 gfx::Size(root->bounds().width() + 100, root->bounds().height() + 100));
1042 EXPECT_EQ( 1042 EXPECT_EQ(
1043 InputHandler::SCROLL_STARTED, 1043 InputHandler::ScrollStarted,
1044 scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE, 1044 scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture,
1045 SCROLL_BLOCKS_ON_NONE)); 1045 ScrollBlocksOnNone));
1046 1046
1047 // Set max_scroll_offset = (0, 0). 1047 // Set max_scroll_offset = (0, 0).
1048 scroll_layer->SetBounds(root->bounds()); 1048 scroll_layer->SetBounds(root->bounds());
1049 EXPECT_EQ( 1049 EXPECT_EQ(
1050 InputHandler::SCROLL_IGNORED, 1050 InputHandler::ScrollIgnored,
1051 scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE, 1051 scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture,
1052 SCROLL_BLOCKS_ON_NONE)); 1052 ScrollBlocksOnNone));
1053 1053
1054 // Set max_scroll_offset = (-100, -100). 1054 // Set max_scroll_offset = (-100, -100).
1055 scroll_layer->SetBounds(gfx::Size()); 1055 scroll_layer->SetBounds(gfx::Size());
1056 EXPECT_EQ( 1056 EXPECT_EQ(
1057 InputHandler::SCROLL_IGNORED, 1057 InputHandler::ScrollIgnored,
1058 scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE, 1058 scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture,
1059 SCROLL_BLOCKS_ON_NONE)); 1059 ScrollBlocksOnNone));
1060 1060
1061 EndTest(); 1061 EndTest();
1062 } 1062 }
1063 1063
1064 void AfterTest() override {} 1064 void AfterTest() override {}
1065 }; 1065 };
1066 1066
1067 SINGLE_AND_MULTI_THREAD_TEST_F( 1067 SINGLE_AND_MULTI_THREAD_TEST_F(
1068 LayerTreeHostScrollTestScrollZeroMaxScrollOffset); 1068 LayerTreeHostScrollTestScrollZeroMaxScrollOffset);
1069 1069
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 RunTest(true, false, true); 1229 RunTest(true, false, true);
1230 } 1230 }
1231 1231
1232 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { 1232 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) {
1233 scroll_destroy_whole_tree_ = true; 1233 scroll_destroy_whole_tree_ = true;
1234 RunTest(true, false, true); 1234 RunTest(true, false, true);
1235 } 1235 }
1236 1236
1237 } // namespace 1237 } // namespace
1238 } // namespace cc 1238 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_no_message_loop.cc ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698