Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Unified Diff: third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp

Issue 2649863006: Add null check to animations for registered custom property initial values (Closed)
Patch Set: Fix shadowed variable Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/animations/custom-properties/empty-initial-value-crash.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp
diff --git a/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp
index c15db7de439ddc884aa8f714245b961ac1073afd..26f23618931360efb4859b6a3b267bcfe1613e57 100644
--- a/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp
+++ b/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp
@@ -87,6 +87,12 @@ class InheritedCustomPropertyChecker
if (!inheritedValue) {
inheritedValue = m_initialValue.get();
}
+ if (inheritedValue == m_inheritedValue.get()) {
+ return true;
+ }
+ if (!inheritedValue || !m_inheritedValue) {
+ return false;
+ }
return m_inheritedValue->equals(*inheritedValue);
}
@@ -207,20 +213,23 @@ CSSInterpolationType::maybeConvertCustomPropertyDeclarationInternal(
return nullptr;
}
+ const CSSValue* value = nullptr;
if (declaration.isInitial(isInheritedProperty)) {
- return maybeConvertValue(*registration->initial(), state,
- conversionCheckers);
+ value = registration->initial();
+ } else {
+ value =
+ state.parentStyle()->getRegisteredVariable(name, isInheritedProperty);
+ if (!value) {
+ value = registration->initial();
+ }
+ conversionCheckers.push_back(InheritedCustomPropertyChecker::create(
+ name, isInheritedProperty, value, registration->initial()));
}
-
- DCHECK(declaration.isInherit(isInheritedProperty));
- const CSSValue* inheritedValue =
- state.parentStyle()->getRegisteredVariable(name, isInheritedProperty);
- if (!inheritedValue) {
- inheritedValue = registration->initial();
+ if (!value) {
+ return nullptr;
}
- conversionCheckers.push_back(InheritedCustomPropertyChecker::create(
- name, isInheritedProperty, inheritedValue, registration->initial()));
- return maybeConvertValue(*inheritedValue, state, conversionCheckers);
+
+ return maybeConvertValue(*value, state, conversionCheckers);
}
if (declaration.value()->needsVariableResolution()) {
@@ -263,6 +272,9 @@ InterpolationValue CSSInterpolationType::maybeConvertUnderlyingValue(
if (!underlyingValue) {
underlyingValue = registration->initial();
}
+ if (!underlyingValue) {
+ return nullptr;
+ }
// TODO(alancutter): Remove the need for passing in conversion checkers.
ConversionCheckers dummyConversionCheckers;
return maybeConvertValue(*underlyingValue, environment.state(),
« no previous file with comments | « third_party/WebKit/LayoutTests/animations/custom-properties/empty-initial-value-crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698