Commit 09d14652 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Add a use counter for getComputedStyle outside the flat tree.

We would like to return empty styles for elements which are connected but
not part of the flat tree. That is, shadow host children which are not
slotted or any nodes in its flat subtree.

Bug: 831568
Change-Id: Ifd6ab89196a83571044ca995198e3e31c904304e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1916460
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715234}
parent b8711233
...@@ -2469,6 +2469,7 @@ enum WebFeature { ...@@ -2469,6 +2469,7 @@ enum WebFeature {
kModuleDedicatedWorker = 3085, kModuleDedicatedWorker = 3085,
kFetchBodyStreamInServiceWorker = 3086, kFetchBodyStreamInServiceWorker = 3086,
kFetchBodyStreamOutsideServiceWorker = 3087, kFetchBodyStreamOutsideServiceWorker = 3087,
kGetComputedStyleOutsideFlatTree = 3088,
// 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.
......
...@@ -307,9 +307,14 @@ bool CSSComputedStyleDeclaration::IsMonospaceFont() const { ...@@ -307,9 +307,14 @@ bool CSSComputedStyleDeclaration::IsMonospaceFont() const {
const ComputedStyle* CSSComputedStyleDeclaration::ComputeComputedStyle() const { const ComputedStyle* CSSComputedStyleDeclaration::ComputeComputedStyle() const {
Node* styled_node = this->StyledNode(); Node* styled_node = this->StyledNode();
DCHECK(styled_node); DCHECK(styled_node);
return styled_node->EnsureComputedStyle(styled_node->IsPseudoElement() const ComputedStyle* style = styled_node->EnsureComputedStyle(
? kPseudoIdNone styled_node->IsPseudoElement() ? kPseudoIdNone
: pseudo_element_specifier_); : pseudo_element_specifier_);
if (style && style->IsEnsuredOutsideFlatTree()) {
UseCounter::Count(node_->GetDocument(),
WebFeature::kGetComputedStyleOutsideFlatTree);
}
return style;
} }
Node* CSSComputedStyleDeclaration::StyledNode() const { Node* CSSComputedStyleDeclaration::StyledNode() const {
......
...@@ -25456,6 +25456,7 @@ Called by update_net_error_codes.py.--> ...@@ -25456,6 +25456,7 @@ Called by update_net_error_codes.py.-->
<int value="3085" label="ModuleDedicatedWorker"/> <int value="3085" label="ModuleDedicatedWorker"/>
<int value="3086" label="FetchBodyStreamInServiceWorker"/> <int value="3086" label="FetchBodyStreamInServiceWorker"/>
<int value="3087" label="FetchBodyStreamOutsideServiceWorker"/> <int value="3087" label="FetchBodyStreamOutsideServiceWorker"/>
<int value="3088" label="GetComputedStyleOutsideFlatTree"/>
</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