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

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: 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 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..428531757cec98cfd1175c4089b07cf026a6d1cb 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(smcgruer): 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 its original position
+ // before scroll. This method is only safe to call if ComputeStickyOffset has
+ // been invoked.
+ FloatSize GetOffsetForStickyPosition(const StickyConstraintsMap&) const;
+
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