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

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

Issue 870363005: Remove scroll_delta flooring hack (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 422
423 // Check that a fractional scroll delta is correctly accumulated over 423 // Check that a fractional scroll delta is correctly accumulated over
424 // multiple commits. 424 // multiple commits.
425 switch (impl->active_tree()->source_frame_number()) { 425 switch (impl->active_tree()->source_frame_number()) {
426 case 0: 426 case 0:
427 EXPECT_VECTOR_EQ(scroll_layer->BaseScrollOffset(), gfx::Vector2d(0, 0)); 427 EXPECT_VECTOR_EQ(scroll_layer->BaseScrollOffset(), gfx::Vector2d(0, 0));
428 EXPECT_VECTOR_EQ(scroll_layer->ScrollDelta(), gfx::Vector2d(0, 0)); 428 EXPECT_VECTOR_EQ(scroll_layer->ScrollDelta(), gfx::Vector2d(0, 0));
429 PostSetNeedsCommitToMainThread(); 429 PostSetNeedsCommitToMainThread();
430 break; 430 break;
431 case 1: 431 case 1:
432 EXPECT_VECTOR_EQ(scroll_layer->BaseScrollOffset(), 432 EXPECT_VECTOR_EQ(scroll_layer->BaseScrollOffset(), scroll_amount_);
433 gfx::ToFlooredVector2d(scroll_amount_)); 433 EXPECT_VECTOR_EQ(scroll_layer->ScrollDelta(), gfx::Vector2dF());
434 EXPECT_VECTOR_EQ(scroll_layer->ScrollDelta(),
435 gfx::Vector2dF(fmod(scroll_amount_.x(), 1.0f), 0.0f));
436 PostSetNeedsCommitToMainThread(); 434 PostSetNeedsCommitToMainThread();
437 break; 435 break;
438 case 2: 436 case 2:
439 EXPECT_VECTOR_EQ( 437 EXPECT_VECTOR_EQ(scroll_layer->BaseScrollOffset(),
440 scroll_layer->BaseScrollOffset(), 438 (scroll_amount_ + scroll_amount_));
441 gfx::ToFlooredVector2d(scroll_amount_ + scroll_amount_)); 439 EXPECT_VECTOR_EQ(scroll_layer->ScrollDelta(), gfx::Vector2dF());
442 EXPECT_VECTOR_EQ(
443 scroll_layer->ScrollDelta(),
444 gfx::Vector2dF(fmod(2.0f * scroll_amount_.x(), 1.0f), 0.0f));
445 EndTest(); 440 EndTest();
446 break; 441 break;
447 } 442 }
448 scroll_layer->ScrollBy(scroll_amount_); 443 scroll_layer->ScrollBy(scroll_amount_);
449 } 444 }
450 445
451 void AfterTest() override {} 446 void AfterTest() override {}
452 447
453 private: 448 private:
454 gfx::Vector2dF scroll_amount_; 449 gfx::Vector2dF scroll_amount_;
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 RunTest(true, false, true); 1226 RunTest(true, false, true);
1232 } 1227 }
1233 1228
1234 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { 1229 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) {
1235 scroll_destroy_whole_tree_ = true; 1230 scroll_destroy_whole_tree_ = true;
1236 RunTest(true, false, true); 1231 RunTest(true, false, true);
1237 } 1232 }
1238 1233
1239 } // namespace 1234 } // namespace
1240 } // namespace cc 1235 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_no_message_loop.cc ('k') | content/browser/renderer_host/compositor_impl_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698