Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1132)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/CompositingReasons.cpp

Issue 2606863002: Complete XXXPaintPropertyNode::operator== and toString() (Closed)
Patch Set: - Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "platform/graphics/CompositingReasons.h" 5 #include "platform/graphics/CompositingReasons.h"
6 6
7 #include "wtf/StdLibExtras.h" 7 #include "wtf/StdLibExtras.h"
8 #include "wtf/text/StringBuilder.h"
8 9
9 namespace blink { 10 namespace blink {
10 11
11 const CompositingReasonStringMap kCompositingReasonStringMap[] = { 12 const CompositingReasonStringMap kCompositingReasonStringMap[] = {
12 {CompositingReasonNone, "Unknown", "No reason given"}, 13 {CompositingReasonNone, "Unknown", "No reason given"},
13 {CompositingReason3DTransform, "transform3D", "Has a 3d transform"}, 14 {CompositingReason3DTransform, "transform3D", "Has a 3d transform"},
14 {CompositingReasonVideo, "video", "Is an accelerated video"}, 15 {CompositingReasonVideo, "video", "Is an accelerated video"},
15 {CompositingReasonCanvas, "canvas", 16 {CompositingReasonCanvas, "canvas",
16 "Is an accelerated canvas, or is a display list backed canvas that was " 17 "Is an accelerated canvas, or is a display list backed canvas that was "
17 "promoted to a layer based on a performance heuristic."}, 18 "promoted to a layer based on a performance heuristic."},
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 {CompositingReasonLayerForDecoration, "layerForDecoration", 135 {CompositingReasonLayerForDecoration, "layerForDecoration",
135 "Layer painted on top of other layers as decoration"}, 136 "Layer painted on top of other layers as decoration"},
136 {CompositingReasonInlineTransform, "inlineTransform", 137 {CompositingReasonInlineTransform, "inlineTransform",
137 "Has an inline transform, which causes subsequent layers to assume " 138 "Has an inline transform, which causes subsequent layers to assume "
138 "overlap"}, 139 "overlap"},
139 }; 140 };
140 141
141 const size_t kNumberOfCompositingReasons = 142 const size_t kNumberOfCompositingReasons =
142 WTF_ARRAY_LENGTH(kCompositingReasonStringMap); 143 WTF_ARRAY_LENGTH(kCompositingReasonStringMap);
143 144
145 String compositingReasonsAsString(CompositingReasons reasons) {
146 if (!reasons)
147 return "none";
148
149 StringBuilder builder;
150 for (size_t i = 0; i < kNumberOfCompositingReasons; ++i) {
151 if (reasons & kCompositingReasonStringMap[i].reason) {
152 if (builder.length())
153 builder.append(',');
154 builder.append(kCompositingReasonStringMap[i].shortName);
155 }
156 }
157 return builder.toString();
158 }
159
144 } // namespace blink 160 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698