| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/compositor/layer.h" | 5 #include "ui/compositor/layer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 | 783 |
| 784 clone = layer->Clone(); | 784 clone = layer->Clone(); |
| 785 | 785 |
| 786 // The clone is a copy of the latest state. | 786 // The clone is a copy of the latest state. |
| 787 EXPECT_TRUE(clone->GetTargetTransform().IsIdentity()); | 787 EXPECT_TRUE(clone->GetTargetTransform().IsIdentity()); |
| 788 EXPECT_EQ(kTransparent, clone->background_color()); | 788 EXPECT_EQ(kTransparent, clone->background_color()); |
| 789 EXPECT_EQ(kTransparent, clone->GetTargetColor()); | 789 EXPECT_EQ(kTransparent, clone->GetTargetColor()); |
| 790 EXPECT_FALSE(clone->layer_inverted()); | 790 EXPECT_FALSE(clone->layer_inverted()); |
| 791 EXPECT_FALSE(clone->fills_bounds_opaquely()); | 791 EXPECT_FALSE(clone->fills_bounds_opaquely()); |
| 792 | 792 |
| 793 // A solid color layer with transparent color can be marked as opaque. The |
| 794 // clone should retain this state. |
| 795 layer.reset(CreateLayer(LAYER_SOLID_COLOR)); |
| 796 layer->SetColor(kTransparent); |
| 797 layer->SetFillsBoundsOpaquely(true); |
| 798 |
| 799 clone = layer->Clone(); |
| 800 EXPECT_TRUE(clone->GetTargetTransform().IsIdentity()); |
| 801 EXPECT_EQ(kTransparent, clone->background_color()); |
| 802 EXPECT_EQ(kTransparent, clone->GetTargetColor()); |
| 803 EXPECT_FALSE(clone->layer_inverted()); |
| 804 EXPECT_TRUE(clone->fills_bounds_opaquely()); |
| 805 |
| 793 layer.reset(CreateLayer(LAYER_SOLID_COLOR)); | 806 layer.reset(CreateLayer(LAYER_SOLID_COLOR)); |
| 794 layer->SetVisible(true); | 807 layer->SetVisible(true); |
| 795 layer->SetOpacity(1.0f); | 808 layer->SetOpacity(1.0f); |
| 796 layer->SetColor(SK_ColorRED); | 809 layer->SetColor(SK_ColorRED); |
| 797 | 810 |
| 798 ScopedLayerAnimationSettings settings(layer->GetAnimator()); | 811 ScopedLayerAnimationSettings settings(layer->GetAnimator()); |
| 799 layer->SetVisible(false); | 812 layer->SetVisible(false); |
| 800 layer->SetOpacity(0.0f); | 813 layer->SetOpacity(0.0f); |
| 801 layer->SetColor(SK_ColorGREEN); | 814 layer->SetColor(SK_ColorGREEN); |
| 802 | 815 |
| (...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2283 layer.set_name("foo"); | 2296 layer.set_name("foo"); |
| 2284 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info = | 2297 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info = |
| 2285 layer.TakeDebugInfo(nullptr); | 2298 layer.TakeDebugInfo(nullptr); |
| 2286 std::string trace_format("bar,"); | 2299 std::string trace_format("bar,"); |
| 2287 debug_info->AppendAsTraceFormat(&trace_format); | 2300 debug_info->AppendAsTraceFormat(&trace_format); |
| 2288 std::string expected("bar,{\"layer_name\":\"foo\"}"); | 2301 std::string expected("bar,{\"layer_name\":\"foo\"}"); |
| 2289 EXPECT_EQ(expected, trace_format); | 2302 EXPECT_EQ(expected, trace_format); |
| 2290 } | 2303 } |
| 2291 | 2304 |
| 2292 } // namespace ui | 2305 } // namespace ui |
| OLD | NEW |