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

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

Issue 2911463002: Unify the calculation of main thread offset of sticky element (Closed)
Patch Set: Address comments Created 3 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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 std::vector<int> nodes_affected_by_inner_viewport_bounds_delta_; 302 std::vector<int> nodes_affected_by_inner_viewport_bounds_delta_;
303 std::vector<int> nodes_affected_by_outer_viewport_bounds_delta_; 303 std::vector<int> nodes_affected_by_outer_viewport_bounds_delta_;
304 std::vector<TransformCachedNodeData> cached_data_; 304 std::vector<TransformCachedNodeData> cached_data_;
305 std::vector<StickyPositionNodeData> sticky_position_data_; 305 std::vector<StickyPositionNodeData> sticky_position_data_;
306 }; 306 };
307 307
308 struct StickyPositionNodeData { 308 struct StickyPositionNodeData {
309 int scroll_ancestor; 309 int scroll_ancestor;
310 LayerStickyPositionConstraint constraints; 310 LayerStickyPositionConstraint constraints;
311 311
312 // This is the offset that blink has already applied to counteract the main
313 // thread scroll offset of the scroll ancestor. We need to account for this
314 // by computing the additional offset necessary to keep the element stuck.
315 gfx::Vector2dF main_thread_offset;
316
317 // In order to properly compute the sticky offset, we need to know if we have 312 // In order to properly compute the sticky offset, we need to know if we have
318 // any sticky ancestors both between ourselves and our containing block and 313 // any sticky ancestors both between ourselves and our containing block and
319 // between our containing block and the viewport. These ancestors are then 314 // between our containing block and the viewport. These ancestors are then
320 // used to correct the constraining rect locations. 315 // used to correct the constraining rect locations.
321 int nearest_node_shifting_sticky_box; 316 int nearest_node_shifting_sticky_box;
322 int nearest_node_shifting_containing_block; 317 int nearest_node_shifting_containing_block;
323 318
324 // For performance we cache our accumulated sticky offset to allow descendant 319 // For performance we cache our accumulated sticky offset to allow descendant
325 // sticky elements to offset their constraint rects. Because we can either 320 // sticky elements to offset their constraint rects. Because we can either
326 // affect the sticky box constraint rect or the containing block constraint 321 // affect the sticky box constraint rect or the containing block constraint
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 DrawTransforms& GetDrawTransforms(int transform_id, int effect_id) const; 717 DrawTransforms& GetDrawTransforms(int transform_id, int effect_id) const;
723 DrawTransformData& FetchDrawTransformsDataFromCache(int transform_id, 718 DrawTransformData& FetchDrawTransformsDataFromCache(int transform_id,
724 int effect_id) const; 719 int effect_id) const;
725 720
726 PropertyTreesCachedData cached_data_; 721 PropertyTreesCachedData cached_data_;
727 }; 722 };
728 723
729 } // namespace cc 724 } // namespace cc
730 725
731 #endif // CC_TREES_PROPERTY_TREE_H_ 726 #endif // CC_TREES_PROPERTY_TREE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698