| 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 16 matching lines...) Expand all Loading... |
| 27 PaintPropertyTreeBuilderContext treeBuilderContext; | 27 PaintPropertyTreeBuilderContext treeBuilderContext; |
| 28 PaintInvalidatorContext paintInvalidatorContext; | 28 PaintInvalidatorContext paintInvalidatorContext; |
| 29 | 29 |
| 30 // The ancestor in the PaintLayer tree which has overflow clip, or | 30 // The ancestor in the PaintLayer tree which has overflow clip, or |
| 31 // is the root layer. Note that it is tree ancestor, not containing | 31 // is the root layer. Note that it is tree ancestor, not containing |
| 32 // block or stacking ancestor. | 32 // block or stacking ancestor. |
| 33 PaintLayer* ancestorOverflowPaintLayer; | 33 PaintLayer* ancestorOverflowPaintLayer; |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 void PrePaintTreeWalk::walk(FrameView& rootFrame) { | 36 void PrePaintTreeWalk::walk(FrameView& rootFrame) { |
| 37 //LOG(INFO) << "sizeOf(PrePaintTreeWalkContext): " << sizeof(PrePaintTreeWalkC
ontext); |
| 38 //LOG(INFO) << "sizeOf(PaintPropertyTreeBuilderContext): " << sizeof(PaintProp
ertyTreeBuilderContext); |
| 39 //LOG(INFO) << "sizeOf(PaintInvalidatorContext): " << sizeof(PaintInvalidatorC
ontext); |
| 40 //LOG(INFO) << "sizeOf(PaintLayer*): " << sizeof(PaintLayer*); |
| 41 |
| 37 DCHECK(rootFrame.frame().document()->lifecycle().state() == | 42 DCHECK(rootFrame.frame().document()->lifecycle().state() == |
| 38 DocumentLifecycle::InPrePaint); | 43 DocumentLifecycle::InPrePaint); |
| 39 | 44 |
| 40 PrePaintTreeWalkContext initialContext; | 45 PrePaintTreeWalkContext initialContext; |
| 41 initialContext.treeBuilderContext = | 46 initialContext.treeBuilderContext = |
| 42 m_propertyTreeBuilder.setupInitialContext(); | 47 m_propertyTreeBuilder.setupInitialContext(); |
| 43 walk(rootFrame, initialContext); | 48 walk(rootFrame, initialContext); |
| 44 m_paintInvalidator.processPendingDelayedPaintInvalidations(); | 49 m_paintInvalidator.processPendingDelayedPaintInvalidations(); |
| 45 } | 50 } |
| 46 | 51 |
| 47 bool PrePaintTreeWalk::walk(FrameView& frameView, | 52 bool PrePaintTreeWalk::walk(FrameView& frameView, |
| 48 const PrePaintTreeWalkContext& parentContext) { | 53 PrePaintTreeWalkContext& context) { |
| 49 if (frameView.shouldThrottleRendering()) { | 54 if (frameView.shouldThrottleRendering()) { |
| 50 // The walk was interrupted by throttled rendering so this subtree was not | 55 // The walk was interrupted by throttled rendering so this subtree was not |
| 51 // fully updated. | 56 // fully updated. |
| 52 return false; | 57 return false; |
| 53 } | 58 } |
| 54 | 59 |
| 55 PrePaintTreeWalkContext context(parentContext); | 60 //PrePaintTreeWalkContext context(parentContext); |
| 56 m_propertyTreeBuilder.updateProperties(frameView, context.treeBuilderContext); | 61 m_propertyTreeBuilder.updateProperties(frameView, context.treeBuilderContext); |
| 57 m_paintInvalidator.invalidatePaintIfNeeded(frameView, | 62 m_paintInvalidator.invalidatePaintIfNeeded(frameView, |
| 58 context.paintInvalidatorContext); | 63 context.paintInvalidatorContext); |
| 59 | 64 |
| 60 LayoutView* view = frameView.layoutView(); | 65 LayoutView* view = frameView.layoutView(); |
| 61 bool descendantsFullyUpdated = view ? walk(*view, context) : true; | 66 bool descendantsFullyUpdated = view ? walk(*view, context) : true; |
| 62 if (descendantsFullyUpdated) { | 67 if (descendantsFullyUpdated) { |
| 63 #if DCHECK_IS_ON() | 68 #if DCHECK_IS_ON() |
| 64 frameView.layoutView()->assertSubtreeClearedPaintInvalidationFlags(); | 69 frameView.layoutView()->assertSubtreeClearedPaintInvalidationFlags(); |
| 65 #endif | 70 #endif |
| (...skipping 26 matching lines...) Expand all Loading... |
| 92 paintLayer->updateLayerPosition(); | 97 paintLayer->updateLayerPosition(); |
| 93 } | 98 } |
| 94 | 99 |
| 95 if (object.hasOverflowClip() || (paintLayer && paintLayer->isRootLayer())) { | 100 if (object.hasOverflowClip() || (paintLayer && paintLayer->isRootLayer())) { |
| 96 DCHECK(paintLayer); | 101 DCHECK(paintLayer); |
| 97 context.ancestorOverflowPaintLayer = paintLayer; | 102 context.ancestorOverflowPaintLayer = paintLayer; |
| 98 } | 103 } |
| 99 } | 104 } |
| 100 | 105 |
| 101 bool PrePaintTreeWalk::walk(const LayoutObject& object, | 106 bool PrePaintTreeWalk::walk(const LayoutObject& object, |
| 102 const PrePaintTreeWalkContext& parentContext) { | 107 PrePaintTreeWalkContext& context) { |
| 103 PrePaintTreeWalkContext context(parentContext); | 108 //PrePaintTreeWalkContext context(parentContext); |
| 104 | 109 |
| 105 // This must happen before updateContextForBoxPosition, because the | 110 // This must happen before updateContextForBoxPosition, because the |
| 106 // latter reads some of the state computed uere. | 111 // latter reads some of the state computed uere. |
| 107 updateAuxiliaryObjectProperties(object, context); | 112 updateAuxiliaryObjectProperties(object, context); |
| 108 | 113 |
| 109 // Ensure the current context takes into account the box's position. This can | 114 // Ensure the current context takes into account the box's position. This can |
| 110 // force a subtree update due to paint offset changes and must precede any | 115 // force a subtree update due to paint offset changes and must precede any |
| 111 // early out from the treewalk. | 116 // early out from the treewalk. |
| 112 LayoutPoint oldPaintOffset = object.paintOffset(); | 117 LayoutPoint oldPaintOffset = object.paintOffset(); |
| 113 m_propertyTreeBuilder.updateContextForBoxPosition(object, | 118 m_propertyTreeBuilder.updateContextForBoxPosition(object, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 167 |
| 163 if (descendantsFullyUpdated) { | 168 if (descendantsFullyUpdated) { |
| 164 // If descendants were not updated, do not clear flags. During the next | 169 // If descendants were not updated, do not clear flags. During the next |
| 165 // PrePaintTreeWalk, these flags will be used again. | 170 // PrePaintTreeWalk, these flags will be used again. |
| 166 object.getMutableForPainting().clearPaintFlags(); | 171 object.getMutableForPainting().clearPaintFlags(); |
| 167 } | 172 } |
| 168 return descendantsFullyUpdated; | 173 return descendantsFullyUpdated; |
| 169 } | 174 } |
| 170 | 175 |
| 171 } // namespace blink | 176 } // namespace blink |
| OLD | NEW |