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

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

Issue 2733633002: Handle nested position:sticky elements correctly (compositor) (Closed)
Patch Set: Revert float changes to unittests too Created 3 years, 9 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 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/rect.h" 11 #include "ui/gfx/geometry/rect.h"
11 12
12 namespace cc { 13 namespace cc {
13 14
14 struct CC_EXPORT LayerStickyPositionConstraint { 15 struct CC_EXPORT LayerStickyPositionConstraint {
15 LayerStickyPositionConstraint(); 16 LayerStickyPositionConstraint();
16 LayerStickyPositionConstraint(const LayerStickyPositionConstraint& other); 17 LayerStickyPositionConstraint(const LayerStickyPositionConstraint& other);
17 18
18 bool is_sticky : 1; 19 bool is_sticky : 1;
19 bool is_anchored_left : 1; 20 bool is_anchored_left : 1;
(...skipping 17 matching lines...) Expand all
37 // relative to the scroll ancestor. The sticky box is only offset once the 38 // relative to the scroll ancestor. The sticky box is only offset once the
38 // scroll has passed its initial position (e.g. top_offset will only push 39 // scroll has passed its initial position (e.g. top_offset will only push
39 // the element down from its original position). 40 // the element down from its original position).
40 gfx::Rect scroll_container_relative_sticky_box_rect; 41 gfx::Rect scroll_container_relative_sticky_box_rect;
41 42
42 // The layout rectangle of the sticky box's containing block relative to the 43 // The layout rectangle of the sticky box's containing block relative to the
43 // scroll ancestor. The sticky box is only moved as far as its containing 44 // scroll ancestor. The sticky box is only moved as far as its containing
44 // block boundary. 45 // block boundary.
45 gfx::Rect scroll_container_relative_containing_block_rect; 46 gfx::Rect scroll_container_relative_containing_block_rect;
46 47
48 // The nearest ancestor sticky layer ids that affect the sticky box constraint
49 // rect and the containing block constraint rect respectively. If no such
50 // layer exists, these are set to Layer::INVALID_ID.
51 int nearest_layer_shifting_sticky_box;
52 int nearest_layer_shifting_containing_block;
53
54 // Returns the nearest sticky ancestor layer, or Layer::INVALID_ID if no such
55 // layer exists.
56 int NearestStickyAncestor();
57
47 bool operator==(const LayerStickyPositionConstraint&) const; 58 bool operator==(const LayerStickyPositionConstraint&) const;
48 bool operator!=(const LayerStickyPositionConstraint&) const; 59 bool operator!=(const LayerStickyPositionConstraint&) const;
49 }; 60 };
50 61
51 } // namespace cc 62 } // namespace cc
52 63
53 #endif // CC_LAYERS_LAYER_STICKY_POSITION_CONSTRAINT_H_ 64 #endif // CC_LAYERS_LAYER_STICKY_POSITION_CONSTRAINT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698