| 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/FrameHost.h" | 8 #include "core/frame/FrameHost.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/layout/LayoutBlock.h" | 10 #include "core/layout/LayoutBlock.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 void CompositingInputsUpdater::updateRecursive(PaintLayer* layer, | 95 void CompositingInputsUpdater::updateRecursive(PaintLayer* layer, |
| 96 UpdateType updateType, | 96 UpdateType updateType, |
| 97 AncestorInfo info) { | 97 AncestorInfo info) { |
| 98 if (!layer->childNeedsCompositingInputsUpdate() && updateType != ForceUpdate) | 98 if (!layer->childNeedsCompositingInputsUpdate() && updateType != ForceUpdate) |
| 99 return; | 99 return; |
| 100 | 100 |
| 101 const PaintLayer* previousOverflowLayer = layer->ancestorOverflowLayer(); | 101 const PaintLayer* previousOverflowLayer = layer->ancestorOverflowLayer(); |
| 102 layer->updateAncestorOverflowLayer(info.lastOverflowClipLayer); | 102 layer->updateAncestorOverflowLayer(info.lastOverflowClipLayer); |
| 103 if (info.lastOverflowClipLayer && layer->needsCompositingInputsUpdate() && | 103 if (info.lastOverflowClipLayer && layer->needsCompositingInputsUpdate() && |
| 104 layer->layoutObject().style()->position() == EPosition::kSticky) { | 104 layer->layoutObject().style()->position() == EPosition::kSticky) { |
| 105 if (info.lastOverflowClipLayer != previousOverflowLayer && | 105 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 106 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 106 if (info.lastOverflowClipLayer != previousOverflowLayer) { |
| 107 // Old ancestor scroller should no longer have these constraints. | 107 // Old ancestor scroller should no longer have these constraints. |
| 108 ASSERT(!previousOverflowLayer || | 108 DCHECK(!previousOverflowLayer || |
| 109 !previousOverflowLayer->getScrollableArea() | 109 !previousOverflowLayer->getScrollableArea() |
| 110 ->stickyConstraintsMap() | 110 ->stickyConstraintsMap() |
| 111 .contains(layer)); | 111 .contains(layer)); |
| 112 |
| 113 // If our ancestor scroller has changed and the previous one was the |
| 114 // root layer, we are no longer viewport constrained. |
| 115 if (previousOverflowLayer && previousOverflowLayer->isRootLayer()) { |
| 116 layer->layoutObject() |
| 117 .view() |
| 118 ->frameView() |
| 119 ->removeViewportConstrainedObject(layer->layoutObject()); |
| 120 } |
| 121 } |
| 112 | 122 |
| 113 if (info.lastOverflowClipLayer->isRootLayer()) { | 123 if (info.lastOverflowClipLayer->isRootLayer()) { |
| 114 layer->layoutObject().view()->frameView()->addViewportConstrainedObject( | 124 layer->layoutObject().view()->frameView()->addViewportConstrainedObject( |
| 115 layer->layoutObject()); | 125 layer->layoutObject()); |
| 116 } else if (previousOverflowLayer && | |
| 117 previousOverflowLayer->isRootLayer()) { | |
| 118 layer->layoutObject() | |
| 119 .view() | |
| 120 ->frameView() | |
| 121 ->removeViewportConstrainedObject(layer->layoutObject()); | |
| 122 } | 126 } |
| 123 } | 127 } |
| 124 layer->layoutObject().updateStickyPositionConstraints(); | 128 layer->layoutObject().updateStickyPositionConstraints(); |
| 125 | 129 |
| 126 // Sticky position constraints and ancestor overflow scroller affect | 130 // Sticky position constraints and ancestor overflow scroller affect |
| 127 // the sticky layer position, so we need to update it again here. | 131 // the sticky layer position, so we need to update it again here. |
| 128 // TODO(flackr): This should be refactored in the future to be clearer | 132 // TODO(flackr): This should be refactored in the future to be clearer |
| 129 // (i.e. update layer position and ancestor inputs updates in the | 133 // (i.e. update layer position and ancestor inputs updates in the |
| 130 // same walk) | 134 // same walk) |
| 131 layer->updateLayerPosition(); | 135 layer->updateLayerPosition(); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 ASSERT(!layer->needsCompositingInputsUpdate()); | 272 ASSERT(!layer->needsCompositingInputsUpdate()); |
| 269 | 273 |
| 270 for (PaintLayer* child = layer->firstChild(); child; | 274 for (PaintLayer* child = layer->firstChild(); child; |
| 271 child = child->nextSibling()) | 275 child = child->nextSibling()) |
| 272 assertNeedsCompositingInputsUpdateBitsCleared(child); | 276 assertNeedsCompositingInputsUpdateBitsCleared(child); |
| 273 } | 277 } |
| 274 | 278 |
| 275 #endif | 279 #endif |
| 276 | 280 |
| 277 } // namespace blink | 281 } // namespace blink |
| OLD | NEW |