Commit d5cf8252 authored by Anders Hartvoll Ruud's avatar Anders Hartvoll Ruud Committed by Commit Bot

Verify that vars() are resolved in ApplyProperty with CSSCascade enabled

There is code to resolve variables in this function, but we should
not reach it with CSSCascade enabled.

Change-Id: I39580db63b1f48114210b2ac59d3d29253a8eb1a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2302056
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#789309}
parent 3b3d2a16
......@@ -50,6 +50,7 @@
#include "third_party/blink/renderer/core/css/resolver/style_builder.h"
#include "third_party/blink/renderer/core/css/resolver/style_resolver_state.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
namespace blink {
......@@ -70,19 +71,27 @@ void StyleBuilder::ApplyProperty(const CSSProperty& property,
CSSPropertyID id = property.PropertyID();
bool is_inherited = property.IsInherited();
if (id != CSSPropertyID::kVariable && (value.IsVariableReferenceValue() ||
value.IsPendingSubstitutionValue())) {
bool omit_animation_tainted =
CSSAnimations::IsAnimationAffectingProperty(property);
const CSSValue* resolved_value =
CSSVariableResolver(state).ResolveVariableReferences(
id, value, omit_animation_tainted);
ApplyProperty(property, state, *resolved_value);
if (!state.Style()->HasVariableReferenceFromNonInheritedProperty() &&
!is_inherited)
state.Style()->SetHasVariableReferenceFromNonInheritedProperty();
return;
if (RuntimeEnabledFeatures::CSSCascadeEnabled()) {
// These values must be resolved by StyleCascade before application:
DCHECK(!value.IsVariableReferenceValue());
DCHECK(!value.IsPendingSubstitutionValue());
} else {
if (id != CSSPropertyID::kVariable &&
(value.IsVariableReferenceValue() ||
value.IsPendingSubstitutionValue())) {
bool omit_animation_tainted =
CSSAnimations::IsAnimationAffectingProperty(property);
const CSSValue* resolved_value =
CSSVariableResolver(state).ResolveVariableReferences(
id, value, omit_animation_tainted);
ApplyProperty(property, state, *resolved_value);
if (!state.Style()->HasVariableReferenceFromNonInheritedProperty() &&
!is_inherited)
state.Style()->SetHasVariableReferenceFromNonInheritedProperty();
return;
}
}
DCHECK(!property.IsShorthand())
......
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