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

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

Issue 2698843004: Correct for enclosing layers scroll position in sticky_data->main_thread_offset (Closed)
Patch Set: Move offset correction to blink side Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 } 301 }
302 } 302 }
303 303
304 WebLayerStickyPositionConstraint webConstraint; 304 WebLayerStickyPositionConstraint webConstraint;
305 if (sticky) { 305 if (sticky) {
306 const StickyPositionScrollingConstraints& constraints = 306 const StickyPositionScrollingConstraints& constraints =
307 ancestorOverflowLayer->getScrollableArea()->stickyConstraintsMap().get( 307 ancestorOverflowLayer->getScrollableArea()->stickyConstraintsMap().get(
308 &m_owningLayer); 308 &m_owningLayer);
309 309
310 // Find the layout offset of the unshifted sticky box within its enclosing 310 // Find the layout offset of the unshifted sticky box within its enclosing
311 // layer. 311 // layer. If the enclosing layer is not the scroller, the offset must be
312 // adjusted to include the scroll offset to keep it relative.
313 PaintLayer* enclosingLayer =
314 m_owningLayer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf);
312 LayoutPoint enclosingLayerOffset; 315 LayoutPoint enclosingLayerOffset;
313 m_owningLayer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf) 316 enclosingLayer->convertToLayerCoords(m_owningLayer.ancestorOverflowLayer(),
314 ->convertToLayerCoords(m_owningLayer.ancestorOverflowLayer(), 317 enclosingLayerOffset);
315 enclosingLayerOffset); 318 if (enclosingLayer != m_owningLayer.ancestorOverflowLayer() &&
319 enclosingLayer->containingLayer()) {
320 enclosingLayerOffset += enclosingLayer->containingLayer()
321 ->layoutBox()
322 ->scrolledContentOffset();
flackr 2017/02/22 14:23:09 scrolledContentOffset requires that the box has an
smcgruer 2017/02/22 15:42:30 Done.
323 }
324
316 FloatPoint stickyBoxOffset = 325 FloatPoint stickyBoxOffset =
317 constraints.scrollContainerRelativeStickyBoxRect().location(); 326 constraints.scrollContainerRelativeStickyBoxRect().location();
318 DCHECK(!m_contentOffsetInCompositingLayerDirty); 327 DCHECK(!m_contentOffsetInCompositingLayerDirty);
319 stickyBoxOffset.moveBy(FloatPoint(-enclosingLayerOffset) - 328 stickyBoxOffset.moveBy(FloatPoint(-enclosingLayerOffset) -
320 FloatSize(contentOffsetInCompositingLayer())); 329 FloatSize(contentOffsetInCompositingLayer()));
321 330
322 webConstraint.isSticky = true; 331 webConstraint.isSticky = true;
323 webConstraint.isAnchoredLeft = 332 webConstraint.isAnchoredLeft =
324 constraints.anchorEdges() & 333 constraints.anchorEdges() &
325 StickyPositionScrollingConstraints::AnchorEdgeLeft; 334 StickyPositionScrollingConstraints::AnchorEdgeLeft;
(...skipping 3152 matching lines...) Expand 10 before | Expand all | Expand 10 after
3478 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { 3487 } else if (graphicsLayer == m_decorationOutlineLayer.get()) {
3479 name = "Decoration Layer"; 3488 name = "Decoration Layer";
3480 } else { 3489 } else {
3481 ASSERT_NOT_REACHED(); 3490 ASSERT_NOT_REACHED();
3482 } 3491 }
3483 3492
3484 return name; 3493 return name;
3485 } 3494 }
3486 3495
3487 } // namespace blink 3496 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698