| 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.h" | 5 #include "cc/layer.h" |
| 6 | 6 |
| 7 #include "cc/keyframed_animation_curve.h" | 7 #include "cc/keyframed_animation_curve.h" |
| 8 #include "cc/layer_impl.h" | 8 #include "cc/layer_impl.h" |
| 9 #include "cc/layer_painter.h" | 9 #include "cc/layer_painter.h" |
| 10 #include "cc/layer_tree_host.h" | 10 #include "cc/layer_tree_host.h" |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 EXPECT_FALSE(testLayer->needsDisplay()); | 552 EXPECT_FALSE(testLayer->needsDisplay()); |
| 553 | 553 |
| 554 // Test properties that should call setNeedsDisplay and setNeedsCommit | 554 // Test properties that should call setNeedsDisplay and setNeedsCommit |
| 555 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setBounds(gfx::Size(5, 10))); | 555 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setBounds(gfx::Size(5, 10))); |
| 556 EXPECT_TRUE(testLayer->needsDisplay()); | 556 EXPECT_TRUE(testLayer->needsDisplay()); |
| 557 } | 557 } |
| 558 | 558 |
| 559 TEST_F(LayerTest, verifyPushPropertiesAccumulatesUpdateRect) | 559 TEST_F(LayerTest, verifyPushPropertiesAccumulatesUpdateRect) |
| 560 { | 560 { |
| 561 scoped_refptr<Layer> testLayer = Layer::create(); | 561 scoped_refptr<Layer> testLayer = Layer::create(); |
| 562 scoped_ptr<LayerImpl> implLayer = LayerImpl::create(&m_hostImpl, 1); | 562 scoped_ptr<LayerImpl> implLayer = LayerImpl::create(m_hostImpl.activeTree(),
1); |
| 563 | 563 |
| 564 testLayer->setNeedsDisplayRect(gfx::RectF(gfx::PointF(), gfx::SizeF(5, 5))); | 564 testLayer->setNeedsDisplayRect(gfx::RectF(gfx::PointF(), gfx::SizeF(5, 5))); |
| 565 testLayer->pushPropertiesTo(implLayer.get()); | 565 testLayer->pushPropertiesTo(implLayer.get()); |
| 566 EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(), gfx::SizeF(5, 5)), implLayer-
>updateRect()); | 566 EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(), gfx::SizeF(5, 5)), implLayer-
>updateRect()); |
| 567 | 567 |
| 568 // The LayerImpl's updateRect should be accumulated here, since we did not d
o anything to clear it. | 568 // The LayerImpl's updateRect should be accumulated here, since we did not d
o anything to clear it. |
| 569 testLayer->setNeedsDisplayRect(gfx::RectF(gfx::PointF(10, 10), gfx::SizeF(5,
5))); | 569 testLayer->setNeedsDisplayRect(gfx::RectF(gfx::PointF(10, 10), gfx::SizeF(5,
5))); |
| 570 testLayer->pushPropertiesTo(implLayer.get()); | 570 testLayer->pushPropertiesTo(implLayer.get()); |
| 571 EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(), gfx::SizeF(15, 15)), implLaye
r->updateRect()); | 571 EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(), gfx::SizeF(15, 15)), implLaye
r->updateRect()); |
| 572 | 572 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 scoped_refptr<MockLayer> layer(new MockLayer); | 824 scoped_refptr<MockLayer> layer(new MockLayer); |
| 825 EXPECT_FALSE(layer->needsDisplay()); | 825 EXPECT_FALSE(layer->needsDisplay()); |
| 826 layer->setBounds(gfx::Size(0, 10)); | 826 layer->setBounds(gfx::Size(0, 10)); |
| 827 EXPECT_FALSE(layer->needsDisplay()); | 827 EXPECT_FALSE(layer->needsDisplay()); |
| 828 layer->setBounds(gfx::Size(10, 10)); | 828 layer->setBounds(gfx::Size(10, 10)); |
| 829 EXPECT_TRUE(layer->needsDisplay()); | 829 EXPECT_TRUE(layer->needsDisplay()); |
| 830 } | 830 } |
| 831 | 831 |
| 832 } // namespace | 832 } // namespace |
| 833 } // namespace cc | 833 } // namespace cc |
| OLD | NEW |