OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef StickyPositionViewportConstraints_h | |
6 #define StickyPositionViewportConstraints_h | |
7 | |
8 #include "core/page/scrolling/ViewportConstraints.h" | |
9 | |
10 namespace blink { | |
11 | |
12 class StickyPositionViewportConstraints final : public ViewportConstraints { | |
chrishtr
2016/01/30 01:49:03
On further reflection, StickyPositionScrollingCons
flackr
2016/02/22 22:55:23
Done.
| |
13 public: | |
14 StickyPositionViewportConstraints() | |
15 : m_leftOffset(0) | |
16 , m_rightOffset(0) | |
17 , m_topOffset(0) | |
18 , m_bottomOffset(0) | |
19 { } | |
20 | |
21 StickyPositionViewportConstraints(const StickyPositionViewportConstraints& o ther) | |
22 : ViewportConstraints(other) | |
23 , m_leftOffset(other.m_leftOffset) | |
24 , m_rightOffset(other.m_rightOffset) | |
25 , m_topOffset(other.m_topOffset) | |
26 , m_bottomOffset(other.m_bottomOffset) | |
27 , m_absoluteContainingBlockRect(other.m_absoluteContainingBlockRect) | |
28 , m_absoluteStickyBoxRect(other.m_absoluteStickyBoxRect) | |
29 { } | |
30 | |
31 FloatSize computeStickyOffset(const FloatRect& viewportRect) const; | |
32 | |
33 float leftOffset() const { return m_leftOffset; } | |
34 float rightOffset() const { return m_rightOffset; } | |
35 float topOffset() const { return m_topOffset; } | |
36 float bottomOffset() const { return m_bottomOffset; } | |
37 | |
38 void setLeftOffset(float offset) { m_leftOffset = offset; } | |
39 void setRightOffset(float offset) { m_rightOffset = offset; } | |
40 void setTopOffset(float offset) { m_topOffset = offset; } | |
41 void setBottomOffset(float offset) { m_bottomOffset = offset; } | |
42 | |
43 void setAbsoluteContainingBlockRect(const FloatRect& rect) { m_absoluteConta iningBlockRect = rect; } | |
chrishtr
2016/01/30 01:49:03
setScrollContainerRelativeContainingBlockRect
flackr
2016/02/22 22:55:23
Done.
| |
44 | |
45 void setAbsoluteStickyBoxRect(const FloatRect& rect) { m_absoluteStickyBoxRe ct = rect; } | |
chrishtr
2016/01/30 01:49:03
setScrollContainerRelativeStickyBoxRect
flackr
2016/02/22 22:55:23
Done.
| |
46 | |
47 bool operator==(const StickyPositionViewportConstraints& other) const | |
48 { | |
49 return m_leftOffset == other.m_leftOffset | |
50 && m_rightOffset == other.m_rightOffset | |
51 && m_topOffset == other.m_topOffset | |
52 && m_bottomOffset == other.m_bottomOffset | |
53 && m_absoluteContainingBlockRect == other.m_absoluteContainingBlockR ect | |
54 && m_absoluteStickyBoxRect == other.m_absoluteStickyBoxRect; | |
55 } | |
56 | |
57 bool operator!=(const StickyPositionViewportConstraints& other) const { retu rn !(*this == other); } | |
58 | |
59 private: | |
60 ConstraintType constraintType() const override { return StickyPositionConstr aint; } | |
61 | |
62 float m_leftOffset; | |
63 float m_rightOffset; | |
64 float m_topOffset; | |
65 float m_bottomOffset; | |
66 FloatRect m_absoluteContainingBlockRect; | |
67 FloatRect m_absoluteStickyBoxRect; | |
68 }; | |
69 | |
70 } // namespace blink | |
71 | |
72 #endif // StickyPositionViewportConstraints_h | |
OLD | NEW |