Chromium Code Reviews| Index: third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.cpp |
| diff --git a/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.cpp b/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.cpp |
| index f099cdce40417819ed11a11f133cdf54b503a75f..226e0fce0636c519af4a37691cf6a7574cc76077 100644 |
| --- a/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.cpp |
| +++ b/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.cpp |
| @@ -3,6 +3,7 @@ |
| // found in the LICENSE file. |
| #include "core/page/scrolling/StickyPositionScrollingConstraints.h" |
| +#include "core/paint/PaintLayer.h" |
| namespace blink { |
| @@ -88,4 +89,17 @@ FloatSize StickyPositionScrollingConstraints::ComputeStickyOffset( |
| return sticky_offset; |
| } |
| +FloatSize |
| +StickyPositionScrollingConstraints::GetPositionRelativeToScrollAncestor( |
| + const StickyConstraintsMap& constraints_map) const { |
| + FloatSize nearest_sticky_box_shifting_sticky_box_constraints_offset; |
| + if (nearest_sticky_box_shifting_sticky_box_) { |
| + nearest_sticky_box_shifting_sticky_box_constraints_offset = |
| + constraints_map.at(nearest_sticky_box_shifting_sticky_box_->Layer()) |
| + .GetTotalStickyBoxStickyOffset(); |
| + } |
| + return total_sticky_box_sticky_offset_ - |
|
chrishtr
2017/06/05 18:58:33
Could you explain why this logic is correct? I'm n
yigu
2017/06/05 21:03:49
We do the subtraction because total_sticky_box_sti
trchen
2017/06/05 22:43:11
+1 We need more comments in the headers. It took m
yigu
2017/06/06 19:33:18
I've updated the function name.
|
| + nearest_sticky_box_shifting_sticky_box_constraints_offset; |
| +} |
| + |
| } // namespace blink |