| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/layout/compositing/CompositingInputsUpdater.h" | 5 #include "core/layout/compositing/CompositingInputsUpdater.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/layout/LayoutBlock.h" | 9 #include "core/layout/LayoutBlock.h" |
| 10 #include "core/layout/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 137 |
| 138 if (layer->needsCompositingInputsUpdate()) { | 138 if (layer->needsCompositingInputsUpdate()) { |
| 139 if (info.enclosingCompositedLayer) | 139 if (info.enclosingCompositedLayer) |
| 140 info.enclosingCompositedLayer->compositedLayerMapping() | 140 info.enclosingCompositedLayer->compositedLayerMapping() |
| 141 ->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree); | 141 ->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree); |
| 142 updateType = ForceUpdate; | 142 updateType = ForceUpdate; |
| 143 } | 143 } |
| 144 | 144 |
| 145 if (updateType == ForceUpdate) { | 145 if (updateType == ForceUpdate) { |
| 146 PaintLayer::AncestorDependentCompositingInputs properties; | 146 PaintLayer::AncestorDependentCompositingInputs properties; |
| 147 PaintLayer::RareAncestorDependentCompositingInputs rareProperties; | |
| 148 | 147 |
| 149 if (!layer->isRootLayer()) { | 148 if (!layer->isRootLayer()) { |
| 150 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 149 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 151 properties.unclippedAbsoluteBoundingBox = | 150 properties.unclippedAbsoluteBoundingBox = |
| 152 enclosingIntRect(m_geometryMap.absoluteRect( | 151 enclosingIntRect(m_geometryMap.absoluteRect( |
| 153 FloatRect(layer->boundingBoxForCompositingOverlapTest()))); | 152 FloatRect(layer->boundingBoxForCompositingOverlapTest()))); |
| 154 // FIXME: Setting the absBounds to 1x1 instead of 0x0 makes very little | 153 // FIXME: Setting the absBounds to 1x1 instead of 0x0 makes very little |
| 155 // sense, but removing this code will make JSGameBench sad. | 154 // sense, but removing this code will make JSGameBench sad. |
| 156 // See https://codereview.chromium.org/13912020/ | 155 // See https://codereview.chromium.org/13912020/ |
| 157 if (properties.unclippedAbsoluteBoundingBox.isEmpty()) | 156 if (properties.unclippedAbsoluteBoundingBox.isEmpty()) |
| 158 properties.unclippedAbsoluteBoundingBox.setSize(IntSize(1, 1)); | 157 properties.unclippedAbsoluteBoundingBox.setSize(IntSize(1, 1)); |
| 159 | 158 |
| 160 IntRect clipRect = | 159 IntRect clipRect = |
| 161 pixelSnappedIntRect(layer->clipper() | 160 pixelSnappedIntRect(layer->clipper() |
| 162 .backgroundClipRect(ClipRectsContext( | 161 .backgroundClipRect(ClipRectsContext( |
| 163 m_rootLayer, AbsoluteClipRects)) | 162 m_rootLayer, AbsoluteClipRects)) |
| 164 .rect()); | 163 .rect()); |
| 165 properties.clippedAbsoluteBoundingBox = | 164 properties.clippedAbsoluteBoundingBox = |
| 166 properties.unclippedAbsoluteBoundingBox; | 165 properties.unclippedAbsoluteBoundingBox; |
| 167 properties.clippedAbsoluteBoundingBox.intersect(clipRect); | 166 properties.clippedAbsoluteBoundingBox.intersect(clipRect); |
| 168 } | 167 } |
| 169 | 168 |
| 170 const PaintLayer* parent = layer->parent(); | 169 const PaintLayer* parent = layer->parent(); |
| 171 rareProperties.opacityAncestor = | 170 properties.opacityAncestor = |
| 172 parent->isTransparent() ? parent : parent->opacityAncestor(); | 171 parent->isTransparent() ? parent : parent->opacityAncestor(); |
| 173 rareProperties.transformAncestor = | 172 properties.transformAncestor = |
| 174 parent->transform() ? parent : parent->transformAncestor(); | 173 parent->transform() ? parent : parent->transformAncestor(); |
| 175 rareProperties.filterAncestor = parent->hasFilterInducingProperty() | 174 properties.filterAncestor = parent->hasFilterInducingProperty() |
| 176 ? parent | 175 ? parent |
| 177 : parent->filterAncestor(); | 176 : parent->filterAncestor(); |
| 178 bool layerIsFixedPosition = | 177 bool layerIsFixedPosition = |
| 179 layer->layoutObject()->style()->position() == FixedPosition; | 178 layer->layoutObject()->style()->position() == FixedPosition; |
| 180 rareProperties.nearestFixedPositionLayer = | 179 properties.nearestFixedPositionLayer = |
| 181 layerIsFixedPosition ? layer : parent->nearestFixedPositionLayer(); | 180 layerIsFixedPosition ? layer : parent->nearestFixedPositionLayer(); |
| 182 | 181 |
| 183 if (info.hasAncestorWithClipRelatedProperty) { | 182 if (info.hasAncestorWithClipRelatedProperty) { |
| 184 const PaintLayer* parentLayerOnClippingContainerChain = | 183 const PaintLayer* parentLayerOnClippingContainerChain = |
| 185 findParentLayerOnClippingContainerChain(layer); | 184 findParentLayerOnClippingContainerChain(layer); |
| 186 const bool parentHasClipRelatedProperty = | 185 const bool parentHasClipRelatedProperty = |
| 187 parentLayerOnClippingContainerChain->layoutObject() | 186 parentLayerOnClippingContainerChain->layoutObject() |
| 188 ->hasClipRelatedProperty(); | 187 ->hasClipRelatedProperty(); |
| 189 properties.clippingContainer = | 188 properties.clippingContainer = |
| 190 parentHasClipRelatedProperty | 189 parentHasClipRelatedProperty |
| 191 ? parentLayerOnClippingContainerChain->layoutObject() | 190 ? parentLayerOnClippingContainerChain->layoutObject() |
| 192 : parentLayerOnClippingContainerChain->clippingContainer(); | 191 : parentLayerOnClippingContainerChain->clippingContainer(); |
| 193 | 192 |
| 194 if (layer->layoutObject()->isOutOfFlowPositioned() && | 193 if (layer->layoutObject()->isOutOfFlowPositioned() && |
| 195 !layer->subtreeIsInvisible()) { | 194 !layer->subtreeIsInvisible()) { |
| 196 const PaintLayer* clippingLayer = | 195 const PaintLayer* clippingLayer = |
| 197 properties.clippingContainer | 196 properties.clippingContainer |
| 198 ? properties.clippingContainer->enclosingLayer() | 197 ? properties.clippingContainer->enclosingLayer() |
| 199 : layer->compositor()->rootLayer(); | 198 : layer->compositor()->rootLayer(); |
| 200 if (hasClippedStackingAncestor(layer, clippingLayer)) | 199 if (hasClippedStackingAncestor(layer, clippingLayer)) |
| 201 rareProperties.clipParent = clippingLayer; | 200 properties.clipParent = clippingLayer; |
| 202 } | 201 } |
| 203 } | 202 } |
| 204 | 203 |
| 205 if (info.lastScrollingAncestor) { | 204 if (info.lastScrollingAncestor) { |
| 206 const LayoutObject* containingBlock = | 205 const LayoutObject* containingBlock = |
| 207 layer->layoutObject()->containingBlock(); | 206 layer->layoutObject()->containingBlock(); |
| 208 const PaintLayer* parentLayerOnContainingBlockChain = | 207 const PaintLayer* parentLayerOnContainingBlockChain = |
| 209 findParentLayerOnContainingBlockChain(containingBlock); | 208 findParentLayerOnContainingBlockChain(containingBlock); |
| 210 | 209 |
| 211 rareProperties.ancestorScrollingLayer = | 210 properties.ancestorScrollingLayer = |
| 212 parentLayerOnContainingBlockChain->ancestorScrollingLayer(); | 211 parentLayerOnContainingBlockChain->ancestorScrollingLayer(); |
| 213 if (parentLayerOnContainingBlockChain->scrollsOverflow()) | 212 if (parentLayerOnContainingBlockChain->scrollsOverflow()) |
| 214 rareProperties.ancestorScrollingLayer = | 213 properties.ancestorScrollingLayer = parentLayerOnContainingBlockChain; |
| 215 parentLayerOnContainingBlockChain; | |
| 216 | 214 |
| 217 if (layer->stackingNode()->isStacked() && | 215 if (layer->stackingNode()->isStacked() && |
| 218 rareProperties.ancestorScrollingLayer && | 216 properties.ancestorScrollingLayer && |
| 219 !info.ancestorStackingContext->layoutObject()->isDescendantOf( | 217 !info.ancestorStackingContext->layoutObject()->isDescendantOf( |
| 220 rareProperties.ancestorScrollingLayer->layoutObject())) | 218 properties.ancestorScrollingLayer->layoutObject())) |
| 221 rareProperties.scrollParent = rareProperties.ancestorScrollingLayer; | 219 properties.scrollParent = properties.ancestorScrollingLayer; |
| 222 } | 220 } |
| 223 } | 221 } |
| 224 | 222 |
| 225 layer->updateAncestorDependentCompositingInputs( | 223 layer->updateAncestorDependentCompositingInputs( |
| 226 properties, rareProperties, info.hasAncestorWithClipPath); | 224 properties, info.hasAncestorWithClipPath); |
| 227 } | 225 } |
| 228 | 226 |
| 229 if (layer->stackingNode()->isStackingContext()) | 227 if (layer->stackingNode()->isStackingContext()) |
| 230 info.ancestorStackingContext = layer; | 228 info.ancestorStackingContext = layer; |
| 231 | 229 |
| 232 if (layer->isRootLayer() || layer->layoutObject()->hasOverflowClip()) | 230 if (layer->isRootLayer() || layer->layoutObject()->hasOverflowClip()) |
| 233 info.lastOverflowClipLayer = layer; | 231 info.lastOverflowClipLayer = layer; |
| 234 | 232 |
| 235 if (layer->scrollsOverflow()) | 233 if (layer->scrollsOverflow()) |
| 236 info.lastScrollingAncestor = layer; | 234 info.lastScrollingAncestor = layer; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 ASSERT(!layer->needsCompositingInputsUpdate()); | 276 ASSERT(!layer->needsCompositingInputsUpdate()); |
| 279 | 277 |
| 280 for (PaintLayer* child = layer->firstChild(); child; | 278 for (PaintLayer* child = layer->firstChild(); child; |
| 281 child = child->nextSibling()) | 279 child = child->nextSibling()) |
| 282 assertNeedsCompositingInputsUpdateBitsCleared(child); | 280 assertNeedsCompositingInputsUpdateBitsCleared(child); |
| 283 } | 281 } |
| 284 | 282 |
| 285 #endif | 283 #endif |
| 286 | 284 |
| 287 } // namespace blink | 285 } // namespace blink |
| OLD | NEW |