Chromium Code Reviews| 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 26 matching lines...) Expand all Loading... | |
| 37 | 37 |
| 38 void PrePaintTreeWalk::walk(FrameView& frameView, | 38 void PrePaintTreeWalk::walk(FrameView& frameView, |
| 39 const PrePaintTreeWalkContext& context) { | 39 const PrePaintTreeWalkContext& context) { |
| 40 if (frameView.shouldThrottleRendering()) | 40 if (frameView.shouldThrottleRendering()) |
| 41 return; | 41 return; |
| 42 | 42 |
| 43 PrePaintTreeWalkContext localContext(context); | 43 PrePaintTreeWalkContext localContext(context); |
| 44 m_propertyTreeBuilder.updateFramePropertiesAndContext( | 44 m_propertyTreeBuilder.updateFramePropertiesAndContext( |
| 45 frameView, localContext.treeBuilderContext); | 45 frameView, localContext.treeBuilderContext); |
| 46 | 46 |
| 47 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { | 47 m_paintInvalidator.invalidatePaintIfNeeded( |
|
wkorman
2016/11/10 23:26:41
Is this change also enabling SP invalidation for a
Xianzhu
2016/11/10 23:35:47
The check was just redundant. The whole code is ex
| |
| 48 m_paintInvalidator.invalidatePaintIfNeeded( | 48 frameView, localContext.paintInvalidatorContext); |
| 49 frameView, localContext.paintInvalidatorContext); | |
| 50 } | |
| 51 | 49 |
| 52 if (LayoutView* layoutView = frameView.layoutView()) | 50 if (LayoutView* layoutView = frameView.layoutView()) |
| 53 walk(*layoutView, localContext); | 51 walk(*layoutView, localContext); |
| 54 | 52 |
| 55 #if DCHECK_IS_ON() | 53 #if DCHECK_IS_ON() |
| 56 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) | 54 frameView.layoutView()->assertSubtreeClearedPaintInvalidationFlags(); |
| 57 frameView.layoutView()->assertSubtreeClearedPaintInvalidationFlags(); | |
| 58 #endif | 55 #endif |
| 59 } | 56 } |
| 60 | 57 |
| 61 void PrePaintTreeWalk::walk(const LayoutObject& object, | 58 void PrePaintTreeWalk::walk(const LayoutObject& object, |
| 62 const PrePaintTreeWalkContext& context) { | 59 const PrePaintTreeWalkContext& context) { |
| 63 PrePaintTreeWalkContext localContext(context); | 60 PrePaintTreeWalkContext localContext(context); |
| 64 | 61 |
| 65 if (object.isLayoutMultiColumnSpannerPlaceholder()) { | 62 if (object.isLayoutMultiColumnSpannerPlaceholder()) { |
| 66 // Walk multi-column spanner as if it replaces the placeholder. | 63 // Walk multi-column spanner as if it replaces the placeholder. |
| 67 // Set the flag so that the tree builder can specially handle out-of-flow | 64 // Set the flag so that the tree builder can specially handle out-of-flow |
| 68 // positioned descendants if their containers are between the multi-column | 65 // positioned descendants if their containers are between the multi-column |
| 69 // container and the spanner. See PaintPropertyTreeBuilder for details. | 66 // container and the spanner. See PaintPropertyTreeBuilder for details. |
| 70 localContext.treeBuilderContext.isUnderMultiColumnSpanner = true; | 67 localContext.treeBuilderContext.isUnderMultiColumnSpanner = true; |
| 71 object.getMutableForPainting().clearPaintInvalidationFlags(); | |
| 72 walk(*toLayoutMultiColumnSpannerPlaceholder(object) | 68 walk(*toLayoutMultiColumnSpannerPlaceholder(object) |
| 73 .layoutObjectInFlowThread(), | 69 .layoutObjectInFlowThread(), |
| 74 localContext); | 70 localContext); |
| 71 object.getMutableForPainting().clearPaintInvalidationFlags(); | |
| 75 return; | 72 return; |
| 76 } | 73 } |
| 77 | 74 |
| 78 m_propertyTreeBuilder.updatePropertiesAndContextForSelf( | 75 m_propertyTreeBuilder.updatePropertiesAndContextForSelf( |
| 79 object, localContext.treeBuilderContext); | 76 object, localContext.treeBuilderContext); |
| 80 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) | 77 m_paintInvalidator.invalidatePaintIfNeeded( |
| 81 m_paintInvalidator.invalidatePaintIfNeeded( | 78 object, localContext.paintInvalidatorContext); |
| 82 object, localContext.paintInvalidatorContext); | |
| 83 m_propertyTreeBuilder.updatePropertiesAndContextForChildren( | 79 m_propertyTreeBuilder.updatePropertiesAndContextForChildren( |
| 84 object, localContext.treeBuilderContext); | 80 object, localContext.treeBuilderContext); |
| 85 | 81 |
| 86 for (const LayoutObject* child = object.slowFirstChild(); child; | 82 for (const LayoutObject* child = object.slowFirstChild(); child; |
| 87 child = child->nextSibling()) { | 83 child = child->nextSibling()) { |
| 88 // Column spanners are walked through their placeholders. See above. | 84 // Column spanners are walked through their placeholders. See above. |
| 89 if (child->isColumnSpanAll()) | 85 if (child->isColumnSpanAll()) |
| 90 continue; | 86 continue; |
| 91 walk(*child, localContext); | 87 walk(*child, localContext); |
| 92 } | 88 } |
| 93 | 89 |
| 94 if (object.isLayoutPart()) { | 90 if (object.isLayoutPart()) { |
| 95 const LayoutPart& layoutPart = toLayoutPart(object); | 91 const LayoutPart& layoutPart = toLayoutPart(object); |
| 96 Widget* widget = layoutPart.widget(); | 92 Widget* widget = layoutPart.widget(); |
| 97 if (widget && widget->isFrameView()) { | 93 if (widget && widget->isFrameView()) { |
| 98 localContext.treeBuilderContext.current.paintOffset += | 94 localContext.treeBuilderContext.current.paintOffset += |
| 99 layoutPart.replacedContentRect().location() - | 95 layoutPart.replacedContentRect().location() - |
| 100 widget->frameRect().location(); | 96 widget->frameRect().location(); |
| 101 localContext.treeBuilderContext.current.paintOffset = | 97 localContext.treeBuilderContext.current.paintOffset = |
| 102 roundedIntPoint(localContext.treeBuilderContext.current.paintOffset); | 98 roundedIntPoint(localContext.treeBuilderContext.current.paintOffset); |
| 103 walk(*toFrameView(widget), localContext); | 99 walk(*toFrameView(widget), localContext); |
| 104 } | 100 } |
| 105 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). | 101 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). |
| 106 } | 102 } |
| 103 object.getMutableForPainting().clearPaintInvalidationFlags(); | |
| 107 } | 104 } |
| 108 | 105 |
| 109 } // namespace blink | 106 } // namespace blink |
| OLD | NEW |