| OLD | NEW |
| 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 "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
| 10 #include "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class PropertyTreeState; | 14 class PropertyTreeState; |
| 15 class ObjectPaintProperties; | 15 class ObjectPaintProperties; |
| 16 class PaintLayer; |
| 16 | 17 |
| 17 // 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 |
| 18 // objects. | 19 // objects. |
| 19 // TODO(pdr): Store LayoutBoxModelObject's m_paintLayer in this structure. | |
| 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(); } |
| 29 void SetLayer(std::unique_ptr<PaintLayer>); |
| 30 |
| 28 ObjectPaintProperties* PaintProperties() const { | 31 ObjectPaintProperties* PaintProperties() const { |
| 29 return paint_properties_.get(); | 32 return paint_properties_.get(); |
| 30 } | 33 } |
| 31 ObjectPaintProperties& EnsurePaintProperties(); | 34 ObjectPaintProperties& EnsurePaintProperties(); |
| 32 | 35 |
| 33 PropertyTreeState* LocalBorderBoxProperties() const { | 36 PropertyTreeState* LocalBorderBoxProperties() const { |
| 34 return local_border_box_properties_.get(); | 37 return local_border_box_properties_.get(); |
| 35 } | 38 } |
| 36 | 39 |
| 37 void ClearLocalBorderBoxProperties(); | 40 void ClearLocalBorderBoxProperties(); |
| 38 void SetLocalBorderBoxProperties(PropertyTreeState&); | 41 void SetLocalBorderBoxProperties(PropertyTreeState&); |
| 39 | 42 |
| 40 // This is the complete set of property nodes that can be used to paint the | 43 // This is the complete set of property nodes that can be used to paint the |
| 41 // contents of this object. It is similar to local_border_box_properties_ but | 44 // contents of this object. It is similar to local_border_box_properties_ but |
| 42 // includes properties (e.g., overflow clip, scroll translation) that apply | 45 // includes properties (e.g., overflow clip, scroll translation) that apply |
| 43 // to contents. | 46 // to contents. |
| 44 PropertyTreeState ContentsProperties() const; | 47 PropertyTreeState ContentsProperties() const; |
| 45 | 48 |
| 46 private: | 49 private: |
| 50 // The PaintLayer associated with this LayoutBoxModelObject. This can be null |
| 51 // depending on the return value of LayoutBoxModelObject::layerTypeRequired(). |
| 52 std::unique_ptr<PaintLayer> layer_; |
| 53 |
| 47 // Holds references to the paint property nodes created by this object. | 54 // Holds references to the paint property nodes created by this object. |
| 48 std::unique_ptr<ObjectPaintProperties> paint_properties_; | 55 std::unique_ptr<ObjectPaintProperties> paint_properties_; |
| 49 | 56 |
| 50 // This is a complete set of property nodes that should be used as a | 57 // This is a complete set of property nodes that should be used as a |
| 51 // starting point to paint a LayoutObject. This data is cached because some | 58 // starting point to paint a LayoutObject. This data is cached because some |
| 52 // properties inherit from the containing block chain instead of the | 59 // properties inherit from the containing block chain instead of the |
| 53 // painting parent and cannot be derived in O(1) during the paint walk. | 60 // painting parent and cannot be derived in O(1) during the paint walk. |
| 54 // | 61 // |
| 55 // For example: <div style='opacity: 0.3;'/> | 62 // For example: <div style='opacity: 0.3;'/> |
| 56 // The div's local border box properties would have an opacity 0.3 effect | 63 // The div's local border box properties would have an opacity 0.3 effect |
| 57 // node. Even though the div has no transform, its local border box | 64 // node. Even though the div has no transform, its local border box |
| 58 // properties would have a transform node that points to the div's | 65 // properties would have a transform node that points to the div's |
| 59 // ancestor transform space. | 66 // ancestor transform space. |
| 60 std::unique_ptr<PropertyTreeState> local_border_box_properties_; | 67 std::unique_ptr<PropertyTreeState> local_border_box_properties_; |
| 61 }; | 68 }; |
| 62 | 69 |
| 63 } // namespace blink | 70 } // namespace blink |
| 64 | 71 |
| 65 #endif | 72 #endif |
| OLD | NEW |