Commit 83b67653 authored by Anders Hartvoll Ruud's avatar Anders Hartvoll Ruud Committed by Commit Bot

[@property] Actually count usage + unit test

Bug: 1085994
Change-Id: Ied0e00fa9e67850860ed0126269533396834b66b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2215814Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771987}
parent 84e0ff62
...@@ -63,7 +63,7 @@ void CountAtRule(const CSSParserContext* context, CSSAtRuleID rule_id) { ...@@ -63,7 +63,7 @@ void CountAtRule(const CSSParserContext* context, CSSAtRuleID rule_id) {
break; break;
case kCSSAtRuleProperty: case kCSSAtRuleProperty:
feature = WebFeature::kCSSAtRuleProperty; feature = WebFeature::kCSSAtRuleProperty;
return; break;
case kCSSAtRuleSupports: case kCSSAtRuleSupports:
feature = WebFeature::kCSSAtRuleSupports; feature = WebFeature::kCSSAtRuleSupports;
break; break;
......
...@@ -2702,6 +2702,30 @@ TEST_F(StyleEngineTest, PrintNoDarkColorScheme) { ...@@ -2702,6 +2702,30 @@ TEST_F(StyleEngineTest, PrintNoDarkColorScheme) {
GetCSSPropertyColor())); GetCSSPropertyColor()));
} }
TEST_F(StyleEngineTest, AtPropertyUseCount) {
ScopedCSSVariables2AtPropertyForTest scoped_feature(true);
GetDocument().body()->setInnerHTML(R"HTML(
<style>
body { --x: No @property rule here; }
</style>
)HTML");
UpdateAllLifecyclePhases();
EXPECT_FALSE(GetDocument().IsUseCounted(WebFeature::kCSSAtRuleProperty));
GetDocument().body()->setInnerHTML(R"HTML(
<style>
@property --x {
syntax: "<length>";
inherits: false;
initial-value: 0px;
}
</style>
)HTML");
UpdateAllLifecyclePhases();
EXPECT_TRUE(GetDocument().IsUseCounted(WebFeature::kCSSAtRuleProperty));
}
class ParameterizedStyleEngineTest class ParameterizedStyleEngineTest
: public testing::WithParamInterface<bool>, : public testing::WithParamInterface<bool>,
private ScopedCSSReducedFontLoadingInvalidationsForTest, private ScopedCSSReducedFontLoadingInvalidationsForTest,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment