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

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

Issue 2844803007: Introduce FragmentData, and put ObjectPaintProperties into it. (Closed)
Patch Set: none Created 3 years, 7 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 RarePaintData_h 5 #ifndef RarePaintData_h
6 #define RarePaintData_h 6 #define RarePaintData_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/paint/FragmentData.h"
9 #include "platform/wtf/Allocator.h" 10 #include "platform/wtf/Allocator.h"
10 #include "platform/wtf/Noncopyable.h" 11 #include "platform/wtf/Noncopyable.h"
11 12
12 namespace blink { 13 namespace blink {
13 14
14 class PropertyTreeState; 15 class PropertyTreeState;
15 class ObjectPaintProperties;
16 class PaintLayer; 16 class PaintLayer;
17 17
18 // This is for paint-related data on LayoutObject that is not needed on all 18 // This is for paint-related data on LayoutObject that is not needed on all
19 // objects. 19 // objects.
20 class CORE_EXPORT RarePaintData { 20 class CORE_EXPORT RarePaintData {
21 WTF_MAKE_NONCOPYABLE(RarePaintData); 21 WTF_MAKE_NONCOPYABLE(RarePaintData);
22 USING_FAST_MALLOC(RarePaintData); 22 USING_FAST_MALLOC(RarePaintData);
23 23
24 public: 24 public:
25 RarePaintData(); 25 RarePaintData();
26 ~RarePaintData(); 26 ~RarePaintData();
27 27
28 PaintLayer* Layer() { return layer_.get(); } 28 PaintLayer* Layer() { return layer_.get(); }
29 void SetLayer(std::unique_ptr<PaintLayer>); 29 void SetLayer(std::unique_ptr<PaintLayer>);
30 30
31 FragmentData* Fragment() const { return fragment_data_.get(); }
32
33 FragmentData& EnsureFragment();
34
31 ObjectPaintProperties* PaintProperties() const { 35 ObjectPaintProperties* PaintProperties() const {
32 return paint_properties_.get(); 36 if (fragment_data_)
37 return fragment_data_->PaintProperties();
38 return nullptr;
33 } 39 }
34 ObjectPaintProperties& EnsurePaintProperties();
35 void ClearPaintProperties();
36 40
37 PropertyTreeState* LocalBorderBoxProperties() const { 41 PropertyTreeState* LocalBorderBoxProperties() const {
38 return local_border_box_properties_.get(); 42 return local_border_box_properties_.get();
39 } 43 }
40 44
41 void ClearLocalBorderBoxProperties(); 45 void ClearLocalBorderBoxProperties();
42 void SetLocalBorderBoxProperties(PropertyTreeState&); 46 void SetLocalBorderBoxProperties(PropertyTreeState&);
43 47
44 // This is the complete set of property nodes that can be used to paint the 48 // This is the complete set of property nodes that can be used to paint the
45 // contents of this object. It is similar to local_border_box_properties_ but 49 // contents of this object. It is similar to local_border_box_properties_ but
46 // includes properties (e.g., overflow clip, scroll translation) that apply 50 // includes properties (e.g., overflow clip, scroll translation) that apply
47 // to contents. 51 // to contents.
48 PropertyTreeState ContentsProperties() const; 52 PropertyTreeState ContentsProperties() const;
49 53
50 private: 54 private:
51 // The PaintLayer associated with this LayoutBoxModelObject. This can be null 55 // The PaintLayer associated with this LayoutBoxModelObject. This can be null
52 // depending on the return value of LayoutBoxModelObject::layerTypeRequired(). 56 // depending on the return value of LayoutBoxModelObject::layerTypeRequired().
53 std::unique_ptr<PaintLayer> layer_; 57 std::unique_ptr<PaintLayer> layer_;
54 58
55 // Holds references to the paint property nodes created by this object. 59 std::unique_ptr<FragmentData> fragment_data_;
56 std::unique_ptr<ObjectPaintProperties> paint_properties_;
57 60
58 // This is a complete set of property nodes that should be used as a 61 // This is a complete set of property nodes that should be used as a
59 // starting point to paint a LayoutObject. This data is cached because some 62 // starting point to paint a LayoutObject. This data is cached because some
60 // properties inherit from the containing block chain instead of the 63 // properties inherit from the containing block chain instead of the
61 // painting parent and cannot be derived in O(1) during the paint walk. 64 // painting parent and cannot be derived in O(1) during the paint walk.
62 // 65 //
63 // For example: <div style='opacity: 0.3;'/> 66 // For example: <div style='opacity: 0.3;'/>
64 // The div's local border box properties would have an opacity 0.3 effect 67 // The div's local border box properties would have an opacity 0.3 effect
65 // node. Even though the div has no transform, its local border box 68 // node. Even though the div has no transform, its local border box
66 // properties would have a transform node that points to the div's 69 // properties would have a transform node that points to the div's
67 // ancestor transform space. 70 // ancestor transform space.
68 std::unique_ptr<PropertyTreeState> local_border_box_properties_; 71 std::unique_ptr<PropertyTreeState> local_border_box_properties_;
69 }; 72 };
70 73
71 } // namespace blink 74 } // namespace blink
72 75
73 #endif 76 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/README.md ('k') | third_party/WebKit/Source/core/paint/RarePaintData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698