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

Side by Side Diff: cc/layer_tree_host_common_unittest.cc

Issue 11293194: ui: Prefer +/- operators to apply offsets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: floats Created 8 years, 1 month 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
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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/layer_tree_host_common.h" 7 #include "cc/layer_tree_host_common.h"
8 8
9 #include "cc/content_layer.h" 9 #include "cc/content_layer.h"
10 #include "cc/content_layer_client.h" 10 #include "cc/content_layer_client.h"
(...skipping 3482 matching lines...) Expand 10 before | Expand all | Expand 10 after
3493 expectedChildTransform.translate(deviceScaleFactor * child->position().x(), deviceScaleFactor * child->position().y()); 3493 expectedChildTransform.translate(deviceScaleFactor * child->position().x(), deviceScaleFactor * child->position().y());
3494 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform ()); 3494 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform ());
3495 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->screenSpaceTr ansform()); 3495 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->screenSpaceTr ansform());
3496 3496
3497 // Verify results of transformed child rects 3497 // Verify results of transformed child rects
3498 gfx::RectF childContentBounds(gfx::PointF(), gfx::SizeF(child->contentBounds ())); 3498 gfx::RectF childContentBounds(gfx::PointF(), gfx::SizeF(child->contentBounds ()));
3499 3499
3500 gfx::RectF childDrawRect = MathUtil::mapClippedRect(child->drawTransform(), childContentBounds); 3500 gfx::RectF childDrawRect = MathUtil::mapClippedRect(child->drawTransform(), childContentBounds);
3501 gfx::RectF childScreenSpaceRect = MathUtil::mapClippedRect(child->screenSpac eTransform(), childContentBounds); 3501 gfx::RectF childScreenSpaceRect = MathUtil::mapClippedRect(child->screenSpac eTransform(), childContentBounds);
3502 3502
3503 gfx::RectF expectedChildDrawRect(gfx::PointF(), child->bounds()); 3503 gfx::RectF expectedChildDrawRect(child->position(), child->bounds());
3504 expectedChildDrawRect.Offset(child->position().x(), child->position().y());
3505 expectedChildDrawRect.Scale(deviceScaleFactor); 3504 expectedChildDrawRect.Scale(deviceScaleFactor);
3506 EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childDrawRect); 3505 EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childDrawRect);
3507 EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childScreenSpaceRect); 3506 EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childScreenSpaceRect);
3508 3507
3509 // Verify childNoScale transforms 3508 // Verify childNoScale transforms
3510 WebTransformationMatrix expectedChildNoScaleTransform = child->drawTransform (); 3509 WebTransformationMatrix expectedChildNoScaleTransform = child->drawTransform ();
3511 // All transforms operate on content rects. The child's content rect 3510 // All transforms operate on content rects. The child's content rect
3512 // incorporates device scale, but the childNoScale does not; add it here. 3511 // incorporates device scale, but the childNoScale does not; add it here.
3513 expectedChildNoScaleTransform.scale(deviceScaleFactor); 3512 expectedChildNoScaleTransform.scale(deviceScaleFactor);
3514 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale- >drawTransform()); 3513 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale- >drawTransform());
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
4039 int nonexistentId = -1; 4038 int nonexistentId = -1;
4040 EXPECT_EQ(root, LayerTreeHostCommon::findLayerInSubtree(root.get(), root->id ())); 4039 EXPECT_EQ(root, LayerTreeHostCommon::findLayerInSubtree(root.get(), root->id ()));
4041 EXPECT_EQ(child, LayerTreeHostCommon::findLayerInSubtree(root.get(), child-> id())); 4040 EXPECT_EQ(child, LayerTreeHostCommon::findLayerInSubtree(root.get(), child-> id()));
4042 EXPECT_EQ(grandChild, LayerTreeHostCommon::findLayerInSubtree(root.get(), gr andChild->id())); 4041 EXPECT_EQ(grandChild, LayerTreeHostCommon::findLayerInSubtree(root.get(), gr andChild->id()));
4043 EXPECT_EQ(maskLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(), mas kLayer->id())); 4042 EXPECT_EQ(maskLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(), mas kLayer->id()));
4044 EXPECT_EQ(replicaLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(), replicaLayer->id())); 4043 EXPECT_EQ(replicaLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(), replicaLayer->id()));
4045 EXPECT_EQ(0, LayerTreeHostCommon::findLayerInSubtree(root.get(), nonexistent Id)); 4044 EXPECT_EQ(0, LayerTreeHostCommon::findLayerInSubtree(root.get(), nonexistent Id));
4046 } 4045 }
4047 4046
4048 } // anonymous namespace 4047 } // anonymous namespace
OLDNEW
« .gitmodules ('K') | « cc/geometry.h ('k') | cc/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698