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

Unified Diff: cc/layers/layer_sticky_position_constraint.h

Issue 2733633002: Handle nested position:sticky elements correctly (compositor) (Closed)
Patch Set: Address reviewer comments 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 side-by-side diff with in-line comments
Download patch
Index: cc/layers/layer_sticky_position_constraint.h
diff --git a/cc/layers/layer_sticky_position_constraint.h b/cc/layers/layer_sticky_position_constraint.h
index 3f43bc7751ab614b2c12b25c18d73a71cd308012..176a3a5406f0b43ec0d93d42571f9ec74b5e6f5f 100644
--- a/cc/layers/layer_sticky_position_constraint.h
+++ b/cc/layers/layer_sticky_position_constraint.h
@@ -7,7 +7,9 @@
#include "cc/base/cc_export.h"
-#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/geometry/point_f.h"
+#include "ui/gfx/geometry/rect_f.h"
+#include "ui/gfx/geometry/vector2d_f.h"
namespace cc {
@@ -31,18 +33,28 @@ struct CC_EXPORT LayerStickyPositionConstraint {
// The layout offset of the sticky box relative to its containing layer.
// This is used to detect the sticky offset the main thread has applied
// to the layer.
- gfx::Point parent_relative_sticky_box_offset;
+ gfx::PointF parent_relative_sticky_box_offset;
// The rectangle corresponding to original layout position of the sticky box
// relative to the scroll ancestor. The sticky box is only offset once the
// scroll has passed its initial position (e.g. top_offset will only push
// the element down from its original position).
- gfx::Rect scroll_container_relative_sticky_box_rect;
+ gfx::RectF scroll_container_relative_sticky_box_rect;
// The layout rectangle of the sticky box's containing block relative to the
// scroll ancestor. The sticky box is only moved as far as its containing
// block boundary.
- gfx::Rect scroll_container_relative_containing_block_rect;
+ gfx::RectF scroll_container_relative_containing_block_rect;
+
+ // The nearest ancestor sticky layer ids that affect the sticky box constraint
+ // rect and the containing block constraint rect respectively. If no such
+ // layer exists, these are set to Layer::INVALID_ID.
+ int nearest_layer_shifting_sticky_box;
+ int nearest_layer_shifting_containing_block;
+
+ // Returns the nearest sticky ancestor layer, or Layer::INVALID_ID if no such
+ // layer exists.
+ int NearestStickyAncestor();
bool operator==(const LayerStickyPositionConstraint&) const;
bool operator!=(const LayerStickyPositionConstraint&) const;

Powered by Google App Engine
This is Rietveld 408576698