| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "core/layout/LayoutHTMLCanvas.h" | 43 #include "core/layout/LayoutHTMLCanvas.h" |
| 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/compositing/PaintLayerCompositor.h" | 49 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 50 #include "core/page/ChromeClient.h" | 50 #include "core/page/ChromeClient.h" |
| 51 #include "core/page/Page.h" | 51 #include "core/page/Page.h" |
| 52 #include "core/page/scrolling/ScrollingCoordinator.h" | 52 #include "core/page/scrolling/ScrollingCoordinator.h" |
| 53 #include "core/page/scrolling/StickyPositionScrollingConstraints.h" |
| 53 #include "core/paint/ObjectPaintInvalidator.h" | 54 #include "core/paint/ObjectPaintInvalidator.h" |
| 54 #include "core/paint/PaintInfo.h" | 55 #include "core/paint/PaintInfo.h" |
| 55 #include "core/paint/PaintLayerPainter.h" | 56 #include "core/paint/PaintLayerPainter.h" |
| 56 #include "core/paint/PaintLayerStackingNodeIterator.h" | 57 #include "core/paint/PaintLayerStackingNodeIterator.h" |
| 57 #include "core/paint/PaintTiming.h" | 58 #include "core/paint/PaintTiming.h" |
| 58 #include "core/paint/ScrollableAreaPainter.h" | 59 #include "core/paint/ScrollableAreaPainter.h" |
| 59 #include "core/paint/TransformRecorder.h" | 60 #include "core/paint/TransformRecorder.h" |
| 60 #include "core/plugins/PluginView.h" | 61 #include "core/plugins/PluginView.h" |
| 61 #include "platform/LengthFunctions.h" | 62 #include "platform/LengthFunctions.h" |
| 62 #include "platform/RuntimeEnabledFeatures.h" | 63 #include "platform/RuntimeEnabledFeatures.h" |
| 63 #include "platform/fonts/FontCache.h" | 64 #include "platform/fonts/FontCache.h" |
| 64 #include "platform/geometry/TransformState.h" | 65 #include "platform/geometry/TransformState.h" |
| 65 #include "platform/graphics/BitmapImage.h" | 66 #include "platform/graphics/BitmapImage.h" |
| 66 #include "platform/graphics/CompositorMutableProperties.h" | 67 #include "platform/graphics/CompositorMutableProperties.h" |
| 67 #include "platform/graphics/GraphicsContext.h" | 68 #include "platform/graphics/GraphicsContext.h" |
| 68 #include "platform/graphics/paint/ClipDisplayItem.h" | 69 #include "platform/graphics/paint/ClipDisplayItem.h" |
| 69 #include "platform/graphics/paint/CullRect.h" | 70 #include "platform/graphics/paint/CullRect.h" |
| 70 #include "platform/graphics/paint/DrawingRecorder.h" | 71 #include "platform/graphics/paint/DrawingRecorder.h" |
| 71 #include "platform/graphics/paint/PaintController.h" | 72 #include "platform/graphics/paint/PaintController.h" |
| 72 #include "platform/graphics/paint/SkPictureBuilder.h" | 73 #include "platform/graphics/paint/SkPictureBuilder.h" |
| 73 #include "platform/graphics/paint/TransformDisplayItem.h" | 74 #include "platform/graphics/paint/TransformDisplayItem.h" |
| 75 #include "public/platform/WebLayerStickyPositionConstraint.h" |
| 74 #include "wtf/CurrentTime.h" | 76 #include "wtf/CurrentTime.h" |
| 75 #include "wtf/text/StringBuilder.h" | 77 #include "wtf/text/StringBuilder.h" |
| 76 #include <memory> | 78 #include <memory> |
| 77 | 79 |
| 78 namespace blink { | 80 namespace blink { |
| 79 | 81 |
| 80 using namespace HTMLNames; | 82 using namespace HTMLNames; |
| 81 | 83 |
| 82 static IntRect clipBox(LayoutBox* layoutObject); | 84 static IntRect clipBox(LayoutBox* layoutObject); |
| 83 | 85 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 226 } |
| 225 | 227 |
| 226 void CompositedLayerMapping::createPrimaryGraphicsLayer() | 228 void CompositedLayerMapping::createPrimaryGraphicsLayer() |
| 227 { | 229 { |
| 228 m_graphicsLayer = createGraphicsLayer(m_owningLayer.getCompositingReasons(),
m_owningLayer.getSquashingDisallowedReasons()); | 230 m_graphicsLayer = createGraphicsLayer(m_owningLayer.getCompositingReasons(),
m_owningLayer.getSquashingDisallowedReasons()); |
| 229 | 231 |
| 230 updateOpacity(layoutObject()->styleRef()); | 232 updateOpacity(layoutObject()->styleRef()); |
| 231 updateTransform(layoutObject()->styleRef()); | 233 updateTransform(layoutObject()->styleRef()); |
| 232 updateFilters(layoutObject()->styleRef()); | 234 updateFilters(layoutObject()->styleRef()); |
| 233 updateBackdropFilters(layoutObject()->styleRef()); | 235 updateBackdropFilters(layoutObject()->styleRef()); |
| 236 updateStickyConstraints(layoutObject()->styleRef()); |
| 234 updateLayerBlendMode(layoutObject()->styleRef()); | 237 updateLayerBlendMode(layoutObject()->styleRef()); |
| 235 updateIsRootForIsolatedGroup(); | 238 updateIsRootForIsolatedGroup(); |
| 236 } | 239 } |
| 237 | 240 |
| 238 void CompositedLayerMapping::destroyGraphicsLayers() | 241 void CompositedLayerMapping::destroyGraphicsLayers() |
| 239 { | 242 { |
| 240 if (m_graphicsLayer) | 243 if (m_graphicsLayer) |
| 241 m_graphicsLayer->removeFromParent(); | 244 m_graphicsLayer->removeFromParent(); |
| 242 | 245 |
| 243 m_ancestorClippingLayer = nullptr; | 246 m_ancestorClippingLayer = nullptr; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 274 void CompositedLayerMapping::updateFilters(const ComputedStyle& style) | 277 void CompositedLayerMapping::updateFilters(const ComputedStyle& style) |
| 275 { | 278 { |
| 276 m_graphicsLayer->setFilters(owningLayer().computeFilterOperations(style)); | 279 m_graphicsLayer->setFilters(owningLayer().computeFilterOperations(style)); |
| 277 } | 280 } |
| 278 | 281 |
| 279 void CompositedLayerMapping::updateBackdropFilters(const ComputedStyle& style) | 282 void CompositedLayerMapping::updateBackdropFilters(const ComputedStyle& style) |
| 280 { | 283 { |
| 281 m_graphicsLayer->setBackdropFilters(owningLayer().computeBackdropFilterOpera
tions(style)); | 284 m_graphicsLayer->setBackdropFilters(owningLayer().computeBackdropFilterOpera
tions(style)); |
| 282 } | 285 } |
| 283 | 286 |
| 287 void CompositedLayerMapping::updateStickyConstraints(const ComputedStyle& style) |
| 288 { |
| 289 bool sticky = style.position() == EPosition::StickyPosition; |
| 290 const PaintLayer* ancestorOverflowLayer = m_owningLayer.ancestorOverflowLaye
r(); |
| 291 // TODO(flackr): Do we still need this? |
| 292 if (sticky) { |
| 293 if (!ancestorOverflowLayer->isRootLayer()) { |
| 294 sticky = ancestorOverflowLayer->needsCompositedScrolling(); |
| 295 } else { |
| 296 sticky = layoutObject()->view()->frameView()->isScrollable(); |
| 297 } |
| 298 } |
| 299 |
| 300 WebLayerStickyPositionConstraint webConstraint; |
| 301 if (sticky) { |
| 302 const StickyPositionScrollingConstraints& constraints = ancestorOverflow
Layer->getScrollableArea()->stickyConstraintsMap().get(&m_owningLayer); |
| 303 webConstraint.isSticky = true; |
| 304 webConstraint.isAnchoredLeft = constraints.anchorEdges() & StickyPositio
nScrollingConstraints::AnchorEdgeLeft; |
| 305 webConstraint.isAnchoredRight = constraints.anchorEdges() & StickyPositi
onScrollingConstraints::AnchorEdgeRight; |
| 306 webConstraint.isAnchoredTop = constraints.anchorEdges() & StickyPosition
ScrollingConstraints::AnchorEdgeTop; |
| 307 webConstraint.isAnchoredBottom = constraints.anchorEdges() & StickyPosit
ionScrollingConstraints::AnchorEdgeBottom; |
| 308 webConstraint.leftOffset = constraints.leftOffset(); |
| 309 webConstraint.rightOffset = constraints.rightOffset(); |
| 310 webConstraint.topOffset = constraints.topOffset(); |
| 311 webConstraint.bottomOffset = constraints.bottomOffset(); |
| 312 webConstraint.absoluteStickyBoxRect = enclosingIntRect(constraints.scrol
lContainerRelativeStickyBoxRect()); |
| 313 webConstraint.absoluteContainingBlockRect = enclosingIntRect(constraints
.scrollContainerRelativeContainingBlockRect()); |
| 314 } |
| 315 |
| 316 m_graphicsLayer->setStickyPositionConstraint(webConstraint); |
| 317 } |
| 318 |
| 284 void CompositedLayerMapping::updateLayerBlendMode(const ComputedStyle& style) | 319 void CompositedLayerMapping::updateLayerBlendMode(const ComputedStyle& style) |
| 285 { | 320 { |
| 286 setBlendMode(style.blendMode()); | 321 setBlendMode(style.blendMode()); |
| 287 } | 322 } |
| 288 | 323 |
| 289 void CompositedLayerMapping::updateIsRootForIsolatedGroup() | 324 void CompositedLayerMapping::updateIsRootForIsolatedGroup() |
| 290 { | 325 { |
| 291 bool isolate = m_owningLayer.shouldIsolateCompositedDescendants(); | 326 bool isolate = m_owningLayer.shouldIsolateCompositedDescendants(); |
| 292 | 327 |
| 293 // non stacking context layers should never isolate | 328 // non stacking context layers should never isolate |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 // Set opacity, if it is not animating. | 763 // Set opacity, if it is not animating. |
| 729 if (!layoutObject()->style()->isRunningOpacityAnimationOnCompositor()) | 764 if (!layoutObject()->style()->isRunningOpacityAnimationOnCompositor()) |
| 730 updateOpacity(layoutObject()->styleRef()); | 765 updateOpacity(layoutObject()->styleRef()); |
| 731 | 766 |
| 732 if (!layoutObject()->style()->isRunningFilterAnimationOnCompositor()) | 767 if (!layoutObject()->style()->isRunningFilterAnimationOnCompositor()) |
| 733 updateFilters(layoutObject()->styleRef()); | 768 updateFilters(layoutObject()->styleRef()); |
| 734 | 769 |
| 735 if (!layoutObject()->style()->isRunningBackdropFilterAnimationOnCompositor()
) | 770 if (!layoutObject()->style()->isRunningBackdropFilterAnimationOnCompositor()
) |
| 736 updateBackdropFilters(layoutObject()->styleRef()); | 771 updateBackdropFilters(layoutObject()->styleRef()); |
| 737 | 772 |
| 773 updateStickyConstraints(layoutObject()->styleRef()); |
| 774 |
| 738 // We compute everything relative to the enclosing compositing layer. | 775 // We compute everything relative to the enclosing compositing layer. |
| 739 IntRect ancestorCompositingBounds; | 776 IntRect ancestorCompositingBounds; |
| 740 if (compositingContainer) { | 777 if (compositingContainer) { |
| 741 ASSERT(compositingContainer->hasCompositedLayerMapping()); | 778 ASSERT(compositingContainer->hasCompositedLayerMapping()); |
| 742 ancestorCompositingBounds = compositingContainer->compositedLayerMapping
()->pixelSnappedCompositedBounds(); | 779 ancestorCompositingBounds = compositingContainer->compositedLayerMapping
()->pixelSnappedCompositedBounds(); |
| 743 } | 780 } |
| 744 | 781 |
| 745 IntRect localCompositingBounds; | 782 IntRect localCompositingBounds; |
| 746 IntRect relativeCompositingBounds; | 783 IntRect relativeCompositingBounds; |
| 747 LayoutPoint offsetFromCompositedAncestor; | 784 LayoutPoint offsetFromCompositedAncestor; |
| (...skipping 1956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2704 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2741 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
| 2705 name = "Scrolling Contents Layer"; | 2742 name = "Scrolling Contents Layer"; |
| 2706 } else { | 2743 } else { |
| 2707 ASSERT_NOT_REACHED(); | 2744 ASSERT_NOT_REACHED(); |
| 2708 } | 2745 } |
| 2709 | 2746 |
| 2710 return name; | 2747 return name; |
| 2711 } | 2748 } |
| 2712 | 2749 |
| 2713 } // namespace blink | 2750 } // namespace blink |
| OLD | NEW |