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

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

Issue 2911463002: Unify the calculation of main thread offset of sticky element (Closed)
Patch Set: nit 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 std::vector<int> nodes_affected_by_inner_viewport_bounds_delta_; 304 std::vector<int> nodes_affected_by_inner_viewport_bounds_delta_;
305 std::vector<int> nodes_affected_by_outer_viewport_bounds_delta_; 305 std::vector<int> nodes_affected_by_outer_viewport_bounds_delta_;
306 std::vector<TransformCachedNodeData> cached_data_; 306 std::vector<TransformCachedNodeData> cached_data_;
307 std::vector<StickyPositionNodeData> sticky_position_data_; 307 std::vector<StickyPositionNodeData> sticky_position_data_;
308 }; 308 };
309 309
310 struct StickyPositionNodeData { 310 struct StickyPositionNodeData {
311 int scroll_ancestor; 311 int scroll_ancestor;
312 LayerStickyPositionConstraint constraints; 312 LayerStickyPositionConstraint constraints;
313 313
314 // This is the offset that blink has already applied to counteract the main
315 // thread scroll offset of the scroll ancestor. We need to account for this
316 // by computing the additional offset necessary to keep the element stuck.
317 gfx::Vector2dF main_thread_offset;
318
319 // In order to properly compute the sticky offset, we need to know if we have 314 // In order to properly compute the sticky offset, we need to know if we have
320 // any sticky ancestors both between ourselves and our containing block and 315 // any sticky ancestors both between ourselves and our containing block and
321 // between our containing block and the viewport. These ancestors are then 316 // between our containing block and the viewport. These ancestors are then
322 // used to correct the constraining rect locations. 317 // used to correct the constraining rect locations.
323 int nearest_node_shifting_sticky_box; 318 int nearest_node_shifting_sticky_box;
324 int nearest_node_shifting_containing_block; 319 int nearest_node_shifting_containing_block;
325 320
326 // For performance we cache our accumulated sticky offset to allow descendant 321 // For performance we cache our accumulated sticky offset to allow descendant
327 // sticky elements to offset their constraint rects. Because we can either 322 // sticky elements to offset their constraint rects. Because we can either
328 // affect the sticky box constraint rect or the containing block constraint 323 // affect the sticky box constraint rect or the containing block constraint
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 DrawTransforms& GetDrawTransforms(int transform_id, int effect_id) const; 728 DrawTransforms& GetDrawTransforms(int transform_id, int effect_id) const;
734 DrawTransformData& FetchDrawTransformsDataFromCache(int transform_id, 729 DrawTransformData& FetchDrawTransformsDataFromCache(int transform_id,
735 int effect_id) const; 730 int effect_id) const;
736 731
737 PropertyTreesCachedData cached_data_; 732 PropertyTreesCachedData cached_data_;
738 }; 733 };
739 734
740 } // namespace cc 735 } // namespace cc
741 736
742 #endif // CC_TREES_PROPERTY_TREE_H_ 737 #endif // CC_TREES_PROPERTY_TREE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698