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

Unified Diff: cc/trees/property_tree.h

Issue 2251303003: Implement position: sticky updates on compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with master and add comments to WebLayerStickyPositionConstraint members. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/property_tree.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/property_tree.h
diff --git a/cc/trees/property_tree.h b/cc/trees/property_tree.h
index a429612774d183ac119bc15f5f5946465160d427..0670230dba8e499bf02c8982ec1c24df022242ca 100644
--- a/cc/trees/property_tree.h
+++ b/cc/trees/property_tree.h
@@ -14,6 +14,7 @@
#include "cc/animation/element_id.h"
#include "cc/base/cc_export.h"
#include "cc/base/synced_property.h"
+#include "cc/layers/layer_sticky_position_constraint.h"
#include "cc/output/filter_operations.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/scroll_offset.h"
@@ -31,6 +32,7 @@ namespace proto {
class PropertyTree;
class PropertyTrees;
class ScrollNodeData;
+class StickyPositionNodeData;
class TreeNode;
} // namespace proto
@@ -122,6 +124,20 @@ class CC_EXPORT PropertyTree {
PropertyTrees* property_trees_;
};
+struct StickyPositionNodeData {
+ int scroll_ancestor;
+ LayerStickyPositionConstraint constraints;
+
+ // This is the offset that blink has already applied to counteract the main
+ // thread scroll offset of the scroll ancestor. We need to account for this
+ // by computing the additional offset necessary to keep the element stuck.
+ gfx::Vector2dF main_thread_offset;
+
+ StickyPositionNodeData() : scroll_ancestor(-1) {}
+ void ToProtobuf(proto::StickyPositionNodeData* proto) const;
+ void FromProtobuf(const proto::StickyPositionNodeData& proto);
+};
+
class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> {
public:
TransformTree();
@@ -255,6 +271,8 @@ class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> {
return cached_data_;
}
+ StickyPositionNodeData* StickyPositionData(int node_id);
+
void ToProtobuf(proto::PropertyTree* proto) const;
void FromProtobuf(const proto::PropertyTree& proto,
std::unordered_map<int, int>* node_id_to_index_map);
@@ -303,6 +321,7 @@ class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> {
std::vector<int> nodes_affected_by_inner_viewport_bounds_delta_;
std::vector<int> nodes_affected_by_outer_viewport_bounds_delta_;
std::vector<TransformCachedNodeData> cached_data_;
+ std::vector<StickyPositionNodeData> sticky_position_data_;
};
class CC_EXPORT ClipTree final : public PropertyTree<ClipNode> {
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/property_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698