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

Unified Diff: third_party/WebKit/Source/core/page/scrolling/ViewportConstraints.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/ViewportConstraints.h
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollingConstraints.h b/third_party/WebKit/Source/core/page/scrolling/ViewportConstraints.h
similarity index 74%
rename from third_party/WebKit/Source/core/page/scrolling/ScrollingConstraints.h
rename to third_party/WebKit/Source/core/page/scrolling/ViewportConstraints.h
index 6b3dca6ed15f4f13cb52653d392476c18f874ecc..47537b3d9fced950f3c145af2de92b15bba214a9 100644
--- a/third_party/WebKit/Source/core/page/scrolling/ScrollingConstraints.h
+++ b/third_party/WebKit/Source/core/page/scrolling/ViewportConstraints.h
@@ -23,8 +23,8 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef ScrollingConstraints_h
-#define ScrollingConstraints_h
chrishtr 2016/01/30 01:49:03 Rename to ScrollingConstraints? Sorry for going in
+#ifndef ViewportConstraints_h
+#define ViewportConstraints_h
#include "platform/geometry/FloatRect.h"
#include "wtf/Allocator.h"
@@ -32,13 +32,13 @@
namespace blink {
// ViewportConstraints classes encapsulate data and logic required to reposition elements whose layout
-// depends on the viewport rect (i.e., position fixed), when scrolling and zooming.
+// depends on the viewport rect (positioned fixed and sticky), when scrolling and zooming.
class ViewportConstraints {
STACK_ALLOCATED();
public:
- // FIXME: Simplify this code now that position: sticky doesn't exist.
enum ConstraintType {
FixedPositionConstaint,
+ StickyPositionConstraint,
};
enum AnchorEdgeFlags {
@@ -84,35 +84,20 @@ public:
FixedPositionViewportConstraints(const FixedPositionViewportConstraints& other)
: ViewportConstraints(other)
- , m_viewportRectAtLastLayout(other.m_viewportRectAtLastLayout)
- , m_layerPositionAtLastLayout(other.m_layerPositionAtLastLayout)
{ }
- FloatPoint layerPositionForViewportRect(const FloatRect& viewportRect) const;
-
- const FloatRect& viewportRectAtLastLayout() const { return m_viewportRectAtLastLayout; }
- void setViewportRectAtLastLayout(const FloatRect& rect) { m_viewportRectAtLastLayout = rect; }
-
- const FloatPoint& layerPositionAtLastLayout() const { return m_layerPositionAtLastLayout; }
- void setLayerPositionAtLastLayout(const FloatPoint& point) { m_layerPositionAtLastLayout = point; }
-
bool operator==(const FixedPositionViewportConstraints& other) const
{
return m_alignmentOffset == other.m_alignmentOffset
- && m_anchorEdges == other.m_anchorEdges
- && m_viewportRectAtLastLayout == other.m_viewportRectAtLastLayout
- && m_layerPositionAtLastLayout == other.m_layerPositionAtLastLayout;
+ && m_anchorEdges == other.m_anchorEdges;
}
bool operator!=(const FixedPositionViewportConstraints& other) const { return !(*this == other); }
private:
ConstraintType constraintType() const override { return FixedPositionConstaint; }
-
- FloatRect m_viewportRectAtLastLayout;
- FloatPoint m_layerPositionAtLastLayout;
};
} // namespace blink
-#endif // ScrollingConstraints_h
+#endif // ViewportConstraints_h

Powered by Google App Engine
This is Rietveld 408576698