OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CompositingReasons_h | 5 #ifndef CompositingReasons_h |
6 #define CompositingReasons_h | 6 #define CompositingReasons_h |
7 | 7 |
8 #include "wtf/MathExtras.h" | 8 #include "wtf/MathExtras.h" |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | CompositingReasonIsolateCompositedDescendants | 110 | CompositingReasonIsolateCompositedDescendants |
111 | CompositingReasonPreserve3DWith3DDescendants; // preserve-3d has to create
backing store to ensure that 3d-transformed elements intersect. | 111 | CompositingReasonPreserve3DWith3DDescendants; // preserve-3d has to create
backing store to ensure that 3d-transformed elements intersect. |
112 | 112 |
113 const uint64_t CompositingReasonComboSquashableReasons = | 113 const uint64_t CompositingReasonComboSquashableReasons = |
114 CompositingReasonOverlap | 114 CompositingReasonOverlap |
115 | CompositingReasonAssumedOverlap | 115 | CompositingReasonAssumedOverlap |
116 | CompositingReasonOverflowScrollingParent; | 116 | CompositingReasonOverflowScrollingParent; |
117 | 117 |
118 typedef uint64_t CompositingReasons; | 118 typedef uint64_t CompositingReasons; |
119 | 119 |
| 120 // Any reasons other than overlap or assumed overlap will require the layer to b
e separately compositing. |
| 121 inline bool requiresCompositing(CompositingReasons reasons) |
| 122 { |
| 123 return reasons & ~CompositingReasonComboSquashableReasons; |
| 124 } |
| 125 |
| 126 // If the layer has overlap or assumed overlap, but no other reasons, then it sh
ould be squashed. |
| 127 inline bool requiresSquashing(CompositingReasons reasons) |
| 128 { |
| 129 return !requiresCompositing(reasons) && (reasons & CompositingReasonComboSqu
ashableReasons); |
| 130 } |
| 131 |
120 struct CompositingReasonStringMap { | 132 struct CompositingReasonStringMap { |
121 CompositingReasons reason; | 133 CompositingReasons reason; |
122 const char* shortName; | 134 const char* shortName; |
123 const char* description; | 135 const char* description; |
124 }; | 136 }; |
125 | 137 |
126 // FIXME: This static data shouldn't be in a header. When it's in the header | 138 // FIXME: This static data shouldn't be in a header. When it's in the header |
127 // it's copied into every compilation unit that includes the header. | 139 // it's copied into every compilation unit that includes the header. |
128 static const CompositingReasonStringMap compositingReasonStringMap[] = { | 140 static const CompositingReasonStringMap compositingReasonStringMap[] = { |
129 { CompositingReasonNone, | 141 { CompositingReasonNone, |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 "layerForMask", | 277 "layerForMask", |
266 "Secondary layer, to contain the mask contents" }, | 278 "Secondary layer, to contain the mask contents" }, |
267 { CompositingReasonLayerForClippingMask, | 279 { CompositingReasonLayerForClippingMask, |
268 "layerForClippingMask", | 280 "layerForClippingMask", |
269 "Secondary layer, for clipping mask" } | 281 "Secondary layer, for clipping mask" } |
270 }; | 282 }; |
271 | 283 |
272 } // namespace WebCore | 284 } // namespace WebCore |
273 | 285 |
274 #endif // CompositingReasons_h | 286 #endif // CompositingReasons_h |
OLD | NEW |