From c33595f17bbfee3ce3d74306fa1e34622e184cf4 Mon Sep 17 00:00:00 2001 From: "enne@chromium.org" Date: Fri, 12 Jul 2013 21:06:06 +0000 Subject: cc: Remove SetNeedsDisplay on first resize This is just some cleanup that I noticed while modifying SetNeedsDisplay. Derived layer types all handle bounds changes during Update already, either during the first resize or later ones. This was added in the stone age via https://bugs.webkit.org/show_bug.cgi?id=45092, and is no longer valid. R=danakj@chromium.org BUG=none Review URL: https://chromiumcodereview.appspot.com/5296106992828416 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211455 0039d316-1c4b-4281-b951-d872f2087c98 --- cc/layers/layer.cc | 8 +------- cc/layers/layer_unittest.cc | 22 +--------------------- cc/layers/tiled_layer_unittest.cc | 2 ++ 3 files changed, 4 insertions(+), 28 deletions(-) diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc index 9cb4708..ed979a9 100644 --- a/cc/layers/layer.cc +++ b/cc/layers/layer.cc @@ -277,14 +277,8 @@ void Layer::SetBounds(gfx::Size size) { if (bounds() == size) return; - bool first_resize = bounds().IsEmpty() && !size.IsEmpty(); - bounds_ = size; - - if (first_resize) - SetNeedsDisplay(); - else - SetNeedsCommit(); + SetNeedsCommit(); } Layer* Layer::RootLayer() { diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc index 3ef22da..fb3a752 100644 --- a/cc/layers/layer_unittest.cc +++ b/cc/layers/layer_unittest.cc @@ -467,7 +467,7 @@ TEST_F(LayerTest, CheckSetNeedsDisplayCausesCorrectBehavior) { // This is just initialization, but SetNeedsCommit behavior is verified anyway // to avoid warnings. EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetBounds(test_bounds)); - EXPECT_TRUE(test_layer->NeedsDisplayForTesting()); + EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); // The real test begins here. test_layer->ResetNeedsDisplayForTesting(); @@ -549,26 +549,6 @@ TEST_F(LayerTest, CheckPropertyChangeCausesCorrectBehavior) { EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times((AnyNumber())); } -TEST_F(LayerTest, SetBoundsTriggersSetNeedsRedrawAfterGettingNonEmptyBounds) { - scoped_refptr test_layer = Layer::Create(); - EXPECT_SET_NEEDS_FULL_TREE_SYNC( - 1, layer_tree_host_->SetRootLayer(test_layer)); - EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetIsDrawable(true)); - - EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); - EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetBounds(gfx::Size(0, 10))); - EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); - EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetBounds(gfx::Size(10, 10))); - EXPECT_TRUE(test_layer->NeedsDisplayForTesting()); - - test_layer->ResetNeedsDisplayForTesting(); - EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); - - // Calling SetBounds only invalidates on the first time. - EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetBounds(gfx::Size(7, 10))); - EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); -} - TEST_F(LayerTest, PushPropertiesAccumulatesUpdateRect) { scoped_refptr test_layer = Layer::Create(); scoped_ptr impl_layer = diff --git a/cc/layers/tiled_layer_unittest.cc b/cc/layers/tiled_layer_unittest.cc index 6c7ba8a..3eab50c 100644 --- a/cc/layers/tiled_layer_unittest.cc +++ b/cc/layers/tiled_layer_unittest.cc @@ -819,6 +819,8 @@ TEST_F(TiledLayerTest, VerifyInvalidationWhenContentsScaleChanges) { layer->SetBounds(gfx::Size(100, 100)); CalcDrawProps(layer); layer->draw_properties().visible_content_rect = gfx::Rect(0, 0, 100, 100); + layer->Update(queue_.get(), NULL); + UpdateTextures(); EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 100, 100), layer->last_needs_display_rect()); -- cgit v1.1