Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Side by Side Diff: third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp

Issue 2763833003: Optimize PaintInvalidatorContext::mapLocalRectToVisualRectInBacking() (Closed)
Patch Set: - Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/PrePaintTreeWalk.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "core/layout/LayoutPart.h" 11 #include "core/layout/LayoutPart.h"
12 #include "core/layout/LayoutView.h" 12 #include "core/layout/LayoutView.h"
13 #include "core/paint/PaintLayer.h" 13 #include "core/paint/PaintLayer.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 struct PrePaintTreeWalkContext { 17 struct PrePaintTreeWalkContext {
18 PrePaintTreeWalkContext() 18 PrePaintTreeWalkContext(GeometryMapper& geometryMapper)
19 : treeBuilderContext( 19 : treeBuilderContext(
20 WTF::wrapUnique(new PaintPropertyTreeBuilderContext)), 20 WTF::wrapUnique(new PaintPropertyTreeBuilderContext)),
21 paintInvalidatorContext(*treeBuilderContext), 21 paintInvalidatorContext(*treeBuilderContext, geometryMapper),
22 ancestorOverflowPaintLayer(nullptr), 22 ancestorOverflowPaintLayer(nullptr),
23 ancestorTransformedOrRootPaintLayer(nullptr) {} 23 ancestorTransformedOrRootPaintLayer(nullptr) {}
24 PrePaintTreeWalkContext(const PrePaintTreeWalkContext& parentContext) 24 PrePaintTreeWalkContext(const PrePaintTreeWalkContext& parentContext)
25 : treeBuilderContext(WTF::wrapUnique(new PaintPropertyTreeBuilderContext( 25 : treeBuilderContext(WTF::wrapUnique(new PaintPropertyTreeBuilderContext(
26 *parentContext.treeBuilderContext))), 26 *parentContext.treeBuilderContext))),
27 paintInvalidatorContext(*treeBuilderContext, 27 paintInvalidatorContext(*treeBuilderContext,
28 parentContext.paintInvalidatorContext), 28 parentContext.paintInvalidatorContext),
29 ancestorOverflowPaintLayer(parentContext.ancestorOverflowPaintLayer), 29 ancestorOverflowPaintLayer(parentContext.ancestorOverflowPaintLayer),
30 ancestorTransformedOrRootPaintLayer( 30 ancestorTransformedOrRootPaintLayer(
31 parentContext.ancestorTransformedOrRootPaintLayer) {} 31 parentContext.ancestorTransformedOrRootPaintLayer) {}
32 32
33 // PaintPropertyTreeBuilderContext is large and can lead to stack overflows 33 // PaintPropertyTreeBuilderContext is large and can lead to stack overflows
34 // when recursion is deep so this context object is allocated on the heap. 34 // when recursion is deep so this context object is allocated on the heap.
35 // See: https://crbug.com/698653. 35 // See: https://crbug.com/698653.
36 std::unique_ptr<PaintPropertyTreeBuilderContext> treeBuilderContext; 36 std::unique_ptr<PaintPropertyTreeBuilderContext> treeBuilderContext;
37 37
38 PaintInvalidatorContext paintInvalidatorContext; 38 PaintInvalidatorContext paintInvalidatorContext;
39 39
40 // The ancestor in the PaintLayer tree which has overflow clip, or 40 // The ancestor in the PaintLayer tree which has overflow clip, or
41 // is the root layer. Note that it is tree ancestor, not containing 41 // is the root layer. Note that it is tree ancestor, not containing
42 // block or stacking ancestor. 42 // block or stacking ancestor.
43 PaintLayer* ancestorOverflowPaintLayer; 43 PaintLayer* ancestorOverflowPaintLayer;
44 PaintLayer* ancestorTransformedOrRootPaintLayer; 44 PaintLayer* ancestorTransformedOrRootPaintLayer;
45 }; 45 };
46 46
47 void PrePaintTreeWalk::walk(FrameView& rootFrame) { 47 void PrePaintTreeWalk::walk(FrameView& rootFrame) {
48 DCHECK(rootFrame.frame().document()->lifecycle().state() == 48 DCHECK(rootFrame.frame().document()->lifecycle().state() ==
49 DocumentLifecycle::InPrePaint); 49 DocumentLifecycle::InPrePaint);
50 50
51 PrePaintTreeWalkContext initialContext; 51 PrePaintTreeWalkContext initialContext(m_geometryMapper);
52 m_propertyTreeBuilder.setupInitialContext(*initialContext.treeBuilderContext); 52 m_propertyTreeBuilder.setupInitialContext(*initialContext.treeBuilderContext);
53 initialContext.ancestorTransformedOrRootPaintLayer = 53 initialContext.ancestorTransformedOrRootPaintLayer =
54 rootFrame.layoutView()->layer(); 54 rootFrame.layoutView()->layer();
55 55
56 // GeometryMapper depends on paint properties. 56 // GeometryMapper depends on paint properties.
57 if (rootFrame.needsPaintPropertyUpdate() || 57 if (rootFrame.needsPaintPropertyUpdate() ||
58 (rootFrame.layoutView() && 58 (rootFrame.layoutView() &&
59 !shouldEndWalkBefore(*rootFrame.layoutView(), initialContext))) 59 !shouldEndWalkBefore(*rootFrame.layoutView(), initialContext)))
60 m_geometryMapper.clearCache(); 60 m_geometryMapper.clearCache();
61 61
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 roundedIntPoint(context.treeBuilderContext->current.paintOffset); 281 roundedIntPoint(context.treeBuilderContext->current.paintOffset);
282 walk(*toFrameView(frameViewBase), context); 282 walk(*toFrameView(frameViewBase), context);
283 } 283 }
284 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). 284 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281).
285 } 285 }
286 286
287 object.getMutableForPainting().clearPaintFlags(); 287 object.getMutableForPainting().clearPaintFlags();
288 } 288 }
289 289
290 } // namespace blink 290 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PrePaintTreeWalk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698