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

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: Address reviewer comments Created 3 years, 9 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 m_graphicsLayer->setFilters( 284 m_graphicsLayer->setFilters(
285 owningLayer().createCompositorFilterOperationsForFilter(style)); 285 owningLayer().createCompositorFilterOperationsForFilter(style));
286 } 286 }
287 287
288 void CompositedLayerMapping::updateBackdropFilters(const ComputedStyle& style) { 288 void CompositedLayerMapping::updateBackdropFilters(const ComputedStyle& style) {
289 m_graphicsLayer->setBackdropFilters( 289 m_graphicsLayer->setBackdropFilters(
290 owningLayer().createCompositorFilterOperationsForBackdropFilter(style)); 290 owningLayer().createCompositorFilterOperationsForBackdropFilter(style));
291 } 291 }
292 292
293 void CompositedLayerMapping::updateStickyConstraints( 293 void CompositedLayerMapping::updateStickyConstraints(
294 const ComputedStyle& style) { 294 const ComputedStyle& style,
295 const PaintLayer* compositingContainer) {
295 bool sticky = style.position() == EPosition::kSticky; 296 bool sticky = style.position() == EPosition::kSticky;
296 const PaintLayer* ancestorOverflowLayer = 297 const PaintLayer* ancestorOverflowLayer =
297 m_owningLayer.ancestorOverflowLayer(); 298 m_owningLayer.ancestorOverflowLayer();
298 // TODO(flackr): Do we still need this? 299 // TODO(flackr): Do we still need this?
299 if (sticky) { 300 if (sticky) {
300 if (!ancestorOverflowLayer->isRootLayer()) { 301 if (!ancestorOverflowLayer->isRootLayer()) {
301 sticky = ancestorOverflowLayer->needsCompositedScrolling(); 302 sticky = ancestorOverflowLayer->needsCompositedScrolling();
302 } else { 303 } else {
303 sticky = layoutObject().view()->frameView()->isScrollable(); 304 sticky = layoutObject().view()->frameView()->isScrollable();
304 } 305 }
305 } 306 }
306 307
307 WebLayerStickyPositionConstraint webConstraint; 308 WebLayerStickyPositionConstraint webConstraint;
308 if (sticky) { 309 if (sticky) {
309 const StickyPositionScrollingConstraints& constraints = 310 const StickyPositionScrollingConstraints& constraints =
310 ancestorOverflowLayer->getScrollableArea()->stickyConstraintsMap().at( 311 ancestorOverflowLayer->getScrollableArea()->stickyConstraintsMap().at(
311 &m_owningLayer); 312 &m_owningLayer);
312 313
313 // Find the layout offset of the unshifted sticky box within its enclosing 314 // Find the layout offset of the unshifted sticky box within its
314 // layer. 315 // compositingContainer. If the enclosing layer is not the scroller, then
316 // the offset must be adjusted to include the scroll offset to keep it
317 // relative to compositingContainer.
315 LayoutPoint enclosingLayerOffset; 318 LayoutPoint enclosingLayerOffset;
316 m_owningLayer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf) 319 compositingContainer->convertToLayerCoords(ancestorOverflowLayer,
317 ->convertToLayerCoords(m_owningLayer.ancestorOverflowLayer(), 320 enclosingLayerOffset);
318 enclosingLayerOffset); 321 if (compositingContainer != ancestorOverflowLayer) {
322 enclosingLayerOffset += LayoutSize(
323 ancestorOverflowLayer->getScrollableArea()->getScrollOffset());
324 }
325
319 FloatPoint stickyBoxOffset = 326 FloatPoint stickyBoxOffset =
320 constraints.scrollContainerRelativeStickyBoxRect().location(); 327 constraints.scrollContainerRelativeStickyBoxRect().location();
321 DCHECK(!m_contentOffsetInCompositingLayerDirty); 328 DCHECK(!m_contentOffsetInCompositingLayerDirty);
322 stickyBoxOffset.moveBy(FloatPoint(-enclosingLayerOffset) - 329 stickyBoxOffset.moveBy(FloatPoint(-enclosingLayerOffset) -
323 FloatSize(contentOffsetInCompositingLayer())); 330 FloatSize(contentOffsetInCompositingLayer()));
324 331
325 webConstraint.isSticky = true; 332 webConstraint.isSticky = true;
326 webConstraint.isAnchoredLeft = 333 webConstraint.isAnchoredLeft =
327 constraints.anchorEdges() & 334 constraints.anchorEdges() &
328 StickyPositionScrollingConstraints::AnchorEdgeLeft; 335 StickyPositionScrollingConstraints::AnchorEdgeLeft;
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 FloatSize contentsSize(relativeCompositingBounds.size()); 1014 FloatSize contentsSize(relativeCompositingBounds.size());
1008 1015
1009 updateMainGraphicsLayerGeometry(relativeCompositingBounds, 1016 updateMainGraphicsLayerGeometry(relativeCompositingBounds,
1010 localCompositingBounds, 1017 localCompositingBounds,
1011 graphicsLayerParentLocation); 1018 graphicsLayerParentLocation);
1012 updateOverflowControlsHostLayerGeometry(compositingStackingContext, 1019 updateOverflowControlsHostLayerGeometry(compositingStackingContext,
1013 compositingContainer, 1020 compositingContainer,
1014 graphicsLayerParentLocation); 1021 graphicsLayerParentLocation);
1015 updateContentsOffsetInCompositingLayer(snappedOffsetFromCompositedAncestor, 1022 updateContentsOffsetInCompositingLayer(snappedOffsetFromCompositedAncestor,
1016 graphicsLayerParentLocation); 1023 graphicsLayerParentLocation);
1017 updateStickyConstraints(layoutObject().styleRef()); 1024 updateStickyConstraints(layoutObject().styleRef(), compositingContainer);
1018 updateSquashingLayerGeometry( 1025 updateSquashingLayerGeometry(
1019 graphicsLayerParentLocation, compositingContainer, m_squashedLayers, 1026 graphicsLayerParentLocation, compositingContainer, m_squashedLayers,
1020 m_squashingLayer.get(), &m_squashingLayerOffsetFromTransformedAncestor, 1027 m_squashingLayer.get(), &m_squashingLayerOffsetFromTransformedAncestor,
1021 layersNeedingPaintInvalidation); 1028 layersNeedingPaintInvalidation);
1022 1029
1023 // If we have a layer that clips children, position it. 1030 // If we have a layer that clips children, position it.
1024 IntRect clippingBox; 1031 IntRect clippingBox;
1025 if (m_childContainmentLayer && layoutObject().isBox()) 1032 if (m_childContainmentLayer && layoutObject().isBox())
1026 clippingBox = clipBox(toLayoutBox(layoutObject())); 1033 clippingBox = clipBox(toLayoutBox(layoutObject()));
1027 1034
(...skipping 2453 matching lines...) Expand 10 before | Expand all | Expand 10 after
3481 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { 3488 } else if (graphicsLayer == m_decorationOutlineLayer.get()) {
3482 name = "Decoration Layer"; 3489 name = "Decoration Layer";
3483 } else { 3490 } else {
3484 ASSERT_NOT_REACHED(); 3491 ASSERT_NOT_REACHED();
3485 } 3492 }
3486 3493
3487 return name; 3494 return name;
3488 } 3495 }
3489 3496
3490 } // namespace blink 3497 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698