| 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 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 void CompositingInputsUpdater::update() { | 24 void CompositingInputsUpdater::update() { |
| 25 TRACE_EVENT0("blink", "CompositingInputsUpdater::update"); | 25 TRACE_EVENT0("blink", "CompositingInputsUpdater::update"); |
| 26 updateRecursive(m_rootLayer, DoNotForceUpdate, AncestorInfo()); | 26 updateRecursive(m_rootLayer, DoNotForceUpdate, AncestorInfo()); |
| 27 } | 27 } |
| 28 | 28 |
| 29 static const PaintLayer* findParentLayerOnClippingContainerChain( | 29 static const PaintLayer* findParentLayerOnClippingContainerChain( |
| 30 const PaintLayer* layer) { | 30 const PaintLayer* layer) { |
| 31 LayoutObject* current = layer->layoutObject(); | 31 LayoutObject* current = layer->layoutObject(); |
| 32 while (current) { | 32 while (current) { |
| 33 if (current->style()->position() == FixedPosition) { | 33 if (current->style()->position() == EPosition::kFixed) { |
| 34 for (current = current->parent(); | 34 for (current = current->parent(); |
| 35 current && !current->canContainFixedPositionObjects(); | 35 current && !current->canContainFixedPositionObjects(); |
| 36 current = current->parent()) { | 36 current = current->parent()) { |
| 37 // CSS clip applies to fixed position elements even for ancestors that | 37 // CSS clip applies to fixed position elements even for ancestors that |
| 38 // are not what the fixed element is positioned with respect to. | 38 // are not what the fixed element is positioned with respect to. |
| 39 if (current->hasClip()) { | 39 if (current->hasClip()) { |
| 40 DCHECK(current->hasLayer()); | 40 DCHECK(current->hasLayer()); |
| 41 return static_cast<const LayoutBoxModelObject*>(current)->layer(); | 41 return static_cast<const LayoutBoxModelObject*>(current)->layer(); |
| 42 } | 42 } |
| 43 } | 43 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 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() == StickyPosition) { | 104 layer->layoutObject()->style()->position() == EPosition::kSticky) { |
| 105 if (info.lastOverflowClipLayer != previousOverflowLayer && | 105 if (info.lastOverflowClipLayer != previousOverflowLayer && |
| 106 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 106 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 107 // Old ancestor scroller should no longer have these constraints. | 107 // Old ancestor scroller should no longer have these constraints. |
| 108 ASSERT(!previousOverflowLayer || | 108 ASSERT(!previousOverflowLayer || |
| 109 !previousOverflowLayer->getScrollableArea() | 109 !previousOverflowLayer->getScrollableArea() |
| 110 ->stickyConstraintsMap() | 110 ->stickyConstraintsMap() |
| 111 .contains(layer)); | 111 .contains(layer)); |
| 112 | 112 |
| 113 if (info.lastOverflowClipLayer->isRootLayer()) | 113 if (info.lastOverflowClipLayer->isRootLayer()) |
| 114 layer->layoutObject() | 114 layer->layoutObject() |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 const PaintLayer* parent = layer->parent(); | 170 const PaintLayer* parent = layer->parent(); |
| 171 properties.opacityAncestor = | 171 properties.opacityAncestor = |
| 172 parent->isTransparent() ? parent : parent->opacityAncestor(); | 172 parent->isTransparent() ? parent : parent->opacityAncestor(); |
| 173 properties.transformAncestor = | 173 properties.transformAncestor = |
| 174 parent->transform() ? parent : parent->transformAncestor(); | 174 parent->transform() ? parent : parent->transformAncestor(); |
| 175 properties.filterAncestor = parent->hasFilterInducingProperty() | 175 properties.filterAncestor = parent->hasFilterInducingProperty() |
| 176 ? parent | 176 ? parent |
| 177 : parent->filterAncestor(); | 177 : parent->filterAncestor(); |
| 178 bool layerIsFixedPosition = | 178 bool layerIsFixedPosition = |
| 179 layer->layoutObject()->style()->position() == FixedPosition; | 179 layer->layoutObject()->style()->position() == EPosition::kFixed; |
| 180 properties.nearestFixedPositionLayer = | 180 properties.nearestFixedPositionLayer = |
| 181 layerIsFixedPosition ? layer : parent->nearestFixedPositionLayer(); | 181 layerIsFixedPosition ? layer : parent->nearestFixedPositionLayer(); |
| 182 | 182 |
| 183 if (info.hasAncestorWithClipRelatedProperty) { | 183 if (info.hasAncestorWithClipRelatedProperty) { |
| 184 const PaintLayer* parentLayerOnClippingContainerChain = | 184 const PaintLayer* parentLayerOnClippingContainerChain = |
| 185 findParentLayerOnClippingContainerChain(layer); | 185 findParentLayerOnClippingContainerChain(layer); |
| 186 const bool parentHasClipRelatedProperty = | 186 const bool parentHasClipRelatedProperty = |
| 187 parentLayerOnClippingContainerChain->layoutObject() | 187 parentLayerOnClippingContainerChain->layoutObject() |
| 188 ->hasClipRelatedProperty(); | 188 ->hasClipRelatedProperty(); |
| 189 properties.clippingContainer = | 189 properties.clippingContainer = |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 ASSERT(!layer->needsCompositingInputsUpdate()); | 268 ASSERT(!layer->needsCompositingInputsUpdate()); |
| 269 | 269 |
| 270 for (PaintLayer* child = layer->firstChild(); child; | 270 for (PaintLayer* child = layer->firstChild(); child; |
| 271 child = child->nextSibling()) | 271 child = child->nextSibling()) |
| 272 assertNeedsCompositingInputsUpdateBitsCleared(child); | 272 assertNeedsCompositingInputsUpdateBitsCleared(child); |
| 273 } | 273 } |
| 274 | 274 |
| 275 #endif | 275 #endif |
| 276 | 276 |
| 277 } // namespace blink | 277 } // namespace blink |
| OLD | NEW |