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

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

Issue 1308273010: Adapt and reland old position sticky implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Merge with master and skip anonymous containing blocks for sticky container. Created 4 years, 11 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/StickyPositionViewportConstraints.h
diff --git a/third_party/WebKit/Source/core/page/scrolling/StickyPositionViewportConstraints.h b/third_party/WebKit/Source/core/page/scrolling/StickyPositionViewportConstraints.h
new file mode 100644
index 0000000000000000000000000000000000000000..1508d210ea6ae3d0a3300818e471c276dc966196
--- /dev/null
+++ b/third_party/WebKit/Source/core/page/scrolling/StickyPositionViewportConstraints.h
@@ -0,0 +1,72 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef StickyPositionViewportConstraints_h
+#define StickyPositionViewportConstraints_h
+
+#include "core/page/scrolling/ViewportConstraints.h"
+
+namespace blink {
+
+class StickyPositionViewportConstraints final : public ViewportConstraints {
chrishtr 2016/01/30 01:49:03 On further reflection, StickyPositionScrollingCons
flackr 2016/02/22 22:55:23 Done.
+public:
+ StickyPositionViewportConstraints()
+ : m_leftOffset(0)
+ , m_rightOffset(0)
+ , m_topOffset(0)
+ , m_bottomOffset(0)
+ { }
+
+ StickyPositionViewportConstraints(const StickyPositionViewportConstraints& other)
+ : ViewportConstraints(other)
+ , m_leftOffset(other.m_leftOffset)
+ , m_rightOffset(other.m_rightOffset)
+ , m_topOffset(other.m_topOffset)
+ , m_bottomOffset(other.m_bottomOffset)
+ , m_absoluteContainingBlockRect(other.m_absoluteContainingBlockRect)
+ , m_absoluteStickyBoxRect(other.m_absoluteStickyBoxRect)
+ { }
+
+ FloatSize computeStickyOffset(const FloatRect& viewportRect) const;
+
+ float leftOffset() const { return m_leftOffset; }
+ float rightOffset() const { return m_rightOffset; }
+ float topOffset() const { return m_topOffset; }
+ float bottomOffset() const { return m_bottomOffset; }
+
+ void setLeftOffset(float offset) { m_leftOffset = offset; }
+ void setRightOffset(float offset) { m_rightOffset = offset; }
+ void setTopOffset(float offset) { m_topOffset = offset; }
+ void setBottomOffset(float offset) { m_bottomOffset = offset; }
+
+ void setAbsoluteContainingBlockRect(const FloatRect& rect) { m_absoluteContainingBlockRect = rect; }
chrishtr 2016/01/30 01:49:03 setScrollContainerRelativeContainingBlockRect
flackr 2016/02/22 22:55:23 Done.
+
+ void setAbsoluteStickyBoxRect(const FloatRect& rect) { m_absoluteStickyBoxRect = rect; }
chrishtr 2016/01/30 01:49:03 setScrollContainerRelativeStickyBoxRect
flackr 2016/02/22 22:55:23 Done.
+
+ bool operator==(const StickyPositionViewportConstraints& other) const
+ {
+ return m_leftOffset == other.m_leftOffset
+ && m_rightOffset == other.m_rightOffset
+ && m_topOffset == other.m_topOffset
+ && m_bottomOffset == other.m_bottomOffset
+ && m_absoluteContainingBlockRect == other.m_absoluteContainingBlockRect
+ && m_absoluteStickyBoxRect == other.m_absoluteStickyBoxRect;
+ }
+
+ bool operator!=(const StickyPositionViewportConstraints& other) const { return !(*this == other); }
+
+private:
+ ConstraintType constraintType() const override { return StickyPositionConstraint; }
+
+ float m_leftOffset;
+ float m_rightOffset;
+ float m_topOffset;
+ float m_bottomOffset;
+ FloatRect m_absoluteContainingBlockRect;
+ FloatRect m_absoluteStickyBoxRect;
+};
+
+} // namespace blink
+
+#endif // StickyPositionViewportConstraints_h

Powered by Google App Engine
This is Rietveld 408576698