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

Side by Side Diff: cc/layers/layer_sticky_position_constraint.h

Issue 2911463002: Unify the calculation of main thread offset of sticky element (Closed)
Patch Set: Bug fix 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
« no previous file with comments | « cc/layers/layer_impl_test_properties.h ('k') | cc/layers/layer_sticky_position_constraint.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_LAYERS_LAYER_STICKY_POSITION_CONSTRAINT_H_ 5 #ifndef CC_LAYERS_LAYER_STICKY_POSITION_CONSTRAINT_H_
6 #define CC_LAYERS_LAYER_STICKY_POSITION_CONSTRAINT_H_ 6 #define CC_LAYERS_LAYER_STICKY_POSITION_CONSTRAINT_H_
7 7
8 #include "cc/cc_export.h" 8 #include "cc/cc_export.h"
9 9
10 #include "ui/gfx/geometry/point.h" 10 #include "ui/gfx/geometry/point.h"
(...skipping 11 matching lines...) Expand all
22 bool is_anchored_top : 1; 22 bool is_anchored_top : 1;
23 bool is_anchored_bottom : 1; 23 bool is_anchored_bottom : 1;
24 24
25 // The offset from each edge of the ancestor scroller (or the viewport) to 25 // The offset from each edge of the ancestor scroller (or the viewport) to
26 // try to maintain to the sticky box as we scroll. 26 // try to maintain to the sticky box as we scroll.
27 float left_offset; 27 float left_offset;
28 float right_offset; 28 float right_offset;
29 float top_offset; 29 float top_offset;
30 float bottom_offset; 30 float bottom_offset;
31 31
32 // The layout offset of the sticky box relative to its containing layer.
33 // This is used to detect the sticky offset the main thread has applied
34 // to the layer.
35 gfx::Point parent_relative_sticky_box_offset;
36
37 // The rectangle corresponding to original layout position of the sticky box 32 // The rectangle corresponding to original layout position of the sticky box
38 // relative to the scroll ancestor. The sticky box is only offset once the 33 // relative to the scroll ancestor. The sticky box is only offset once the
39 // scroll has passed its initial position (e.g. top_offset will only push 34 // scroll has passed its initial position (e.g. top_offset will only push
40 // the element down from its original position). 35 // the element down from its original position).
41 gfx::Rect scroll_container_relative_sticky_box_rect; 36 gfx::Rect scroll_container_relative_sticky_box_rect;
42 37
43 // The layout rectangle of the sticky box's containing block relative to the 38 // The layout rectangle of the sticky box's containing block relative to the
44 // scroll ancestor. The sticky box is only moved as far as its containing 39 // scroll ancestor. The sticky box is only moved as far as its containing
45 // block boundary. 40 // block boundary.
46 gfx::Rect scroll_container_relative_containing_block_rect; 41 gfx::Rect scroll_container_relative_containing_block_rect;
47 42
48 // The nearest ancestor sticky layer ids that affect the sticky box constraint 43 // The nearest ancestor sticky layer ids that affect the sticky box constraint
49 // rect and the containing block constraint rect respectively. If no such 44 // rect and the containing block constraint rect respectively. If no such
50 // layer exists, these are set to Layer::INVALID_ID. 45 // layer exists, these are set to Layer::INVALID_ID.
51 int nearest_layer_shifting_sticky_box; 46 int nearest_layer_shifting_sticky_box;
52 int nearest_layer_shifting_containing_block; 47 int nearest_layer_shifting_containing_block;
53 48
54 // Returns the nearest sticky ancestor layer, or Layer::INVALID_ID if no such 49 // Returns the nearest sticky ancestor layer, or Layer::INVALID_ID if no such
55 // layer exists. 50 // layer exists.
56 int NearestStickyAncestor(); 51 int NearestStickyAncestor();
57 52
58 bool operator==(const LayerStickyPositionConstraint&) const; 53 bool operator==(const LayerStickyPositionConstraint&) const;
59 bool operator!=(const LayerStickyPositionConstraint&) const; 54 bool operator!=(const LayerStickyPositionConstraint&) const;
60 }; 55 };
61 56
62 } // namespace cc 57 } // namespace cc
63 58
64 #endif // CC_LAYERS_LAYER_STICKY_POSITION_CONSTRAINT_H_ 59 #endif // CC_LAYERS_LAYER_STICKY_POSITION_CONSTRAINT_H_
OLDNEW
« no previous file with comments | « cc/layers/layer_impl_test_properties.h ('k') | cc/layers/layer_sticky_position_constraint.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698