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

Side by Side Diff: LayoutTests/animations/svg-attribute-interpolation/resources/interpolation-test.js

Issue 1151573017: Web Animations: Always use svg prefix when animating SVG attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Only first letter changes case when svg prefix is added/removed Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 (function() { 6 (function() {
7 var testCount = 0; 7 var testCount = 0;
8 var animationEventCount = 0; 8 var animationEventCount = 0;
9 9
10 var durationSeconds = 0.001; 10 var durationSeconds = 0.001;
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 var setElement = document.createElementNS(svgNamespace, 'set'); 462 var setElement = document.createElementNS(svgNamespace, 'set');
463 setElement.setAttribute('attributeName', namespacedAttributeName(attribute Name)); 463 setElement.setAttribute('attributeName', namespacedAttributeName(attribute Name));
464 setElement.setAttribute('attributeType', 'XML'); 464 setElement.setAttribute('attributeType', 'XML');
465 setElement.setAttribute('to', expectation); 465 setElement.setAttribute('to', expectation);
466 element.appendChild(setElement); 466 element.appendChild(setElement);
467 } else { 467 } else {
468 element.setAttribute(attributeName, expectation); 468 element.setAttribute(attributeName, expectation);
469 } 469 }
470 } 470 }
471 471
472 // The following collide with CSS properties or the Web Animations API (offset ).
473 var svgPrefixedAttributes = [
474 'cx',
475 'cy',
476 'height',
477 'offset',
478 'offset',
479 'order',
480 'r',
481 'rx',
482 'ry',
483 'transform',
484 'width',
485 'x',
486 'y',
487 ];
488
489 function makeKeyframes(target, attributeName, params) { 472 function makeKeyframes(target, attributeName, params) {
490 if (svgPrefixedAttributes.indexOf(attributeName) !== -1) 473 // Replace 'transform' with 'svgTransform', etc. This avoids collisions with CSS properties or the Web Animations API (offset).
491 attributeName = 'svg' + attributeName[0].toUpperCase() + attributeName.sli ce(1); 474 attributeName = 'svg' + attributeName[0].toUpperCase() + attributeName.slice (1);
alancutter (OOO until 2018) 2015/06/09 06:25:05 Nit: Store this in a different variable called pre
492 475
493 var keyframes = [{}, {}]; 476 var keyframes = [{}, {}];
494 if (attributeName === 'class') { 477 if (attributeName === 'svgClass') {
495 // Preserve the existing classes as we use them to select elements. 478 // Preserve the existing classes as we use them to select elements.
496 keyframes[0][attributeName] = target['className'].baseVal + ' ' + params.f rom; 479 keyframes[0][attributeName] = target['className'].baseVal + ' ' + params.f rom;
497 keyframes[1][attributeName] = target['className'].baseVal + ' ' + params.t o; 480 keyframes[1][attributeName] = target['className'].baseVal + ' ' + params.t o;
498 } else { 481 } else {
499 keyframes[0][attributeName] = params.from; 482 keyframes[0][attributeName] = params.from;
500 keyframes[1][attributeName] = params.to; 483 keyframes[1][attributeName] = params.to;
501 } 484 }
502 return keyframes; 485 return keyframes;
503 } 486 }
504 487
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 setTimeout(function() { 655 setTimeout(function() {
673 if (finished) { 656 if (finished) {
674 return; 657 return;
675 } 658 }
676 finishTest(); 659 finishTest();
677 }, 5000); 660 }, 5000);
678 } 661 }
679 662
680 window.assertAttributeInterpolation = assertAttributeInterpolation; 663 window.assertAttributeInterpolation = assertAttributeInterpolation;
681 })(); 664 })();
OLDNEW
« no previous file with comments | « no previous file | Source/core/animation/EffectInput.cpp » ('j') | Source/core/animation/EffectInput.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698