| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef RarePaintData_h |
| 6 #define RarePaintData_h |
| 7 |
| 8 #include "core/CoreExport.h" |
| 9 #include "wtf/Allocator.h" |
| 10 #include "wtf/Noncopyable.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class PropertyTreeState; |
| 15 class ObjectPaintProperties; |
| 16 |
| 17 // This is for paint-related data on LayoutObject that is not needed on all |
| 18 // objects. |
| 19 // TODO(pdr): Store LayoutBoxModelObject's m_paintLayer in this structure. |
| 20 class CORE_EXPORT RarePaintData { |
| 21 WTF_MAKE_NONCOPYABLE(RarePaintData); |
| 22 USING_FAST_MALLOC(RarePaintData); |
| 23 |
| 24 public: |
| 25 RarePaintData(); |
| 26 ~RarePaintData(); |
| 27 |
| 28 ObjectPaintProperties* paintProperties() const { |
| 29 return m_paintProperties.get(); |
| 30 } |
| 31 ObjectPaintProperties& ensurePaintProperties(); |
| 32 |
| 33 PropertyTreeState* localBorderBoxProperties() const { |
| 34 return m_localBorderBoxProperties.get(); |
| 35 } |
| 36 |
| 37 void clearLocalBorderBoxProperties(); |
| 38 void setLocalBorderBoxProperties(PropertyTreeState&); |
| 39 const PropertyTreeState* contentsProperties() const; |
| 40 |
| 41 private: |
| 42 // Holds references to the paint property nodes created by this object. |
| 43 std::unique_ptr<ObjectPaintProperties> m_paintProperties; |
| 44 |
| 45 // This is a complete set of property nodes that should be used as a |
| 46 // starting point to paint a LayoutObject. This data is cached because some |
| 47 // properties inherit from the containing block chain instead of the |
| 48 // painting parent and cannot be derived in O(1) during the paint walk. |
| 49 // |
| 50 // For example: <div style='opacity: 0.3;'/> |
| 51 // The div's local border box properties would have an opacity 0.3 effect |
| 52 // node. Even though the div has no transform, its local border box |
| 53 // properties would have a transform node that points to the div's |
| 54 // ancestor transform space. |
| 55 std::unique_ptr<PropertyTreeState> m_localBorderBoxProperties; |
| 56 |
| 57 // This is the complete set of property nodes that can be used to paint the |
| 58 // contents of this object. It is similar to m_localBorderBoxProperties but |
| 59 // includes properties (e.g., overflow clip, scroll translation) that apply |
| 60 // to contents. This cached value is derived from m_localBorderBoxProperties |
| 61 // and m_paintProperties and should be invalidated when these change. |
| 62 mutable std::unique_ptr<PropertyTreeState> m_contentsProperties; |
| 63 }; |
| 64 |
| 65 } // namespace blink |
| 66 |
| 67 #endif |
| OLD | NEW |