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.
6 #include "platform/graphics/CompositingReasons.h"
8 #include "wtf/StdLibExtras.h"
12 const CompositingReasonStringMap kCompositingReasonStringMap[] = {
13 { CompositingReasonNone,
16 { CompositingReason3DTransform,
18 "Has a 3d transform" },
19 { CompositingReasonVideo,
21 "Is an accelerated video" },
22 { CompositingReasonCanvas,
24 "Is an accelerated canvas" },
25 { CompositingReasonPlugin,
27 "Is an accelerated plugin" },
28 { CompositingReasonIFrame,
30 "Is an accelerated iFrame" },
31 { CompositingReasonBackfaceVisibilityHidden,
32 "backfaceVisibilityHidden",
33 "Has backface-visibility: hidden" },
34 { CompositingReasonActiveAnimation,
36 "Has an active accelerated animation or transition" },
37 { CompositingReasonTransitionProperty,
39 "Has an acceleratable transition property (active or inactive)" },
40 { CompositingReasonPositionFixed,
42 "Is fixed position" },
43 { CompositingReasonOverflowScrollingTouch,
44 "overflowScrollingTouch",
45 "Is a scrollable overflow element" },
46 { CompositingReasonOverflowScrollingParent,
47 "overflowScrollingParent",
48 "Scroll parent is not an ancestor" },
49 { CompositingReasonOutOfFlowClipping,
51 "Has clipping ancestor" },
52 { CompositingReasonVideoOverlay,
54 "Is overlay controls for video" },
55 { CompositingReasonWillChangeCompositingHint,
57 "Has a will-change compositing hint" },
58 { CompositingReasonAssumedOverlap,
60 "Might overlap other composited content" },
61 { CompositingReasonOverlap,
63 "Overlaps other composited content" },
64 { CompositingReasonNegativeZIndexChildren,
65 "negativeZIndexChildren",
66 "Parent with composited negative z-index content" },
67 { CompositingReasonScrollsWithRespectToSquashingLayer,
68 "scrollsWithRespectToSquashingLayer",
69 "Cannot be squashed since this layer scrolls with respect to the squashing layer" },
70 { CompositingReasonSquashingSparsityExceeded,
71 "squashingSparsityExceeded",
72 "Cannot be squashed as the squashing layer would become too sparse" },
73 { CompositingReasonSquashingClippingContainerMismatch,
74 "squashingClippingContainerMismatch",
75 "Cannot be squashed because this layer has a different clipping container than the squashing layer" },
76 { CompositingReasonSquashingOpacityAncestorMismatch,
77 "squashingOpacityAncestorMismatch",
78 "Cannot be squashed because this layer has a different opacity ancestor than the squashing layer" },
79 { CompositingReasonSquashingTransformAncestorMismatch,
80 "squashingTransformAncestorMismatch",
81 "Cannot be squashed because this layer has a different transform ancestor than the squashing layer" },
82 { CompositingReasonSquashingFilterMismatch,
83 "squashingFilterAncestorMismatch",
84 "Cannot be squashed because this layer has a different filter ancestor than the squashing layer, or this layer has a filter" },
85 { CompositingReasonSquashingWouldBreakPaintOrder,
86 "squashingWouldBreakPaintOrder",
87 "Cannot be squashed without breaking paint order" },
88 { CompositingReasonSquashingVideoIsDisallowed,
89 "squashingVideoIsDisallowed",
90 "Squashing video is not supported" },
91 { CompositingReasonSquashedLayerClipsCompositingDescendants,
92 "squashedLayerClipsCompositingDescendants",
93 "Squashing a layer that clips composited descendants is not supported." },
94 { CompositingReasonSquashingRenderPartIsDisallowed,
95 "squashingRenderPartIsDisallowed",
96 "Squashing a frame, iframe or plugin is not supported." },
97 { CompositingReasonSquashingReflectionIsDisallowed,
98 "squashingReflectionDisallowed",
99 "Squashing a element with a reflection is not supported." },
100 { CompositingReasonSquashingBlendingIsDisallowed,
101 "squashingBlendingDisallowed",
102 "Squashing a layer with blending is not supported." },
103 { CompositingReasonTransformWithCompositedDescendants,
104 "transformWithCompositedDescendants",
105 "Has a transform that needs to be known by compositor because of composited descendants" },
106 { CompositingReasonOpacityWithCompositedDescendants,
107 "opacityWithCompositedDescendants",
108 "Has opacity that needs to be applied by compositor because of composited descendants" },
109 { CompositingReasonMaskWithCompositedDescendants,
110 "maskWithCompositedDescendants",
111 "Has a mask that needs to be known by compositor because of composited descendants" },
112 { CompositingReasonReflectionWithCompositedDescendants,
113 "reflectionWithCompositedDescendants",
114 "Has a reflection that needs to be known by compositor because of composited descendants" },
115 { CompositingReasonFilterWithCompositedDescendants,
116 "filterWithCompositedDescendants",
117 "Has a filter effect that needs to be known by compositor because of composited descendants" },
118 { CompositingReasonBlendingWithCompositedDescendants,
119 "blendingWithCompositedDescendants",
120 "Has a blenidng effect that needs to be known by compositor because of composited descendants" },
121 { CompositingReasonClipsCompositingDescendants,
122 "clipsCompositingDescendants",
123 "Has a clip that needs to be known by compositor because of composited descendants" },
124 { CompositingReasonPerspectiveWith3DDescendants,
125 "perspectiveWith3DDescendants",
126 "Has a perspective transform that needs to be known by compositor because of 3d descendants" },
127 { CompositingReasonPreserve3DWith3DDescendants,
128 "preserve3DWith3DDescendants",
129 "Has a preserves-3d property that needs to be known by compositor because of 3d descendants" },
130 { CompositingReasonReflectionOfCompositedParent,
131 "reflectionOfCompositedParent",
132 "Is a reflection of a composited layer" },
133 { CompositingReasonIsolateCompositedDescendants,
134 "isolateCompositedDescendants",
135 "Should isolate descendants to apply a blend effect" },
136 { CompositingReasonRoot,
138 "Is the root layer" },
139 { CompositingReasonLayerForAncestorClip,
140 "layerForAncestorClip",
141 "Secondary layer, applies a clip due to a sibling in the compositing tree" },
142 { CompositingReasonLayerForDescendantClip,
143 "layerForDescendantClip",
144 "Secondary layer, to clip descendants of the owning layer" },
145 { CompositingReasonLayerForPerspective,
146 "layerForPerspective",
147 "Secondary layer, to house the perspective transform for all descendants" },
148 { CompositingReasonLayerForHorizontalScrollbar,
149 "layerForHorizontalScrollbar",
150 "Secondary layer, the horizontal scrollbar layer" },
151 { CompositingReasonLayerForVerticalScrollbar,
152 "layerForVerticalScrollbar",
153 "Secondary layer, the vertical scrollbar layer" },
154 { CompositingReasonLayerForOverflowControlsHost,
155 "layerForOverflowControlsHost",
156 "Secondary layer, the overflow controls host layer" },
157 { CompositingReasonLayerForScrollCorner,
158 "layerForScrollCorner",
159 "Secondary layer, the scroll corner layer" },
160 { CompositingReasonLayerForScrollingContents,
161 "layerForScrollingContents",
162 "Secondary layer, to house contents that can be scrolled" },
163 { CompositingReasonLayerForScrollingContainer,
164 "layerForScrollingContainer",
165 "Secondary layer, used to position the scolling contents while scrolling" },
166 { CompositingReasonLayerForSquashingContents,
167 "layerForSquashingContents",
168 "Secondary layer, home for a group of squashable content" },
169 { CompositingReasonLayerForSquashingContainer,
170 "layerForSquashingContainer",
171 "Secondary layer, no-op layer to place the squashing layer correctly in the composited layer tree" },
172 { CompositingReasonLayerForForeground,
173 "layerForForeground",
174 "Secondary layer, to contain any normal flow and positive z-index contents on top of a negative z-index layer" },
175 { CompositingReasonLayerForBackground,
176 "layerForBackground",
177 "Secondary layer, to contain acceleratable background content" },
178 { CompositingReasonLayerForMask,
180 "Secondary layer, to contain the mask contents" },
181 { CompositingReasonLayerForClippingMask,
182 "layerForClippingMask",
183 "Secondary layer, for clipping mask" },
184 { CompositingReasonLayerForScrollingBlockSelection,
185 "layerForScrollingBlockSelection",
186 "Secondary layer, to house block selection gaps for composited scrolling with no scrolling contents" },
187 { CompositingReasonInlineTransform,
189 "Has an inline transform, which causes subsequent layers to assume overlap" },
192 size_t kNumberOfCompositingReasons = WTF_ARRAY_LENGTH(kCompositingReasonStringMap);