| 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" | |
| 8 #include "core/layout/LayoutBlock.h" | 7 #include "core/layout/LayoutBlock.h" |
| 9 #include "core/layout/LayoutView.h" | |
| 10 #include "core/layout/compositing/CompositedLayerMapping.h" | 8 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 11 #include "core/layout/compositing/PaintLayerCompositor.h" | 9 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 12 #include "core/paint/PaintLayer.h" | 10 #include "core/paint/PaintLayer.h" |
| 13 #include "platform/TraceEvent.h" | 11 #include "platform/TraceEvent.h" |
| 14 | 12 |
| 15 namespace blink { | 13 namespace blink { |
| 16 | 14 |
| 17 CompositingInputsUpdater::CompositingInputsUpdater(PaintLayer* rootLayer) | 15 CompositingInputsUpdater::CompositingInputsUpdater(PaintLayer* rootLayer) |
| 18 : m_geometryMap(UseTransforms) | 16 : m_geometryMap(UseTransforms) |
| 19 , m_rootLayer(rootLayer) | 17 , m_rootLayer(rootLayer) |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } | 90 } |
| 93 } | 91 } |
| 94 return false; | 92 return false; |
| 95 } | 93 } |
| 96 | 94 |
| 97 void CompositingInputsUpdater::updateRecursive(PaintLayer* layer, UpdateType upd
ateType, AncestorInfo info) | 95 void CompositingInputsUpdater::updateRecursive(PaintLayer* layer, UpdateType upd
ateType, AncestorInfo info) |
| 98 { | 96 { |
| 99 if (!layer->childNeedsCompositingInputsUpdate() && updateType != ForceUpdate
) | 97 if (!layer->childNeedsCompositingInputsUpdate() && updateType != ForceUpdate
) |
| 100 return; | 98 return; |
| 101 | 99 |
| 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 | |
| 124 m_geometryMap.pushMappingsToAncestor(layer, layer->parent()); | 100 m_geometryMap.pushMappingsToAncestor(layer, layer->parent()); |
| 125 | 101 |
| 126 if (layer->hasCompositedLayerMapping()) | 102 if (layer->hasCompositedLayerMapping()) |
| 127 info.enclosingCompositedLayer = layer; | 103 info.enclosingCompositedLayer = layer; |
| 128 | 104 |
| 129 if (layer->needsCompositingInputsUpdate()) { | 105 if (layer->needsCompositingInputsUpdate()) { |
| 130 if (info.enclosingCompositedLayer) | 106 if (info.enclosingCompositedLayer) |
| 131 info.enclosingCompositedLayer->compositedLayerMapping()->setNeedsGra
phicsLayerUpdate(GraphicsLayerUpdateSubtree); | 107 info.enclosingCompositedLayer->compositedLayerMapping()->setNeedsGra
phicsLayerUpdate(GraphicsLayerUpdateSubtree); |
| 132 updateType = ForceUpdate; | 108 updateType = ForceUpdate; |
| 133 } | 109 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 rareProperties.scrollParent = rareProperties.ancestorScrolli
ngLayer; | 156 rareProperties.scrollParent = rareProperties.ancestorScrolli
ngLayer; |
| 181 } | 157 } |
| 182 } | 158 } |
| 183 | 159 |
| 184 layer->updateAncestorDependentCompositingInputs(properties, rareProperti
es, info.hasAncestorWithClipPath); | 160 layer->updateAncestorDependentCompositingInputs(properties, rareProperti
es, info.hasAncestorWithClipPath); |
| 185 } | 161 } |
| 186 | 162 |
| 187 if (layer->stackingNode()->isStackingContext()) | 163 if (layer->stackingNode()->isStackingContext()) |
| 188 info.ancestorStackingContext = layer; | 164 info.ancestorStackingContext = layer; |
| 189 | 165 |
| 190 if (layer->isRootLayer() || layer->layoutObject()->hasOverflowClip()) | |
| 191 info.lastOverflowClipLayer = layer; | |
| 192 | |
| 193 if (layer->scrollsOverflow()) | 166 if (layer->scrollsOverflow()) |
| 194 info.lastScrollingAncestor = layer; | 167 info.lastScrollingAncestor = layer; |
| 195 | 168 |
| 196 if (layer->layoutObject()->hasClipRelatedProperty()) | 169 if (layer->layoutObject()->hasClipRelatedProperty()) |
| 197 info.hasAncestorWithClipRelatedProperty = true; | 170 info.hasAncestorWithClipRelatedProperty = true; |
| 198 | 171 |
| 199 if (layer->layoutObject()->hasClipPath()) | 172 if (layer->layoutObject()->hasClipPath()) |
| 200 info.hasAncestorWithClipPath = true; | 173 info.hasAncestorWithClipPath = true; |
| 201 | 174 |
| 202 bool hasDescendantWithClipPath = false; | 175 bool hasDescendantWithClipPath = false; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 221 ASSERT(!layer->childNeedsCompositingInputsUpdate()); | 194 ASSERT(!layer->childNeedsCompositingInputsUpdate()); |
| 222 ASSERT(!layer->needsCompositingInputsUpdate()); | 195 ASSERT(!layer->needsCompositingInputsUpdate()); |
| 223 | 196 |
| 224 for (PaintLayer* child = layer->firstChild(); child; child = child->nextSibl
ing()) | 197 for (PaintLayer* child = layer->firstChild(); child; child = child->nextSibl
ing()) |
| 225 assertNeedsCompositingInputsUpdateBitsCleared(child); | 198 assertNeedsCompositingInputsUpdateBitsCleared(child); |
| 226 } | 199 } |
| 227 | 200 |
| 228 #endif | 201 #endif |
| 229 | 202 |
| 230 } // namespace blink | 203 } // namespace blink |
| OLD | NEW |