Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: cc/trees/tree_synchronizer.cc

Issue 146713002: Revert of Pinch/Zoom Infrastructure & Plumbing CL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | content/public/common/common_param_traits_macros.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/trees/tree_synchronizer.h" 5 #include "cc/trees/tree_synchronizer.h"
6 6
7 #include "base/containers/hash_tables.h" 7 #include "base/containers/hash_tables.h"
8 #include "base/containers/scoped_ptr_hash_map.h" 8 #include "base/containers/scoped_ptr_hash_map.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "cc/animation/scrollbar_animation_controller.h" 11 #include "cc/animation/scrollbar_animation_controller.h"
12 #include "cc/input/scrollbar.h" 12 #include "cc/input/scrollbar.h"
13 #include "cc/layers/layer.h" 13 #include "cc/layers/layer.h"
14 #include "cc/layers/layer_impl.h" 14 #include "cc/layers/layer_impl.h"
15 #include "cc/layers/scrollbar_layer_impl_base.h" 15 #include "cc/layers/scrollbar_layer_impl_base.h"
16 #include "cc/layers/scrollbar_layer_interface.h" 16 #include "cc/layers/scrollbar_layer_interface.h"
17 17
18 namespace cc { 18 namespace cc {
19 19
20 typedef base::ScopedPtrHashMap<int, LayerImpl> ScopedPtrLayerImplMap; 20 typedef base::ScopedPtrHashMap<int, LayerImpl> ScopedPtrLayerImplMap;
21 typedef base::hash_map<int, LayerImpl*> RawPtrLayerImplMap; 21 typedef base::hash_map<int, LayerImpl*> RawPtrLayerImplMap;
22 22
23 void CollectExistingLayerImplRecursive(ScopedPtrLayerImplMap* old_layers, 23 void CollectExistingLayerImplRecursive(ScopedPtrLayerImplMap* old_layers,
24 scoped_ptr<LayerImpl> layer_impl) { 24 scoped_ptr<LayerImpl> layer_impl) {
25 if (!layer_impl) 25 if (!layer_impl)
26 return; 26 return;
27 27
28 layer_impl->ClearScrollbars();
29 if (ScrollbarLayerImplBase* scrollbar_layer =
30 layer_impl->ToScrollbarLayer()) {
31 scrollbar_layer->ClearClipLayer();
32 scrollbar_layer->ClearScrollLayer();
33 }
34
35 OwnedLayerImplList& children = layer_impl->children(); 28 OwnedLayerImplList& children = layer_impl->children();
36 for (OwnedLayerImplList::iterator it = children.begin(); 29 for (OwnedLayerImplList::iterator it = children.begin();
37 it != children.end(); 30 it != children.end();
38 ++it) 31 ++it)
39 CollectExistingLayerImplRecursive(old_layers, children.take(it)); 32 CollectExistingLayerImplRecursive(old_layers, children.take(it));
40 33
41 CollectExistingLayerImplRecursive(old_layers, layer_impl->TakeMaskLayer()); 34 CollectExistingLayerImplRecursive(old_layers, layer_impl->TakeMaskLayer());
42 CollectExistingLayerImplRecursive(old_layers, layer_impl->TakeReplicaLayer()); 35 CollectExistingLayerImplRecursive(old_layers, layer_impl->TakeReplicaLayer());
43 36
44 int id = layer_impl->id(); 37 int id = layer_impl->id();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 for (size_t i = 0; i < layer->children().size(); ++i) { 105 for (size_t i = 0; i < layer->children().size(); ++i) {
113 layer_impl->AddChild(SynchronizeTreesRecursiveInternal( 106 layer_impl->AddChild(SynchronizeTreesRecursiveInternal(
114 new_layers, old_layers, layer->child_at(i), tree_impl)); 107 new_layers, old_layers, layer->child_at(i), tree_impl));
115 } 108 }
116 109
117 layer_impl->SetMaskLayer(SynchronizeTreesRecursiveInternal( 110 layer_impl->SetMaskLayer(SynchronizeTreesRecursiveInternal(
118 new_layers, old_layers, layer->mask_layer(), tree_impl)); 111 new_layers, old_layers, layer->mask_layer(), tree_impl));
119 layer_impl->SetReplicaLayer(SynchronizeTreesRecursiveInternal( 112 layer_impl->SetReplicaLayer(SynchronizeTreesRecursiveInternal(
120 new_layers, old_layers, layer->replica_layer(), tree_impl)); 113 new_layers, old_layers, layer->replica_layer(), tree_impl));
121 114
115 // Remove all dangling pointers. The pointers will be setup later in
116 // UpdateScrollbarLayerPointersRecursive phase
117 layer_impl->SetHorizontalScrollbarLayer(NULL);
118 layer_impl->SetVerticalScrollbarLayer(NULL);
119
122 return layer_impl.Pass(); 120 return layer_impl.Pass();
123 } 121 }
124 122
125 scoped_ptr<LayerImpl> SynchronizeTreesRecursive( 123 scoped_ptr<LayerImpl> SynchronizeTreesRecursive(
126 RawPtrLayerImplMap* new_layers, 124 RawPtrLayerImplMap* new_layers,
127 ScopedPtrLayerImplMap* old_layers, 125 ScopedPtrLayerImplMap* old_layers,
128 Layer* layer, 126 Layer* layer,
129 LayerTreeImpl* tree_impl) { 127 LayerTreeImpl* tree_impl) {
130 return SynchronizeTreesRecursiveInternal( 128 return SynchronizeTreesRecursiveInternal(
131 new_layers, old_layers, layer, tree_impl); 129 new_layers, old_layers, layer, tree_impl);
(...skipping 23 matching lines...) Expand all
155 ScrollbarLayerType* scrollbar_layer = layer->ToScrollbarLayer(); 153 ScrollbarLayerType* scrollbar_layer = layer->ToScrollbarLayer();
156 if (!scrollbar_layer) 154 if (!scrollbar_layer)
157 return; 155 return;
158 156
159 RawPtrLayerImplMap::const_iterator iter = 157 RawPtrLayerImplMap::const_iterator iter =
160 new_layers->find(layer->id()); 158 new_layers->find(layer->id());
161 ScrollbarLayerImplBase* scrollbar_layer_impl = 159 ScrollbarLayerImplBase* scrollbar_layer_impl =
162 iter != new_layers->end() 160 iter != new_layers->end()
163 ? static_cast<ScrollbarLayerImplBase*>(iter->second) 161 ? static_cast<ScrollbarLayerImplBase*>(iter->second)
164 : NULL; 162 : NULL;
163 iter = new_layers->find(scrollbar_layer->ScrollLayerId());
164 LayerImpl* scroll_layer_impl =
165 iter != new_layers->end() ? iter->second : NULL;
166
165 DCHECK(scrollbar_layer_impl); 167 DCHECK(scrollbar_layer_impl);
168 DCHECK(scroll_layer_impl);
166 169
167 scrollbar_layer->PushScrollClipPropertiesTo(scrollbar_layer_impl); 170 if (scrollbar_layer->orientation() == HORIZONTAL)
171 scroll_layer_impl->SetHorizontalScrollbarLayer(scrollbar_layer_impl);
172 else
173 scroll_layer_impl->SetVerticalScrollbarLayer(scrollbar_layer_impl);
168 } 174 }
169 175
170 void UpdateScrollbarLayerPointersRecursive(const RawPtrLayerImplMap* new_layers, 176 void UpdateScrollbarLayerPointersRecursive(const RawPtrLayerImplMap* new_layers,
171 Layer* layer) { 177 Layer* layer) {
172 UpdateScrollbarLayerPointersRecursiveInternal<Layer, ScrollbarLayerInterface>( 178 UpdateScrollbarLayerPointersRecursiveInternal<Layer, ScrollbarLayerInterface>(
173 new_layers, layer); 179 new_layers, layer);
174 } 180 }
175 181
176 void UpdateScrollbarLayerPointersRecursive(const RawPtrLayerImplMap* new_layers, 182 void UpdateScrollbarLayerPointersRecursive(const RawPtrLayerImplMap* new_layers,
177 LayerImpl* layer) { 183 LayerImpl* layer) {
(...skipping 14 matching lines...) Expand all
192 } 198 }
193 199
194 DCHECK_EQ(layer->id(), layer_impl->id()); 200 DCHECK_EQ(layer->id(), layer_impl->id());
195 201
196 bool push_layer = layer->needs_push_properties(); 202 bool push_layer = layer->needs_push_properties();
197 bool recurse_on_children_and_dependents = 203 bool recurse_on_children_and_dependents =
198 layer->descendant_needs_push_properties(); 204 layer->descendant_needs_push_properties();
199 205
200 if (push_layer) 206 if (push_layer)
201 layer->PushPropertiesTo(layer_impl); 207 layer->PushPropertiesTo(layer_impl);
202 else if (layer->ToScrollbarLayer())
203 layer->ToScrollbarLayer()->PushScrollClipPropertiesTo(layer_impl);
204 208
205 size_t num_dependents_need_push_properties = 0; 209 size_t num_dependents_need_push_properties = 0;
206 if (recurse_on_children_and_dependents) { 210 if (recurse_on_children_and_dependents) {
207 PushPropertiesInternal(layer->mask_layer(), 211 PushPropertiesInternal(layer->mask_layer(),
208 layer_impl->mask_layer(), 212 layer_impl->mask_layer(),
209 &num_dependents_need_push_properties); 213 &num_dependents_need_push_properties);
210 PushPropertiesInternal(layer->replica_layer(), 214 PushPropertiesInternal(layer->replica_layer(),
211 layer_impl->replica_layer(), 215 layer_impl->replica_layer(),
212 &num_dependents_need_push_properties); 216 &num_dependents_need_push_properties);
213 217
(...skipping 27 matching lines...) Expand all
241 layer, layer_impl, &num_dependents_need_push_properties); 245 layer, layer_impl, &num_dependents_need_push_properties);
242 } 246 }
243 247
244 void TreeSynchronizer::PushProperties(LayerImpl* layer, LayerImpl* layer_impl) { 248 void TreeSynchronizer::PushProperties(LayerImpl* layer, LayerImpl* layer_impl) {
245 size_t num_dependents_need_push_properties = 0; 249 size_t num_dependents_need_push_properties = 0;
246 PushPropertiesInternal( 250 PushPropertiesInternal(
247 layer, layer_impl, &num_dependents_need_push_properties); 251 layer, layer_impl, &num_dependents_need_push_properties);
248 } 252 }
249 253
250 } // namespace cc 254 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | content/public/common/common_param_traits_macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698