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

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: Remove check for containingLayer and make unittest more nested 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 enclosingLayerOffset += LayoutSize(enclosingLayer->ancestorOverflowLayer()
320 ->getScrollableArea()
321 ->getScrollOffset());
322 }
323
316 FloatPoint stickyBoxOffset = 324 FloatPoint stickyBoxOffset =
317 constraints.scrollContainerRelativeStickyBoxRect().location(); 325 constraints.scrollContainerRelativeStickyBoxRect().location();
318 DCHECK(!m_contentOffsetInCompositingLayerDirty); 326 DCHECK(!m_contentOffsetInCompositingLayerDirty);
319 stickyBoxOffset.moveBy(FloatPoint(-enclosingLayerOffset) - 327 stickyBoxOffset.moveBy(FloatPoint(-enclosingLayerOffset) -
320 FloatSize(contentOffsetInCompositingLayer())); 328 FloatSize(contentOffsetInCompositingLayer()));
321 329
322 webConstraint.isSticky = true; 330 webConstraint.isSticky = true;
323 webConstraint.isAnchoredLeft = 331 webConstraint.isAnchoredLeft =
324 constraints.anchorEdges() & 332 constraints.anchorEdges() &
325 StickyPositionScrollingConstraints::AnchorEdgeLeft; 333 StickyPositionScrollingConstraints::AnchorEdgeLeft;
(...skipping 3152 matching lines...) Expand 10 before | Expand all | Expand 10 after
3478 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { 3486 } else if (graphicsLayer == m_decorationOutlineLayer.get()) {
3479 name = "Decoration Layer"; 3487 name = "Decoration Layer";
3480 } else { 3488 } else {
3481 ASSERT_NOT_REACHED(); 3489 ASSERT_NOT_REACHED();
3482 } 3490 }
3483 3491
3484 return name; 3492 return name;
3485 } 3493 }
3486 3494
3487 } // namespace blink 3495 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698