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

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

Issue 2144823006: Reuse existing paint property node is possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 5 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
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/TransformPaintPropertyNode.h" 11 #include "platform/graphics/paint/TransformPaintPropertyNode.h"
12 #include "wtf/RefPtr.h" 12 #include "wtf/RefPtr.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 class FrameView; 16 class FrameView;
17 class LayoutObject; 17 class LayoutObject;
18 class ObjectPaintProperties;
18 19
19 // The context for PaintPropertyTreeBuilder. 20 // The context for PaintPropertyTreeBuilder.
20 // It's responsible for bookkeeping tree state in other order, for example, the most recent 21 // It's responsible for bookkeeping tree state in other order, for example, the most recent
21 // position container seen. 22 // position container seen.
22 struct PaintPropertyTreeBuilderContext { 23 struct PaintPropertyTreeBuilderContext {
23 // State that propagates on the containing block chain (and so is adjusted 24 // State that propagates on the containing block chain (and so is adjusted
24 // when an absolute or fixed position object is encountered). 25 // when an absolute or fixed position object is encountered).
25 struct ContainingBlockContext { 26 struct ContainingBlockContext {
26 // The combination of a transform and paint offset describes a linear sp ace. 27 // The combination of a transform and paint offset describes a linear sp ace.
27 // When a layout object recur to its children, the main context is expec ted to refer 28 // When a layout object recur to its children, the main context is expec ted to refer
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // Special things include but not limit to: overflow clip, transform, fixed-pos, animation, 61 // Special things include but not limit to: overflow clip, transform, fixed-pos, animation,
61 // mask, filter, ... etc. 62 // mask, filter, ... etc.
62 // It expects to be invoked for each layout tree node in DOM order during InPreP aint phase. 63 // It expects to be invoked for each layout tree node in DOM order during InPreP aint phase.
63 class PaintPropertyTreeBuilder { 64 class PaintPropertyTreeBuilder {
64 public: 65 public:
65 void buildTreeRootNodes(FrameView&, PaintPropertyTreeBuilderContext&); 66 void buildTreeRootNodes(FrameView&, PaintPropertyTreeBuilderContext&);
66 void buildTreeNodes(FrameView&, PaintPropertyTreeBuilderContext&); 67 void buildTreeNodes(FrameView&, PaintPropertyTreeBuilderContext&);
67 void buildTreeNodes(const LayoutObject&, PaintPropertyTreeBuilderContext&); 68 void buildTreeNodes(const LayoutObject&, PaintPropertyTreeBuilderContext&);
68 69
69 private: 70 private:
71 // Common logic to update a paint property. It tries to reuse the existing p aint property node of
72 // the object if the value is not changed. Returns the existing or newly cre ated paint property node,
73 // or nullptr if no paint property node is needed.
74 // It requires a ComputeProperty function which computes the paint property node value if needed and
75 // returns true, or returns false if no paint property node value is needed.
76 template <
77 typename PropertyNode,
78 PropertyNode* (ObjectPaintProperties::*Getter)() const,
79 void (ObjectPaintProperties::*Setter)(PassRefPtr<PropertyNode>),
80 bool (*ComputeProperty)(const LayoutObject&, PaintPropertyTreeBuilderCon text&, typename PropertyNode::Value&)>
81 static PropertyNode* updateObjectPaintProperty(const LayoutObject&, PaintPro pertyTreeBuilderContext&, PropertyNode*& contextProperty);
82
83 static bool computePaintOffsetTranslation(const LayoutObject&, PaintProperty TreeBuilderContext&, TransformPaintPropertyNode::Value&);
70 static void updatePaintOffsetTranslation(const LayoutObject&, PaintPropertyT reeBuilderContext&); 84 static void updatePaintOffsetTranslation(const LayoutObject&, PaintPropertyT reeBuilderContext&);
85
86 static bool computeTransform(const LayoutObject&, PaintPropertyTreeBuilderCo ntext&, TransformPaintPropertyNode::Value&);
71 static void updateTransform(const LayoutObject&, PaintPropertyTreeBuilderCon text&); 87 static void updateTransform(const LayoutObject&, PaintPropertyTreeBuilderCon text&);
88
89 static bool computeEffect(const LayoutObject&, PaintPropertyTreeBuilderConte xt&, EffectPaintPropertyNode::Value&);
72 static void updateEffect(const LayoutObject&, PaintPropertyTreeBuilderContex t&); 90 static void updateEffect(const LayoutObject&, PaintPropertyTreeBuilderContex t&);
91
92 static bool computeCssClip(const LayoutObject&, PaintPropertyTreeBuilderCont ext&, ClipPaintPropertyNode::Value&);
73 static void updateCssClip(const LayoutObject&, PaintPropertyTreeBuilderConte xt&); 93 static void updateCssClip(const LayoutObject&, PaintPropertyTreeBuilderConte xt&);
94
74 static void updateLocalBorderBoxContext(const LayoutObject&, const PaintProp ertyTreeBuilderContext&); 95 static void updateLocalBorderBoxContext(const LayoutObject&, const PaintProp ertyTreeBuilderContext&);
96
97 static bool computeScrollbarPaintOffset(const LayoutObject&, const PaintProp ertyTreeBuilderContext&, TransformPaintPropertyNode::Value&);
75 static void updateScrollbarPaintOffset(const LayoutObject&, const PaintPrope rtyTreeBuilderContext&); 98 static void updateScrollbarPaintOffset(const LayoutObject&, const PaintPrope rtyTreeBuilderContext&);
99
100 static bool computeOverflowClip(const LayoutObject&, PaintPropertyTreeBuilde rContext&, ClipPaintPropertyNode::Value&);
76 static void updateOverflowClip(const LayoutObject&, PaintPropertyTreeBuilder Context&); 101 static void updateOverflowClip(const LayoutObject&, PaintPropertyTreeBuilder Context&);
102
103 static bool computePerspective(const LayoutObject&, PaintPropertyTreeBuilder Context&, TransformPaintPropertyNode::Value&);
77 static void updatePerspective(const LayoutObject&, PaintPropertyTreeBuilderC ontext&); 104 static void updatePerspective(const LayoutObject&, PaintPropertyTreeBuilderC ontext&);
105
106 static bool computeSvgLocalToBorderBoxTransform(const LayoutObject&, PaintPr opertyTreeBuilderContext&, TransformPaintPropertyNode::Value&);
78 static void updateSvgLocalToBorderBoxTransform(const LayoutObject&, PaintPro pertyTreeBuilderContext&); 107 static void updateSvgLocalToBorderBoxTransform(const LayoutObject&, PaintPro pertyTreeBuilderContext&);
108
109 static bool computeScrollTranslation(const LayoutObject&, PaintPropertyTreeB uilderContext&, TransformPaintPropertyNode::Value&);
79 static void updateScrollTranslation(const LayoutObject&, PaintPropertyTreeBu ilderContext&); 110 static void updateScrollTranslation(const LayoutObject&, PaintPropertyTreeBu ilderContext&);
111
112 static bool computeOutOfFlowContext(const LayoutObject&, PaintPropertyTreeBu ilderContext&, ClipPaintPropertyNode::Value&);
80 static void updateOutOfFlowContext(const LayoutObject&, PaintPropertyTreeBui lderContext&); 113 static void updateOutOfFlowContext(const LayoutObject&, PaintPropertyTreeBui lderContext&);
81 }; 114 };
82 115
83 } // namespace blink 116 } // namespace blink
84 117
85 #endif // PaintPropertyTreeBuilder_h 118 #endif // PaintPropertyTreeBuilder_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698