| 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/frame/FrameView.h" |
| 7 #include "core/layout/LayoutBlock.h" | 8 #include "core/layout/LayoutBlock.h" |
| 9 #include "core/layout/LayoutView.h" |
| 8 #include "core/layout/compositing/CompositedLayerMapping.h" | 10 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 9 #include "core/layout/compositing/PaintLayerCompositor.h" | 11 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 10 #include "core/paint/PaintLayer.h" | 12 #include "core/paint/PaintLayer.h" |
| 11 #include "platform/TraceEvent.h" | 13 #include "platform/TraceEvent.h" |
| 12 | 14 |
| 13 namespace blink { | 15 namespace blink { |
| 14 | 16 |
| 15 CompositingInputsUpdater::CompositingInputsUpdater(PaintLayer* rootLayer) | 17 CompositingInputsUpdater::CompositingInputsUpdater(PaintLayer* rootLayer) |
| 16 : m_geometryMap(UseTransforms) | 18 : m_geometryMap(UseTransforms) |
| 17 , m_rootLayer(rootLayer) | 19 , m_rootLayer(rootLayer) |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 92 } |
| 91 } | 93 } |
| 92 return false; | 94 return false; |
| 93 } | 95 } |
| 94 | 96 |
| 95 void CompositingInputsUpdater::updateRecursive(PaintLayer* layer, UpdateType upd
ateType, AncestorInfo info) | 97 void CompositingInputsUpdater::updateRecursive(PaintLayer* layer, UpdateType upd
ateType, AncestorInfo info) |
| 96 { | 98 { |
| 97 if (!layer->childNeedsCompositingInputsUpdate() && updateType != ForceUpdate
) | 99 if (!layer->childNeedsCompositingInputsUpdate() && updateType != ForceUpdate
) |
| 98 return; | 100 return; |
| 99 | 101 |
| 102 const PaintLayer* previousOverflowLayer = layer->ancestorOverflowLayer(); |
| 103 layer->updateAncestorOverflowLayer(info.lastOverflowClipLayer); |
| 104 if (info.lastOverflowClipLayer && layer->needsCompositingInputsUpdate() && l
ayer->layoutObject()->style()->position() == StickyPosition) { |
| 105 if (info.lastOverflowClipLayer != previousOverflowLayer) { |
| 106 // Old ancestor scroller should no longer have these constraints. |
| 107 ASSERT(!previousOverflowLayer || !previousOverflowLayer->getScrollab
leArea()->stickyConstraintsMap().contains(layer)); |
| 108 |
| 109 if (info.lastOverflowClipLayer->isRootLayer()) |
| 110 layer->layoutObject()->view()->frameView()->addViewportConstrain
edObject(layer->layoutObject()); |
| 111 else if (previousOverflowLayer && previousOverflowLayer->isRootLayer
()) |
| 112 layer->layoutObject()->view()->frameView()->removeViewportConstr
ainedObject(layer->layoutObject()); |
| 113 } |
| 114 layer->layoutObject()->updateStickyPositionConstraints(); |
| 115 |
| 116 // Sticky position constraints and ancestor overflow scroller affect |
| 117 // the sticky layer position, so we need to update it again here. |
| 118 // TODO(flackr): This should be refactored in the future to be clearer |
| 119 // (i.e. update layer position and ancestor inputs updates in the |
| 120 // same walk) |
| 121 layer->updateLayerPosition(); |
| 122 } |
| 123 |
| 100 m_geometryMap.pushMappingsToAncestor(layer, layer->parent()); | 124 m_geometryMap.pushMappingsToAncestor(layer, layer->parent()); |
| 101 | 125 |
| 102 if (layer->hasCompositedLayerMapping()) | 126 if (layer->hasCompositedLayerMapping()) |
| 103 info.enclosingCompositedLayer = layer; | 127 info.enclosingCompositedLayer = layer; |
| 104 | 128 |
| 105 if (layer->needsCompositingInputsUpdate()) { | 129 if (layer->needsCompositingInputsUpdate()) { |
| 106 if (info.enclosingCompositedLayer) | 130 if (info.enclosingCompositedLayer) |
| 107 info.enclosingCompositedLayer->compositedLayerMapping()->setNeedsGra
phicsLayerUpdate(GraphicsLayerUpdateSubtree); | 131 info.enclosingCompositedLayer->compositedLayerMapping()->setNeedsGra
phicsLayerUpdate(GraphicsLayerUpdateSubtree); |
| 108 updateType = ForceUpdate; | 132 updateType = ForceUpdate; |
| 109 } | 133 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 rareProperties.scrollParent = rareProperties.ancestorScrolli
ngLayer; | 180 rareProperties.scrollParent = rareProperties.ancestorScrolli
ngLayer; |
| 157 } | 181 } |
| 158 } | 182 } |
| 159 | 183 |
| 160 layer->updateAncestorDependentCompositingInputs(properties, rareProperti
es, info.hasAncestorWithClipPath); | 184 layer->updateAncestorDependentCompositingInputs(properties, rareProperti
es, info.hasAncestorWithClipPath); |
| 161 } | 185 } |
| 162 | 186 |
| 163 if (layer->stackingNode()->isStackingContext()) | 187 if (layer->stackingNode()->isStackingContext()) |
| 164 info.ancestorStackingContext = layer; | 188 info.ancestorStackingContext = layer; |
| 165 | 189 |
| 190 if (layer->isRootLayer() || layer->layoutObject()->hasOverflowClip()) |
| 191 info.lastOverflowClipLayer = layer; |
| 192 |
| 166 if (layer->scrollsOverflow()) | 193 if (layer->scrollsOverflow()) |
| 167 info.lastScrollingAncestor = layer; | 194 info.lastScrollingAncestor = layer; |
| 168 | 195 |
| 169 if (layer->layoutObject()->hasClipRelatedProperty()) | 196 if (layer->layoutObject()->hasClipRelatedProperty()) |
| 170 info.hasAncestorWithClipRelatedProperty = true; | 197 info.hasAncestorWithClipRelatedProperty = true; |
| 171 | 198 |
| 172 if (layer->layoutObject()->hasClipPath()) | 199 if (layer->layoutObject()->hasClipPath()) |
| 173 info.hasAncestorWithClipPath = true; | 200 info.hasAncestorWithClipPath = true; |
| 174 | 201 |
| 175 bool hasDescendantWithClipPath = false; | 202 bool hasDescendantWithClipPath = false; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 194 ASSERT(!layer->childNeedsCompositingInputsUpdate()); | 221 ASSERT(!layer->childNeedsCompositingInputsUpdate()); |
| 195 ASSERT(!layer->needsCompositingInputsUpdate()); | 222 ASSERT(!layer->needsCompositingInputsUpdate()); |
| 196 | 223 |
| 197 for (PaintLayer* child = layer->firstChild(); child; child = child->nextSibl
ing()) | 224 for (PaintLayer* child = layer->firstChild(); child; child = child->nextSibl
ing()) |
| 198 assertNeedsCompositingInputsUpdateBitsCleared(child); | 225 assertNeedsCompositingInputsUpdateBitsCleared(child); |
| 199 } | 226 } |
| 200 | 227 |
| 201 #endif | 228 #endif |
| 202 | 229 |
| 203 } // namespace blink | 230 } // namespace blink |
| OLD | NEW |