@@ -3182,239 +3182,6 @@ TEST_F(StyleEngineTest, SystemColorComputeToSelfUseCount) {
3182
3182
GetDocument ().IsUseCounted (WebFeature::kCSSSystemColorComputeToSelf ));
3183
3183
}
3184
3184
3185
- TEST_F (StyleEngineTest, InvalidVariableUnsetUseCount) {
3186
- // Do not count for basic variable usage.
3187
- GetDocument ().body ()->setInnerHTML (R"HTML(
3188
- <style>
3189
- #outer { --x: foo; }
3190
- #inner { --x: bar; }
3191
- </style>
3192
- <div id=outer>
3193
- <div id=inner></div>
3194
- <div>
3195
- )HTML" );
3196
- UpdateAllLifecyclePhases ();
3197
- EXPECT_FALSE (IsUseCounted (WebFeature::kCSSInvalidVariableUnset ));
3198
- ClearUseCounter (WebFeature::kCSSInvalidVariableUnset );
3199
-
3200
- // Do not count when a fallback handles the unknown variable.
3201
- GetDocument ().body ()->setInnerHTML (R"HTML(
3202
- <style>
3203
- #outer { --x: foo; }
3204
- #inner { --x: var(--unknown,bar); }
3205
- </style>
3206
- <div id=outer>
3207
- <div id=inner></div>
3208
- <div>
3209
- )HTML" );
3210
- UpdateAllLifecyclePhases ();
3211
- EXPECT_FALSE (IsUseCounted (WebFeature::kCSSInvalidVariableUnset ));
3212
- ClearUseCounter (WebFeature::kCSSInvalidVariableUnset );
3213
-
3214
- // Do not count for explicit 'unset'.
3215
- GetDocument ().body ()->setInnerHTML (R"HTML(
3216
- <style>
3217
- #outer { --x: foo; }
3218
- #inner { --x: unset; }
3219
- </style>
3220
- <div id=outer>
3221
- <div id=inner></div>
3222
- <div>
3223
- )HTML" );
3224
- UpdateAllLifecyclePhases ();
3225
- EXPECT_FALSE (IsUseCounted (WebFeature::kCSSInvalidVariableUnset ));
3226
- ClearUseCounter (WebFeature::kCSSInvalidVariableUnset );
3227
-
3228
- // Do not count when we anyway end up with the guaranteed-invalid value.
3229
- // (Applies to registered properties as well).
3230
- GetDocument ().body ()->setInnerHTML (R"HTML(
3231
- <style>
3232
- @property --y {
3233
- syntax: "*";
3234
- inherits: true;
3235
- }
3236
- @property --z {
3237
- syntax: "*";
3238
- inherits: false;
3239
- }
3240
- #inner {
3241
- --x: var(--unknown);
3242
- --y: var(--unknown);
3243
- --z: var(--unknown);
3244
- }
3245
- </style>
3246
- <div id=outer>
3247
- <div id=inner></div>
3248
- <div>
3249
- )HTML" );
3250
- UpdateAllLifecyclePhases ();
3251
- EXPECT_FALSE (IsUseCounted (WebFeature::kCSSInvalidVariableUnset ));
3252
- ClearUseCounter (WebFeature::kCSSInvalidVariableUnset );
3253
-
3254
- // Count when 'unset' inherits something that not guaranteed-invalid.
3255
- GetDocument ().body ()->setInnerHTML (R"HTML(
3256
- <style>
3257
- #outer { --x: foo; }
3258
- #inner { --x: var(--unknown); }
3259
- </style>
3260
- <div id=outer>
3261
- <div id=inner></div>
3262
- <div>
3263
- )HTML" );
3264
- UpdateAllLifecyclePhases ();
3265
- EXPECT_TRUE (IsUseCounted (WebFeature::kCSSInvalidVariableUnset ));
3266
- ClearUseCounter (WebFeature::kCSSInvalidVariableUnset );
3267
-
3268
- // Do not count for non-universal registered custom properties.
3269
- GetDocument ().body ()->setInnerHTML (R"HTML(
3270
- <style>
3271
- @property --x {
3272
- syntax: "<length>";
3273
- inherits: true;
3274
- initial-value: 0px;
3275
- }
3276
- #outer { --x: 1px; }
3277
- #inner { --x: var(--unknown); }
3278
- </style>
3279
- <div id=outer>
3280
- <div id=inner></div>
3281
- <div>
3282
- )HTML" );
3283
- UpdateAllLifecyclePhases ();
3284
- EXPECT_FALSE (IsUseCounted (WebFeature::kCSSInvalidVariableUnset ));
3285
- ClearUseCounter (WebFeature::kCSSInvalidVariableUnset );
3286
-
3287
- // Count for universal registered custom properties.
3288
- GetDocument ().body ()->setInnerHTML (R"HTML(
3289
- <style>
3290
- @property --x {
3291
- syntax: "*";
3292
- inherits: true;
3293
- }
3294
- #outer { --x: bar; }
3295
- #inner { --x: var(--unknown); }
3296
- </style>
3297
- <div id=outer>
3298
- <div id=inner></div>
3299
- <div>
3300
- )HTML" );
3301
- UpdateAllLifecyclePhases ();
3302
- EXPECT_TRUE (IsUseCounted (WebFeature::kCSSInvalidVariableUnset ));
3303
- ClearUseCounter (WebFeature::kCSSInvalidVariableUnset );
3304
-
3305
- // Do not count for non-inherited universal registered custom properties
3306
- // without initial value.
3307
- GetDocument ().body ()->setInnerHTML (R"HTML(
3308
- <style>
3309
- @property --x {
3310
- syntax: "*";
3311
- inherits: false;
3312
- }
3313
- #outer { --x: bar; }
3314
- #inner { --x: var(--unknown); }
3315
- </style>
3316
- <div id=outer>
3317
- <div id=inner></div>
3318
- <div>
3319
- )HTML" );
3320
- UpdateAllLifecyclePhases ();
3321
- EXPECT_FALSE (IsUseCounted (WebFeature::kCSSInvalidVariableUnset ));
3322
- ClearUseCounter (WebFeature::kCSSInvalidVariableUnset );
3323
-
3324
- // Count for universal registered custom properties even with an
3325
- // initial-value defined.
3326
- GetDocument ().body ()->setInnerHTML (R"HTML(
3327
- <style>
3328
- @property --x {
3329
- syntax: "*";
3330
- inherits: true;
3331
- initial-value: foo;
3332
- }
3333
- #outer { --x: bar; }
3334
- #inner { --x: var(--unknown); }
3335
- </style>
3336
- <div id=outer>
3337
- <div id=inner></div>
3338
- <div>
3339
- )HTML" );
3340
- UpdateAllLifecyclePhases ();
3341
- EXPECT_TRUE (IsUseCounted (WebFeature::kCSSInvalidVariableUnset ));
3342
- ClearUseCounter (WebFeature::kCSSInvalidVariableUnset );
3343
-
3344
- // Do not count for cycles.
3345
- GetDocument ().body ()->setInnerHTML (R"HTML(
3346
- <style>
3347
- @property --a {
3348
- syntax: "*";
3349
- inherits: true;
3350
- }
3351
- @property --b {
3352
- syntax: "*";
3353
- inherits: true;
3354
- }
3355
- #outer {
3356
- --a: foo;
3357
- --b: foo;
3358
- --c: foo;
3359
- --d: foo;
3360
- }
3361
- #inner {
3362
- --a: var(--b);
3363
- --b: var(--a);
3364
- --c: var(--d);
3365
- --d: var(--c);
3366
- }
3367
- </style>
3368
- <div id=outer>
3369
- <div id=inner></div>
3370
- <div>
3371
- )HTML" );
3372
- UpdateAllLifecyclePhases ();
3373
- EXPECT_FALSE (IsUseCounted (WebFeature::kCSSInvalidVariableUnset ));
3374
- ClearUseCounter (WebFeature::kCSSInvalidVariableUnset );
3375
-
3376
- // Count for @keyframes
3377
- GetDocument ().body ()->setInnerHTML (R"HTML(
3378
- <style>
3379
- @keyframes anim {
3380
- from { --x: var(--unknown); }
3381
- to { --x: var(--unknown); }
3382
- }
3383
- #outer {
3384
- --x: foo;
3385
- }
3386
- #inner {
3387
- animation: anim 10s;
3388
- }
3389
- </style>
3390
- <div id=outer>
3391
- <div id=inner></div>
3392
- <div>
3393
- )HTML" );
3394
- UpdateAllLifecyclePhases ();
3395
- EXPECT_TRUE (IsUseCounted (WebFeature::kCSSInvalidVariableUnset ));
3396
- ClearUseCounter (WebFeature::kCSSInvalidVariableUnset );
3397
-
3398
- // Don't count for @keyframes if there's nothing to inherit.
3399
- GetDocument ().body ()->setInnerHTML (R"HTML(
3400
- <style>
3401
- @keyframes anim {
3402
- from { --x: var(--unknown); }
3403
- to { --x: var(--unknown); }
3404
- }
3405
- #inner {
3406
- animation: anim 10s;
3407
- }
3408
- </style>
3409
- <div id=outer>
3410
- <div id=inner></div>
3411
- <div>
3412
- )HTML" );
3413
- UpdateAllLifecyclePhases ();
3414
- EXPECT_FALSE (IsUseCounted (WebFeature::kCSSInvalidVariableUnset ));
3415
- ClearUseCounter (WebFeature::kCSSInvalidVariableUnset );
3416
- }
3417
-
3418
3185
// https://crbug.com/1050564
3419
3186
TEST_F (StyleEngineTest, MediaAttributeChangeUpdatesFontCacheVersion) {
3420
3187
GetDocument ().body ()->setInnerHTML (R"HTML(
0 commit comments