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

Unified Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 2890583002: Fix incorrect use of coords conversion for sticky elements (Closed)
Patch Set: nit 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/layout/compositing/CompositedLayerMapping.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
index c438cf02eb89b27ee507e657c12a2d6998906d3c..c4210b99139b9e7b071bcc5690ddbb2513571847 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -317,8 +317,16 @@ void CompositedLayerMapping::UpdateStickyConstraints(
// The enclosing layers offset returned from |convertToLayerCoords| must be
// adjusted for both scroll and ancestor sticky elements.
LayoutPoint enclosing_layer_offset;
- compositing_container->ConvertToLayerCoords(ancestor_overflow_layer,
- enclosing_layer_offset);
+ // The offset from the compositing_container to the ancestor_overflow_layer
+ // when we have a scroll parent is computed by the source_to_parent vector
+ // on the transform node.
+ // TODO(yigu): Eventually we want to remove the dependancy of
+ // source_to_parent from StickyPositionOffset in property_tree.cc.
+ if (!ScrollParent()) {
+ compositing_container->ConvertToLayerCoords(ancestor_overflow_layer,
+ enclosing_layer_offset);
+ }
+
DCHECK(!ScrollParent() || ScrollParent() == ancestor_overflow_layer);
if (!ScrollParent() && compositing_container != ancestor_overflow_layer) {
enclosing_layer_offset += LayoutSize(
@@ -338,7 +346,9 @@ void CompositedLayerMapping::UpdateStickyConstraints(
FloatPoint(-enclosing_layer_offset) -
FloatSize(ContentOffsetInCompositingLayer()));
- if (compositing_container != ancestor_overflow_layer) {
+ // When we have a scroll parent, the content offset is computed by
+ // source_offset on the transform node.
+ if (!ScrollParent() && compositing_container != ancestor_overflow_layer) {
parent_relative_sticky_box_offset.MoveBy(
FloatPoint(compositing_container->GetCompositedLayerMapping()
->ContentOffsetInCompositingLayer()));
« no previous file with comments | « third_party/WebKit/LayoutTests/compositing/overflow/ancestor-overflow-layer-of-sticky-child-of-compositing-container-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698