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

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

Issue 2401903002: Compute and include the offset of the sticky box to its enclosing composited layer. (Closed)
Patch Set: Created 4 years, 2 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 } else { 295 } else {
296 sticky = layoutObject()->view()->frameView()->isScrollable(); 296 sticky = layoutObject()->view()->frameView()->isScrollable();
297 } 297 }
298 } 298 }
299 299
300 WebLayerStickyPositionConstraint webConstraint; 300 WebLayerStickyPositionConstraint webConstraint;
301 if (sticky) { 301 if (sticky) {
302 const StickyPositionScrollingConstraints& constraints = 302 const StickyPositionScrollingConstraints& constraints =
303 ancestorOverflowLayer->getScrollableArea()->stickyConstraintsMap().get( 303 ancestorOverflowLayer->getScrollableArea()->stickyConstraintsMap().get(
304 &m_owningLayer); 304 &m_owningLayer);
305
306 // Find the layout offset of the unshifted sticky box within its enclosing l ayer.
307 LayoutPoint enclosingLayerOffset;
308 m_owningLayer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf)
309 ->convertToLayerCoords(m_owningLayer.ancestorOverflowLayer(),
310 enclosingLayerOffset);
311 FloatPoint stickyBoxOffset =
312 constraints.scrollContainerRelativeStickyBoxRect().location();
313 stickyBoxOffset.moveBy(FloatPoint(-enclosingLayerOffset));
314
305 webConstraint.isSticky = true; 315 webConstraint.isSticky = true;
306 webConstraint.isAnchoredLeft = 316 webConstraint.isAnchoredLeft =
307 constraints.anchorEdges() & 317 constraints.anchorEdges() &
308 StickyPositionScrollingConstraints::AnchorEdgeLeft; 318 StickyPositionScrollingConstraints::AnchorEdgeLeft;
309 webConstraint.isAnchoredRight = 319 webConstraint.isAnchoredRight =
310 constraints.anchorEdges() & 320 constraints.anchorEdges() &
311 StickyPositionScrollingConstraints::AnchorEdgeRight; 321 StickyPositionScrollingConstraints::AnchorEdgeRight;
312 webConstraint.isAnchoredTop = 322 webConstraint.isAnchoredTop =
313 constraints.anchorEdges() & 323 constraints.anchorEdges() &
314 StickyPositionScrollingConstraints::AnchorEdgeTop; 324 StickyPositionScrollingConstraints::AnchorEdgeTop;
315 webConstraint.isAnchoredBottom = 325 webConstraint.isAnchoredBottom =
316 constraints.anchorEdges() & 326 constraints.anchorEdges() &
317 StickyPositionScrollingConstraints::AnchorEdgeBottom; 327 StickyPositionScrollingConstraints::AnchorEdgeBottom;
318 webConstraint.leftOffset = constraints.leftOffset(); 328 webConstraint.leftOffset = constraints.leftOffset();
319 webConstraint.rightOffset = constraints.rightOffset(); 329 webConstraint.rightOffset = constraints.rightOffset();
320 webConstraint.topOffset = constraints.topOffset(); 330 webConstraint.topOffset = constraints.topOffset();
321 webConstraint.bottomOffset = constraints.bottomOffset(); 331 webConstraint.bottomOffset = constraints.bottomOffset();
332 webConstraint.parentRelativeStickyBoxOffset =
333 roundedIntPoint(stickyBoxOffset);
322 webConstraint.scrollContainerRelativeStickyBoxRect = 334 webConstraint.scrollContainerRelativeStickyBoxRect =
323 enclosingIntRect(constraints.scrollContainerRelativeStickyBoxRect()); 335 enclosingIntRect(constraints.scrollContainerRelativeStickyBoxRect());
324 webConstraint.scrollContainerRelativeContainingBlockRect = enclosingIntRect( 336 webConstraint.scrollContainerRelativeContainingBlockRect = enclosingIntRect(
325 constraints.scrollContainerRelativeContainingBlockRect()); 337 constraints.scrollContainerRelativeContainingBlockRect());
326 } 338 }
327 339
328 m_graphicsLayer->setStickyPositionConstraint(webConstraint); 340 m_graphicsLayer->setStickyPositionConstraint(webConstraint);
329 } 341 }
330 342
331 void CompositedLayerMapping::updateLayerBlendMode(const ComputedStyle& style) { 343 void CompositedLayerMapping::updateLayerBlendMode(const ComputedStyle& style) {
(...skipping 2821 matching lines...) Expand 10 before | Expand all | Expand 10 after
3153 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 3165 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
3154 name = "Scrolling Contents Layer"; 3166 name = "Scrolling Contents Layer";
3155 } else { 3167 } else {
3156 ASSERT_NOT_REACHED(); 3168 ASSERT_NOT_REACHED();
3157 } 3169 }
3158 3170
3159 return name; 3171 return name;
3160 } 3172 }
3161 3173
3162 } // namespace blink 3174 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698