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

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

Issue 1611713002: Add Scroll Tree data structure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add scroll tree serialization unit tests Created 4 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
« no previous file with comments | « cc/proto/property_tree.proto ('k') | cc/trees/property_tree.cc » ('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 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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "cc/base/cc_export.h" 12 #include "cc/base/cc_export.h"
13 #include "cc/layers/scroll_blocks_on.h"
13 #include "ui/gfx/geometry/rect_f.h" 14 #include "ui/gfx/geometry/rect_f.h"
14 #include "ui/gfx/geometry/scroll_offset.h" 15 #include "ui/gfx/geometry/scroll_offset.h"
15 #include "ui/gfx/transform.h" 16 #include "ui/gfx/transform.h"
16 17
17 namespace cc { 18 namespace cc {
18 19
19 namespace proto { 20 namespace proto {
20 class ClipNodeData; 21 class ClipNodeData;
21 class EffectNodeData; 22 class EffectNodeData;
22 class PropertyTree; 23 class PropertyTree;
23 class PropertyTrees; 24 class PropertyTrees;
25 class ScrollNodeData;
24 class TranformNodeData; 26 class TranformNodeData;
25 class TransformTreeData; 27 class TransformTreeData;
26 class TreeNode; 28 class TreeNode;
27 } 29 }
28 30
29 // ------------------------------*IMPORTANT*--------------------------------- 31 // ------------------------------*IMPORTANT*---------------------------------
30 // Each class declared here has a corresponding proto defined in 32 // Each class declared here has a corresponding proto defined in
31 // cc/proto/property_tree.proto. When making any changes to a class structure 33 // cc/proto/property_tree.proto. When making any changes to a class structure
32 // including addition/deletion/updation of a field, please also make the 34 // including addition/deletion/updation of a field, please also make the
33 // change to its proto and the ToProtobuf and FromProtobuf methods for that 35 // change to its proto and the ToProtobuf and FromProtobuf methods for that
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 int clip_id; 249 int clip_id;
248 250
249 bool operator==(const EffectNodeData& other) const; 251 bool operator==(const EffectNodeData& other) const;
250 252
251 void ToProtobuf(proto::TreeNode* proto) const; 253 void ToProtobuf(proto::TreeNode* proto) const;
252 void FromProtobuf(const proto::TreeNode& proto); 254 void FromProtobuf(const proto::TreeNode& proto);
253 }; 255 };
254 256
255 typedef TreeNode<EffectNodeData> EffectNode; 257 typedef TreeNode<EffectNodeData> EffectNode;
256 258
259 struct CC_EXPORT ScrollNodeData {
260 ScrollNodeData();
261
262 bool scrollable;
263 bool should_scroll_on_main_thread;
264 ScrollBlocksOn scroll_blocks_on;
265 bool contains_non_fast_scrollable_region;
266
267 int transform_id;
268
269 bool operator==(const ScrollNodeData& other) const;
270
271 void ToProtobuf(proto::TreeNode* proto) const;
272 void FromProtobuf(const proto::TreeNode& proto);
273 };
274
275 typedef TreeNode<ScrollNodeData> ScrollNode;
276
257 template <typename T> 277 template <typename T>
258 class CC_EXPORT PropertyTree { 278 class CC_EXPORT PropertyTree {
259 public: 279 public:
260 PropertyTree(); 280 PropertyTree();
261 virtual ~PropertyTree(); 281 virtual ~PropertyTree();
262 282
263 bool operator==(const PropertyTree<T>& other) const; 283 bool operator==(const PropertyTree<T>& other) const;
264 284
265 int Insert(const T& tree_node, int parent_id); 285 int Insert(const T& tree_node, int parent_id);
266 286
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 499
480 void ClearCopyRequests(); 500 void ClearCopyRequests();
481 501
482 void ToProtobuf(proto::PropertyTree* proto) const; 502 void ToProtobuf(proto::PropertyTree* proto) const;
483 void FromProtobuf(const proto::PropertyTree& proto); 503 void FromProtobuf(const proto::PropertyTree& proto);
484 504
485 private: 505 private:
486 void UpdateOpacities(EffectNode* node, EffectNode* parent_node); 506 void UpdateOpacities(EffectNode* node, EffectNode* parent_node);
487 }; 507 };
488 508
509 class CC_EXPORT ScrollTree final : public PropertyTree<ScrollNode> {
510 public:
511 bool operator==(const ScrollTree& other) const;
512
513 void ToProtobuf(proto::PropertyTree* proto) const;
514 void FromProtobuf(const proto::PropertyTree& proto);
515 };
516
489 class CC_EXPORT PropertyTrees final { 517 class CC_EXPORT PropertyTrees final {
490 public: 518 public:
491 PropertyTrees(); 519 PropertyTrees();
520 ~PropertyTrees();
492 521
493 bool operator==(const PropertyTrees& other) const; 522 bool operator==(const PropertyTrees& other) const;
494 523
495 void ToProtobuf(proto::PropertyTrees* proto) const; 524 void ToProtobuf(proto::PropertyTrees* proto) const;
496 void FromProtobuf(const proto::PropertyTrees& proto); 525 void FromProtobuf(const proto::PropertyTrees& proto);
497 526
498 TransformTree transform_tree; 527 TransformTree transform_tree;
499 EffectTree effect_tree; 528 EffectTree effect_tree;
500 ClipTree clip_tree; 529 ClipTree clip_tree;
530 ScrollTree scroll_tree;
501 bool needs_rebuild; 531 bool needs_rebuild;
502 bool non_root_surfaces_enabled; 532 bool non_root_surfaces_enabled;
503 int sequence_number; 533 int sequence_number;
504 }; 534 };
505 535
506 } // namespace cc 536 } // namespace cc
507 537
508 #endif // CC_TREES_PROPERTY_TREE_H_ 538 #endif // CC_TREES_PROPERTY_TREE_H_
OLDNEW
« no previous file with comments | « cc/proto/property_tree.proto ('k') | cc/trees/property_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698