OLD | NEW |
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.h" | 7 #include "cc/layer_tree_host.h" |
8 | 8 |
9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
10 #include "cc/content_layer.h" | 10 #include "cc/content_layer.h" |
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 | 1339 |
1340 // Both layers should be drawing into the root render surface. | 1340 // Both layers should be drawing into the root render surface. |
1341 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 1341 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
1342 ASSERT_EQ(root->renderSurface(), renderSurfaceLayerList[0]->renderSurfac
e()); | 1342 ASSERT_EQ(root->renderSurface(), renderSurfaceLayerList[0]->renderSurfac
e()); |
1343 ASSERT_EQ(2u, root->renderSurface()->layerList().size()); | 1343 ASSERT_EQ(2u, root->renderSurface()->layerList().size()); |
1344 | 1344 |
1345 // The root render surface is the size of the viewport. | 1345 // The root render surface is the size of the viewport. |
1346 EXPECT_RECT_EQ(gfx::Rect(0, 0, 60, 60), root->renderSurface()->contentRe
ct()); | 1346 EXPECT_RECT_EQ(gfx::Rect(0, 0, 60, 60), root->renderSurface()->contentRe
ct()); |
1347 | 1347 |
1348 // The content bounds of the child should be scaled. | 1348 // The content bounds of the child should be scaled. |
1349 gfx::Size childBoundsScaled = child->bounds(); | 1349 gfx::Size childBoundsScaled = gfx::ToCeiledSize(gfx::ScaleSize(child->bo
unds(), 1.5)); |
1350 childBoundsScaled = gfx::ToRoundedSize(childBoundsScaled.Scale(1.5)); | |
1351 EXPECT_EQ(childBoundsScaled, child->contentBounds()); | 1350 EXPECT_EQ(childBoundsScaled, child->contentBounds()); |
1352 | 1351 |
1353 WebTransformationMatrix scaleTransform; | 1352 WebTransformationMatrix scaleTransform; |
1354 scaleTransform.scale(impl->deviceScaleFactor()); | 1353 scaleTransform.scale(impl->deviceScaleFactor()); |
1355 | 1354 |
1356 // The root layer is scaled by 2x. | 1355 // The root layer is scaled by 2x. |
1357 WebTransformationMatrix rootScreenSpaceTransform = scaleTransform; | 1356 WebTransformationMatrix rootScreenSpaceTransform = scaleTransform; |
1358 WebTransformationMatrix rootDrawTransform = scaleTransform; | 1357 WebTransformationMatrix rootDrawTransform = scaleTransform; |
1359 | 1358 |
1360 EXPECT_EQ(rootDrawTransform, root->drawTransform()); | 1359 EXPECT_EQ(rootDrawTransform, root->drawTransform()); |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2187 , m_initialScroll(10, 20) | 2186 , m_initialScroll(10, 20) |
2188 , m_secondScroll(40, 5) | 2187 , m_secondScroll(40, 5) |
2189 , m_scrollAmount(2, -1) | 2188 , m_scrollAmount(2, -1) |
2190 , m_rootScrolls(0) | 2189 , m_rootScrolls(0) |
2191 { | 2190 { |
2192 } | 2191 } |
2193 | 2192 |
2194 virtual void beginTest() OVERRIDE | 2193 virtual void beginTest() OVERRIDE |
2195 { | 2194 { |
2196 gfx::Size viewportSize(10, 10); | 2195 gfx::Size viewportSize(10, 10); |
2197 gfx::Size deviceViewportSize = gfx::ToCeiledSize(viewportSize.Scale(m_de
viceScaleFactor)); | 2196 gfx::Size deviceViewportSize = gfx::ToCeiledSize(gfx::ScaleSize(viewport
Size, m_deviceScaleFactor)); |
2198 m_layerTreeHost->setViewportSize(viewportSize, deviceViewportSize); | 2197 m_layerTreeHost->setViewportSize(viewportSize, deviceViewportSize); |
2199 | 2198 |
2200 m_layerTreeHost->setDeviceScaleFactor(m_deviceScaleFactor); | 2199 m_layerTreeHost->setDeviceScaleFactor(m_deviceScaleFactor); |
2201 | 2200 |
2202 m_rootScrollLayer = ContentLayer::create(&m_mockDelegate); | 2201 m_rootScrollLayer = ContentLayer::create(&m_mockDelegate); |
2203 m_rootScrollLayer->setBounds(gfx::Size(110, 110)); | 2202 m_rootScrollLayer->setBounds(gfx::Size(110, 110)); |
2204 | 2203 |
2205 m_rootScrollLayer->setPosition(gfx::PointF(0, 0)); | 2204 m_rootScrollLayer->setPosition(gfx::PointF(0, 0)); |
2206 m_rootScrollLayer->setAnchorPoint(gfx::PointF(0, 0)); | 2205 m_rootScrollLayer->setAnchorPoint(gfx::PointF(0, 0)); |
2207 | 2206 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2347 , m_initialScroll(10, 20) | 2346 , m_initialScroll(10, 20) |
2348 , m_secondScroll(40, 5) | 2347 , m_secondScroll(40, 5) |
2349 , m_scrollAmount(2, -1) | 2348 , m_scrollAmount(2, -1) |
2350 , m_rootScrolls(0) | 2349 , m_rootScrolls(0) |
2351 { | 2350 { |
2352 } | 2351 } |
2353 | 2352 |
2354 virtual void beginTest() OVERRIDE | 2353 virtual void beginTest() OVERRIDE |
2355 { | 2354 { |
2356 gfx::Size viewportSize(10, 10); | 2355 gfx::Size viewportSize(10, 10); |
2357 gfx::Size deviceViewportSize = gfx::ToCeiledSize(viewportSize.Scale(m_de
viceScaleFactor)); | 2356 gfx::Size deviceViewportSize = gfx::ToCeiledSize(gfx::ScaleSize(viewport
Size, m_deviceScaleFactor)); |
2358 m_layerTreeHost->setViewportSize(viewportSize, deviceViewportSize); | 2357 m_layerTreeHost->setViewportSize(viewportSize, deviceViewportSize); |
2359 | 2358 |
2360 m_layerTreeHost->setDeviceScaleFactor(m_deviceScaleFactor); | 2359 m_layerTreeHost->setDeviceScaleFactor(m_deviceScaleFactor); |
2361 | 2360 |
2362 m_rootScrollLayer = ContentLayer::create(&m_mockDelegate); | 2361 m_rootScrollLayer = ContentLayer::create(&m_mockDelegate); |
2363 m_rootScrollLayer->setBounds(gfx::Size(110, 110)); | 2362 m_rootScrollLayer->setBounds(gfx::Size(110, 110)); |
2364 | 2363 |
2365 m_rootScrollLayer->setPosition(gfx::PointF(0, 0)); | 2364 m_rootScrollLayer->setPosition(gfx::PointF(0, 0)); |
2366 m_rootScrollLayer->setAnchorPoint(gfx::PointF(0, 0)); | 2365 m_rootScrollLayer->setAnchorPoint(gfx::PointF(0, 0)); |
2367 | 2366 |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3225 int m_numCommitsDeferred; | 3224 int m_numCommitsDeferred; |
3226 int m_numCompleteCommits; | 3225 int m_numCompleteCommits; |
3227 }; | 3226 }; |
3228 | 3227 |
3229 TEST_F(LayerTreeHostTestDeferCommits, runMultiThread) | 3228 TEST_F(LayerTreeHostTestDeferCommits, runMultiThread) |
3230 { | 3229 { |
3231 runTest(true); | 3230 runTest(true); |
3232 } | 3231 } |
3233 | 3232 |
3234 } // anonymous namespace | 3233 } // anonymous namespace |
OLD | NEW |