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

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

Issue 2636233002: Add offset of content in composited layer to sticky position offset. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 228
229 void CompositedLayerMapping::createPrimaryGraphicsLayer() { 229 void CompositedLayerMapping::createPrimaryGraphicsLayer() {
230 m_graphicsLayer = 230 m_graphicsLayer =
231 createGraphicsLayer(m_owningLayer.getCompositingReasons(), 231 createGraphicsLayer(m_owningLayer.getCompositingReasons(),
232 m_owningLayer.getSquashingDisallowedReasons()); 232 m_owningLayer.getSquashingDisallowedReasons());
233 233
234 updateOpacity(layoutObject()->styleRef()); 234 updateOpacity(layoutObject()->styleRef());
235 updateTransform(layoutObject()->styleRef()); 235 updateTransform(layoutObject()->styleRef());
236 updateFilters(layoutObject()->styleRef()); 236 updateFilters(layoutObject()->styleRef());
237 updateBackdropFilters(layoutObject()->styleRef()); 237 updateBackdropFilters(layoutObject()->styleRef());
238 updateStickyConstraints(layoutObject()->styleRef());
239 updateLayerBlendMode(layoutObject()->styleRef()); 238 updateLayerBlendMode(layoutObject()->styleRef());
240 updateIsRootForIsolatedGroup(); 239 updateIsRootForIsolatedGroup();
241 } 240 }
242 241
243 void CompositedLayerMapping::destroyGraphicsLayers() { 242 void CompositedLayerMapping::destroyGraphicsLayers() {
244 if (m_graphicsLayer) 243 if (m_graphicsLayer)
245 m_graphicsLayer->removeFromParent(); 244 m_graphicsLayer->removeFromParent();
246 245
247 m_ancestorClippingLayer = nullptr; 246 m_ancestorClippingLayer = nullptr;
248 m_ancestorClippingMaskLayer = nullptr; 247 m_ancestorClippingMaskLayer = nullptr;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 &m_owningLayer); 307 &m_owningLayer);
309 308
310 // Find the layout offset of the unshifted sticky box within its enclosing 309 // Find the layout offset of the unshifted sticky box within its enclosing
311 // layer. 310 // layer.
312 LayoutPoint enclosingLayerOffset; 311 LayoutPoint enclosingLayerOffset;
313 m_owningLayer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf) 312 m_owningLayer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf)
314 ->convertToLayerCoords(m_owningLayer.ancestorOverflowLayer(), 313 ->convertToLayerCoords(m_owningLayer.ancestorOverflowLayer(),
315 enclosingLayerOffset); 314 enclosingLayerOffset);
316 FloatPoint stickyBoxOffset = 315 FloatPoint stickyBoxOffset =
317 constraints.scrollContainerRelativeStickyBoxRect().location(); 316 constraints.scrollContainerRelativeStickyBoxRect().location();
318 stickyBoxOffset.moveBy(FloatPoint(-enclosingLayerOffset)); 317 DCHECK(!m_contentOffsetInCompositingLayerDirty);
318 stickyBoxOffset.moveBy(FloatPoint(-enclosingLayerOffset) -
319 FloatSize(contentOffsetInCompositingLayer()));
chrishtr 2017/01/17 23:07:26 Is it possible for |layoutObject()| to be both sti
flackr 2017/01/18 13:28:45 If it was squashed its position would have to be u
319 320
320 webConstraint.isSticky = true; 321 webConstraint.isSticky = true;
321 webConstraint.isAnchoredLeft = 322 webConstraint.isAnchoredLeft =
322 constraints.anchorEdges() & 323 constraints.anchorEdges() &
323 StickyPositionScrollingConstraints::AnchorEdgeLeft; 324 StickyPositionScrollingConstraints::AnchorEdgeLeft;
324 webConstraint.isAnchoredRight = 325 webConstraint.isAnchoredRight =
325 constraints.anchorEdges() & 326 constraints.anchorEdges() &
326 StickyPositionScrollingConstraints::AnchorEdgeRight; 327 StickyPositionScrollingConstraints::AnchorEdgeRight;
327 webConstraint.isAnchoredTop = 328 webConstraint.isAnchoredTop =
328 constraints.anchorEdges() & 329 constraints.anchorEdges() &
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 // Set opacity, if it is not animating. 937 // Set opacity, if it is not animating.
937 if (!layoutObject()->style()->isRunningOpacityAnimationOnCompositor()) 938 if (!layoutObject()->style()->isRunningOpacityAnimationOnCompositor())
938 updateOpacity(layoutObject()->styleRef()); 939 updateOpacity(layoutObject()->styleRef());
939 940
940 if (!layoutObject()->style()->isRunningFilterAnimationOnCompositor()) 941 if (!layoutObject()->style()->isRunningFilterAnimationOnCompositor())
941 updateFilters(layoutObject()->styleRef()); 942 updateFilters(layoutObject()->styleRef());
942 943
943 if (!layoutObject()->style()->isRunningBackdropFilterAnimationOnCompositor()) 944 if (!layoutObject()->style()->isRunningBackdropFilterAnimationOnCompositor())
944 updateBackdropFilters(layoutObject()->styleRef()); 945 updateBackdropFilters(layoutObject()->styleRef());
945 946
946 updateStickyConstraints(layoutObject()->styleRef());
947
948 // We compute everything relative to the enclosing compositing layer. 947 // We compute everything relative to the enclosing compositing layer.
949 IntRect ancestorCompositingBounds; 948 IntRect ancestorCompositingBounds;
950 if (compositingContainer) { 949 if (compositingContainer) {
951 ASSERT(compositingContainer->hasCompositedLayerMapping()); 950 ASSERT(compositingContainer->hasCompositedLayerMapping());
952 ancestorCompositingBounds = compositingContainer->compositedLayerMapping() 951 ancestorCompositingBounds = compositingContainer->compositedLayerMapping()
953 ->pixelSnappedCompositedBounds(); 952 ->pixelSnappedCompositedBounds();
954 } 953 }
955 954
956 IntRect localCompositingBounds; 955 IntRect localCompositingBounds;
957 IntRect relativeCompositingBounds; 956 IntRect relativeCompositingBounds;
(...skipping 16 matching lines...) Expand all
974 FloatSize contentsSize(relativeCompositingBounds.size()); 973 FloatSize contentsSize(relativeCompositingBounds.size());
975 974
976 updateMainGraphicsLayerGeometry(relativeCompositingBounds, 975 updateMainGraphicsLayerGeometry(relativeCompositingBounds,
977 localCompositingBounds, 976 localCompositingBounds,
978 graphicsLayerParentLocation); 977 graphicsLayerParentLocation);
979 updateOverflowControlsHostLayerGeometry(compositingStackingContext, 978 updateOverflowControlsHostLayerGeometry(compositingStackingContext,
980 compositingContainer, 979 compositingContainer,
981 graphicsLayerParentLocation); 980 graphicsLayerParentLocation);
982 updateContentsOffsetInCompositingLayer(snappedOffsetFromCompositedAncestor, 981 updateContentsOffsetInCompositingLayer(snappedOffsetFromCompositedAncestor,
983 graphicsLayerParentLocation); 982 graphicsLayerParentLocation);
983 updateStickyConstraints(layoutObject()->styleRef());
984 updateSquashingLayerGeometry( 984 updateSquashingLayerGeometry(
985 graphicsLayerParentLocation, compositingContainer, m_squashedLayers, 985 graphicsLayerParentLocation, compositingContainer, m_squashedLayers,
986 m_squashingLayer.get(), &m_squashingLayerOffsetFromTransformedAncestor, 986 m_squashingLayer.get(), &m_squashingLayerOffsetFromTransformedAncestor,
987 layersNeedingPaintInvalidation); 987 layersNeedingPaintInvalidation);
988 988
989 // If we have a layer that clips children, position it. 989 // If we have a layer that clips children, position it.
990 IntRect clippingBox; 990 IntRect clippingBox;
991 if (m_childContainmentLayer && layoutObject()->isBox()) 991 if (m_childContainmentLayer && layoutObject()->isBox())
992 clippingBox = clipBox(toLayoutBox(layoutObject())); 992 clippingBox = clipBox(toLayoutBox(layoutObject()));
993 993
(...skipping 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after
3444 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { 3444 } else if (graphicsLayer == m_decorationOutlineLayer.get()) {
3445 name = "Decoration Layer"; 3445 name = "Decoration Layer";
3446 } else { 3446 } else {
3447 ASSERT_NOT_REACHED(); 3447 ASSERT_NOT_REACHED();
3448 } 3448 }
3449 3449
3450 return name; 3450 return name;
3451 } 3451 }
3452 3452
3453 } // namespace blink 3453 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698