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

Side by Side Diff: cc/layer_tree_host_common.h

Issue 12407002: Align physical pixels of scrolled layers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | « no previous file | cc/layer_tree_host_common.cc » ('j') | cc/layer_tree_host_common.cc » ('J')
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 #ifndef CC_LAYER_TREE_HOST_COMMON_H_ 5 #ifndef CC_LAYER_TREE_HOST_COMMON_H_
6 #define CC_LAYER_TREE_HOST_COMMON_H_ 6 #define CC_LAYER_TREE_HOST_COMMON_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "cc/cc_export.h" 9 #include "cc/cc_export.h"
10 #include "cc/scoped_ptr_vector.h" 10 #include "cc/scoped_ptr_vector.h"
(...skipping 21 matching lines...) Expand all
32 static bool layerHasTouchEventHandlersAt(const gfx::PointF& screenSpacePoint , LayerImpl* layerImpl); 32 static bool layerHasTouchEventHandlersAt(const gfx::PointF& screenSpacePoint , LayerImpl* layerImpl);
33 33
34 template<typename LayerType> static bool renderSurfaceContributesToTarget(La yerType*, int targetSurfaceLayerID); 34 template<typename LayerType> static bool renderSurfaceContributesToTarget(La yerType*, int targetSurfaceLayerID);
35 35
36 template<class Function, typename LayerType> static void callFunctionForSubt ree(LayerType* rootLayer); 36 template<class Function, typename LayerType> static void callFunctionForSubt ree(LayerType* rootLayer);
37 37
38 // Returns a layer with the given id if one exists in the subtree starting 38 // Returns a layer with the given id if one exists in the subtree starting
39 // from the given root layer (including mask and replica layers). 39 // from the given root layer (including mask and replica layers).
40 template<typename LayerType> static LayerType* findLayerInSubtree(LayerType* rootLayer, int layerId); 40 template<typename LayerType> static LayerType* findLayerInSubtree(LayerType* rootLayer, int layerId);
41 41
42 // Content layers can be either directly scrollable or contained in an outer
43 // scrolling layer which applies the scroll transform. Given a content layer ,
44 // this function returns the associated scroll layer if any.
45 template<typename LayerType> static LayerType* findScrollLayerForContentLaye r(LayerType* layer);
46
42 static Layer* getChildAsRawPtr(const std::vector<scoped_refptr<Layer> >& chi ldren, size_t index) 47 static Layer* getChildAsRawPtr(const std::vector<scoped_refptr<Layer> >& chi ldren, size_t index)
43 { 48 {
44 return children[index].get(); 49 return children[index].get();
45 } 50 }
46 51
47 static LayerImpl* getChildAsRawPtr(const ScopedPtrVector<LayerImpl>& childre n, size_t index) 52 static LayerImpl* getChildAsRawPtr(const ScopedPtrVector<LayerImpl>& childre n, size_t index)
48 { 53 {
49 return children[index]; 54 return children[index];
50 } 55 }
51 56
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 if (LayerType* replicaLayer = rootLayer->replicaLayer()) { 111 if (LayerType* replicaLayer = rootLayer->replicaLayer()) {
107 Function()(replicaLayer); 112 Function()(replicaLayer);
108 if (LayerType* maskLayer = replicaLayer->maskLayer()) 113 if (LayerType* maskLayer = replicaLayer->maskLayer())
109 Function()(maskLayer); 114 Function()(maskLayer);
110 } 115 }
111 116
112 for (size_t i = 0; i < rootLayer->children().size(); ++i) 117 for (size_t i = 0; i < rootLayer->children().size(); ++i)
113 callFunctionForSubtree<Function>(getChildAsRawPtr(rootLayer->children(), i)); 118 callFunctionForSubtree<Function>(getChildAsRawPtr(rootLayer->children(), i));
114 } 119 }
115 120
121 template<typename LayerType>
122 LayerType* LayerTreeHostCommon::findScrollLayerForContentLayer(LayerType* layer)
123 {
124 if (!layer)
125 return 0;
126
127 if (layer->scrollable())
128 return layer;
129
130 if (layer->drawsContent() && layer->parent() && layer->parent()->scrollable( ))
131 return layer->parent();
132
133 return 0;
134 }
135
116 } // namespace cc 136 } // namespace cc
117 137
118 #endif // CC_LAYER_TREE_HOST_COMMON_H_ 138 #endif // CC_LAYER_TREE_HOST_COMMON_H_
OLDNEW
« no previous file with comments | « no previous file | cc/layer_tree_host_common.cc » ('j') | cc/layer_tree_host_common.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698