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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 1372253002: gfx: Make conversions from gfx::Point to PointF explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-gfx: . Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host_unittest.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index fa97535552c73dc9b70523374c711a57fc9cc6c4..8f06ab0d82ff0a0e6eccabb8c66f42387b42e093 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -915,7 +915,7 @@ class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate
bool has_thumb = false;
scrollbar_ = FakePaintedScrollbarLayer::Create(
layer_settings(), paint_scrollbar, has_thumb, root_layer_->id());
- scrollbar_->SetPosition(gfx::Point(0, 10));
+ scrollbar_->SetPosition(gfx::PointF(0.f, 10.f));
scrollbar_->SetBounds(gfx::Size(10, 10));
root_layer_->AddChild(scrollbar_);
@@ -1631,7 +1631,7 @@ class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers
root_layer_->SetBounds(gfx::Size(30, 30));
child_layer_->SetIsDrawable(true);
- child_layer_->SetPosition(gfx::Point(2, 2));
+ child_layer_->SetPosition(gfx::PointF(2.f, 2.f));
child_layer_->SetBounds(gfx::Size(10, 10));
layer_tree_host()->SetRootLayer(root_layer_);
@@ -1657,8 +1657,8 @@ class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers
impl->active_tree()->root_layer()->children()[0]);
// Positions remain in layout pixels.
- EXPECT_EQ(gfx::Point(0, 0), root->position());
- EXPECT_EQ(gfx::Point(2, 2), child->position());
+ EXPECT_EQ(gfx::PointF(), root->position());
+ EXPECT_EQ(gfx::PointF(2.f, 2.f), child->position());
// Compute all the layer transforms for the frame.
LayerTreeHostImpl::FrameData frame_data;
@@ -3287,7 +3287,7 @@ class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion
EXPECT_FALSE(grandchild3_->descendant_needs_push_properties());
grandchild1_->RemoveFromParent();
- grandchild1_->SetPosition(gfx::Point(1, 1));
+ grandchild1_->SetPosition(gfx::PointF(1.f, 1.f));
EXPECT_FALSE(root_->needs_push_properties());
EXPECT_FALSE(root_->descendant_needs_push_properties());
@@ -3311,7 +3311,7 @@ class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion
EXPECT_FALSE(grandchild3_->needs_push_properties());
EXPECT_FALSE(grandchild3_->descendant_needs_push_properties());
- grandchild2_->SetPosition(gfx::Point(1, 1));
+ grandchild2_->SetPosition(gfx::PointF(1.f, 1.f));
EXPECT_FALSE(root_->needs_push_properties());
EXPECT_TRUE(root_->descendant_needs_push_properties());
@@ -3419,8 +3419,8 @@ class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree
// Change grandchildren while their parent is not in the tree.
child_->RemoveFromParent();
- grandchild1_->SetPosition(gfx::Point(1, 1));
- grandchild2_->SetPosition(gfx::Point(1, 1));
+ grandchild1_->SetPosition(gfx::PointF(1.f, 1.f));
+ grandchild2_->SetPosition(gfx::PointF(1.f, 1.f));
root_->AddChild(child_);
EXPECT_FALSE(root_->needs_push_properties());
@@ -3485,9 +3485,9 @@ class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild
EXPECT_FALSE(grandchild3_->needs_push_properties());
EXPECT_FALSE(grandchild3_->descendant_needs_push_properties());
- child_->SetPosition(gfx::Point(1, 1));
- grandchild1_->SetPosition(gfx::Point(1, 1));
- grandchild2_->SetPosition(gfx::Point(1, 1));
+ child_->SetPosition(gfx::PointF(1.f, 1.f));
+ grandchild1_->SetPosition(gfx::PointF(1.f, 1.f));
+ grandchild2_->SetPosition(gfx::PointF(1.f, 1.f));
EXPECT_FALSE(root_->needs_push_properties());
EXPECT_TRUE(root_->descendant_needs_push_properties());
@@ -3549,9 +3549,9 @@ class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent
EXPECT_FALSE(grandchild3_->needs_push_properties());
EXPECT_FALSE(grandchild3_->descendant_needs_push_properties());
- grandchild1_->SetPosition(gfx::Point(1, 1));
- grandchild2_->SetPosition(gfx::Point(1, 1));
- child_->SetPosition(gfx::Point(1, 1));
+ grandchild1_->SetPosition(gfx::PointF(1.f, 1.f));
+ grandchild2_->SetPosition(gfx::PointF(1.f, 1.f));
+ child_->SetPosition(gfx::PointF(1.f, 1.f));
EXPECT_FALSE(root_->needs_push_properties());
EXPECT_TRUE(root_->descendant_needs_push_properties());
@@ -3741,17 +3741,17 @@ class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest {
protected:
void SetupTree() override {
root_layer_ = Layer::Create(layer_settings());
- root_layer_->SetPosition(gfx::Point());
+ root_layer_->SetPosition(gfx::PointF());
root_layer_->SetBounds(gfx::Size(10, 10));
parent_layer_ = SolidColorLayer::Create(layer_settings());
- parent_layer_->SetPosition(gfx::Point());
+ parent_layer_->SetPosition(gfx::PointF());
parent_layer_->SetBounds(gfx::Size(10, 10));
parent_layer_->SetIsDrawable(true);
root_layer_->AddChild(parent_layer_);
child_layer_ = SolidColorLayer::Create(layer_settings());
- child_layer_->SetPosition(gfx::Point());
+ child_layer_->SetPosition(gfx::PointF());
child_layer_->SetBounds(gfx::Size(10, 10));
child_layer_->SetIsDrawable(true);
parent_layer_->AddChild(child_layer_);
@@ -5802,18 +5802,20 @@ class LayerTreeTestMaskLayerForSurfaceWithClippedLayer : public LayerTreeTest {
gfx::Size root_size(100, 100);
root->SetBounds(root_size);
- gfx::Rect clipping_rect(20, 10, 10, 20);
- clipping_layer->SetBounds(clipping_rect.size());
- clipping_layer->SetPosition(clipping_rect.origin());
+ gfx::PointF clipping_origin(20.f, 10.f);
+ gfx::Size clipping_size(10, 20);
+ clipping_layer->SetBounds(clipping_size);
+ clipping_layer->SetPosition(clipping_origin);
clipping_layer->SetMasksToBounds(true);
gfx::Size layer_size(50, 50);
content_layer->SetBounds(layer_size);
- content_layer->SetPosition(gfx::Point() - clipping_rect.OffsetFromOrigin());
+ content_layer->SetPosition(gfx::PointF() -
+ clipping_origin.OffsetFromOrigin());
gfx::Size child_size(50, 50);
content_child_layer->SetBounds(child_size);
- content_child_layer->SetPosition(gfx::Point(20, 0));
+ content_child_layer->SetPosition(gfx::PointF(20.f, 0.f));
gfx::Size mask_size(100, 100);
mask_layer->SetBounds(mask_size);

Powered by Google App Engine
This is Rietveld 408576698