| 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 "cc/layer_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/synchronization/lock.h" | 7 #include "base/synchronization/lock.h" |
| 8 #include "cc/content_layer.h" | 8 #include "cc/content_layer.h" |
| 9 #include "cc/content_layer_client.h" | 9 #include "cc/content_layer_client.h" |
| 10 #include "cc/layer_impl.h" | 10 #include "cc/layer_impl.h" |
| (...skipping 2254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2265 EXPECT_VECTOR_EQ(rootScrollLayer->scrollDelta(), gfx::Vector2d()); | 2265 EXPECT_VECTOR_EQ(rootScrollLayer->scrollDelta(), gfx::Vector2d()); |
| 2266 EXPECT_EQ(rootScrollLayer->bounds().width() * m_deviceScaleFactor, rootS
crollLayer->contentBounds().width()); | 2266 EXPECT_EQ(rootScrollLayer->bounds().width() * m_deviceScaleFactor, rootS
crollLayer->contentBounds().width()); |
| 2267 EXPECT_EQ(rootScrollLayer->bounds().height() * m_deviceScaleFactor, root
ScrollLayer->contentBounds().height()); | 2267 EXPECT_EQ(rootScrollLayer->bounds().height() * m_deviceScaleFactor, root
ScrollLayer->contentBounds().height()); |
| 2268 EXPECT_EQ(childLayer->bounds().width() * m_deviceScaleFactor, childLayer
->contentBounds().width()); | 2268 EXPECT_EQ(childLayer->bounds().width() * m_deviceScaleFactor, childLayer
->contentBounds().width()); |
| 2269 EXPECT_EQ(childLayer->bounds().height() * m_deviceScaleFactor, childLaye
r->contentBounds().height()); | 2269 EXPECT_EQ(childLayer->bounds().height() * m_deviceScaleFactor, childLaye
r->contentBounds().height()); |
| 2270 | 2270 |
| 2271 switch (impl->activeTree()->source_frame_number()) { | 2271 switch (impl->activeTree()->source_frame_number()) { |
| 2272 case 0: | 2272 case 0: |
| 2273 // Gesture scroll on impl thread. | 2273 // Gesture scroll on impl thread. |
| 2274 EXPECT_EQ(impl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Ge
sture), InputHandlerClient::ScrollStarted); | 2274 EXPECT_EQ(impl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Ge
sture), InputHandlerClient::ScrollStarted); |
| 2275 impl->scrollBy(gfx::Point(), m_scrollAmount); | 2275 impl->scrollBy(0, gfx::Point(), m_scrollAmount); |
| 2276 impl->scrollEnd(); | 2276 impl->scrollEnd(); |
| 2277 | 2277 |
| 2278 EXPECT_VECTOR_EQ(m_initialScroll, childLayer->scrollOffset()); | 2278 EXPECT_VECTOR_EQ(m_initialScroll, childLayer->scrollOffset()); |
| 2279 EXPECT_VECTOR_EQ(m_scrollAmount, childLayer->scrollDelta()); | 2279 EXPECT_VECTOR_EQ(m_scrollAmount, childLayer->scrollDelta()); |
| 2280 break; | 2280 break; |
| 2281 case 1: | 2281 case 1: |
| 2282 // Wheel scroll on impl thread. | 2282 // Wheel scroll on impl thread. |
| 2283 EXPECT_EQ(impl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wh
eel), InputHandlerClient::ScrollStarted); | 2283 EXPECT_EQ(impl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wh
eel), InputHandlerClient::ScrollStarted); |
| 2284 impl->scrollBy(gfx::Point(), m_scrollAmount); | 2284 impl->scrollBy(0, gfx::Point(), m_scrollAmount); |
| 2285 impl->scrollEnd(); | 2285 impl->scrollEnd(); |
| 2286 | 2286 |
| 2287 EXPECT_VECTOR_EQ(m_secondScroll, childLayer->scrollOffset()); | 2287 EXPECT_VECTOR_EQ(m_secondScroll, childLayer->scrollOffset()); |
| 2288 EXPECT_VECTOR_EQ(m_scrollAmount, childLayer->scrollDelta()); | 2288 EXPECT_VECTOR_EQ(m_scrollAmount, childLayer->scrollDelta()); |
| 2289 break; | 2289 break; |
| 2290 case 2: | 2290 case 2: |
| 2291 EXPECT_VECTOR_EQ(m_secondScroll + m_scrollAmount, childLayer->scroll
Offset()); | 2291 EXPECT_VECTOR_EQ(m_secondScroll + m_scrollAmount, childLayer->scroll
Offset()); |
| 2292 EXPECT_VECTOR_EQ(gfx::Vector2d(0, 0), childLayer->scrollDelta()); | 2292 EXPECT_VECTOR_EQ(gfx::Vector2d(0, 0), childLayer->scrollDelta()); |
| 2293 | 2293 |
| 2294 endTest(); | 2294 endTest(); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2400 LayerImpl* rootScrollLayer = root->children()[0]; | 2400 LayerImpl* rootScrollLayer = root->children()[0]; |
| 2401 | 2401 |
| 2402 EXPECT_VECTOR_EQ(root->scrollDelta(), gfx::Vector2d()); | 2402 EXPECT_VECTOR_EQ(root->scrollDelta(), gfx::Vector2d()); |
| 2403 EXPECT_EQ(rootScrollLayer->bounds().width() * m_deviceScaleFactor, rootS
crollLayer->contentBounds().width()); | 2403 EXPECT_EQ(rootScrollLayer->bounds().width() * m_deviceScaleFactor, rootS
crollLayer->contentBounds().width()); |
| 2404 EXPECT_EQ(rootScrollLayer->bounds().height() * m_deviceScaleFactor, root
ScrollLayer->contentBounds().height()); | 2404 EXPECT_EQ(rootScrollLayer->bounds().height() * m_deviceScaleFactor, root
ScrollLayer->contentBounds().height()); |
| 2405 | 2405 |
| 2406 switch (impl->activeTree()->source_frame_number()) { | 2406 switch (impl->activeTree()->source_frame_number()) { |
| 2407 case 0: | 2407 case 0: |
| 2408 // Gesture scroll on impl thread. | 2408 // Gesture scroll on impl thread. |
| 2409 EXPECT_EQ(impl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Ge
sture), InputHandlerClient::ScrollStarted); | 2409 EXPECT_EQ(impl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Ge
sture), InputHandlerClient::ScrollStarted); |
| 2410 impl->scrollBy(gfx::Point(), m_scrollAmount); | 2410 impl->scrollBy(0, gfx::Point(), m_scrollAmount); |
| 2411 impl->scrollEnd(); | 2411 impl->scrollEnd(); |
| 2412 | 2412 |
| 2413 EXPECT_VECTOR_EQ(m_initialScroll, rootScrollLayer->scrollOffset()); | 2413 EXPECT_VECTOR_EQ(m_initialScroll, rootScrollLayer->scrollOffset()); |
| 2414 EXPECT_VECTOR_EQ(m_scrollAmount, rootScrollLayer->scrollDelta()); | 2414 EXPECT_VECTOR_EQ(m_scrollAmount, rootScrollLayer->scrollDelta()); |
| 2415 break; | 2415 break; |
| 2416 case 1: | 2416 case 1: |
| 2417 // Wheel scroll on impl thread. | 2417 // Wheel scroll on impl thread. |
| 2418 EXPECT_EQ(impl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wh
eel), InputHandlerClient::ScrollStarted); | 2418 EXPECT_EQ(impl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wh
eel), InputHandlerClient::ScrollStarted); |
| 2419 impl->scrollBy(gfx::Point(), m_scrollAmount); | 2419 impl->scrollBy(0, gfx::Point(), m_scrollAmount); |
| 2420 impl->scrollEnd(); | 2420 impl->scrollEnd(); |
| 2421 | 2421 |
| 2422 EXPECT_VECTOR_EQ(m_secondScroll, rootScrollLayer->scrollOffset()); | 2422 EXPECT_VECTOR_EQ(m_secondScroll, rootScrollLayer->scrollOffset()); |
| 2423 EXPECT_VECTOR_EQ(m_scrollAmount, rootScrollLayer->scrollDelta()); | 2423 EXPECT_VECTOR_EQ(m_scrollAmount, rootScrollLayer->scrollDelta()); |
| 2424 break; | 2424 break; |
| 2425 case 2: | 2425 case 2: |
| 2426 EXPECT_VECTOR_EQ(m_secondScroll + m_scrollAmount, rootScrollLayer->s
crollOffset()); | 2426 EXPECT_VECTOR_EQ(m_secondScroll + m_scrollAmount, rootScrollLayer->s
crollOffset()); |
| 2427 EXPECT_VECTOR_EQ(gfx::Vector2d(0, 0), rootScrollLayer->scrollDelta()
); | 2427 EXPECT_VECTOR_EQ(gfx::Vector2d(0, 0), rootScrollLayer->scrollDelta()
); |
| 2428 | 2428 |
| 2429 endTest(); | 2429 endTest(); |
| (...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3379 LayerTreeSettings settings; | 3379 LayerTreeSettings settings; |
| 3380 settings.maxPartialTextureUpdates = 4; | 3380 settings.maxPartialTextureUpdates = 4; |
| 3381 | 3381 |
| 3382 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc
oped_ptr<Thread>()); | 3382 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc
oped_ptr<Thread>()); |
| 3383 EXPECT_TRUE(host->initializeRendererIfNeeded()); | 3383 EXPECT_TRUE(host->initializeRendererIfNeeded()); |
| 3384 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates); | 3384 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates); |
| 3385 } | 3385 } |
| 3386 | 3386 |
| 3387 } // namespace | 3387 } // namespace |
| 3388 } // namespace cc | 3388 } // namespace cc |
| OLD | NEW |