| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef SKY_ENGINE_PLATFORM_GRAPHICS_COMPOSITINGREASONS_H_ | |
| 6 #define SKY_ENGINE_PLATFORM_GRAPHICS_COMPOSITINGREASONS_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 #include "sky/engine/platform/PlatformExport.h" | |
| 10 #include "sky/engine/wtf/MathExtras.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 const uint64_t CompositingReasonNone = 0; | |
| 15 const uint64_t CompositingReasonAll = ~stat
ic_cast<uint64_t>(0); | |
| 16 | |
| 17 // FIXME(sky): Get rid of all this. | |
| 18 | |
| 19 // Intrinsic reasons that can be known right away by the layer | |
| 20 const uint64_t CompositingReason3DTransform = UINT6
4_C(1) << 0; | |
| 21 const uint64_t CompositingReasonVideo = UINT6
4_C(1) << 1; | |
| 22 const uint64_t CompositingReasonCanvas = UINT6
4_C(1) << 2; | |
| 23 const uint64_t CompositingReasonIFrame = UINT6
4_C(1) << 4; | |
| 24 const uint64_t CompositingReasonBackfaceVisibilityHidden = UINT6
4_C(1) << 5; | |
| 25 const uint64_t CompositingReasonActiveAnimation = UINT6
4_C(1) << 6; | |
| 26 const uint64_t CompositingReasonTransitionProperty = UINT6
4_C(1) << 7; | |
| 27 const uint64_t CompositingReasonOverflowScrollingTouch = UINT6
4_C(1) << 9; | |
| 28 const uint64_t CompositingReasonOverflowScrollingParent = UINT6
4_C(1) << 10; | |
| 29 const uint64_t CompositingReasonOutOfFlowClipping = UINT6
4_C(1) << 11; | |
| 30 const uint64_t CompositingReasonWillChangeCompositingHint = UINT6
4_C(1) << 13; | |
| 31 | |
| 32 // Overlap reasons that require knowing what's behind you in paint-order before
knowing the answer | |
| 33 const uint64_t CompositingReasonAssumedOverlap = UINT6
4_C(1) << 14; | |
| 34 const uint64_t CompositingReasonOverlap = UINT6
4_C(1) << 15; | |
| 35 const uint64_t CompositingReasonNegativeZIndexChildren = UINT6
4_C(1) << 16; | |
| 36 const uint64_t CompositingReasonScrollsWithRespectToSquashingLayer = UINT6
4_C(1) << 17; | |
| 37 const uint64_t CompositingReasonSquashingClippingContainerMismatch = UINT6
4_C(1) << 19; | |
| 38 const uint64_t CompositingReasonSquashingOpacityAncestorMismatch = UINT6
4_C(1) << 20; | |
| 39 const uint64_t CompositingReasonSquashingTransformAncestorMismatch = UINT6
4_C(1) << 21; | |
| 40 const uint64_t CompositingReasonSquashingFilterAncestorMismatch = UINT6
4_C(1) << 22; | |
| 41 const uint64_t CompositingReasonSquashingWouldBreakPaintOrder = UINT6
4_C(1) << 23; | |
| 42 const uint64_t CompositingReasonSquashingVideoIsDisallowed = UINT6
4_C(1) << 24; | |
| 43 const uint64_t CompositingReasonSquashedLayerClipsCompositingDescendants = UINT6
4_C(1) << 25; | |
| 44 | |
| 45 // Subtree reasons that require knowing what the status of your subtree is befor
e knowing the answer | |
| 46 const uint64_t CompositingReasonTransformWithCompositedDescendants = UINT6
4_C(1) << 28; | |
| 47 const uint64_t CompositingReasonOpacityWithCompositedDescendants = UINT6
4_C(1) << 29; | |
| 48 const uint64_t CompositingReasonMaskWithCompositedDescendants = UINT6
4_C(1) << 30; | |
| 49 const uint64_t CompositingReasonFilterWithCompositedDescendants = UINT6
4_C(1) << 32; | |
| 50 // TODO(sky): Unused 33 | |
| 51 const uint64_t CompositingReasonClipsCompositingDescendants = UINT6
4_C(1) << 34; | |
| 52 const uint64_t CompositingReasonPerspectiveWith3DDescendants = UINT6
4_C(1) << 35; | |
| 53 const uint64_t CompositingReasonPreserve3DWith3DDescendants = UINT6
4_C(1) << 36; | |
| 54 // TODO(sky): Unused 37 & 38 | |
| 55 | |
| 56 // The root layer is a special case that may be forced to be a layer, but also i
t needs to be | |
| 57 // a layer if anything else in the subtree is composited. | |
| 58 const uint64_t CompositingReasonRoot = UINT6
4_C(1) << 39; | |
| 59 | |
| 60 // CompositedLayerMapping internal hierarchy reasons | |
| 61 const uint64_t CompositingReasonLayerForAncestorClip = UINT6
4_C(1) << 40; | |
| 62 const uint64_t CompositingReasonLayerForDescendantClip = UINT6
4_C(1) << 41; | |
| 63 const uint64_t CompositingReasonLayerForPerspective = UINT6
4_C(1) << 42; | |
| 64 // FIXME(sky): 43 is unused. | |
| 65 // FIXME(sky): 44 is unused. | |
| 66 const uint64_t CompositingReasonLayerForOverflowControlsHost = UINT6
4_C(1) << 45; | |
| 67 // FIXME(sky): 46 is unused. | |
| 68 const uint64_t CompositingReasonLayerForSquashingContents = UINT6
4_C(1) << 49; | |
| 69 const uint64_t CompositingReasonLayerForSquashingContainer = UINT6
4_C(1) << 50; | |
| 70 const uint64_t CompositingReasonLayerForForeground = UINT6
4_C(1) << 51; | |
| 71 const uint64_t CompositingReasonLayerForBackground = UINT6
4_C(1) << 52; | |
| 72 const uint64_t CompositingReasonLayerForMask = UINT6
4_C(1) << 53; | |
| 73 const uint64_t CompositingReasonLayerForClippingMask = UINT6
4_C(1) << 54; | |
| 74 // FIXME(sky): 55 is unused. | |
| 75 | |
| 76 // Composited elements with inline transforms trigger assumed overlap so that | |
| 77 // we can update their transforms quickly. | |
| 78 const uint64_t CompositingReasonInlineTransform = UINT6
4_C(1) << 56; | |
| 79 | |
| 80 // Various combinations of compositing reasons are defined here also, for more i
ntutive and faster bitwise logic. | |
| 81 const uint64_t CompositingReasonComboAllDirectReasons = | |
| 82 CompositingReason3DTransform | |
| 83 | CompositingReasonVideo | |
| 84 | CompositingReasonCanvas | |
| 85 | CompositingReasonIFrame | |
| 86 | CompositingReasonBackfaceVisibilityHidden | |
| 87 | CompositingReasonActiveAnimation | |
| 88 | CompositingReasonTransitionProperty | |
| 89 | CompositingReasonOverflowScrollingTouch | |
| 90 | CompositingReasonOverflowScrollingParent | |
| 91 | CompositingReasonOutOfFlowClipping | |
| 92 | CompositingReasonWillChangeCompositingHint; | |
| 93 | |
| 94 const uint64_t CompositingReasonComboAllDirectStyleDeterminedReasons = | |
| 95 CompositingReason3DTransform | |
| 96 | CompositingReasonBackfaceVisibilityHidden | |
| 97 | CompositingReasonActiveAnimation | |
| 98 | CompositingReasonTransitionProperty | |
| 99 | CompositingReasonWillChangeCompositingHint; | |
| 100 | |
| 101 const uint64_t CompositingReasonComboCompositedDescendants = | |
| 102 CompositingReasonTransformWithCompositedDescendants | |
| 103 | CompositingReasonOpacityWithCompositedDescendants | |
| 104 | CompositingReasonMaskWithCompositedDescendants | |
| 105 | CompositingReasonFilterWithCompositedDescendants | |
| 106 | CompositingReasonClipsCompositingDescendants; | |
| 107 | |
| 108 const uint64_t CompositingReasonCombo3DDescendants = | |
| 109 CompositingReasonPreserve3DWith3DDescendants | |
| 110 | CompositingReasonPerspectiveWith3DDescendants; | |
| 111 | |
| 112 const uint64_t CompositingReasonComboAllStyleDeterminedReasons = | |
| 113 CompositingReasonComboAllDirectStyleDeterminedReasons | |
| 114 | CompositingReasonComboCompositedDescendants | |
| 115 | CompositingReasonCombo3DDescendants | |
| 116 | CompositingReasonInlineTransform; | |
| 117 | |
| 118 const uint64_t CompositingReasonComboReasonsThatRequireOwnBacking = | |
| 119 CompositingReasonComboAllDirectReasons | |
| 120 | CompositingReasonOverlap | |
| 121 | CompositingReasonAssumedOverlap | |
| 122 | CompositingReasonNegativeZIndexChildren | |
| 123 | CompositingReasonScrollsWithRespectToSquashingLayer | |
| 124 | CompositingReasonSquashingClippingContainerMismatch | |
| 125 | CompositingReasonSquashingOpacityAncestorMismatch | |
| 126 | CompositingReasonSquashingTransformAncestorMismatch | |
| 127 | CompositingReasonSquashingFilterAncestorMismatch | |
| 128 | CompositingReasonSquashingWouldBreakPaintOrder | |
| 129 | CompositingReasonSquashingVideoIsDisallowed | |
| 130 | CompositingReasonSquashedLayerClipsCompositingDescendants | |
| 131 | CompositingReasonTransformWithCompositedDescendants | |
| 132 | CompositingReasonOpacityWithCompositedDescendants | |
| 133 | CompositingReasonMaskWithCompositedDescendants | |
| 134 | CompositingReasonFilterWithCompositedDescendants | |
| 135 | CompositingReasonPreserve3DWith3DDescendants; // preserve-3d has to create
backing store to ensure that 3d-transformed elements intersect. | |
| 136 | |
| 137 const uint64_t CompositingReasonComboSquashableReasons = | |
| 138 CompositingReasonOverlap | |
| 139 | CompositingReasonAssumedOverlap | |
| 140 | CompositingReasonOverflowScrollingParent; | |
| 141 | |
| 142 typedef uint64_t CompositingReasons; | |
| 143 | |
| 144 // Any reasons other than overlap or assumed overlap will require the layer to b
e separately compositing. | |
| 145 inline bool requiresCompositing(CompositingReasons reasons) | |
| 146 { | |
| 147 return reasons & ~CompositingReasonComboSquashableReasons; | |
| 148 } | |
| 149 | |
| 150 // If the layer has overlap or assumed overlap, but no other reasons, then it sh
ould be squashed. | |
| 151 inline bool requiresSquashing(CompositingReasons reasons) | |
| 152 { | |
| 153 return !requiresCompositing(reasons) && (reasons & CompositingReasonComboSqu
ashableReasons); | |
| 154 } | |
| 155 | |
| 156 struct CompositingReasonStringMap { | |
| 157 CompositingReasons reason; | |
| 158 const char* shortName; | |
| 159 const char* description; | |
| 160 }; | |
| 161 | |
| 162 PLATFORM_EXPORT extern const CompositingReasonStringMap kCompositingReasonString
Map[]; | |
| 163 PLATFORM_EXPORT extern size_t kNumberOfCompositingReasons; | |
| 164 | |
| 165 } // namespace blink | |
| 166 | |
| 167 #endif // SKY_ENGINE_PLATFORM_GRAPHICS_COMPOSITINGREASONS_H_ | |
| OLD | NEW |