| 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 19 matching lines...) Expand all Loading... |
| 30 PaintPropertyTreeBuilderContext treeBuilderContext; | 30 PaintPropertyTreeBuilderContext treeBuilderContext; |
| 31 PaintInvalidatorContext paintInvalidatorContext; | 31 PaintInvalidatorContext paintInvalidatorContext; |
| 32 | 32 |
| 33 // The ancestor in the PaintLayer tree which has overflow clip, or | 33 // The ancestor in the PaintLayer tree which has overflow clip, or |
| 34 // is the root layer. Note that it is tree ancestor, not containing | 34 // is the root layer. Note that it is tree ancestor, not containing |
| 35 // block or stacking ancestor. | 35 // block or stacking ancestor. |
| 36 PaintLayer* ancestorOverflowPaintLayer; | 36 PaintLayer* ancestorOverflowPaintLayer; |
| 37 PaintLayer* ancestorTransformedOrRootPaintLayer; | 37 PaintLayer* ancestorTransformedOrRootPaintLayer; |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 struct TreeStats { |
| 41 int frames; |
| 42 int layoutObjects; |
| 43 int objectPaintProps; |
| 44 |
| 45 // Specific property counts |
| 46 int paintOffsetTranslation; |
| 47 int transform; |
| 48 int effect; |
| 49 int filter; |
| 50 int mask; |
| 51 int maskClip; |
| 52 int cssClip; |
| 53 int cssClipFixedPosition; |
| 54 int innerBorderRadiusClip; |
| 55 int overflowClip; |
| 56 int perspective; |
| 57 int svgLocalToBorderBoxTransform; |
| 58 int scrollTranslation; |
| 59 int scrollbarPaintOffset; |
| 60 int localBorderBoxProperties; |
| 61 int contentsProperties; |
| 62 }; |
| 63 |
| 64 void PrePaintTreeWalk::printStats(const FrameView& rootFrame) |
| 65 { |
| 66 TreeStats stats = {}; |
| 67 countStats(stats, rootFrame); |
| 68 LOG(ERROR) << "stats--------"; |
| 69 LOG(ERROR) << "stats.frames: " << stats.frames; |
| 70 LOG(ERROR) << "stats.layoutObjects: " << stats.layoutObjects; |
| 71 LOG(ERROR) << "stats.objectPaintProps: " << stats.objectPaintProps; |
| 72 LOG(ERROR) << " paintOffsetTranslation: " << stats.paintOffsetTranslation; |
| 73 LOG(ERROR) << " transform: " << stats.transform; |
| 74 LOG(ERROR) << " effect: " << stats.effect; |
| 75 LOG(ERROR) << " filter: " << stats.filter; |
| 76 LOG(ERROR) << " mask: " << stats.mask; |
| 77 LOG(ERROR) << " maskClip: " << stats.maskClip; |
| 78 LOG(ERROR) << " cssClip: " << stats.cssClip; |
| 79 LOG(ERROR) << " cssClipFixedPosition: " << stats.cssClipFixedPosition; |
| 80 LOG(ERROR) << " innerBorderRadiusClip: " << stats.innerBorderRadiusClip; |
| 81 LOG(ERROR) << " overflowClip: " << stats.overflowClip; |
| 82 LOG(ERROR) << " perspective: " << stats.perspective; |
| 83 LOG(ERROR) << " svgLocalToBorderBoxTransform: " << stats.svgLocalToBorderBoxT
ransform; |
| 84 LOG(ERROR) << " scrollTranslation: " << stats.scrollTranslation; |
| 85 LOG(ERROR) << " scrollbarPaintOffset: " << stats.scrollbarPaintOffset; |
| 86 LOG(ERROR) << " localBorderBoxProperties: " << stats.localBorderBoxProperties
; |
| 87 LOG(ERROR) << " contentsProperties: " << stats.contentsProperties; |
| 88 } |
| 89 |
| 90 void PrePaintTreeWalk::countStats(TreeStats& stats, const FrameView& frame) |
| 91 { |
| 92 stats.frames++; |
| 93 if (LayoutView* view = frame.layoutView()) |
| 94 countStats(stats, *view); |
| 95 } |
| 96 |
| 97 void PrePaintTreeWalk::countStats(TreeStats& stats, const LayoutObject& object) |
| 98 { |
| 99 stats.layoutObjects++; |
| 100 |
| 101 if (const auto* props = object.paintProperties()) { |
| 102 stats.objectPaintProps++; |
| 103 |
| 104 if (props->paintOffsetTranslation()) |
| 105 stats.paintOffsetTranslation++; |
| 106 if (props->transform()) |
| 107 stats.transform++; |
| 108 if (props->effect()) |
| 109 stats.effect++; |
| 110 if (props->filter()) |
| 111 stats.filter++; |
| 112 if (props->mask()) |
| 113 stats.mask++; |
| 114 if (props->maskClip()) |
| 115 stats.maskClip++; |
| 116 if (props->cssClip()) |
| 117 stats.cssClip++; |
| 118 if (props->cssClipFixedPosition()) |
| 119 stats.cssClipFixedPosition++; |
| 120 if (props->innerBorderRadiusClip()) |
| 121 stats.innerBorderRadiusClip++; |
| 122 if (props->overflowClip()) |
| 123 stats.overflowClip++; |
| 124 if (props->perspective()) |
| 125 stats.perspective++; |
| 126 if (props->svgLocalToBorderBoxTransform()) |
| 127 stats.svgLocalToBorderBoxTransform++; |
| 128 if (props->scrollTranslation()) |
| 129 stats.scrollTranslation++; |
| 130 if (props->scrollbarPaintOffset()) |
| 131 stats.scrollbarPaintOffset++; |
| 132 if (props->localBorderBoxProperties()) |
| 133 stats.localBorderBoxProperties++; |
| 134 if (props->hasContentsProperties()) |
| 135 stats.contentsProperties++; |
| 136 } |
| 137 |
| 138 for (const LayoutObject* child = object.slowFirstChild(); child; child = child
->nextSibling()) { |
| 139 countStats(stats, *child); |
| 140 } |
| 141 if (object.isLayoutPart()) { |
| 142 const LayoutPart& layoutPart = toLayoutPart(object); |
| 143 FrameViewBase* frameViewBase = layoutPart.frameViewBase(); |
| 144 if (frameViewBase && frameViewBase->isFrameView()) |
| 145 countStats(stats, *toFrameView(frameViewBase)); |
| 146 } |
| 147 } |
| 148 |
| 40 void PrePaintTreeWalk::walk(FrameView& rootFrame) { | 149 void PrePaintTreeWalk::walk(FrameView& rootFrame) { |
| 41 DCHECK(rootFrame.frame().document()->lifecycle().state() == | 150 DCHECK(rootFrame.frame().document()->lifecycle().state() == |
| 42 DocumentLifecycle::InPrePaint); | 151 DocumentLifecycle::InPrePaint); |
| 43 | 152 |
| 44 PrePaintTreeWalkContext initialContext; | 153 PrePaintTreeWalkContext initialContext; |
| 45 initialContext.treeBuilderContext = | 154 initialContext.treeBuilderContext = |
| 46 m_propertyTreeBuilder.setupInitialContext(); | 155 m_propertyTreeBuilder.setupInitialContext(); |
| 47 initialContext.ancestorTransformedOrRootPaintLayer = | 156 initialContext.ancestorTransformedOrRootPaintLayer = |
| 48 rootFrame.layoutView()->layer(); | 157 rootFrame.layoutView()->layer(); |
| 49 | 158 |
| 50 // GeometryMapper depends on paint properties. | 159 // GeometryMapper depends on paint properties. |
| 51 if (rootFrame.needsPaintPropertyUpdate() || | 160 if (rootFrame.needsPaintPropertyUpdate() || |
| 52 (rootFrame.layoutView() && | 161 (rootFrame.layoutView() && |
| 53 !shouldEndWalkBefore(*rootFrame.layoutView(), initialContext))) | 162 !shouldEndWalkBefore(*rootFrame.layoutView(), initialContext))) |
| 54 m_geometryMapper.clearCache(); | 163 m_geometryMapper.clearCache(); |
| 55 | 164 |
| 56 walk(rootFrame, initialContext); | 165 walk(rootFrame, initialContext); |
| 57 m_paintInvalidator.processPendingDelayedPaintInvalidations(); | 166 m_paintInvalidator.processPendingDelayedPaintInvalidations(); |
| 167 |
| 168 printStats(rootFrame); |
| 58 } | 169 } |
| 59 | 170 |
| 60 void PrePaintTreeWalk::walk(FrameView& frameView, | 171 void PrePaintTreeWalk::walk(FrameView& frameView, |
| 61 const PrePaintTreeWalkContext& parentContext) { | 172 const PrePaintTreeWalkContext& parentContext) { |
| 62 if (frameView.shouldThrottleRendering()) { | 173 if (frameView.shouldThrottleRendering()) { |
| 63 // Skip the throttled frame. Will update it when it becomes unthrottled. | 174 // Skip the throttled frame. Will update it when it becomes unthrottled. |
| 64 return; | 175 return; |
| 65 } | 176 } |
| 66 | 177 |
| 67 PrePaintTreeWalkContext context(parentContext); | 178 PrePaintTreeWalkContext context(parentContext); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 roundedIntPoint(context->treeBuilderContext.current.paintOffset); | 391 roundedIntPoint(context->treeBuilderContext.current.paintOffset); |
| 281 walk(*toFrameView(frameViewBase), *context); | 392 walk(*toFrameView(frameViewBase), *context); |
| 282 } | 393 } |
| 283 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). | 394 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). |
| 284 } | 395 } |
| 285 | 396 |
| 286 object.getMutableForPainting().clearPaintFlags(); | 397 object.getMutableForPainting().clearPaintFlags(); |
| 287 } | 398 } |
| 288 | 399 |
| 289 } // namespace blink | 400 } // namespace blink |
| OLD | NEW |