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

Avoid deprecated CSSInterpolationEnvironment constructor

The CSSInterpolationEnvironment constructor that accepts a
CSSVariableResolver should only be used when the CSSCascade flag is
disabled.

Change-Id: I7a7b984c16dcc684e5d76d412a0e1565d7efb1c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2302113
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: default avatarRobert Flack <flackr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#789558}
parent 713432e2
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "third_party/blink/renderer/core/animation/interpolation_environment.h" #include "third_party/blink/renderer/core/animation/interpolation_environment.h"
#include "third_party/blink/renderer/core/css/resolver/style_resolver_state.h" #include "third_party/blink/renderer/core/css/resolver/style_resolver_state.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
namespace blink { namespace blink {
...@@ -23,7 +24,9 @@ class CSSInterpolationEnvironment : public InterpolationEnvironment { ...@@ -23,7 +24,9 @@ class CSSInterpolationEnvironment : public InterpolationEnvironment {
: InterpolationEnvironment(map), : InterpolationEnvironment(map),
state_(&state), state_(&state),
style_(state.Style()), style_(state.Style()),
variable_resolver_(variable_resolver) {} variable_resolver_(variable_resolver) {
DCHECK(!RuntimeEnabledFeatures::CSSCascadeEnabled());
}
explicit CSSInterpolationEnvironment(const InterpolationTypesMap& map, explicit CSSInterpolationEnvironment(const InterpolationTypesMap& map,
StyleResolverState& state, StyleResolverState& state,
...@@ -33,7 +36,9 @@ class CSSInterpolationEnvironment : public InterpolationEnvironment { ...@@ -33,7 +36,9 @@ class CSSInterpolationEnvironment : public InterpolationEnvironment {
state_(&state), state_(&state),
style_(state.Style()), style_(state.Style()),
cascade_(cascade), cascade_(cascade),
cascade_resolver_(cascade_resolver) {} cascade_resolver_(cascade_resolver) {
DCHECK(RuntimeEnabledFeatures::CSSCascadeEnabled());
}
explicit CSSInterpolationEnvironment(const InterpolationTypesMap& map, explicit CSSInterpolationEnvironment(const InterpolationTypesMap& map,
const ComputedStyle& style) const ComputedStyle& style)
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "third_party/blink/renderer/core/animation/interpolation_environment.h" #include "third_party/blink/renderer/core/animation/interpolation_environment.h"
#include "third_party/blink/renderer/core/animation/interpolation_type.h" #include "third_party/blink/renderer/core/animation/interpolation_type.h"
#include "third_party/blink/renderer/core/css/resolver/style_resolver_state.h" #include "third_party/blink/renderer/core/css/resolver/style_resolver_state.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
namespace blink { namespace blink {
...@@ -48,9 +49,15 @@ TransitionInterpolation::CurrentNonInterpolableValue() const { ...@@ -48,9 +49,15 @@ TransitionInterpolation::CurrentNonInterpolableValue() const {
void TransitionInterpolation::Apply(StyleResolverState& state) const { void TransitionInterpolation::Apply(StyleResolverState& state) const {
CSSInterpolationTypesMap map(state.GetDocument().GetPropertyRegistry(), CSSInterpolationTypesMap map(state.GetDocument().GetPropertyRegistry(),
state.GetDocument()); state.GetDocument());
CSSInterpolationEnvironment environment(map, state, nullptr); if (RuntimeEnabledFeatures::CSSCascadeEnabled()) {
type_.Apply(CurrentInterpolableValue(), CurrentNonInterpolableValue(), CSSInterpolationEnvironment environment(map, state, nullptr, nullptr);
environment); type_.Apply(CurrentInterpolableValue(), CurrentNonInterpolableValue(),
environment);
} else {
CSSInterpolationEnvironment environment(map, state, nullptr);
type_.Apply(CurrentInterpolableValue(), CurrentNonInterpolableValue(),
environment);
}
} }
std::unique_ptr<TypedInterpolationValue> std::unique_ptr<TypedInterpolationValue>
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "third_party/blink/renderer/core/css/resolver/style_resolver.h" #include "third_party/blink/renderer/core/css/resolver/style_resolver.h"
#include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
namespace blink { namespace blink {
...@@ -47,9 +48,16 @@ void TransitionKeyframe::AddKeyframePropertiesToV8Object( ...@@ -47,9 +48,16 @@ void TransitionKeyframe::AddKeyframePropertiesToV8Object(
StyleResolverState state(document, *element); StyleResolverState state(document, *element);
state.SetStyle(ComputedStyle::Create()); state.SetStyle(ComputedStyle::Create());
CSSInterpolationTypesMap map(document.GetPropertyRegistry(), document); CSSInterpolationTypesMap map(document.GetPropertyRegistry(), document);
CSSInterpolationEnvironment environment(map, state, nullptr);
value_->GetType().Apply(value_->GetInterpolableValue(), if (RuntimeEnabledFeatures::CSSCascadeEnabled()) {
value_->GetNonInterpolableValue(), environment); CSSInterpolationEnvironment environment(map, state, nullptr, nullptr);
value_->GetType().Apply(value_->GetInterpolableValue(),
value_->GetNonInterpolableValue(), environment);
} else {
CSSInterpolationEnvironment environment(map, state, nullptr);
value_->GetType().Apply(value_->GetInterpolableValue(),
value_->GetNonInterpolableValue(), environment);
}
const ComputedStyle* style = state.Style(); const ComputedStyle* style = state.Style();
String property_value = String property_value =
......
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