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

Unified Diff: cc/trees/property_tree.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/trees/property_tree.h
diff --git a/cc/trees/property_tree.h b/cc/trees/property_tree.h
index f7e90ea7b47277c8df23da1df91cfd84ecc80de1..929cacf42b940b4df7ef90823f4ffb55a9f27048 100644
--- a/cc/trees/property_tree.h
+++ b/cc/trees/property_tree.h
@@ -113,7 +113,24 @@ struct StickyPositionNodeData {
// by computing the additional offset necessary to keep the element stuck.
gfx::Vector2dF main_thread_offset;
- StickyPositionNodeData() : scroll_ancestor(-1) {}
+ // In order to properly compute the sticky offset, we need to know if we have
+ // any sticky ancestors both between ourselves and our containing block and
+ // between our containing block and the viewport. These ancestors are then
+ // used to correct the constraining rect locations.
+ int nearest_node_shifting_sticky_box;
+ int nearest_node_shifting_containing_block;
+
+ // For performance we cache our accumulated sticky offset to allow descendant
+ // sticky elements to offset their constraint rects. Because we can either
+ // affect the sticky box constraint rect or the containing block constraint
+ // rect, we need to accumulate both.
+ gfx::Vector2dF total_sticky_box_sticky_offset;
+ gfx::Vector2dF total_containing_block_sticky_offset;
+
+ StickyPositionNodeData()
+ : scroll_ancestor(-1),
flackr 2017/03/17 18:04:08 nit: Can we change these ids to kInvalidNodeId?
smcgruer 2017/03/17 18:42:42 Done.
+ nearest_node_shifting_sticky_box(-1),
+ nearest_node_shifting_containing_block(-1) {}
};
class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> {

Powered by Google App Engine
This is Rietveld 408576698