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

Side by Side Diff: cc/trees/property_tree.h

Issue 1144993004: cc: Make impl-thread property trees handle fixed-position layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@EnablePropertyTreeVerificationOnImpl
Patch Set: Don't rebuild impl property trees Created 5 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_TREES_PROPERTY_TREE_H_ 5 #ifndef CC_TREES_PROPERTY_TREE_H_
6 #define CC_TREES_PROPERTY_TREE_H_ 6 #define CC_TREES_PROPERTY_TREE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // TODO(vollick): will be moved when accelerated effects are implemented. 99 // TODO(vollick): will be moved when accelerated effects are implemented.
100 gfx::ScrollOffset scroll_offset; 100 gfx::ScrollOffset scroll_offset;
101 101
102 // We scroll snap where possible, but this has an effect on scroll 102 // We scroll snap where possible, but this has an effect on scroll
103 // compensation: the snap is yet more scrolling that must be compensated for. 103 // compensation: the snap is yet more scrolling that must be compensated for.
104 // This value stores the snapped amount for this purpose. 104 // This value stores the snapped amount for this purpose.
105 gfx::Vector2dF scroll_snap; 105 gfx::Vector2dF scroll_snap;
106 106
107 // TODO(vollick): will be moved when accelerated effects are implemented. 107 // TODO(vollick): will be moved when accelerated effects are implemented.
108 gfx::Vector2dF source_offset; 108 gfx::Vector2dF source_offset;
109 gfx::Vector2dF source_to_parent;
109 110
110 void set_to_parent(const gfx::Transform& transform) { 111 void set_to_parent(const gfx::Transform& transform) {
111 to_parent = transform; 112 to_parent = transform;
112 is_invertible = to_parent.IsInvertible(); 113 is_invertible = to_parent.IsInvertible();
113 } 114 }
114 115
115 void update_pre_local_transform(const gfx::Point3F& transform_origin); 116 void update_pre_local_transform(const gfx::Point3F& transform_origin);
116 117
117 void update_post_local_transform(const gfx::PointF& position, 118 void update_post_local_transform(const gfx::PointF& position,
118 const gfx::Point3F& transform_origin); 119 const gfx::Point3F& transform_origin);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 169
169 private: 170 private:
170 // Copy and assign are permitted. This is how we do tree sync. 171 // Copy and assign are permitted. This is how we do tree sync.
171 std::vector<T> nodes_; 172 std::vector<T> nodes_;
172 173
173 bool needs_update_; 174 bool needs_update_;
174 }; 175 };
175 176
176 class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> { 177 class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> {
177 public: 178 public:
179 TransformTree();
180
178 // Computes the change of basis transform from node |source_id| to |dest_id|. 181 // Computes the change of basis transform from node |source_id| to |dest_id|.
179 // The function returns false iff the inverse of a singular transform was 182 // The function returns false iff the inverse of a singular transform was
180 // used (and the result should, therefore, not be trusted). Transforms may 183 // used (and the result should, therefore, not be trusted). Transforms may
181 // be computed between any pair of nodes that have an ancestor/descendant 184 // be computed between any pair of nodes that have an ancestor/descendant
182 // relationship. Transforms between other pairs of nodes may only be computed 185 // relationship. Transforms between other pairs of nodes may only be computed
183 // if the following condition holds: let id1 the larger id and let id2 be the 186 // if the following condition holds: let id1 the larger id and let id2 be the
184 // other id; then the nearest ancestor of node id1 whose id is smaller than 187 // other id; then the nearest ancestor of node id1 whose id is smaller than
185 // id2 is the lowest common ancestor of the pair of nodes, and the transform 188 // id2 is the lowest common ancestor of the pair of nodes, and the transform
186 // from this lowest common ancestor to node id2 is only a 2d translation. 189 // from this lowest common ancestor to node id2 is only a 2d translation.
187 bool ComputeTransform(int source_id, 190 bool ComputeTransform(int source_id,
(...skipping 17 matching lines...) Expand all
205 int dest_id, 208 int dest_id,
206 gfx::Transform* transform) const; 209 gfx::Transform* transform) const;
207 210
208 // Returns true iff the nodes indexed by |source_id| and |dest_id| are 2D axis 211 // Returns true iff the nodes indexed by |source_id| and |dest_id| are 2D axis
209 // aligned with respect to one another. 212 // aligned with respect to one another.
210 bool Are2DAxisAligned(int source_id, int dest_id) const; 213 bool Are2DAxisAligned(int source_id, int dest_id) const;
211 214
212 // Updates the parent, target, and screen space transforms and snapping. 215 // Updates the parent, target, and screen space transforms and snapping.
213 void UpdateTransforms(int id); 216 void UpdateTransforms(int id);
214 217
218 // A TransformNode's source_to_parent value is used to account for the fact
219 // that fixed-position layers are positioned by Blink wrt to their layer tree
enne (OOO) 2015/05/29 20:07:53 I will be so glad when we get to the point that we
220 // parent (their "source"), but are parented in the transform tree by their
221 // fixed-position container. This value needs to be updated on main-thread
222 // property trees (for position changes initiated by Blink), but not on the
223 // compositor thread (since the offset from a node corresponding to a
224 // fixed-position layer to its fixed-position container is unaffected by
225 // compositor-driven effects).
226 void set_source_to_parent_updates_allowed(bool allowed) {
227 source_to_parent_updates_allowed_ = allowed;
228 }
229 bool source_to_parent_updates_allowed() const {
230 return source_to_parent_updates_allowed_;
231 }
232
215 private: 233 private:
216 // Returns true iff the node at |desc_id| is a descendant of the node at 234 // Returns true iff the node at |desc_id| is a descendant of the node at
217 // |anc_id|. 235 // |anc_id|.
218 bool IsDescendant(int desc_id, int anc_id) const; 236 bool IsDescendant(int desc_id, int anc_id) const;
219 237
220 // Computes the combined transform between |source_id| and |dest_id| and 238 // Computes the combined transform between |source_id| and |dest_id| and
221 // returns false if the inverse of a singular transform was used. These two 239 // returns false if the inverse of a singular transform was used. These two
222 // nodes must be on the same ancestor chain. 240 // nodes must be on the same ancestor chain.
223 bool CombineTransformsBetween(int source_id, 241 bool CombineTransformsBetween(int source_id,
224 int dest_id, 242 int dest_id,
225 gfx::Transform* transform) const; 243 gfx::Transform* transform) const;
226 244
227 // Computes the combined inverse transform between |source_id| and |dest_id| 245 // Computes the combined inverse transform between |source_id| and |dest_id|
228 // and returns false if the inverse of a singular transform was used. These 246 // and returns false if the inverse of a singular transform was used. These
229 // two nodes must be on the same ancestor chain. 247 // two nodes must be on the same ancestor chain.
230 bool CombineInversesBetween(int source_id, 248 bool CombineInversesBetween(int source_id,
231 int dest_id, 249 int dest_id,
232 gfx::Transform* transform) const; 250 gfx::Transform* transform) const;
233 251
234 void UpdateLocalTransform(TransformNode* node); 252 void UpdateLocalTransform(TransformNode* node);
235 void UpdateScreenSpaceTransform(TransformNode* node, 253 void UpdateScreenSpaceTransform(TransformNode* node,
236 TransformNode* parent_node, 254 TransformNode* parent_node,
237 TransformNode* target_node); 255 TransformNode* target_node);
238 void UpdateSublayerScale(TransformNode* node); 256 void UpdateSublayerScale(TransformNode* node);
239 void UpdateTargetSpaceTransform(TransformNode* node, 257 void UpdateTargetSpaceTransform(TransformNode* node,
240 TransformNode* target_node); 258 TransformNode* target_node);
241 void UpdateIsAnimated(TransformNode* node, TransformNode* parent_node); 259 void UpdateIsAnimated(TransformNode* node, TransformNode* parent_node);
242 void UpdateSnapping(TransformNode* node); 260 void UpdateSnapping(TransformNode* node);
261 bool NeedsSourceToParentUpdate(TransformNode* node);
262
263 bool source_to_parent_updates_allowed_;
243 }; 264 };
244 265
245 class CC_EXPORT ClipTree final : public PropertyTree<ClipNode> {}; 266 class CC_EXPORT ClipTree final : public PropertyTree<ClipNode> {};
246 267
247 class CC_EXPORT OpacityTree final : public PropertyTree<OpacityNode> {}; 268 class CC_EXPORT OpacityTree final : public PropertyTree<OpacityNode> {};
248 269
249 class CC_EXPORT PropertyTrees final { 270 class CC_EXPORT PropertyTrees final {
250 public: 271 public:
251 PropertyTrees(); 272 PropertyTrees();
252 273
253 TransformTree transform_tree; 274 TransformTree transform_tree;
254 OpacityTree opacity_tree; 275 OpacityTree opacity_tree;
255 ClipTree clip_tree; 276 ClipTree clip_tree;
256 bool needs_rebuild; 277 bool needs_rebuild;
257 int sequence_number; 278 int sequence_number;
258 }; 279 };
259 280
260 } // namespace cc 281 } // namespace cc
261 282
262 #endif // CC_TREES_PROPERTY_TREE_H_ 283 #endif // CC_TREES_PROPERTY_TREE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698