Commit 67bc72a9 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Skip ShadowRoot::RecalcStyle for FlatTreeStyleRecalc.

The ShadowRoot does not take part in dirty marking with the
FlatTreeStyleRecalc runtime flag enabled. We can just skip directly to
RecalcDescendants(). Since ShadowRoot was not marked with
ChildNeedsStyleRecalc we would otherwise not traverse into the shadow
root children via ShadowRoot::RecalcStyle().

Bug: 972752
Change-Id: I5a3debfa25d1d431e5dab43729c843592d3c6a71
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1841339Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703288}
parent 59cca2c8
......@@ -2935,10 +2935,13 @@ void Element::RecalcStyle(const StyleRecalcChange change) {
if (child_change.TraverseChildren(*this)) {
SelectorFilterParentScope filter_scope(*this);
if (ShadowRoot* root = GetShadowRoot()) {
if (child_change.TraverseChild(*root))
root->RecalcStyle(child_change);
if (!RuntimeEnabledFeatures::FlatTreeStyleRecalcEnabled())
if (RuntimeEnabledFeatures::FlatTreeStyleRecalcEnabled()) {
root->RecalcDescendantStyles(child_change);
} else {
if (child_change.TraverseChild(*root))
root->RecalcStyle(child_change);
RecalcDescendantStyles(StyleRecalcChange::kClearEnsured);
}
} else if (auto* slot = ToHTMLSlotElementIfSupportsAssignmentOrNull(this)) {
slot->RecalcStyleForSlotChildren(child_change);
} else if (auto* insertion_point = DynamicTo<V0InsertionPoint>(this)) {
......
......@@ -141,8 +141,7 @@ void ShadowRoot::setInnerHTML(const StringOrTrustedHTML& stringOrHtml,
void ShadowRoot::RecalcStyle(const StyleRecalcChange change) {
// ShadowRoot doesn't support custom callbacks.
DCHECK(!HasCustomStyleCallbacks());
DCHECK(!NeedsStyleRecalc() ||
!RuntimeEnabledFeatures::FlatTreeStyleRecalcEnabled());
DCHECK(!RuntimeEnabledFeatures::FlatTreeStyleRecalcEnabled());
StyleRecalcChange child_change = change;
if (GetStyleChangeType() == kSubtreeStyleChange)
......
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