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

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

Issue 18400003: cc: Consider scroll offset in CalcDrawProperties (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use a gyp variable Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('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 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_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include "cc/animation/layer_animation_controller.h" 7 #include "cc/animation/layer_animation_controller.h"
8 #include "cc/base/math_util.h" 8 #include "cc/base/math_util.h"
9 #include "cc/layers/content_layer.h" 9 #include "cc/layers/content_layer.h"
10 #include "cc/layers/content_layer_client.h" 10 #include "cc/layers/content_layer_client.h"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 gfx::Size(500, 500), 419 gfx::Size(500, 500),
420 false); 420 false);
421 421
422 scoped_ptr<LayerImpl> scroll_layerScopedPtr( 422 scoped_ptr<LayerImpl> scroll_layerScopedPtr(
423 LayerImpl::Create(host_impl.active_tree(), 2)); 423 LayerImpl::Create(host_impl.active_tree(), 2));
424 LayerImpl* scroll_layer = scroll_layerScopedPtr.get(); 424 LayerImpl* scroll_layer = scroll_layerScopedPtr.get();
425 SetLayerPropertiesForTesting(scroll_layer, 425 SetLayerPropertiesForTesting(scroll_layer,
426 identity_matrix, 426 identity_matrix,
427 identity_matrix, 427 identity_matrix,
428 gfx::PointF(), 428 gfx::PointF(),
429 kScrollLayerPosition, 429 gfx::PointF(),
430 gfx::Size(10, 20), 430 gfx::Size(10, 20),
431 false); 431 false);
432 scroll_layer->SetScrollable(true); 432 scroll_layer->SetScrollable(true);
433 scroll_layer->SetScrollOffset(kScrollOffset); 433 scroll_layer->SetScrollOffset(kScrollOffset);
434 scroll_layer->SetScrollDelta(kScrollDelta); 434 scroll_layer->SetScrollDelta(kScrollDelta);
435 gfx::Transform impl_transform; 435 gfx::Transform impl_transform;
436 scroll_layer->AddChild(sublayer_scoped_ptr.Pass()); 436 scroll_layer->AddChild(sublayer_scoped_ptr.Pass());
437 437
438 scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3)); 438 scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3));
439 SetLayerPropertiesForTesting(root.get(), 439 SetLayerPropertiesForTesting(root.get(),
(...skipping 18 matching lines...) Expand all
458 sublayer->screen_space_transform()); 458 sublayer->screen_space_transform());
459 459
460 gfx::Transform arbitrary_translate; 460 gfx::Transform arbitrary_translate;
461 const float kTranslateX = 10.6f; 461 const float kTranslateX = 10.6f;
462 const float kTranslateY = 20.6f; 462 const float kTranslateY = 20.6f;
463 arbitrary_translate.Translate(kTranslateX, kTranslateY); 463 arbitrary_translate.Translate(kTranslateX, kTranslateY);
464 SetLayerPropertiesForTesting(scroll_layer, 464 SetLayerPropertiesForTesting(scroll_layer,
465 arbitrary_translate, 465 arbitrary_translate,
466 identity_matrix, 466 identity_matrix,
467 gfx::PointF(), 467 gfx::PointF(),
468 kScrollLayerPosition, 468 gfx::PointF(),
469 gfx::Size(10, 20), 469 gfx::Size(10, 20),
470 false); 470 false);
471 ExecuteCalculateDrawProperties( 471 ExecuteCalculateDrawProperties(
472 root.get(), kDeviceScale, kPageScale, scroll_layer); 472 root.get(), kDeviceScale, kPageScale, scroll_layer);
473 expected_transform.MakeIdentity(); 473 expected_transform.MakeIdentity();
474 expected_transform.Translate( 474 expected_transform.Translate(
475 MathUtil::Round(kTranslateX * kPageScale * kDeviceScale + 475 MathUtil::Round(kTranslateX * kPageScale * kDeviceScale +
476 sub_layer_screen_position.x()), 476 sub_layer_screen_position.x()),
477 MathUtil::Round(kTranslateY * kPageScale * kDeviceScale + 477 MathUtil::Round(kTranslateY * kPageScale * kDeviceScale +
478 sub_layer_screen_position.y())); 478 sub_layer_screen_position.y()));
(...skipping 7852 matching lines...) Expand 10 before | Expand all | Expand 10 after
8331 EXPECT_EQ(root->id(), render_surface_layer_list[0]->id()); 8331 EXPECT_EQ(root->id(), render_surface_layer_list[0]->id());
8332 8332
8333 // The root render surface should only have 1 contributing layer, since the 8333 // The root render surface should only have 1 contributing layer, since the
8334 // other layers are empty/clipped away. 8334 // other layers are empty/clipped away.
8335 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); 8335 ASSERT_EQ(1u, root->render_surface()->layer_list().size());
8336 EXPECT_EQ(root->id(), root->render_surface()->layer_list()[0]->id()); 8336 EXPECT_EQ(root->id(), root->render_surface()->layer_list()[0]->id());
8337 } 8337 }
8338 8338
8339 } // namespace 8339 } // namespace
8340 } // namespace cc 8340 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698