Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / frame / UseCounter.cpp
blobc6790752fb164623fad20bfcfa4b6ed8bb07712a
1 /*
2 * Copyright (C) 2012 Google, Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 #include "config.h"
27 #include "core/frame/UseCounter.h"
29 #include "core/css/CSSStyleSheet.h"
30 #include "core/css/StyleSheetContents.h"
31 #include "core/dom/Document.h"
32 #include "core/dom/ExecutionContext.h"
33 #include "core/frame/FrameConsole.h"
34 #include "core/frame/FrameHost.h"
35 #include "core/frame/LocalFrame.h"
36 #include "core/inspector/ConsoleMessage.h"
37 #include "core/workers/WorkerGlobalScope.h"
38 #include "public/platform/Platform.h"
40 namespace blink {
42 static int totalPagesMeasuredCSSSampleId() { return 1; }
44 int UseCounter::m_muteCount = 0;
46 // FIXME : This mapping should be autogenerated. This function should
47 // be moved to a separate file and a script run at build time
48 // to detect new values in CSSPropertyID and add them to the
49 // end of this function. This file would be checked in.
50 // https://code.google.com/p/chromium/issues/detail?id=234940
51 int UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(int id)
53 CSSPropertyID cssPropertyID = static_cast<CSSPropertyID>(id);
55 switch (cssPropertyID) {
56 // Begin at 2, because 1 is reserved for totalPagesMeasuredCSSSampleId.
57 case CSSPropertyColor: return 2;
58 case CSSPropertyDirection: return 3;
59 case CSSPropertyDisplay: return 4;
60 case CSSPropertyFont: return 5;
61 case CSSPropertyFontFamily: return 6;
62 case CSSPropertyFontSize: return 7;
63 case CSSPropertyFontStyle: return 8;
64 case CSSPropertyFontVariant: return 9;
65 case CSSPropertyFontWeight: return 10;
66 case CSSPropertyTextRendering: return 11;
67 case CSSPropertyWebkitFontFeatureSettings: return 12;
68 case CSSPropertyFontKerning: return 13;
69 case CSSPropertyWebkitFontSmoothing: return 14;
70 case CSSPropertyFontVariantLigatures: return 15;
71 case CSSPropertyWebkitLocale: return 16;
72 case CSSPropertyWebkitTextOrientation: return 17;
73 case CSSPropertyWebkitWritingMode: return 18;
74 case CSSPropertyZoom: return 19;
75 case CSSPropertyLineHeight: return 20;
76 case CSSPropertyBackground: return 21;
77 case CSSPropertyBackgroundAttachment: return 22;
78 case CSSPropertyBackgroundClip: return 23;
79 case CSSPropertyBackgroundColor: return 24;
80 case CSSPropertyBackgroundImage: return 25;
81 case CSSPropertyBackgroundOrigin: return 26;
82 case CSSPropertyBackgroundPosition: return 27;
83 case CSSPropertyBackgroundPositionX: return 28;
84 case CSSPropertyBackgroundPositionY: return 29;
85 case CSSPropertyBackgroundRepeat: return 30;
86 case CSSPropertyBackgroundRepeatX: return 31;
87 case CSSPropertyBackgroundRepeatY: return 32;
88 case CSSPropertyBackgroundSize: return 33;
89 case CSSPropertyBorder: return 34;
90 case CSSPropertyBorderBottom: return 35;
91 case CSSPropertyBorderBottomColor: return 36;
92 case CSSPropertyBorderBottomLeftRadius: return 37;
93 case CSSPropertyBorderBottomRightRadius: return 38;
94 case CSSPropertyBorderBottomStyle: return 39;
95 case CSSPropertyBorderBottomWidth: return 40;
96 case CSSPropertyBorderCollapse: return 41;
97 case CSSPropertyBorderColor: return 42;
98 case CSSPropertyBorderImage: return 43;
99 case CSSPropertyBorderImageOutset: return 44;
100 case CSSPropertyBorderImageRepeat: return 45;
101 case CSSPropertyBorderImageSlice: return 46;
102 case CSSPropertyBorderImageSource: return 47;
103 case CSSPropertyBorderImageWidth: return 48;
104 case CSSPropertyBorderLeft: return 49;
105 case CSSPropertyBorderLeftColor: return 50;
106 case CSSPropertyBorderLeftStyle: return 51;
107 case CSSPropertyBorderLeftWidth: return 52;
108 case CSSPropertyBorderRadius: return 53;
109 case CSSPropertyBorderRight: return 54;
110 case CSSPropertyBorderRightColor: return 55;
111 case CSSPropertyBorderRightStyle: return 56;
112 case CSSPropertyBorderRightWidth: return 57;
113 case CSSPropertyBorderSpacing: return 58;
114 case CSSPropertyBorderStyle: return 59;
115 case CSSPropertyBorderTop: return 60;
116 case CSSPropertyBorderTopColor: return 61;
117 case CSSPropertyBorderTopLeftRadius: return 62;
118 case CSSPropertyBorderTopRightRadius: return 63;
119 case CSSPropertyBorderTopStyle: return 64;
120 case CSSPropertyBorderTopWidth: return 65;
121 case CSSPropertyBorderWidth: return 66;
122 case CSSPropertyBottom: return 67;
123 case CSSPropertyBoxShadow: return 68;
124 case CSSPropertyBoxSizing: return 69;
125 case CSSPropertyCaptionSide: return 70;
126 case CSSPropertyClear: return 71;
127 case CSSPropertyClip: return 72;
128 case CSSPropertyWebkitClipPath: return 73;
129 case CSSPropertyContent: return 74;
130 case CSSPropertyCounterIncrement: return 75;
131 case CSSPropertyCounterReset: return 76;
132 case CSSPropertyCursor: return 77;
133 case CSSPropertyEmptyCells: return 78;
134 case CSSPropertyFloat: return 79;
135 case CSSPropertyFontStretch: return 80;
136 case CSSPropertyHeight: return 81;
137 case CSSPropertyImageRendering: return 82;
138 case CSSPropertyLeft: return 83;
139 case CSSPropertyLetterSpacing: return 84;
140 case CSSPropertyListStyle: return 85;
141 case CSSPropertyListStyleImage: return 86;
142 case CSSPropertyListStylePosition: return 87;
143 case CSSPropertyListStyleType: return 88;
144 case CSSPropertyMargin: return 89;
145 case CSSPropertyMarginBottom: return 90;
146 case CSSPropertyMarginLeft: return 91;
147 case CSSPropertyMarginRight: return 92;
148 case CSSPropertyMarginTop: return 93;
149 case CSSPropertyMaxHeight: return 94;
150 case CSSPropertyMaxWidth: return 95;
151 case CSSPropertyMinHeight: return 96;
152 case CSSPropertyMinWidth: return 97;
153 case CSSPropertyOpacity: return 98;
154 case CSSPropertyOrphans: return 99;
155 case CSSPropertyOutline: return 100;
156 case CSSPropertyOutlineColor: return 101;
157 case CSSPropertyOutlineOffset: return 102;
158 case CSSPropertyOutlineStyle: return 103;
159 case CSSPropertyOutlineWidth: return 104;
160 case CSSPropertyOverflow: return 105;
161 case CSSPropertyOverflowWrap: return 106;
162 case CSSPropertyOverflowX: return 107;
163 case CSSPropertyOverflowY: return 108;
164 case CSSPropertyPadding: return 109;
165 case CSSPropertyPaddingBottom: return 110;
166 case CSSPropertyPaddingLeft: return 111;
167 case CSSPropertyPaddingRight: return 112;
168 case CSSPropertyPaddingTop: return 113;
169 case CSSPropertyPage: return 114;
170 case CSSPropertyPageBreakAfter: return 115;
171 case CSSPropertyPageBreakBefore: return 116;
172 case CSSPropertyPageBreakInside: return 117;
173 case CSSPropertyPointerEvents: return 118;
174 case CSSPropertyPosition: return 119;
175 case CSSPropertyQuotes: return 120;
176 case CSSPropertyResize: return 121;
177 case CSSPropertyRight: return 122;
178 case CSSPropertySize: return 123;
179 case CSSPropertySrc: return 124;
180 case CSSPropertySpeak: return 125;
181 case CSSPropertyTableLayout: return 126;
182 case CSSPropertyTabSize: return 127;
183 case CSSPropertyTextAlign: return 128;
184 case CSSPropertyTextDecoration: return 129;
185 case CSSPropertyTextIndent: return 130;
186 /* Removed CSSPropertyTextLineThrough* - 131-135 */
187 case CSSPropertyTextOverflow: return 136;
188 /* Removed CSSPropertyTextOverline* - 137-141 */
189 case CSSPropertyTextShadow: return 142;
190 case CSSPropertyTextTransform: return 143;
191 /* Removed CSSPropertyTextUnderline* - 144-148 */
192 case CSSPropertyTop: return 149;
193 case CSSPropertyTransition: return 150;
194 case CSSPropertyTransitionDelay: return 151;
195 case CSSPropertyTransitionDuration: return 152;
196 case CSSPropertyTransitionProperty: return 153;
197 case CSSPropertyTransitionTimingFunction: return 154;
198 case CSSPropertyUnicodeBidi: return 155;
199 case CSSPropertyUnicodeRange: return 156;
200 case CSSPropertyVerticalAlign: return 157;
201 case CSSPropertyVisibility: return 158;
202 case CSSPropertyWhiteSpace: return 159;
203 case CSSPropertyWidows: return 160;
204 case CSSPropertyWidth: return 161;
205 case CSSPropertyWordBreak: return 162;
206 case CSSPropertyWordSpacing: return 163;
207 case CSSPropertyWordWrap: return 164;
208 case CSSPropertyZIndex: return 165;
209 case CSSPropertyAliasWebkitAnimation: return 166;
210 case CSSPropertyAliasWebkitAnimationDelay: return 167;
211 case CSSPropertyAliasWebkitAnimationDirection: return 168;
212 case CSSPropertyAliasWebkitAnimationDuration: return 169;
213 case CSSPropertyAliasWebkitAnimationFillMode: return 170;
214 case CSSPropertyAliasWebkitAnimationIterationCount: return 171;
215 case CSSPropertyAliasWebkitAnimationName: return 172;
216 case CSSPropertyAliasWebkitAnimationPlayState: return 173;
217 case CSSPropertyAliasWebkitAnimationTimingFunction: return 174;
218 case CSSPropertyWebkitAppearance: return 175;
219 // CSSPropertyWebkitAspectRatio was 176
220 case CSSPropertyAliasWebkitBackfaceVisibility: return 177;
221 case CSSPropertyWebkitBackgroundClip: return 178;
222 case CSSPropertyWebkitBackgroundComposite: return 179;
223 case CSSPropertyWebkitBackgroundOrigin: return 180;
224 case CSSPropertyAliasWebkitBackgroundSize: return 181;
225 case CSSPropertyWebkitBorderAfter: return 182;
226 case CSSPropertyWebkitBorderAfterColor: return 183;
227 case CSSPropertyWebkitBorderAfterStyle: return 184;
228 case CSSPropertyWebkitBorderAfterWidth: return 185;
229 case CSSPropertyWebkitBorderBefore: return 186;
230 case CSSPropertyWebkitBorderBeforeColor: return 187;
231 case CSSPropertyWebkitBorderBeforeStyle: return 188;
232 case CSSPropertyWebkitBorderBeforeWidth: return 189;
233 case CSSPropertyWebkitBorderEnd: return 190;
234 case CSSPropertyWebkitBorderEndColor: return 191;
235 case CSSPropertyWebkitBorderEndStyle: return 192;
236 case CSSPropertyWebkitBorderEndWidth: return 193;
237 // CSSPropertyWebkitBorderFit was 194
238 case CSSPropertyWebkitBorderHorizontalSpacing: return 195;
239 case CSSPropertyWebkitBorderImage: return 196;
240 case CSSPropertyAliasWebkitBorderRadius: return 197;
241 case CSSPropertyWebkitBorderStart: return 198;
242 case CSSPropertyWebkitBorderStartColor: return 199;
243 case CSSPropertyWebkitBorderStartStyle: return 200;
244 case CSSPropertyWebkitBorderStartWidth: return 201;
245 case CSSPropertyWebkitBorderVerticalSpacing: return 202;
246 case CSSPropertyWebkitBoxAlign: return 203;
247 case CSSPropertyWebkitBoxDirection: return 204;
248 case CSSPropertyWebkitBoxFlex: return 205;
249 case CSSPropertyWebkitBoxFlexGroup: return 206;
250 case CSSPropertyWebkitBoxLines: return 207;
251 case CSSPropertyWebkitBoxOrdinalGroup: return 208;
252 case CSSPropertyWebkitBoxOrient: return 209;
253 case CSSPropertyWebkitBoxPack: return 210;
254 case CSSPropertyWebkitBoxReflect: return 211;
255 case CSSPropertyAliasWebkitBoxShadow: return 212;
256 // CSSPropertyWebkitColumnAxis was 214
257 case CSSPropertyWebkitColumnBreakAfter: return 215;
258 case CSSPropertyWebkitColumnBreakBefore: return 216;
259 case CSSPropertyWebkitColumnBreakInside: return 217;
260 case CSSPropertyWebkitColumnCount: return 218;
261 case CSSPropertyWebkitColumnGap: return 219;
262 // CSSPropertyWebkitColumnProgression was 220
263 case CSSPropertyWebkitColumnRule: return 221;
264 case CSSPropertyWebkitColumnRuleColor: return 222;
265 case CSSPropertyWebkitColumnRuleStyle: return 223;
266 case CSSPropertyWebkitColumnRuleWidth: return 224;
267 case CSSPropertyWebkitColumnSpan: return 225;
268 case CSSPropertyWebkitColumnWidth: return 226;
269 case CSSPropertyWebkitColumns: return 227;
270 // 228 was CSSPropertyWebkitBoxDecorationBreak (duplicated due to #ifdef).
271 // 229 was CSSPropertyWebkitFilter (duplicated due to #ifdef).
272 case CSSPropertyAlignContent: return 230;
273 case CSSPropertyAlignItems: return 231;
274 case CSSPropertyAlignSelf: return 232;
275 case CSSPropertyFlex: return 233;
276 case CSSPropertyFlexBasis: return 234;
277 case CSSPropertyFlexDirection: return 235;
278 case CSSPropertyFlexFlow: return 236;
279 case CSSPropertyFlexGrow: return 237;
280 case CSSPropertyFlexShrink: return 238;
281 case CSSPropertyFlexWrap: return 239;
282 case CSSPropertyJustifyContent: return 240;
283 case CSSPropertyWebkitFontSizeDelta: return 241;
284 case CSSPropertyGridTemplateColumns: return 242;
285 case CSSPropertyGridTemplateRows: return 243;
286 case CSSPropertyGridColumnStart: return 244;
287 case CSSPropertyGridColumnEnd: return 245;
288 case CSSPropertyGridRowStart: return 246;
289 case CSSPropertyGridRowEnd: return 247;
290 case CSSPropertyGridColumn: return 248;
291 case CSSPropertyGridRow: return 249;
292 case CSSPropertyGridAutoFlow: return 250;
293 case CSSPropertyWebkitHighlight: return 251;
294 case CSSPropertyWebkitHyphenateCharacter: return 252;
295 // case CSSPropertyWebkitLineBoxContain: return 257;
296 // case CSSPropertyWebkitLineAlign: return 258;
297 case CSSPropertyWebkitLineBreak: return 259;
298 case CSSPropertyWebkitLineClamp: return 260;
299 // case CSSPropertyWebkitLineGrid: return 261;
300 // case CSSPropertyWebkitLineSnap: return 262;
301 case CSSPropertyWebkitLogicalWidth: return 263;
302 case CSSPropertyWebkitLogicalHeight: return 264;
303 case CSSPropertyWebkitMarginAfterCollapse: return 265;
304 case CSSPropertyWebkitMarginBeforeCollapse: return 266;
305 case CSSPropertyWebkitMarginBottomCollapse: return 267;
306 case CSSPropertyWebkitMarginTopCollapse: return 268;
307 case CSSPropertyWebkitMarginCollapse: return 269;
308 case CSSPropertyWebkitMarginAfter: return 270;
309 case CSSPropertyWebkitMarginBefore: return 271;
310 case CSSPropertyWebkitMarginEnd: return 272;
311 case CSSPropertyWebkitMarginStart: return 273;
312 // CSSPropertyWebkitMarquee was 274.
313 // CSSPropertyInternalMarquee* were 275-279.
314 case CSSPropertyWebkitMask: return 280;
315 case CSSPropertyWebkitMaskBoxImage: return 281;
316 case CSSPropertyWebkitMaskBoxImageOutset: return 282;
317 case CSSPropertyWebkitMaskBoxImageRepeat: return 283;
318 case CSSPropertyWebkitMaskBoxImageSlice: return 284;
319 case CSSPropertyWebkitMaskBoxImageSource: return 285;
320 case CSSPropertyWebkitMaskBoxImageWidth: return 286;
321 case CSSPropertyWebkitMaskClip: return 287;
322 case CSSPropertyWebkitMaskComposite: return 288;
323 case CSSPropertyWebkitMaskImage: return 289;
324 case CSSPropertyWebkitMaskOrigin: return 290;
325 case CSSPropertyWebkitMaskPosition: return 291;
326 case CSSPropertyWebkitMaskPositionX: return 292;
327 case CSSPropertyWebkitMaskPositionY: return 293;
328 case CSSPropertyWebkitMaskRepeat: return 294;
329 case CSSPropertyWebkitMaskRepeatX: return 295;
330 case CSSPropertyWebkitMaskRepeatY: return 296;
331 case CSSPropertyWebkitMaskSize: return 297;
332 case CSSPropertyWebkitMaxLogicalWidth: return 298;
333 case CSSPropertyWebkitMaxLogicalHeight: return 299;
334 case CSSPropertyWebkitMinLogicalWidth: return 300;
335 case CSSPropertyWebkitMinLogicalHeight: return 301;
336 // WebkitNbspMode has been deleted, was return 302;
337 case CSSPropertyOrder: return 303;
338 case CSSPropertyWebkitPaddingAfter: return 304;
339 case CSSPropertyWebkitPaddingBefore: return 305;
340 case CSSPropertyWebkitPaddingEnd: return 306;
341 case CSSPropertyWebkitPaddingStart: return 307;
342 case CSSPropertyAliasWebkitPerspective: return 308;
343 case CSSPropertyAliasWebkitPerspectiveOrigin: return 309;
344 case CSSPropertyWebkitPerspectiveOriginX: return 310;
345 case CSSPropertyWebkitPerspectiveOriginY: return 311;
346 case CSSPropertyWebkitPrintColorAdjust: return 312;
347 case CSSPropertyWebkitRtlOrdering: return 313;
348 case CSSPropertyWebkitRubyPosition: return 314;
349 case CSSPropertyWebkitTextCombine: return 315;
350 case CSSPropertyWebkitTextDecorationsInEffect: return 316;
351 case CSSPropertyWebkitTextEmphasis: return 317;
352 case CSSPropertyWebkitTextEmphasisColor: return 318;
353 case CSSPropertyWebkitTextEmphasisPosition: return 319;
354 case CSSPropertyWebkitTextEmphasisStyle: return 320;
355 case CSSPropertyWebkitTextFillColor: return 321;
356 case CSSPropertyWebkitTextSecurity: return 322;
357 case CSSPropertyWebkitTextStroke: return 323;
358 case CSSPropertyWebkitTextStrokeColor: return 324;
359 case CSSPropertyWebkitTextStrokeWidth: return 325;
360 case CSSPropertyAliasWebkitTransform: return 326;
361 case CSSPropertyAliasWebkitTransformOrigin: return 327;
362 case CSSPropertyWebkitTransformOriginX: return 328;
363 case CSSPropertyWebkitTransformOriginY: return 329;
364 case CSSPropertyWebkitTransformOriginZ: return 330;
365 case CSSPropertyAliasWebkitTransformStyle: return 331;
366 case CSSPropertyAliasWebkitTransition: return 332;
367 case CSSPropertyAliasWebkitTransitionDelay: return 333;
368 case CSSPropertyAliasWebkitTransitionDuration: return 334;
369 case CSSPropertyAliasWebkitTransitionProperty: return 335;
370 case CSSPropertyAliasWebkitTransitionTimingFunction: return 336;
371 case CSSPropertyWebkitUserDrag: return 337;
372 case CSSPropertyWebkitUserModify: return 338;
373 case CSSPropertyWebkitUserSelect: return 339;
374 // case CSSPropertyWebkitFlowInto: return 340;
375 // case CSSPropertyWebkitFlowFrom: return 341;
376 // case CSSPropertyWebkitRegionFragment: return 342;
377 // case CSSPropertyWebkitRegionBreakAfter: return 343;
378 // case CSSPropertyWebkitRegionBreakBefore: return 344;
379 // case CSSPropertyWebkitRegionBreakInside: return 345;
380 // case CSSPropertyShapeInside: return 346;
381 case CSSPropertyShapeOutside: return 347;
382 case CSSPropertyShapeMargin: return 348;
383 // case CSSPropertyShapePadding: return 349;
384 // case CSSPropertyWebkitWrapFlow: return 350;
385 // case CSSPropertyWebkitWrapThrough: return 351;
386 // CSSPropertyWebkitWrap was 352.
387 // 353 was CSSPropertyWebkitTapHighlightColor (duplicated due to #ifdef).
388 // 354 was CSSPropertyWebkitAppRegion (duplicated due to #ifdef).
389 case CSSPropertyClipPath: return 355;
390 case CSSPropertyClipRule: return 356;
391 case CSSPropertyMask: return 357;
392 // CSSPropertyEnableBackground has been removed, was return 358;
393 case CSSPropertyFilter: return 359;
394 case CSSPropertyFloodColor: return 360;
395 case CSSPropertyFloodOpacity: return 361;
396 case CSSPropertyLightingColor: return 362;
397 case CSSPropertyStopColor: return 363;
398 case CSSPropertyStopOpacity: return 364;
399 case CSSPropertyColorInterpolation: return 365;
400 case CSSPropertyColorInterpolationFilters: return 366;
401 // case CSSPropertyColorProfile: return 367;
402 case CSSPropertyColorRendering: return 368;
403 case CSSPropertyFill: return 369;
404 case CSSPropertyFillOpacity: return 370;
405 case CSSPropertyFillRule: return 371;
406 case CSSPropertyMarker: return 372;
407 case CSSPropertyMarkerEnd: return 373;
408 case CSSPropertyMarkerMid: return 374;
409 case CSSPropertyMarkerStart: return 375;
410 case CSSPropertyMaskType: return 376;
411 case CSSPropertyShapeRendering: return 377;
412 case CSSPropertyStroke: return 378;
413 case CSSPropertyStrokeDasharray: return 379;
414 case CSSPropertyStrokeDashoffset: return 380;
415 case CSSPropertyStrokeLinecap: return 381;
416 case CSSPropertyStrokeLinejoin: return 382;
417 case CSSPropertyStrokeMiterlimit: return 383;
418 case CSSPropertyStrokeOpacity: return 384;
419 case CSSPropertyStrokeWidth: return 385;
420 case CSSPropertyAlignmentBaseline: return 386;
421 case CSSPropertyBaselineShift: return 387;
422 case CSSPropertyDominantBaseline: return 388;
423 case CSSPropertyGlyphOrientationHorizontal: return 389;
424 case CSSPropertyGlyphOrientationVertical: return 390;
425 // CSSPropertyKerning has been removed, was return 391;
426 case CSSPropertyTextAnchor: return 392;
427 case CSSPropertyVectorEffect: return 393;
428 case CSSPropertyWritingMode: return 394;
429 // CSSPropertyWebkitSvgShadow has been removed, was return 395;
430 // CSSPropertyWebkitCursorVisibility has been removed, was return 396;
431 // CSSPropertyImageOrientation has been removed, was return 397;
432 // CSSPropertyImageResolution has been removed, was return 398;
433 #if defined(ENABLE_CSS_COMPOSITING) && ENABLE_CSS_COMPOSITING
434 case CSSPropertyWebkitBlendMode: return 399;
435 case CSSPropertyWebkitBackgroundBlendMode: return 400;
436 #endif
437 case CSSPropertyTextDecorationLine: return 401;
438 case CSSPropertyTextDecorationStyle: return 402;
439 case CSSPropertyTextDecorationColor: return 403;
440 case CSSPropertyTextAlignLast: return 404;
441 case CSSPropertyTextUnderlinePosition: return 405;
442 case CSSPropertyMaxZoom: return 406;
443 case CSSPropertyMinZoom: return 407;
444 case CSSPropertyOrientation: return 408;
445 case CSSPropertyUserZoom: return 409;
446 // CSSPropertyWebkitDashboardRegion was 410.
447 // CSSPropertyWebkitOverflowScrolling was 411.
448 case CSSPropertyWebkitAppRegion: return 412;
449 case CSSPropertyWebkitFilter: return 413;
450 case CSSPropertyWebkitBoxDecorationBreak: return 414;
451 case CSSPropertyWebkitTapHighlightColor: return 415;
452 case CSSPropertyBufferedRendering: return 416;
453 case CSSPropertyGridAutoRows: return 417;
454 case CSSPropertyGridAutoColumns: return 418;
455 case CSSPropertyBackgroundBlendMode: return 419;
456 case CSSPropertyMixBlendMode: return 420;
457 case CSSPropertyTouchAction: return 421;
458 case CSSPropertyGridArea: return 422;
459 case CSSPropertyGridTemplateAreas: return 423;
460 case CSSPropertyAnimation: return 424;
461 case CSSPropertyAnimationDelay: return 425;
462 case CSSPropertyAnimationDirection: return 426;
463 case CSSPropertyAnimationDuration: return 427;
464 case CSSPropertyAnimationFillMode: return 428;
465 case CSSPropertyAnimationIterationCount: return 429;
466 case CSSPropertyAnimationName: return 430;
467 case CSSPropertyAnimationPlayState: return 431;
468 case CSSPropertyAnimationTimingFunction: return 432;
469 case CSSPropertyObjectFit: return 433;
470 case CSSPropertyPaintOrder: return 434;
471 case CSSPropertyMaskSourceType: return 435;
472 case CSSPropertyIsolation: return 436;
473 case CSSPropertyObjectPosition: return 437;
474 // case CSSPropertyInternalCallback: return 438;
475 case CSSPropertyShapeImageThreshold: return 439;
476 case CSSPropertyColumnFill: return 440;
477 case CSSPropertyTextJustify: return 441;
478 // CSSPropertyTouchActionDelay was 442
479 case CSSPropertyJustifySelf: return 443;
480 case CSSPropertyScrollBehavior: return 444;
481 case CSSPropertyWillChange: return 445;
482 case CSSPropertyTransform: return 446;
483 case CSSPropertyTransformOrigin: return 447;
484 case CSSPropertyTransformStyle: return 448;
485 case CSSPropertyPerspective: return 449;
486 case CSSPropertyPerspectiveOrigin: return 450;
487 case CSSPropertyBackfaceVisibility: return 451;
488 case CSSPropertyGridTemplate: return 452;
489 case CSSPropertyGrid: return 453;
490 case CSSPropertyAll: return 454;
491 case CSSPropertyJustifyItems: return 455;
492 case CSSPropertyMotionPath: return 457;
493 case CSSPropertyMotionOffset: return 458;
494 case CSSPropertyMotionRotation: return 459;
495 case CSSPropertyMotion: return 460;
496 case CSSPropertyX: return 461;
497 case CSSPropertyY: return 462;
498 case CSSPropertyRx: return 463;
499 case CSSPropertyRy: return 464;
500 case CSSPropertyFontSizeAdjust: return 465;
501 case CSSPropertyCx: return 466;
502 case CSSPropertyCy: return 467;
503 case CSSPropertyR: return 468;
504 case CSSPropertyAliasEpubCaptionSide: return 469;
505 case CSSPropertyAliasEpubTextCombine: return 470;
506 case CSSPropertyAliasEpubTextEmphasis: return 471;
507 case CSSPropertyAliasEpubTextEmphasisColor: return 472;
508 case CSSPropertyAliasEpubTextEmphasisStyle: return 473;
509 case CSSPropertyAliasEpubTextOrientation: return 474;
510 case CSSPropertyAliasEpubTextTransform: return 475;
511 case CSSPropertyAliasEpubWordBreak: return 476;
512 case CSSPropertyAliasEpubWritingMode: return 477;
513 case CSSPropertyAliasWebkitAlignContent: return 478;
514 case CSSPropertyAliasWebkitAlignItems: return 479;
515 case CSSPropertyAliasWebkitAlignSelf: return 480;
516 case CSSPropertyAliasWebkitBorderBottomLeftRadius: return 481;
517 case CSSPropertyAliasWebkitBorderBottomRightRadius: return 482;
518 case CSSPropertyAliasWebkitBorderTopLeftRadius: return 483;
519 case CSSPropertyAliasWebkitBorderTopRightRadius: return 484;
520 case CSSPropertyAliasWebkitBoxSizing: return 485;
521 case CSSPropertyAliasWebkitFlex: return 486;
522 case CSSPropertyAliasWebkitFlexBasis: return 487;
523 case CSSPropertyAliasWebkitFlexDirection: return 488;
524 case CSSPropertyAliasWebkitFlexFlow: return 489;
525 case CSSPropertyAliasWebkitFlexGrow: return 490;
526 case CSSPropertyAliasWebkitFlexShrink: return 491;
527 case CSSPropertyAliasWebkitFlexWrap: return 492;
528 case CSSPropertyAliasWebkitJustifyContent: return 493;
529 case CSSPropertyAliasWebkitOpacity: return 494;
530 case CSSPropertyAliasWebkitOrder: return 495;
531 case CSSPropertyAliasWebkitShapeImageThreshold: return 496;
532 case CSSPropertyAliasWebkitShapeMargin: return 497;
533 case CSSPropertyAliasWebkitShapeOutside: return 498;
534 case CSSPropertyScrollSnapType: return 499;
535 case CSSPropertyScrollSnapPointsX: return 500;
536 case CSSPropertyScrollSnapPointsY: return 501;
537 case CSSPropertyScrollSnapCoordinate: return 502;
538 case CSSPropertyScrollSnapDestination: return 503;
539 case CSSPropertyTranslate: return 504;
540 case CSSPropertyRotate: return 505;
541 case CSSPropertyScale: return 506;
542 case CSSPropertyImageOrientation: return 507;
543 case CSSPropertyBackdropFilter: return 508;
545 // 1. Add new features above this line (don't change the assigned numbers of the existing
546 // items).
547 // 2. Update maximumCSSSampleId() with the new maximum value.
548 // 3. Run the update_use_counter_css.py script in
549 // chromium/src/tools/metrics/histograms to update the UMA histogram names.
551 case CSSPropertyInvalid:
552 ASSERT_NOT_REACHED();
553 return 0;
556 ASSERT_NOT_REACHED();
557 return 0;
560 static int maximumCSSSampleId() { return 508; }
562 void UseCounter::muteForInspector()
564 UseCounter::m_muteCount++;
567 void UseCounter::unmuteForInspector()
569 UseCounter::m_muteCount--;
572 UseCounter::UseCounter()
574 m_CSSFeatureBits.ensureSize(lastUnresolvedCSSProperty + 1);
575 m_CSSFeatureBits.clearAll();
578 UseCounter::~UseCounter()
580 // We always log PageDestruction so that we have a scale for the rest of the features.
581 Platform::current()->histogramEnumeration("WebCore.FeatureObserver", PageDestruction, NumberOfFeatures);
583 updateMeasurements();
586 void UseCounter::CountBits::updateMeasurements()
588 for (unsigned i = 0; i < NumberOfFeatures; ++i) {
589 if (m_bits.quickGet(i))
590 Platform::current()->histogramEnumeration("WebCore.FeatureObserver", i, NumberOfFeatures);
592 // Clearing count bits is timing sensitive.
593 m_bits.clearAll();
596 void UseCounter::updateMeasurements()
598 Platform::current()->histogramEnumeration("WebCore.FeatureObserver", PageVisits, NumberOfFeatures);
599 m_countBits.updateMeasurements();
601 // FIXME: Sometimes this function is called more than once per page. The following
602 // bool guards against incrementing the page count when there are no CSS
603 // bits set. http://crbug.com/236262.
604 bool needsPagesMeasuredUpdate = false;
605 for (int i = firstCSSProperty; i <= lastUnresolvedCSSProperty; ++i) {
606 if (m_CSSFeatureBits.quickGet(i)) {
607 int cssSampleId = mapCSSPropertyIdToCSSSampleIdForHistogram(i);
608 Platform::current()->histogramEnumeration("WebCore.FeatureObserver.CSSProperties", cssSampleId, maximumCSSSampleId());
609 needsPagesMeasuredUpdate = true;
613 if (needsPagesMeasuredUpdate)
614 Platform::current()->histogramEnumeration("WebCore.FeatureObserver.CSSProperties", totalPagesMeasuredCSSSampleId(), maximumCSSSampleId());
616 m_CSSFeatureBits.clearAll();
619 void UseCounter::didCommitLoad()
621 updateMeasurements();
624 void UseCounter::count(const Frame* frame, Feature feature)
626 if (!frame)
627 return;
628 FrameHost* host = frame->host();
629 if (!host)
630 return;
632 ASSERT(deprecationMessage(feature).isEmpty());
633 host->useCounter().recordMeasurement(feature);
636 void UseCounter::count(const Document& document, Feature feature)
638 count(document.frame(), feature);
641 bool UseCounter::isCounted(Document& document, Feature feature)
643 Frame* frame = document.frame();
644 if (!frame)
645 return false;
646 FrameHost* host = frame->host();
647 if (!host)
648 return false;
649 return host->useCounter().hasRecordedMeasurement(feature);
652 void UseCounter::count(const ExecutionContext* context, Feature feature)
654 if (!context)
655 return;
656 if (context->isDocument()) {
657 count(*toDocument(context), feature);
658 return;
660 if (context->isWorkerGlobalScope())
661 toWorkerGlobalScope(context)->countFeature(feature);
664 void UseCounter::countIfNotPrivateScript(v8::Isolate* isolate, const Frame* frame, Feature feature)
666 if (DOMWrapperWorld::current(isolate).isPrivateScriptIsolatedWorld())
667 return;
668 UseCounter::count(frame, feature);
671 void UseCounter::countIfNotPrivateScript(v8::Isolate* isolate, const Document& document, Feature feature)
673 if (DOMWrapperWorld::current(isolate).isPrivateScriptIsolatedWorld())
674 return;
675 UseCounter::count(document, feature);
678 void UseCounter::countIfNotPrivateScript(v8::Isolate* isolate, const ExecutionContext* context, Feature feature)
680 if (DOMWrapperWorld::current(isolate).isPrivateScriptIsolatedWorld())
681 return;
682 UseCounter::count(context, feature);
685 void UseCounter::countDeprecation(const LocalFrame* frame, Feature feature)
687 if (!frame)
688 return;
689 FrameHost* host = frame->host();
690 if (!host)
691 return;
693 if (!host->useCounter().hasRecordedMeasurement(feature)) {
694 host->useCounter().recordMeasurement(feature);
695 ASSERT(!deprecationMessage(feature).isEmpty());
696 frame->console().addMessage(ConsoleMessage::create(DeprecationMessageSource, WarningMessageLevel, deprecationMessage(feature)));
700 void UseCounter::countDeprecation(ExecutionContext* context, Feature feature)
702 if (!context)
703 return;
704 if (context->isDocument()) {
705 UseCounter::countDeprecation(*toDocument(context), feature);
706 return;
708 if (context->isWorkerGlobalScope())
709 toWorkerGlobalScope(context)->countDeprecation(feature);
712 void UseCounter::countDeprecation(const Document& document, Feature feature)
714 UseCounter::countDeprecation(document.frame(), feature);
717 void UseCounter::countDeprecationIfNotPrivateScript(v8::Isolate* isolate, ExecutionContext* context, Feature feature)
719 if (DOMWrapperWorld::current(isolate).isPrivateScriptIsolatedWorld())
720 return;
721 UseCounter::countDeprecation(context, feature);
724 static String replacedBy(const char* oldString, const char* newString)
726 return String::format("'%s' is deprecated. Please use '%s' instead.", oldString, newString);
729 String UseCounter::deprecationMessage(Feature feature)
731 switch (feature) {
732 // Quota
733 case PrefixedStorageInfo:
734 return "'window.webkitStorageInfo' is deprecated. Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead.";
736 // Keyboard Event (DOM Level 3)
737 case KeyboardEventKeyLocation:
738 return replacedBy("KeyboardEvent.keyLocation", "KeyboardEvent.location");
740 case ConsoleMarkTimeline:
741 return replacedBy("console.markTimeline", "console.timeStamp");
743 case FileError:
744 return "FileError is deprecated. Please use the 'name' or 'message' attributes of DOMError rather than 'code'.";
746 case CSSStyleSheetInsertRuleOptionalArg:
747 return "Calling CSSStyleSheet.insertRule() with one argument is deprecated. Please pass the index argument as well: insertRule(x, 0).";
749 case PrefixedVideoSupportsFullscreen:
750 return "'HTMLVideoElement.webkitSupportsFullscreen' is deprecated. Its value is true if the video is loaded.";
752 case PrefixedVideoDisplayingFullscreen:
753 return "'HTMLVideoElement.webkitDisplayingFullscreen' is deprecated. Please use the 'fullscreenchange' event instead.";
755 case PrefixedVideoEnterFullscreen:
756 return replacedBy("HTMLVideoElement.webkitEnterFullscreen()", "Element.requestFullscreen()");
758 case PrefixedVideoExitFullscreen:
759 return replacedBy("HTMLVideoElement.webkitExitFullscreen()", "Document.exitFullscreen()");
761 case PrefixedVideoEnterFullScreen:
762 return replacedBy("HTMLVideoElement.webkitEnterFullScreen()", "Element.requestFullscreen()");
764 case PrefixedVideoExitFullScreen:
765 return replacedBy("HTMLVideoElement.webkitExitFullScreen()", "Document.exitFullscreen()");
767 case PrefixedIndexedDB:
768 return replacedBy("webkitIndexedDB", "indexedDB");
770 case PrefixedIDBCursorConstructor:
771 return replacedBy("webkitIDBCursor", "IDBCursor");
773 case PrefixedIDBDatabaseConstructor:
774 return replacedBy("webkitIDBDatabase", "IDBDatabase");
776 case PrefixedIDBFactoryConstructor:
777 return replacedBy("webkitIDBFactory", "IDBFactory");
779 case PrefixedIDBIndexConstructor:
780 return replacedBy("webkitIDBIndex", "IDBIndex");
782 case PrefixedIDBKeyRangeConstructor:
783 return replacedBy("webkitIDBKeyRange", "IDBKeyRange");
785 case PrefixedIDBObjectStoreConstructor:
786 return replacedBy("webkitIDBObjectStore", "IDBObjectStore");
788 case PrefixedIDBRequestConstructor:
789 return replacedBy("webkitIDBRequest", "IDBRequest");
791 case PrefixedIDBTransactionConstructor:
792 return replacedBy("webkitIDBTransaction", "IDBTransaction");
794 case PrefixedRequestAnimationFrame:
795 return "'webkitRequestAnimationFrame' is vendor-specific. Please use the standard 'requestAnimationFrame' instead.";
797 case PrefixedCancelAnimationFrame:
798 return "'webkitCancelAnimationFrame' is vendor-specific. Please use the standard 'cancelAnimationFrame' instead.";
800 case PrefixedCancelRequestAnimationFrame:
801 return "'webkitCancelRequestAnimationFrame' is vendor-specific. Please use the standard 'cancelAnimationFrame' instead.";
803 case NodeIteratorDetach:
804 return "'NodeIterator.detach' is now a no-op, as per DOM (http://dom.spec.whatwg.org/#dom-nodeiterator-detach).";
806 case RangeDetach:
807 return "'Range.detach' is now a no-op, as per DOM (http://dom.spec.whatwg.org/#dom-range-detach).";
809 case SyncXHRWithCredentials:
810 return "Setting 'XMLHttpRequest.withCredentials' for synchronous requests is deprecated.";
812 case PictureSourceSrc:
813 return "<source src> with a <picture> parent is invalid and therefore ignored. Please use <source srcset> instead.";
815 case XHRProgressEventPosition:
816 return "The XMLHttpRequest progress event property 'position' is deprecated. Please use 'loaded' instead.";
818 case XHRProgressEventTotalSize:
819 return "The XMLHttpRequest progress event property 'totalSize' is deprecated. Please use 'total' instead.";
821 case ConsoleTimeline:
822 return replacedBy("console.timeline", "console.time");
824 case ConsoleTimelineEnd:
825 return replacedBy("console.timelineEnd", "console.timeEnd");
827 case CanvasRenderingContext2DCompositeOperationDarker:
828 return replacedBy("darker", "darken");
830 case XMLHttpRequestSynchronousInNonWorkerOutsideBeforeUnload:
831 return "Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.";
833 case GetMatchedCSSRules:
834 return "'getMatchedCSSRules()' is deprecated. For more help, check https://code.google.com/p/chromium/issues/detail?id=437569#c2";
836 case PrefixedImageSmoothingEnabled:
837 return replacedBy("CanvasRenderingContext2D.webkitImageSmoothingEnabled", "CanvasRenderingContext2D.imageSmoothingEnabled");
839 case AudioListenerDopplerFactor:
840 return "dopplerFactor is deprecated and will be removed in M45 when all doppler effects are removed";
842 case AudioListenerSpeedOfSound:
843 return "speedOfSound is deprecated and will be removed in M45 when all doppler effects are removed";
845 case AudioListenerSetVelocity:
846 return "setVelocity() is deprecated and will be removed in M45 when all doppler effects are removed";
848 case PrefixedWindowURL:
849 return replacedBy("webkitURL", "URL");
851 case PrefixedAudioContext:
852 return replacedBy("webkitAudioContext", "AudioContext");
854 case PrefixedOfflineAudioContext:
855 return replacedBy("webkitOfflineAudioContext", "OfflineAudioContext");
857 case RangeExpand:
858 return replacedBy("Range.expand()", "Selection.modify()");
860 case PrefixedMediaAddKey:
861 case PrefixedMediaGenerateKeyRequest:
862 case PrefixedMediaCancelKeyRequest:
863 return "The prefixed Encrypted Media Extensions APIs are deprecated. Please use 'navigator.requestMediaKeySystemAccess()' instead.";
865 case CanPlayTypeKeySystem:
866 return "canPlayType()'s 'keySystem' parameter is deprecated. Please use 'navigator.requestMediaKeySystemAccess()' instead.";
868 case SVGSVGElementForceRedraw:
869 return "'SVGSVGElement.forceRedraw()' is deprecated, please do not use it. It is a no-op, as per SVG2 (https://svgwg.org/svg2-draft/struct.html#__svg__SVGSVGElement__forceRedraw).";
871 case SVGSVGElementSuspendRedraw:
872 return "'SVGSVGElement.suspendRedraw()' is deprecated, please do not use it. It is a no-op, as per SVG2 (https://svgwg.org/svg2-draft/struct.html#__svg__SVGSVGElement__suspendRedraw).";
874 case SVGSVGElementUnsuspendRedraw:
875 return "'SVGSVGElement.unsuspendRedraw()' is deprecated, please do not use it. It is a no-op, as per SVG2 (https://svgwg.org/svg2-draft/struct.html#__svg__SVGSVGElement__unsuspendRedraw).";
877 case SVGSVGElementUnsuspendRedrawAll:
878 return "'SVGSVGElement.unsuspendRedrawAll()' is deprecated, please do not use it. It is a no-op, as per SVG2 (https://svgwg.org/svg2-draft/struct.html#__svg__SVGSVGElement__unsuspendRedrawAll).";
880 // Powerful features on insecure origins (https://goo.gl/rStTGz)
881 case DeviceMotionInsecureOrigin:
882 return "The devicemotion event is deprecated on insecure origins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.";
884 case DeviceOrientationInsecureOrigin:
885 return "The deviceorientation event is deprecated on insecure origins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.";
887 case GeolocationInsecureOrigin:
888 return "getCurrentPosition() and watchPosition() are deprecated on insecure origins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.";
890 case GetUserMediaInsecureOrigin:
891 return "getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.";
893 case EncryptedMediaInsecureOrigin:
894 return "requestMediaKeySystemAccess() is deprecated on insecure origins in the specification. Support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.";
896 case DocumentGetCSSCanvasContext:
897 return "The -webkit-canvas CSS feature is deprecated. Please use a positioned <canvas> element instead.";
899 case ElementCreateShadowRootMultiple:
900 return "Calling Element.createShadowRoot() for an element which already hosts a shadow root is deprecated. See https://www.chromestatus.com/features/4668884095336448 for more details.";
902 case ElementCreateShadowRootMultipleWithUserAgentShadowRoot:
903 return "Calling Element.createShadowRoot() for an element which already hosts a user-agent shadow root is deprecated. See https://www.chromestatus.com/features/4668884095336448 for more details.";
905 case CSSDeepCombinator:
906 return "/deep/ combinator is deprecated. See https://www.chromestatus.com/features/6750456638341120 for more details.";
908 case CSSSelectorPseudoShadow:
909 return "::shadow pseudo-element is deprecated. See https://www.chromestatus.com/features/6750456638341120 for more details.";
911 case PrefixedMouseEventMovementX:
912 return replacedBy("webkitMovementX", "movementX");
914 case PrefixedMouseEventMovementY:
915 return replacedBy("webkitMovementY", "movementY");
917 case SVGSMILElementInDocument:
918 case SVGSMILAnimationInImageRegardlessOfCache:
919 return "SVG's SMIL animations (<animate>, <set>, etc.) are deprecated and will be removed. Please use CSS animations or Web animations instead.";
921 case MediaStreamLabel:
922 return "'MediaStream.label' is deprecated and will be removed in M47, around November 2015. Please use 'MediaStream.id' instead.";
924 case MediaStreamStop:
925 return "'MediaStream.stop()' is deprecated and will be removed in M47, around November 2015. Please use 'MediaStream.active' instead.";
927 case MediaStreamEnded:
928 return "'MediaStream.ended' is deprecated and will be removed in M47, around November 2015. Please use 'MediaStream.active' instead.";
930 case PrefixedPerformanceClearResourceTimings:
931 return replacedBy("Performance.webkitClearResourceTimings", "Performance.clearResourceTimings");
933 case PrefixedPerformanceSetResourceTimingBufferSize:
934 return replacedBy("Performance.webkitSetResourceTimingBufferSize", "Performance.setResourceTimingBufferSize");
936 case PrefixedPerformanceResourceTimingBufferFull:
937 return replacedBy("Performance.onwebkitresourcetimingbufferfull", "Performance.onresourcetimingbufferfull");
939 case FetchAPIRequestContext:
940 return "Request.context is deprecated and will be removed in M46 (see: https://www.chromestatus.com/feature/5534702526005248).";
942 case HeaderValueNotMatchingRFC7230:
943 return "Header values not matching to RFC 7230, will be deprecated (see: https://www.chromestatus.com/feature/6457425448140800).";
945 // Features that aren't deprecated don't have a deprecation message.
946 default:
947 return String();
951 void UseCounter::count(CSSParserContext context, CSSPropertyID feature)
953 ASSERT(feature >= firstCSSProperty);
954 ASSERT(feature <= lastUnresolvedCSSProperty);
956 if (!isUseCounterEnabledForMode(context.mode()))
957 return;
959 m_CSSFeatureBits.quickSet(feature);
962 void UseCounter::count(Feature feature)
964 ASSERT(deprecationMessage(feature).isEmpty());
965 recordMeasurement(feature);
968 UseCounter* UseCounter::getFrom(const Document* document)
970 if (document && document->frameHost())
971 return &document->frameHost()->useCounter();
972 return 0;
975 UseCounter* UseCounter::getFrom(const CSSStyleSheet* sheet)
977 if (sheet)
978 return getFrom(sheet->contents());
979 return 0;
982 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents)
984 // FIXME: We may want to handle stylesheets that have multiple owners
985 // http://crbug.com/242125
986 if (sheetContents && sheetContents->hasSingleOwnerNode())
987 return getFrom(sheetContents->singleOwnerDocument());
988 return 0;
991 } // namespace blink