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

Unified Diff: third_party/WebKit/LayoutTests/animations/interpolation/resources/interpolation-test.js

Issue 2564793002: Add smooth interpolation support for <color> custom properties (Closed)
Patch Set: <color> 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
Index: third_party/WebKit/LayoutTests/animations/interpolation/resources/interpolation-test.js
diff --git a/third_party/WebKit/LayoutTests/animations/interpolation/resources/interpolation-test.js b/third_party/WebKit/LayoutTests/animations/interpolation/resources/interpolation-test.js
index 1fe9ee905b63ca6500919b625757cf0c3d54fa99..4539a679cfcb1dc2b156bd0cc5943a9c76dc7914 100644
--- a/third_party/WebKit/LayoutTests/animations/interpolation/resources/interpolation-test.js
+++ b/third_party/WebKit/LayoutTests/animations/interpolation/resources/interpolation-test.js
@@ -102,7 +102,7 @@
supportsProperty: function() {return true;},
sashab 2017/01/25 02:55:00 These fixes are great, but maybe put in separate p
alancutter (OOO until 2018) 2017/01/25 03:55:13 Done.
supportsValue: function() {return true;},
setup: function(property, from, target) {
- target.style[property] = isNeutralKeyframe(from) ? '' : from;
+ target.style.setProperty(property, isNeutralKeyframe(from) ? '' : from);
},
nonInterpolationExpectations: function(from, to) {
return expectFlip(from, to, -Infinity);
@@ -112,7 +112,7 @@
target.style.transitionDelay = '-1e10s';
target.style.transitionTimingFunction = createEasing(at);
target.style.transitionProperty = property;
- target.style[property] = isNeutralKeyframe(to) ? '' : to;
+ target.style.setProperty(property, isNeutralKeyframe(to) ? '' : to);
},
rebaseline: false,
};
@@ -129,10 +129,12 @@
this.interpolateComposite(property, from, 'replace', to, 'replace', at, target);
},
interpolateComposite: function(property, from, fromComposite, to, toComposite, at, target) {
- // Convert to camelCase
- for (var i = property.length - 2; i > 0; --i) {
- if (property[i] === '-') {
- property = property.substring(0, i) + property[i + 1].toUpperCase() + property.substring(i + 2);
+ // Convert standard properties to camelCase.
+ if (!property.startsWith('--')) {
+ for (var i = property.length - 2; i > 0; --i) {
+ if (property[i] === '-') {
+ property = property.substring(0, i) + property[i + 1].toUpperCase() + property.substring(i + 2);
+ }
}
}
var keyframes = [];
@@ -312,18 +314,18 @@ assertInterpolation({
return expectations.map(function(expectation) {
var actualTargetContainer = createTargetContainer(testContainer, 'actual');
var expectedTargetContainer = createTargetContainer(testContainer, 'expected');
- expectedTargetContainer.target.style[property] = expectation.is;
+ expectedTargetContainer.target.style.setProperty(property, expectation.is);
var target = actualTargetContainer.target;
interpolationMethod.setup(property, from, target);
target.interpolate = function() {
interpolationMethod.interpolate(property, from, to, expectation.at, target);
};
target.measure = function() {
- var actualValue = getComputedStyle(target)[property];
+ var actualValue = getComputedStyle(target).getPropertyValue(property);
test(function() {
assert_equals(
normalizeValue(actualValue),
- normalizeValue(getComputedStyle(expectedTargetContainer.target)[property]));
+ normalizeValue(getComputedStyle(expectedTargetContainer.target).getPropertyValue(property)));
}, `${testText} at (${expectation.at}) is [${sanitizeUrls(actualValue)}]`);
if (rebaselineExpectation) {
rebaselineExpectation.textContent += ` {at: ${expectation.at}, is: '${actualValue}'},\n`;
@@ -369,18 +371,18 @@ assertComposition({
return compositionTest.expectations.map(function(expectation) {
var actualTargetContainer = createTargetContainer(testContainer, 'actual');
var expectedTargetContainer = createTargetContainer(testContainer, 'expected');
- expectedTargetContainer.target.style[property] = expectation.is;
+ expectedTargetContainer.target.style.setProperty(property, expectation.is);
var target = actualTargetContainer.target;
- target.style[property] = underlying;
+ target.style.setProperty(property, underlying);
target.interpolate = function() {
webAnimationsInterpolation.interpolateComposite(property, from, fromComposite, to, toComposite, expectation.at, target);
};
target.measure = function() {
- var actualValue = getComputedStyle(target)[property];
+ var actualValue = getComputedStyle(target).getPropertyValue(property);
test(function() {
assert_equals(
normalizeValue(actualValue),
- normalizeValue(getComputedStyle(expectedTargetContainer.target)[property]));
+ normalizeValue(getComputedStyle(expectedTargetContainer.target).getPropertyValue(property)));
}, `${testText} at (${expectation.at}) is [${sanitizeUrls(actualValue)}]`);
if (rebaselineExpectation) {
rebaselineExpectation.textContent += ` {at: ${expectation.at}, is: '${actualValue}'},\n`;

Powered by Google App Engine
This is Rietveld 408576698