| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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.h" | 5 #include "cc/layers/layer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 layer->SetTransform(transform_); | 1168 layer->SetTransform(transform_); |
| 1169 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); | 1169 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); |
| 1170 layer->Set3dSortingContextId(sorting_context_id_); | 1170 layer->Set3dSortingContextId(sorting_context_id_); |
| 1171 | 1171 |
| 1172 layer->SetScrollClipLayer(scroll_clip_layer_id_); | 1172 layer->SetScrollClipLayer(scroll_clip_layer_id_); |
| 1173 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); | 1173 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); |
| 1174 layer->set_user_scrollable_vertical(user_scrollable_vertical_); | 1174 layer->set_user_scrollable_vertical(user_scrollable_vertical_); |
| 1175 layer->SetElementId(element_id_); | 1175 layer->SetElementId(element_id_); |
| 1176 layer->SetMutableProperties(mutable_properties_); | 1176 layer->SetMutableProperties(mutable_properties_); |
| 1177 | 1177 |
| 1178 LayerImpl* scroll_parent = nullptr; | |
| 1179 if (scroll_parent_) { | |
| 1180 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); | |
| 1181 DCHECK(scroll_parent); | |
| 1182 } | |
| 1183 | |
| 1184 layer->SetScrollParent(scroll_parent); | |
| 1185 if (scroll_children_) { | |
| 1186 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>; | |
| 1187 for (std::set<Layer*>::iterator it = scroll_children_->begin(); | |
| 1188 it != scroll_children_->end(); | |
| 1189 ++it) { | |
| 1190 DCHECK_EQ((*it)->scroll_parent(), this); | |
| 1191 LayerImpl* scroll_child = | |
| 1192 layer->layer_tree_impl()->LayerById((*it)->id()); | |
| 1193 DCHECK(scroll_child); | |
| 1194 scroll_children->insert(scroll_child); | |
| 1195 } | |
| 1196 layer->SetScrollChildren(scroll_children); | |
| 1197 } else { | |
| 1198 layer->SetScrollChildren(nullptr); | |
| 1199 } | |
| 1200 | |
| 1201 LayerImpl* clip_parent = nullptr; | |
| 1202 if (clip_parent_) { | |
| 1203 clip_parent = | |
| 1204 layer->layer_tree_impl()->LayerById(clip_parent_->id()); | |
| 1205 DCHECK(clip_parent); | |
| 1206 } | |
| 1207 | |
| 1208 layer->SetClipParent(clip_parent); | |
| 1209 if (clip_children_) { | |
| 1210 std::set<LayerImpl*>* clip_children = new std::set<LayerImpl*>; | |
| 1211 for (std::set<Layer*>::iterator it = clip_children_->begin(); | |
| 1212 it != clip_children_->end(); ++it) { | |
| 1213 DCHECK_EQ((*it)->clip_parent(), this); | |
| 1214 LayerImpl* clip_child = layer->layer_tree_impl()->LayerById((*it)->id()); | |
| 1215 DCHECK(clip_child); | |
| 1216 clip_children->insert(clip_child); | |
| 1217 } | |
| 1218 layer->SetClipChildren(clip_children); | |
| 1219 } else { | |
| 1220 layer->SetClipChildren(nullptr); | |
| 1221 } | |
| 1222 | |
| 1223 // When a scroll offset animation is interrupted the new scroll position on | 1178 // When a scroll offset animation is interrupted the new scroll position on |
| 1224 // the pending tree will clobber any impl-side scrolling occuring on the | 1179 // the pending tree will clobber any impl-side scrolling occuring on the |
| 1225 // active tree. To do so, avoid scrolling the pending tree along with it | 1180 // active tree. To do so, avoid scrolling the pending tree along with it |
| 1226 // instead of trying to undo that scrolling later. | 1181 // instead of trying to undo that scrolling later. |
| 1227 if (ScrollOffsetAnimationWasInterrupted()) | 1182 if (ScrollOffsetAnimationWasInterrupted()) |
| 1228 layer_tree_host() | 1183 layer_tree_host() |
| 1229 ->property_trees() | 1184 ->property_trees() |
| 1230 ->scroll_tree.SetScrollOffsetClobberActiveValue(layer->id()); | 1185 ->scroll_tree.SetScrollOffsetClobberActiveValue(layer->id()); |
| 1231 | 1186 |
| 1232 { | 1187 { |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 ->data.num_copy_requests_in_subtree; | 1760 ->data.num_copy_requests_in_subtree; |
| 1806 } | 1761 } |
| 1807 | 1762 |
| 1808 gfx::Transform Layer::screen_space_transform() const { | 1763 gfx::Transform Layer::screen_space_transform() const { |
| 1809 DCHECK_NE(transform_tree_index_, -1); | 1764 DCHECK_NE(transform_tree_index_, -1); |
| 1810 return draw_property_utils::ScreenSpaceTransform( | 1765 return draw_property_utils::ScreenSpaceTransform( |
| 1811 this, layer_tree_host_->property_trees()->transform_tree); | 1766 this, layer_tree_host_->property_trees()->transform_tree); |
| 1812 } | 1767 } |
| 1813 | 1768 |
| 1814 } // namespace cc | 1769 } // namespace cc |
| OLD | NEW |