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/views/view.h" | 5 #include "ui/views/view.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 5021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5032 if (scroll_view->contents_viewport_->layer()) | 5032 if (scroll_view->contents_viewport_->layer()) |
5033 return; | 5033 return; |
5034 | 5034 |
5035 EXPECT_FALSE(scroll_view->contents_viewport_->layer()); | 5035 EXPECT_FALSE(scroll_view->contents_viewport_->layer()); |
5036 | 5036 |
5037 std::unique_ptr<View> child_view = NewView(); | 5037 std::unique_ptr<View> child_view = NewView(); |
5038 scroll_view->AddChildView(child_view.get()); | 5038 scroll_view->AddChildView(child_view.get()); |
5039 child_view->SetPaintToLayer(ui::LAYER_TEXTURED); | 5039 child_view->SetPaintToLayer(ui::LAYER_TEXTURED); |
5040 | 5040 |
5041 EXPECT_TRUE(scroll_view->contents_viewport_->layer()); | 5041 EXPECT_TRUE(scroll_view->contents_viewport_->layer()); |
| 5042 // We don't want the viewport's layer to have the fill_bounds_opaquely() bit |
| 5043 // set, as we may have transparent children who want to blend into the |
| 5044 // default background. |
| 5045 EXPECT_FALSE( |
| 5046 scroll_view->contents_viewport_->layer()->fills_bounds_opaquely()); |
| 5047 |
5042 scroll_view->RemoveChildView(child_view.get()); | 5048 scroll_view->RemoveChildView(child_view.get()); |
5043 } | 5049 } |
5044 | 5050 |
5045 // Provides a simple parent view implementation which tracks layer change | 5051 // Provides a simple parent view implementation which tracks layer change |
5046 // notifications from child views. | 5052 // notifications from child views. |
5047 class TestParentView : public View { | 5053 class TestParentView : public View { |
5048 public: | 5054 public: |
5049 TestParentView() | 5055 TestParentView() |
5050 : received_layer_change_notification_(false), layer_change_count_(0) {} | 5056 : received_layer_change_notification_(false), layer_change_count_(0) {} |
5051 | 5057 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5094 EXPECT_TRUE(parent_view->received_layer_change_notification()); | 5100 EXPECT_TRUE(parent_view->received_layer_change_notification()); |
5095 EXPECT_EQ(1, parent_view->layer_change_count()); | 5101 EXPECT_EQ(1, parent_view->layer_change_count()); |
5096 | 5102 |
5097 parent_view->Reset(); | 5103 parent_view->Reset(); |
5098 child_view->SetPaintToLayer(ui::LAYER_SOLID_COLOR); | 5104 child_view->SetPaintToLayer(ui::LAYER_SOLID_COLOR); |
5099 EXPECT_TRUE(parent_view->received_layer_change_notification()); | 5105 EXPECT_TRUE(parent_view->received_layer_change_notification()); |
5100 EXPECT_EQ(1, parent_view->layer_change_count()); | 5106 EXPECT_EQ(1, parent_view->layer_change_count()); |
5101 } | 5107 } |
5102 | 5108 |
5103 } // namespace views | 5109 } // namespace views |
OLD | NEW |