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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.h

Issue 2744243010: Use fast malloc for heap-allocated property tree builder context (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 | « no previous file | 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 #ifndef PaintPropertyTreeBuilder_h 5 #ifndef PaintPropertyTreeBuilder_h
6 #define PaintPropertyTreeBuilder_h 6 #define PaintPropertyTreeBuilder_h
7 7
8 #include "platform/geometry/LayoutPoint.h" 8 #include "platform/geometry/LayoutPoint.h"
9 #include "platform/graphics/paint/ClipPaintPropertyNode.h" 9 #include "platform/graphics/paint/ClipPaintPropertyNode.h"
10 #include "platform/graphics/paint/EffectPaintPropertyNode.h" 10 #include "platform/graphics/paint/EffectPaintPropertyNode.h"
11 #include "platform/graphics/paint/ScrollPaintPropertyNode.h" 11 #include "platform/graphics/paint/ScrollPaintPropertyNode.h"
12 #include "platform/graphics/paint/TransformPaintPropertyNode.h" 12 #include "platform/graphics/paint/TransformPaintPropertyNode.h"
13 #include "wtf/RefPtr.h" 13 #include "wtf/RefPtr.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 class FrameView; 17 class FrameView;
18 class LayoutBoxModelObject; 18 class LayoutBoxModelObject;
19 class LayoutObject; 19 class LayoutObject;
20 20
21 // The context for PaintPropertyTreeBuilder. 21 // The context for PaintPropertyTreeBuilder.
22 // It's responsible for bookkeeping tree state in other order, for example, the 22 // It's responsible for bookkeeping tree state in other order, for example, the
23 // most recent position container seen. 23 // most recent position container seen.
24 struct PaintPropertyTreeBuilderContext { 24 struct PaintPropertyTreeBuilderContext {
25 USING_FAST_MALLOC(PaintPropertyTreeBuilderContext);
26
27 public:
25 // State that propagates on the containing block chain (and so is adjusted 28 // State that propagates on the containing block chain (and so is adjusted
26 // when an absolute or fixed position object is encountered). 29 // when an absolute or fixed position object is encountered).
27 struct ContainingBlockContext { 30 struct ContainingBlockContext {
28 // The combination of a transform and paint offset describes a linear space. 31 // The combination of a transform and paint offset describes a linear space.
29 // When a layout object recur to its children, the main context is expected 32 // When a layout object recur to its children, the main context is expected
30 // to refer the object's border box, then the callee will derive its own 33 // to refer the object's border box, then the callee will derive its own
31 // border box by translating the space with its own layout location. 34 // border box by translating the space with its own layout location.
32 const TransformPaintPropertyNode* transform = nullptr; 35 const TransformPaintPropertyNode* transform = nullptr;
33 LayoutPoint paintOffset; 36 LayoutPoint paintOffset;
34 // Whether newly created children should flatten their inherited transform 37 // Whether newly created children should flatten their inherited transform
(...skipping 20 matching lines...) Expand all
55 ContainingBlockContext current; 58 ContainingBlockContext current;
56 59
57 // Separate context for out-of-flow positioned and fixed positioned elements 60 // Separate context for out-of-flow positioned and fixed positioned elements
58 // are needed because they don't use DOM parent as their containing block. 61 // are needed because they don't use DOM parent as their containing block.
59 // These additional contexts normally pass through untouched, and are only 62 // These additional contexts normally pass through untouched, and are only
60 // copied from the main context when the current element serves as the 63 // copied from the main context when the current element serves as the
61 // containing block of corresponding positioned descendants. Overflow clips 64 // containing block of corresponding positioned descendants. Overflow clips
62 // are also inherited by containing block tree instead of DOM tree, thus they 65 // are also inherited by containing block tree instead of DOM tree, thus they
63 // are included in the additional context too. 66 // are included in the additional context too.
64 ContainingBlockContext absolutePosition; 67 ContainingBlockContext absolutePosition;
65 const LayoutObject* containerForAbsolutePosition = nullptr; 68 const LayoutObject* containerForAbsolutePosition;
Xianzhu 2017/03/20 16:20:24 Why change these?
pdr. 2017/03/20 16:35:32 These seem to be required for fast malloc. A few o
66 69
67 ContainingBlockContext fixedPosition; 70 ContainingBlockContext fixedPosition;
68 71
69 // This is the same as current.paintOffset except when a floating object has 72 // This is the same as current.paintOffset except when a floating object has
70 // non-block ancestors under its containing block. Paint offsets of the 73 // non-block ancestors under its containing block. Paint offsets of the
71 // non-block ancestors should not be accumulated for the floating object. 74 // non-block ancestors should not be accumulated for the floating object.
72 LayoutPoint paintOffsetForFloat; 75 LayoutPoint paintOffsetForFloat;
73 76
74 // The effect hierarchy is applied by the stacking context tree. It is 77 // The effect hierarchy is applied by the stacking context tree. It is
75 // guaranteed that every DOM descendant is also a stacking context descendant. 78 // guaranteed that every DOM descendant is also a stacking context descendant.
76 // Therefore, we don't need extra bookkeeping for effect nodes and can 79 // Therefore, we don't need extra bookkeeping for effect nodes and can
77 // generate the effect tree from a DOM-order traversal. 80 // generate the effect tree from a DOM-order traversal.
78 const EffectPaintPropertyNode* currentEffect = nullptr; 81 const EffectPaintPropertyNode* currentEffect;
79 // Some effects are spatial, i.e. may refer to input pixels outside of output 82 // Some effects are spatial, i.e. may refer to input pixels outside of output
80 // clip. The cull rect for its input shall be derived from its output clip. 83 // clip. The cull rect for its input shall be derived from its output clip.
81 // This variable represents the input cull of current effect, also serves as 84 // This variable represents the input cull of current effect, also serves as
82 // output clip of child effects that don't have a hard clip. 85 // output clip of child effects that don't have a hard clip.
83 const ClipPaintPropertyNode* inputClipOfCurrentEffect = nullptr; 86 const ClipPaintPropertyNode* inputClipOfCurrentEffect;
84 87
85 // True if a change has forced all properties in a subtree to be updated. This 88 // True if a change has forced all properties in a subtree to be updated. This
86 // can be set due to paint offset changes or when the structure of the 89 // can be set due to paint offset changes or when the structure of the
87 // property tree changes (i.e., a node is added or removed). 90 // property tree changes (i.e., a node is added or removed).
88 bool forceSubtreeUpdate = false; 91 bool forceSubtreeUpdate;
92
93 PaintPropertyTreeBuilderContext()
94 : containerForAbsolutePosition(nullptr),
95 currentEffect(nullptr),
96 inputClipOfCurrentEffect(nullptr),
97 forceSubtreeUpdate(false) {}
89 }; 98 };
90 99
91 // Creates paint property tree nodes for special things in the layout tree. 100 // Creates paint property tree nodes for special things in the layout tree.
92 // Special things include but not limit to: overflow clip, transform, fixed-pos, 101 // Special things include but not limit to: overflow clip, transform, fixed-pos,
93 // animation, mask, filter, ... etc. 102 // animation, mask, filter, ... etc.
94 // It expects to be invoked for each layout tree node in DOM order during 103 // It expects to be invoked for each layout tree node in DOM order during
95 // InPrePaint phase. 104 // InPrePaint phase.
96 class PaintPropertyTreeBuilder { 105 class PaintPropertyTreeBuilder {
97 public: 106 public:
98 void setupInitialContext(PaintPropertyTreeBuilderContext&); 107 void setupInitialContext(PaintPropertyTreeBuilderContext&);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 const LayoutObject&, 157 const LayoutObject&,
149 PaintPropertyTreeBuilderContext&); 158 PaintPropertyTreeBuilderContext&);
150 ALWAYS_INLINE static void updateOutOfFlowContext( 159 ALWAYS_INLINE static void updateOutOfFlowContext(
151 const LayoutObject&, 160 const LayoutObject&,
152 PaintPropertyTreeBuilderContext&); 161 PaintPropertyTreeBuilderContext&);
153 }; 162 };
154 163
155 } // namespace blink 164 } // namespace blink
156 165
157 #endif // PaintPropertyTreeBuilder_h 166 #endif // PaintPropertyTreeBuilder_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698