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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayer.cpp

Issue 2911463002: Unify the calculation of main thread offset of sticky element (Closed)
Patch Set: Address comments Created 3 years, 7 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/paint/PaintLayer.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
index 5d76895c46da812a4a79674bbfc21deb8e71769a..16daa7935f716147c8c63a7253c9b2c7d9f603f3 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
@@ -842,6 +842,17 @@ void PaintLayer::UpdateLayerPosition() {
if (rare_data_ || !new_offset.IsZero())
EnsureRareData().offset_for_in_flow_position = new_offset;
local_point.Move(new_offset);
+
+ // Find the layout offset of the unshifted sticky box within its parent
+ // composited layer. This information is used by the compositor side to
+ // compute the additional offset required to keep the element stuck under
+ // compositor scrolling.
+ if (GetLayoutObject().Style()->GetPosition() == EPosition::kSticky &&
+ GetCompositedLayerMapping()) {
+ GetCompositedLayerMapping()
+ ->MainGraphicsLayer()
+ ->SetStickyMainThreadOffset(RoundedIntSize(new_offset));
flackr 2017/06/01 19:01:47 I don't think this is the right place to set the s
yigu 2017/06/01 19:28:40 Done.
+ }
} else if (rare_data_) {
rare_data_->offset_for_in_flow_position = LayoutSize();
}

Powered by Google App Engine
This is Rietveld 408576698