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

Unified Diff: third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h

Issue 2911463002: Unify the calculation of main thread offset of sticky element (Closed)
Patch Set: Address comments 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h
diff --git a/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h b/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h
index 330d2d86334c79ac8050a50cc8565bc97c06bfeb..205c65c9fa6984a5d196d907cc99ef065a15ff77 100644
--- a/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h
+++ b/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h
@@ -7,11 +7,19 @@
#include "platform/geometry/FloatRect.h"
#include "platform/geometry/FloatSize.h"
+#include "platform/wtf/HashMap.h"
namespace blink {
class LayoutBoxModelObject;
+class PaintLayer;
+class StickyPositionScrollingConstraints;
+typedef WTF::HashMap<PaintLayer*, StickyPositionScrollingConstraints>
+ StickyConstraintsMap;
+
+// TODO(yigu): Add detailed comment explaining how
+// StickyPositionScrollingConstraints works.
class StickyPositionScrollingConstraints final {
public:
enum AnchorEdgeFlags {
@@ -113,6 +121,11 @@ class StickyPositionScrollingConstraints final {
return total_containing_block_sticky_offset_;
}
+ // Returns the relative position of the sticky box and ancestor scroller so
+ // that it can figure out how much the main thread has already pushed this
chrishtr 2017/06/05 18:28:45 You shouldn't specify use cases. It's clearer to j
yigu 2017/06/05 18:35:08 Done.
+ // sticky element down from setting the layer position.
+ FloatSize GetLocalStickyOffset(const StickyConstraintsMap&) const;
chrishtr 2017/06/05 18:28:45 GetPositionRelativeToScrollAncestor?
yigu 2017/06/05 18:35:08 Done.
+
const LayoutBoxModelObject* NearestStickyAncestor() const {
// If we have one or more sticky ancestor elements between ourselves and our
// containing block, |m_nearestStickyBoxShiftingStickyBox| points to the

Powered by Google App Engine
This is Rietveld 408576698