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/layers/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "cc/animation/animation_registrar.h" | 9 #include "cc/animation/animation_registrar.h" |
10 #include "cc/animation/scrollbar_animation_controller.h" | 10 #include "cc/animation/scrollbar_animation_controller.h" |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 } | 683 } |
684 | 684 |
685 void LayerImpl::SetBackgroundColor(SkColor background_color) { | 685 void LayerImpl::SetBackgroundColor(SkColor background_color) { |
686 if (background_color_ == background_color) | 686 if (background_color_ == background_color) |
687 return; | 687 return; |
688 | 688 |
689 background_color_ = background_color; | 689 background_color_ = background_color; |
690 NoteLayerPropertyChanged(); | 690 NoteLayerPropertyChanged(); |
691 } | 691 } |
692 | 692 |
| 693 SkColor LayerImpl::SafeOpaqueBackgroundColor() const { |
| 694 SkColor color = background_color(); |
| 695 if (SkColorGetA(color) == 255 && !contents_opaque()) { |
| 696 color = SK_ColorTRANSPARENT; |
| 697 } else if (SkColorGetA(color) != 255 && contents_opaque()) { |
| 698 for (const LayerImpl* layer = parent(); layer; |
| 699 layer = layer->parent()) { |
| 700 color = layer->background_color(); |
| 701 if (SkColorGetA(color) == 255) |
| 702 break; |
| 703 } |
| 704 if (SkColorGetA(color) != 255) |
| 705 color = layer_tree_impl()->background_color(); |
| 706 if (SkColorGetA(color) != 255) |
| 707 color = SkColorSetA(color, 255); |
| 708 } |
| 709 return color; |
| 710 } |
| 711 |
693 void LayerImpl::SetFilters(const WebKit::WebFilterOperations& filters) { | 712 void LayerImpl::SetFilters(const WebKit::WebFilterOperations& filters) { |
694 if (filters_ == filters) | 713 if (filters_ == filters) |
695 return; | 714 return; |
696 | 715 |
697 DCHECK(!filter_); | 716 DCHECK(!filter_); |
698 filters_ = filters; | 717 filters_ = filters; |
699 NoteLayerPropertyChangedForSubtree(); | 718 NoteLayerPropertyChangedForSubtree(); |
700 } | 719 } |
701 | 720 |
702 void LayerImpl::SetBackgroundFilters( | 721 void LayerImpl::SetBackgroundFilters( |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 | 1166 |
1148 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } | 1167 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } |
1149 | 1168 |
1150 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1169 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
1151 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1170 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
1152 AsValueInto(state.get()); | 1171 AsValueInto(state.get()); |
1153 return state.PassAs<base::Value>(); | 1172 return state.PassAs<base::Value>(); |
1154 } | 1173 } |
1155 | 1174 |
1156 } // namespace cc | 1175 } // namespace cc |
OLD | NEW |