OLD | NEW |
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "core/layout/LayoutImage.h" | 44 #include "core/layout/LayoutImage.h" |
45 #include "core/layout/LayoutPart.h" | 45 #include "core/layout/LayoutPart.h" |
46 #include "core/layout/LayoutVideo.h" | 46 #include "core/layout/LayoutVideo.h" |
47 #include "core/layout/LayoutView.h" | 47 #include "core/layout/LayoutView.h" |
48 #include "core/layout/api/LayoutAPIShim.h" | 48 #include "core/layout/api/LayoutAPIShim.h" |
49 #include "core/layout/api/LayoutPartItem.h" | 49 #include "core/layout/api/LayoutPartItem.h" |
50 #include "core/layout/compositing/PaintLayerCompositor.h" | 50 #include "core/layout/compositing/PaintLayerCompositor.h" |
51 #include "core/page/ChromeClient.h" | 51 #include "core/page/ChromeClient.h" |
52 #include "core/page/Page.h" | 52 #include "core/page/Page.h" |
53 #include "core/page/scrolling/ScrollingCoordinator.h" | 53 #include "core/page/scrolling/ScrollingCoordinator.h" |
| 54 #include "core/page/scrolling/StickyPositionScrollingConstraints.h" |
54 #include "core/paint/ObjectPaintInvalidator.h" | 55 #include "core/paint/ObjectPaintInvalidator.h" |
55 #include "core/paint/PaintInfo.h" | 56 #include "core/paint/PaintInfo.h" |
56 #include "core/paint/PaintLayerPainter.h" | 57 #include "core/paint/PaintLayerPainter.h" |
57 #include "core/paint/PaintLayerStackingNodeIterator.h" | 58 #include "core/paint/PaintLayerStackingNodeIterator.h" |
58 #include "core/paint/PaintTiming.h" | 59 #include "core/paint/PaintTiming.h" |
59 #include "core/paint/ScrollableAreaPainter.h" | 60 #include "core/paint/ScrollableAreaPainter.h" |
60 #include "core/paint/TransformRecorder.h" | 61 #include "core/paint/TransformRecorder.h" |
61 #include "core/plugins/PluginView.h" | 62 #include "core/plugins/PluginView.h" |
62 #include "platform/LengthFunctions.h" | 63 #include "platform/LengthFunctions.h" |
63 #include "platform/RuntimeEnabledFeatures.h" | 64 #include "platform/RuntimeEnabledFeatures.h" |
64 #include "platform/fonts/FontCache.h" | 65 #include "platform/fonts/FontCache.h" |
65 #include "platform/geometry/TransformState.h" | 66 #include "platform/geometry/TransformState.h" |
66 #include "platform/graphics/BitmapImage.h" | 67 #include "platform/graphics/BitmapImage.h" |
67 #include "platform/graphics/CompositorFilterOperations.h" | 68 #include "platform/graphics/CompositorFilterOperations.h" |
68 #include "platform/graphics/CompositorMutableProperties.h" | 69 #include "platform/graphics/CompositorMutableProperties.h" |
69 #include "platform/graphics/GraphicsContext.h" | 70 #include "platform/graphics/GraphicsContext.h" |
70 #include "platform/graphics/paint/ClipDisplayItem.h" | 71 #include "platform/graphics/paint/ClipDisplayItem.h" |
71 #include "platform/graphics/paint/CullRect.h" | 72 #include "platform/graphics/paint/CullRect.h" |
72 #include "platform/graphics/paint/DrawingRecorder.h" | 73 #include "platform/graphics/paint/DrawingRecorder.h" |
73 #include "platform/graphics/paint/PaintController.h" | 74 #include "platform/graphics/paint/PaintController.h" |
74 #include "platform/graphics/paint/SkPictureBuilder.h" | 75 #include "platform/graphics/paint/SkPictureBuilder.h" |
75 #include "platform/graphics/paint/TransformDisplayItem.h" | 76 #include "platform/graphics/paint/TransformDisplayItem.h" |
| 77 #include "public/platform/WebLayerStickyPositionConstraint.h" |
76 #include "wtf/CurrentTime.h" | 78 #include "wtf/CurrentTime.h" |
77 #include "wtf/text/StringBuilder.h" | 79 #include "wtf/text/StringBuilder.h" |
78 #include <memory> | 80 #include <memory> |
79 | 81 |
80 namespace blink { | 82 namespace blink { |
81 | 83 |
82 using namespace HTMLNames; | 84 using namespace HTMLNames; |
83 | 85 |
84 static IntRect clipBox(LayoutBox* layoutObject); | 86 static IntRect clipBox(LayoutBox* layoutObject); |
85 | 87 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 228 } |
227 | 229 |
228 void CompositedLayerMapping::createPrimaryGraphicsLayer() | 230 void CompositedLayerMapping::createPrimaryGraphicsLayer() |
229 { | 231 { |
230 m_graphicsLayer = createGraphicsLayer(m_owningLayer.getCompositingReasons(),
m_owningLayer.getSquashingDisallowedReasons()); | 232 m_graphicsLayer = createGraphicsLayer(m_owningLayer.getCompositingReasons(),
m_owningLayer.getSquashingDisallowedReasons()); |
231 | 233 |
232 updateOpacity(layoutObject()->styleRef()); | 234 updateOpacity(layoutObject()->styleRef()); |
233 updateTransform(layoutObject()->styleRef()); | 235 updateTransform(layoutObject()->styleRef()); |
234 updateFilters(layoutObject()->styleRef()); | 236 updateFilters(layoutObject()->styleRef()); |
235 updateBackdropFilters(layoutObject()->styleRef()); | 237 updateBackdropFilters(layoutObject()->styleRef()); |
| 238 updateStickyConstraints(layoutObject()->styleRef()); |
236 updateLayerBlendMode(layoutObject()->styleRef()); | 239 updateLayerBlendMode(layoutObject()->styleRef()); |
237 updateIsRootForIsolatedGroup(); | 240 updateIsRootForIsolatedGroup(); |
238 } | 241 } |
239 | 242 |
240 void CompositedLayerMapping::destroyGraphicsLayers() | 243 void CompositedLayerMapping::destroyGraphicsLayers() |
241 { | 244 { |
242 if (m_graphicsLayer) | 245 if (m_graphicsLayer) |
243 m_graphicsLayer->removeFromParent(); | 246 m_graphicsLayer->removeFromParent(); |
244 | 247 |
245 m_ancestorClippingLayer = nullptr; | 248 m_ancestorClippingLayer = nullptr; |
(...skipping 30 matching lines...) Expand all Loading... |
276 void CompositedLayerMapping::updateFilters(const ComputedStyle& style) | 279 void CompositedLayerMapping::updateFilters(const ComputedStyle& style) |
277 { | 280 { |
278 m_graphicsLayer->setFilters(owningLayer().createCompositorFilterOperationsFo
rFilter(style)); | 281 m_graphicsLayer->setFilters(owningLayer().createCompositorFilterOperationsFo
rFilter(style)); |
279 } | 282 } |
280 | 283 |
281 void CompositedLayerMapping::updateBackdropFilters(const ComputedStyle& style) | 284 void CompositedLayerMapping::updateBackdropFilters(const ComputedStyle& style) |
282 { | 285 { |
283 m_graphicsLayer->setBackdropFilters(owningLayer().createCompositorFilterOper
ationsForBackdropFilter(style)); | 286 m_graphicsLayer->setBackdropFilters(owningLayer().createCompositorFilterOper
ationsForBackdropFilter(style)); |
284 } | 287 } |
285 | 288 |
| 289 void CompositedLayerMapping::updateStickyConstraints(const ComputedStyle& style) |
| 290 { |
| 291 bool sticky = style.position() == EPosition::StickyPosition; |
| 292 const PaintLayer* ancestorOverflowLayer = m_owningLayer.ancestorOverflowLaye
r(); |
| 293 // TODO(flackr): Do we still need this? |
| 294 if (sticky) { |
| 295 if (!ancestorOverflowLayer->isRootLayer()) { |
| 296 sticky = ancestorOverflowLayer->needsCompositedScrolling(); |
| 297 } else { |
| 298 sticky = layoutObject()->view()->frameView()->isScrollable(); |
| 299 } |
| 300 } |
| 301 |
| 302 WebLayerStickyPositionConstraint webConstraint; |
| 303 if (sticky) { |
| 304 const StickyPositionScrollingConstraints& constraints = ancestorOverflow
Layer->getScrollableArea()->stickyConstraintsMap().get(&m_owningLayer); |
| 305 webConstraint.isSticky = true; |
| 306 webConstraint.isAnchoredLeft = constraints.anchorEdges() & StickyPositio
nScrollingConstraints::AnchorEdgeLeft; |
| 307 webConstraint.isAnchoredRight = constraints.anchorEdges() & StickyPositi
onScrollingConstraints::AnchorEdgeRight; |
| 308 webConstraint.isAnchoredTop = constraints.anchorEdges() & StickyPosition
ScrollingConstraints::AnchorEdgeTop; |
| 309 webConstraint.isAnchoredBottom = constraints.anchorEdges() & StickyPosit
ionScrollingConstraints::AnchorEdgeBottom; |
| 310 webConstraint.leftOffset = constraints.leftOffset(); |
| 311 webConstraint.rightOffset = constraints.rightOffset(); |
| 312 webConstraint.topOffset = constraints.topOffset(); |
| 313 webConstraint.bottomOffset = constraints.bottomOffset(); |
| 314 webConstraint.scrollContainerRelativeStickyBoxRect = enclosingIntRect(co
nstraints.scrollContainerRelativeStickyBoxRect()); |
| 315 webConstraint.scrollContainerRelativeContainingBlockRect = enclosingIntR
ect(constraints.scrollContainerRelativeContainingBlockRect()); |
| 316 } |
| 317 |
| 318 m_graphicsLayer->setStickyPositionConstraint(webConstraint); |
| 319 } |
| 320 |
286 void CompositedLayerMapping::updateLayerBlendMode(const ComputedStyle& style) | 321 void CompositedLayerMapping::updateLayerBlendMode(const ComputedStyle& style) |
287 { | 322 { |
288 setBlendMode(style.blendMode()); | 323 setBlendMode(style.blendMode()); |
289 } | 324 } |
290 | 325 |
291 void CompositedLayerMapping::updateIsRootForIsolatedGroup() | 326 void CompositedLayerMapping::updateIsRootForIsolatedGroup() |
292 { | 327 { |
293 bool isolate = m_owningLayer.shouldIsolateCompositedDescendants(); | 328 bool isolate = m_owningLayer.shouldIsolateCompositedDescendants(); |
294 | 329 |
295 // non stacking context layers should never isolate | 330 // non stacking context layers should never isolate |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 // Set opacity, if it is not animating. | 777 // Set opacity, if it is not animating. |
743 if (!layoutObject()->style()->isRunningOpacityAnimationOnCompositor()) | 778 if (!layoutObject()->style()->isRunningOpacityAnimationOnCompositor()) |
744 updateOpacity(layoutObject()->styleRef()); | 779 updateOpacity(layoutObject()->styleRef()); |
745 | 780 |
746 if (!layoutObject()->style()->isRunningFilterAnimationOnCompositor()) | 781 if (!layoutObject()->style()->isRunningFilterAnimationOnCompositor()) |
747 updateFilters(layoutObject()->styleRef()); | 782 updateFilters(layoutObject()->styleRef()); |
748 | 783 |
749 if (!layoutObject()->style()->isRunningBackdropFilterAnimationOnCompositor()
) | 784 if (!layoutObject()->style()->isRunningBackdropFilterAnimationOnCompositor()
) |
750 updateBackdropFilters(layoutObject()->styleRef()); | 785 updateBackdropFilters(layoutObject()->styleRef()); |
751 | 786 |
| 787 updateStickyConstraints(layoutObject()->styleRef()); |
| 788 |
752 // We compute everything relative to the enclosing compositing layer. | 789 // We compute everything relative to the enclosing compositing layer. |
753 IntRect ancestorCompositingBounds; | 790 IntRect ancestorCompositingBounds; |
754 if (compositingContainer) { | 791 if (compositingContainer) { |
755 ASSERT(compositingContainer->hasCompositedLayerMapping()); | 792 ASSERT(compositingContainer->hasCompositedLayerMapping()); |
756 ancestorCompositingBounds = compositingContainer->compositedLayerMapping
()->pixelSnappedCompositedBounds(); | 793 ancestorCompositingBounds = compositingContainer->compositedLayerMapping
()->pixelSnappedCompositedBounds(); |
757 } | 794 } |
758 | 795 |
759 IntRect localCompositingBounds; | 796 IntRect localCompositingBounds; |
760 IntRect relativeCompositingBounds; | 797 IntRect relativeCompositingBounds; |
761 LayoutPoint offsetFromCompositedAncestor; | 798 LayoutPoint offsetFromCompositedAncestor; |
(...skipping 1952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2714 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2751 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
2715 name = "Scrolling Contents Layer"; | 2752 name = "Scrolling Contents Layer"; |
2716 } else { | 2753 } else { |
2717 ASSERT_NOT_REACHED(); | 2754 ASSERT_NOT_REACHED(); |
2718 } | 2755 } |
2719 | 2756 |
2720 return name; | 2757 return name; |
2721 } | 2758 } |
2722 | 2759 |
2723 } // namespace blink | 2760 } // namespace blink |
OLD | NEW |