Commit 11672a8f authored by sky@chromium.org's avatar sky@chromium.org

Makes recreating a layer inherit target visibility and opacity

This better matches expectations.

BUG=none
TEST=none
R=oshima@chromium.org

Review URL: https://codereview.chromium.org/231193002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262778 0039d316-1c4b-4281-b951-d872f2087c98
parent c6a10861
......@@ -147,6 +147,7 @@
'layer_animation_element_unittest.cc',
'layer_animation_sequence_unittest.cc',
'layer_animator_unittest.cc',
'layer_owner_unittest.cc',
'layer_unittest.cc',
'run_all_unittests.cc',
'transform_animation_curve_adapter_unittest.cc',
......
......@@ -38,7 +38,8 @@ scoped_ptr<Layer> LayerOwner::RecreateLayer() {
const gfx::Rect layer_bounds(old_layer->bounds());
Layer* new_layer = new ui::Layer(old_layer->type());
SetLayer(new_layer);
new_layer->SetVisible(old_layer->visible());
new_layer->SetVisible(old_layer->GetTargetVisibility());
new_layer->SetOpacity(old_layer->GetTargetOpacity());
new_layer->set_scale_content(old_layer->scale_content());
new_layer->SetBounds(layer_bounds);
new_layer->SetMasksToBounds(old_layer->GetMasksToBounds());
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/compositor/layer_owner.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animator.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
namespace ui {
TEST(LayerOwnerTest, RecreateLayerHonorsTargetVisibilityAndOpacity) {
LayerOwner owner;
Layer* layer = new Layer;
layer->SetVisible(true);
layer->SetOpacity(1.0f);
owner.SetLayer(layer);
ScopedLayerAnimationSettings settings(layer->GetAnimator());
layer->SetVisible(false);
layer->SetOpacity(0.0f);
EXPECT_TRUE(layer->visible());
EXPECT_EQ(1.0f, layer->opacity());
scoped_ptr<Layer> old_layer(owner.RecreateLayer());
EXPECT_FALSE(owner.layer()->visible());
EXPECT_EQ(0.0f, owner.layer()->opacity());
}
} // namespace ui
......@@ -508,12 +508,6 @@ void HidingWindowAnimationObserver::DetachAndRecreateLayers() {
layer_owner_->root(), topmost_transient_child->layer());
}
}
// TODO(sky): The recreated layer should have the target visibility of
// the original layer.
// Make the new layer invisible immediately.
window_->layer()->SetVisible(false);
window_->layer()->SetOpacity(0);
}
void HidingWindowAnimationObserver::WindowInvalid() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment