Commit cc4e48ec authored by Philip Rogers's avatar Philip Rogers Committed by Commit Bot

Add UseCounter metric for composited (accelerated) SVG

This patch adds a UseCounter metric for composited (accelerated) SVG
content which is enabled by the CompositeSVG experiment.

Bug: 1101002
Change-Id: I42d50caf5ae86e60c74082cb4b21846b46557390
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2498821
Auto-Submit: Philip Rogers <pdr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820807}
parent 9f64374d
...@@ -3038,6 +3038,7 @@ enum WebFeature { ...@@ -3038,6 +3038,7 @@ enum WebFeature {
kColorSchemeDarkSupportedOnRoot = 3707, kColorSchemeDarkSupportedOnRoot = 3707,
kWebBluetoothGetAvailability = 3708, kWebBluetoothGetAvailability = 3708,
kDigitalGoodsListPurchases = 3709, kDigitalGoodsListPurchases = 3709,
kCompositedSVG = 3710,
// Add new features immediately above this line. Don't change assigned // Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots. // numbers of any item, and don't reuse removed slots.
......
...@@ -625,6 +625,9 @@ bool LayoutSVGRoot::HasDescendantWithCompositingReason() const { ...@@ -625,6 +625,9 @@ bool LayoutSVGRoot::HasDescendantWithCompositingReason() const {
} }
} }
has_descendant_with_compositing_reason_dirty_ = false; has_descendant_with_compositing_reason_dirty_ = false;
if (has_descendant_with_compositing_reason_)
UseCounter::Count(GetDocument(), WebFeature::kCompositedSVG);
} }
return has_descendant_with_compositing_reason_; return has_descendant_with_compositing_reason_;
} }
......
...@@ -219,4 +219,25 @@ TEST_P(CompositeSVGLayoutSVGRootTest, HasDescendantCompositingReasons) { ...@@ -219,4 +219,25 @@ TEST_P(CompositeSVGLayoutSVGRootTest, HasDescendantCompositingReasons) {
EXPECT_FALSE(root.HasDescendantCompositingReasons()); EXPECT_FALSE(root.HasDescendantCompositingReasons());
} }
TEST_P(CompositeSVGLayoutSVGRootTest, CompositedSVGMetric) {
SetBodyInnerHTML(R"HTML(
<style>
.anim { animation: anim 5s infinite; }
@keyframes anim {
from { transform: translateX(0); }
to { transform: translateX(100px); }
}
</style>
<svg style="width: 200px; height: 200px;">
<rect id="rect" width="100" height="100" fill="green"/>
</svg>
)HTML");
EXPECT_FALSE(GetDocument().IsUseCounted(WebFeature::kCompositedSVG));
auto* rect = GetDocument().getElementById("rect");
rect->setAttribute(html_names::kClassAttr, "anim");
UpdateAllLifecyclePhasesForTest();
EXPECT_TRUE(GetDocument().IsUseCounted(WebFeature::kCompositedSVG));
}
} // namespace blink } // namespace blink
...@@ -30006,6 +30006,7 @@ Called by update_use_counter_feature_enum.py.--> ...@@ -30006,6 +30006,7 @@ Called by update_use_counter_feature_enum.py.-->
<int value="3707" label="ColorSchemeDarkSupportedOnRoot"/> <int value="3707" label="ColorSchemeDarkSupportedOnRoot"/>
<int value="3708" label="WebBluetoothGetAvailability"/> <int value="3708" label="WebBluetoothGetAvailability"/>
<int value="3709" label="DigitalGoodsListPurchases"/> <int value="3709" label="DigitalGoodsListPurchases"/>
<int value="3710" label="CompositedSVG"/>
</enum> </enum>
<enum name="FeaturePolicyAllowlistType"> <enum name="FeaturePolicyAllowlistType">
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