| OLD | NEW |
| 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 PaintChunkProperties_h | 5 #ifndef PaintChunkProperties_h |
| 6 #define PaintChunkProperties_h | 6 #define PaintChunkProperties_h |
| 7 | 7 |
| 8 #include "platform/graphics/paint/ClipPaintPropertyNode.h" | 8 #include "platform/graphics/paint/ClipPaintPropertyNode.h" |
| 9 #include "platform/graphics/paint/EffectPaintPropertyNode.h" | 9 #include "platform/graphics/paint/EffectPaintPropertyNode.h" |
| 10 #include "platform/graphics/paint/ScrollPaintPropertyNode.h" | 10 #include "platform/graphics/paint/ScrollPaintPropertyNode.h" |
| 11 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | 11 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
| 12 #include "wtf/Allocator.h" | 12 #include "wtf/Allocator.h" |
| 13 #include "wtf/Noncopyable.h" | 13 #include "wtf/Noncopyable.h" |
| 14 #include <iosfwd> | 14 #include <iosfwd> |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 // The set of paint properties applying to a |PaintChunk|. These properties are | 18 // The set of paint properties applying to a |PaintChunk|. These properties are |
| 19 // not local-only paint style parameters such as color, but instead represent | 19 // not local-only paint style parameters such as color, but instead represent |
| 20 // the hierarchy of transforms, clips, effects, etc, that apply to a contiguous | 20 // the hierarchy of transforms, clips, effects, etc, that apply to a contiguous |
| 21 // chunk of display items. A single DisplayItemClient can generate multiple | 21 // chunk of display items. A single DisplayItemClient can generate multiple |
| 22 // properties of the same type and this struct represents the total state of all | 22 // properties of the same type and this struct represents the total state of all |
| 23 // properties for a given |PaintChunk|. | 23 // properties for a given |PaintChunk|. |
| 24 // | 24 // |
| 25 // This differs from |ObjectPaintProperties| because it only stores one property | 25 // This differs from |ObjectPaintProperties| because it only stores one property |
| 26 // for each type (e.g., either transform or perspective, but not both). | 26 // for each type (e.g., either transform or perspective, but not both). |
| 27 struct PaintChunkProperties { | 27 struct PaintChunkProperties { |
| 28 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 28 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 29 | 29 |
| 30 PaintChunkProperties() : backfaceHidden(false) {} | 30 PaintChunkProperties() : backfaceHidden(false), willChangeTransform(false) {} |
| 31 | 31 |
| 32 // TODO(pdr): Refactor these to use PropertyTreeState. | 32 // TODO(pdr): Refactor these to use PropertyTreeState. |
| 33 RefPtr<const TransformPaintPropertyNode> transform; | 33 RefPtr<const TransformPaintPropertyNode> transform; |
| 34 RefPtr<const ClipPaintPropertyNode> clip; | 34 RefPtr<const ClipPaintPropertyNode> clip; |
| 35 RefPtr<const EffectPaintPropertyNode> effect; | 35 RefPtr<const EffectPaintPropertyNode> effect; |
| 36 RefPtr<const ScrollPaintPropertyNode> scroll; | 36 RefPtr<const ScrollPaintPropertyNode> scroll; |
| 37 bool backfaceHidden; | 37 bool backfaceHidden; |
| 38 bool willChangeTransform; |
| 39 |
| 40 bool hasDirectCompositingReasons() const { |
| 41 return backfaceHidden || willChangeTransform; |
| 42 } |
| 38 }; | 43 }; |
| 39 | 44 |
| 40 // Equality is based only on the pointers and is not 'deep' which would require | 45 // Equality is based only on the pointers and is not 'deep' which would require |
| 41 // crawling the entire property tree to compute. | 46 // crawling the entire property tree to compute. |
| 42 inline bool operator==(const PaintChunkProperties& a, | 47 inline bool operator==(const PaintChunkProperties& a, |
| 43 const PaintChunkProperties& b) { | 48 const PaintChunkProperties& b) { |
| 44 return a.transform.get() == b.transform.get() && | 49 return a.transform.get() == b.transform.get() && |
| 45 a.clip.get() == b.clip.get() && a.effect.get() == b.effect.get() && | 50 a.clip.get() == b.clip.get() && a.effect.get() == b.effect.get() && |
| 46 a.scroll.get() == b.scroll.get() && | 51 a.scroll.get() == b.scroll.get() && |
| 47 a.backfaceHidden == b.backfaceHidden; | 52 a.backfaceHidden == b.backfaceHidden && |
| 53 a.willChangeTransform == b.willChangeTransform; |
| 48 } | 54 } |
| 49 | 55 |
| 50 inline bool operator!=(const PaintChunkProperties& a, | 56 inline bool operator!=(const PaintChunkProperties& a, |
| 51 const PaintChunkProperties& b) { | 57 const PaintChunkProperties& b) { |
| 52 return !(a == b); | 58 return !(a == b); |
| 53 } | 59 } |
| 54 | 60 |
| 55 // Redeclared here to avoid ODR issues. | 61 // Redeclared here to avoid ODR issues. |
| 56 // See platform/testing/PaintPrinters.h. | 62 // See platform/testing/PaintPrinters.h. |
| 57 void PrintTo(const PaintChunkProperties&, std::ostream*); | 63 void PrintTo(const PaintChunkProperties&, std::ostream*); |
| 58 | 64 |
| 59 } // namespace blink | 65 } // namespace blink |
| 60 | 66 |
| 61 #endif // PaintChunkProperties_h | 67 #endif // PaintChunkProperties_h |
| OLD | NEW |