| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/paint/PrePaintTreeWalk.h" | 5 #include "core/paint/PrePaintTreeWalk.h" |
| 6 | 6 |
| 7 #include "core/dom/DocumentLifecycle.h" | 7 #include "core/dom/DocumentLifecycle.h" |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h" | 10 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 if (object.hasOverflowClip() || (paintLayer && paintLayer->isRootLayer())) { | 95 if (object.hasOverflowClip() || (paintLayer && paintLayer->isRootLayer())) { |
| 96 DCHECK(paintLayer); | 96 DCHECK(paintLayer); |
| 97 context.ancestorOverflowPaintLayer = paintLayer; | 97 context.ancestorOverflowPaintLayer = paintLayer; |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool PrePaintTreeWalk::walk(const LayoutObject& object, | 101 bool PrePaintTreeWalk::walk(const LayoutObject& object, |
| 102 const PrePaintTreeWalkContext& parentContext) { | 102 const PrePaintTreeWalkContext& parentContext) { |
| 103 PrePaintTreeWalkContext context(parentContext); | 103 PrePaintTreeWalkContext context(parentContext); |
| 104 | 104 |
| 105 // TODO(pdr): Ensure multi column works with incremental property tree | |
| 106 // construction. | |
| 107 if (object.isLayoutMultiColumnSpannerPlaceholder()) { | |
| 108 // Walk multi-column spanner as if it replaces the placeholder. | |
| 109 // Set the flag so that the tree builder can specially handle out-of-flow | |
| 110 // positioned descendants if their containers are between the multi-column | |
| 111 // container and the spanner. See PaintPropertyTreeBuilder for details. | |
| 112 context.treeBuilderContext.isUnderMultiColumnSpanner = true; | |
| 113 const auto& placeholder = toLayoutMultiColumnSpannerPlaceholder(object); | |
| 114 bool descendantsFullyUpdated = | |
| 115 walk(*placeholder.layoutObjectInFlowThread(), context); | |
| 116 if (descendantsFullyUpdated) { | |
| 117 // If descendants were not fully updated, do not clear flags. During the | |
| 118 // next PrePaintTreeWalk, these flags will be used again. | |
| 119 object.getMutableForPainting().clearPaintFlags(); | |
| 120 } | |
| 121 return descendantsFullyUpdated; | |
| 122 } | |
| 123 | |
| 124 // This must happen before updateContextForBoxPosition, because the | 105 // This must happen before updateContextForBoxPosition, because the |
| 125 // latter reads some of the state computed uere. | 106 // latter reads some of the state computed uere. |
| 126 updateAuxiliaryObjectProperties(object, context); | 107 updateAuxiliaryObjectProperties(object, context); |
| 127 | 108 |
| 128 // Ensure the current context takes into account the box's position. This can | 109 // Ensure the current context takes into account the box's position. This can |
| 129 // force a subtree update due to paint offset changes and must precede any | 110 // force a subtree update due to paint offset changes and must precede any |
| 130 // early out from the treewalk. | 111 // early out from the treewalk. |
| 131 LayoutPoint oldPaintOffset = object.paintOffset(); | 112 LayoutPoint oldPaintOffset = object.paintOffset(); |
| 132 m_propertyTreeBuilder.updateContextForBoxPosition(object, | 113 m_propertyTreeBuilder.updateContextForBoxPosition(object, |
| 133 context.treeBuilderContext); | 114 context.treeBuilderContext); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 147 m_propertyTreeBuilder.updatePropertiesForSelf(object, | 128 m_propertyTreeBuilder.updatePropertiesForSelf(object, |
| 148 context.treeBuilderContext); | 129 context.treeBuilderContext); |
| 149 m_paintInvalidator.invalidatePaintIfNeeded(object, oldPaintOffset, | 130 m_paintInvalidator.invalidatePaintIfNeeded(object, oldPaintOffset, |
| 150 context.paintInvalidatorContext); | 131 context.paintInvalidatorContext); |
| 151 m_propertyTreeBuilder.updatePropertiesForChildren(object, | 132 m_propertyTreeBuilder.updatePropertiesForChildren(object, |
| 152 context.treeBuilderContext); | 133 context.treeBuilderContext); |
| 153 | 134 |
| 154 bool descendantsFullyUpdated = true; | 135 bool descendantsFullyUpdated = true; |
| 155 for (const LayoutObject* child = object.slowFirstChild(); child; | 136 for (const LayoutObject* child = object.slowFirstChild(); child; |
| 156 child = child->nextSibling()) { | 137 child = child->nextSibling()) { |
| 157 // Column spanners are walked through their placeholders. See above. | 138 if (child->isLayoutMultiColumnSpannerPlaceholder()) { |
| 158 if (child->isColumnSpanAll()) | 139 child->getMutableForPainting().clearPaintFlags(); |
| 159 continue; | 140 continue; |
| 141 } |
| 160 bool childFullyUpdated = walk(*child, context); | 142 bool childFullyUpdated = walk(*child, context); |
| 161 if (!childFullyUpdated) | 143 if (!childFullyUpdated) |
| 162 descendantsFullyUpdated = false; | 144 descendantsFullyUpdated = false; |
| 163 } | 145 } |
| 164 | 146 |
| 165 if (object.isLayoutPart()) { | 147 if (object.isLayoutPart()) { |
| 166 const LayoutPart& layoutPart = toLayoutPart(object); | 148 const LayoutPart& layoutPart = toLayoutPart(object); |
| 167 Widget* widget = layoutPart.widget(); | 149 Widget* widget = layoutPart.widget(); |
| 168 if (widget && widget->isFrameView()) { | 150 if (widget && widget->isFrameView()) { |
| 169 context.treeBuilderContext.current.paintOffset += | 151 context.treeBuilderContext.current.paintOffset += |
| (...skipping 10 matching lines...) Expand all Loading... |
| 180 | 162 |
| 181 if (descendantsFullyUpdated) { | 163 if (descendantsFullyUpdated) { |
| 182 // If descendants were not updated, do not clear flags. During the next | 164 // If descendants were not updated, do not clear flags. During the next |
| 183 // PrePaintTreeWalk, these flags will be used again. | 165 // PrePaintTreeWalk, these flags will be used again. |
| 184 object.getMutableForPainting().clearPaintFlags(); | 166 object.getMutableForPainting().clearPaintFlags(); |
| 185 } | 167 } |
| 186 return descendantsFullyUpdated; | 168 return descendantsFullyUpdated; |
| 187 } | 169 } |
| 188 | 170 |
| 189 } // namespace blink | 171 } // namespace blink |
| OLD | NEW |