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

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

Issue 584503005: Make scroll offset type of float in cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: link crbug to TODO Created 6 years, 2 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_common.cc ('k') | cc/trees/layer_tree_host_impl.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 <set> 7 #include <set>
8 8
9 #include "cc/animation/layer_animation_controller.h" 9 #include "cc/animation/layer_animation_controller.h"
10 #include "cc/animation/transform_operations.h" 10 #include "cc/animation/transform_operations.h"
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 gfx::Size(10, 12), 277 gfx::Size(10, 12),
278 true, 278 true,
279 false); 279 false);
280 ExecuteCalculateDrawProperties(root.get()); 280 ExecuteCalculateDrawProperties(root.get());
281 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_result, layer->draw_transform()); 281 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_result, layer->draw_transform());
282 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_result, 282 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_result,
283 layer->screen_space_transform()); 283 layer->screen_space_transform());
284 } 284 }
285 285
286 TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) { 286 TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) {
287 const gfx::Vector2d kScrollOffset(50, 100); 287 const gfx::ScrollOffset kScrollOffset(50, 100);
288 const gfx::Vector2dF kScrollDelta(2.34f, 5.67f); 288 const gfx::Vector2dF kScrollDelta(2.34f, 5.67f);
289 const gfx::Vector2d kMaxScrollOffset(200, 200); 289 const gfx::Vector2d kMaxScrollOffset(200, 200);
290 const gfx::PointF kScrollLayerPosition(-kScrollOffset.x(), 290 const gfx::PointF kScrollLayerPosition(-kScrollOffset.x(),
291 -kScrollOffset.y()); 291 -kScrollOffset.y());
292 const float kPageScale = 0.888f; 292 const float kPageScale = 0.888f;
293 const float kDeviceScale = 1.666f; 293 const float kDeviceScale = 1.666f;
294 294
295 FakeImplProxy proxy; 295 FakeImplProxy proxy;
296 TestSharedBitmapManager shared_bitmap_manager; 296 TestSharedBitmapManager shared_bitmap_manager;
297 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 297 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
(...skipping 6282 matching lines...) Expand 10 before | Expand all | Expand 10 after
6580 clip_parent->AddChild(render_surface1); 6580 clip_parent->AddChild(render_surface1);
6581 render_surface1->AddChild(intervening); 6581 render_surface1->AddChild(intervening);
6582 intervening->AddChild(render_surface2); 6582 intervening->AddChild(render_surface2);
6583 render_surface2->AddChild(clip_child); 6583 render_surface2->AddChild(clip_child);
6584 6584
6585 clip_child->SetClipParent(clip_parent.get()); 6585 clip_child->SetClipParent(clip_parent.get());
6586 6586
6587 intervening->SetMasksToBounds(true); 6587 intervening->SetMasksToBounds(true);
6588 clip_parent->SetMasksToBounds(true); 6588 clip_parent->SetMasksToBounds(true);
6589 intervening->SetScrollClipLayerId(clip_parent->id()); 6589 intervening->SetScrollClipLayerId(clip_parent->id());
6590 intervening->SetScrollOffset(gfx::Vector2d(3, 3)); 6590 intervening->SetScrollOffset(gfx::ScrollOffset(3, 3));
6591 6591
6592 render_surface1->SetForceRenderSurface(true); 6592 render_surface1->SetForceRenderSurface(true);
6593 render_surface2->SetForceRenderSurface(true); 6593 render_surface2->SetForceRenderSurface(true);
6594 6594
6595 gfx::Transform translation_transform; 6595 gfx::Transform translation_transform;
6596 translation_transform.Translate(2, 2); 6596 translation_transform.Translate(2, 2);
6597 6597
6598 gfx::Transform identity_transform; 6598 gfx::Transform identity_transform;
6599 SetLayerPropertiesForTesting(root.get(), 6599 SetLayerPropertiesForTesting(root.get(),
6600 identity_transform, 6600 identity_transform,
(...skipping 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after
8610 // by the viewport. 8610 // by the viewport.
8611 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_content_rect()); 8611 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_content_rect());
8612 8612
8613 // Layers drawing to a child render surface should still have their visible 8613 // Layers drawing to a child render surface should still have their visible
8614 // content rect clipped by the viewport. 8614 // content rect clipped by the viewport.
8615 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_content_rect()); 8615 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_content_rect());
8616 } 8616 }
8617 8617
8618 } // namespace 8618 } // namespace
8619 } // namespace cc 8619 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698