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

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: Merge with master and fix long line. 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 } else { 297 } else {
298 sticky = layoutObject()->view()->frameView()->isScrollable(); 298 sticky = layoutObject()->view()->frameView()->isScrollable();
299 } 299 }
300 } 300 }
301 301
302 WebLayerStickyPositionConstraint webConstraint; 302 WebLayerStickyPositionConstraint webConstraint;
303 if (sticky) { 303 if (sticky) {
304 const StickyPositionScrollingConstraints& constraints = 304 const StickyPositionScrollingConstraints& constraints =
305 ancestorOverflowLayer->getScrollableArea()->stickyConstraintsMap().get( 305 ancestorOverflowLayer->getScrollableArea()->stickyConstraintsMap().get(
306 &m_owningLayer); 306 &m_owningLayer);
307
308 // Find the layout offset of the unshifted sticky box within its enclosing
309 // layer.
310 LayoutPoint enclosingLayerOffset;
311 m_owningLayer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf)
312 ->convertToLayerCoords(m_owningLayer.ancestorOverflowLayer(),
313 enclosingLayerOffset);
314 FloatPoint stickyBoxOffset =
315 constraints.scrollContainerRelativeStickyBoxRect().location();
316 stickyBoxOffset.moveBy(FloatPoint(-enclosingLayerOffset));
317
307 webConstraint.isSticky = true; 318 webConstraint.isSticky = true;
308 webConstraint.isAnchoredLeft = 319 webConstraint.isAnchoredLeft =
309 constraints.anchorEdges() & 320 constraints.anchorEdges() &
310 StickyPositionScrollingConstraints::AnchorEdgeLeft; 321 StickyPositionScrollingConstraints::AnchorEdgeLeft;
311 webConstraint.isAnchoredRight = 322 webConstraint.isAnchoredRight =
312 constraints.anchorEdges() & 323 constraints.anchorEdges() &
313 StickyPositionScrollingConstraints::AnchorEdgeRight; 324 StickyPositionScrollingConstraints::AnchorEdgeRight;
314 webConstraint.isAnchoredTop = 325 webConstraint.isAnchoredTop =
315 constraints.anchorEdges() & 326 constraints.anchorEdges() &
316 StickyPositionScrollingConstraints::AnchorEdgeTop; 327 StickyPositionScrollingConstraints::AnchorEdgeTop;
317 webConstraint.isAnchoredBottom = 328 webConstraint.isAnchoredBottom =
318 constraints.anchorEdges() & 329 constraints.anchorEdges() &
319 StickyPositionScrollingConstraints::AnchorEdgeBottom; 330 StickyPositionScrollingConstraints::AnchorEdgeBottom;
320 webConstraint.leftOffset = constraints.leftOffset(); 331 webConstraint.leftOffset = constraints.leftOffset();
321 webConstraint.rightOffset = constraints.rightOffset(); 332 webConstraint.rightOffset = constraints.rightOffset();
322 webConstraint.topOffset = constraints.topOffset(); 333 webConstraint.topOffset = constraints.topOffset();
323 webConstraint.bottomOffset = constraints.bottomOffset(); 334 webConstraint.bottomOffset = constraints.bottomOffset();
335 webConstraint.parentRelativeStickyBoxOffset =
336 roundedIntPoint(stickyBoxOffset);
324 webConstraint.scrollContainerRelativeStickyBoxRect = 337 webConstraint.scrollContainerRelativeStickyBoxRect =
325 enclosingIntRect(constraints.scrollContainerRelativeStickyBoxRect()); 338 enclosingIntRect(constraints.scrollContainerRelativeStickyBoxRect());
326 webConstraint.scrollContainerRelativeContainingBlockRect = enclosingIntRect( 339 webConstraint.scrollContainerRelativeContainingBlockRect = enclosingIntRect(
327 constraints.scrollContainerRelativeContainingBlockRect()); 340 constraints.scrollContainerRelativeContainingBlockRect());
328 } 341 }
329 342
330 m_graphicsLayer->setStickyPositionConstraint(webConstraint); 343 m_graphicsLayer->setStickyPositionConstraint(webConstraint);
331 } 344 }
332 345
333 void CompositedLayerMapping::updateLayerBlendMode(const ComputedStyle& style) { 346 void CompositedLayerMapping::updateLayerBlendMode(const ComputedStyle& style) {
(...skipping 2902 matching lines...) Expand 10 before | Expand all | Expand 10 after
3236 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 3249 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
3237 name = "Scrolling Contents Layer"; 3250 name = "Scrolling Contents Layer";
3238 } else { 3251 } else {
3239 ASSERT_NOT_REACHED(); 3252 ASSERT_NOT_REACHED();
3240 } 3253 }
3241 3254
3242 return name; 3255 return name;
3243 } 3256 }
3244 3257
3245 } // namespace blink 3258 } // namespace blink
OLDNEW
« no previous file with comments | « cc/trees/property_tree_builder.cc ('k') | third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698