Chromium Code Reviews| Index: chrome/browser/resources/print_preview/print_preview_animations.js |
| diff --git a/chrome/browser/resources/print_preview/print_preview_animations.js b/chrome/browser/resources/print_preview/print_preview_animations.js |
| index b8b1a19b06756f40f4df5e7aa09f0d98e8fef877..0498d8c13f51c7f3c47783a9579868d4290a1bb3 100644 |
| --- a/chrome/browser/resources/print_preview/print_preview_animations.js |
| +++ b/chrome/browser/resources/print_preview/print_preview_animations.js |
| @@ -5,7 +5,7 @@ |
| // Counter used to give animations unique names. |
| var animationCounter = 0; |
| -var animationEventTracker_ = new EventTracker(); |
| +var animationEventTracker = new EventTracker(); |
| function addAnimation(code) { |
| var name = 'anim' + animationCounter; |
| @@ -54,7 +54,7 @@ function fadeInElement(el, opt_justShow) { |
| } else { |
| el.style.height = height + 'px'; |
| var animName = addAnimation(getFadeInAnimationCode(height)); |
| - animationEventTracker_.add( |
| + animationEventTracker.add( |
| el, 'animationend', onFadeInAnimationEnd.bind(el), false); |
| el.style.animationName = animName; |
| } |
| @@ -73,8 +73,9 @@ function fadeOutElement(el) { |
| el.style.height = 'auto'; |
| var height = el.offsetHeight; |
| el.style.height = height + 'px'; |
| + /** @suppress {suspiciousCode} */ |
| el.offsetHeight; // Should force an update of the computed style. |
| - animationEventTracker_.add( |
| + animationEventTracker.add( |
| el, 'transitionend', onFadeOutTransitionEnd.bind(el), false); |
| el.classList.add('closing'); |
| el.classList.remove('visible'); |
| @@ -89,7 +90,7 @@ function fadeOutElement(el) { |
| function onFadeOutTransitionEnd(event) { |
| if (event.propertyName != 'height') |
| return; |
| - animationEventTracker_.remove(this, 'transitionend'); |
| + animationEventTracker.remove(this, 'transitionend'); |
| this.hidden = true; |
| } |
| @@ -113,7 +114,7 @@ function fadeInAnimationCleanup(element) { |
| if (animEl) |
| animEl.parentNode.removeChild(animEl); |
| element.style.animationName = ''; |
| - animationEventTracker_.remove(element, 'animationend'); |
| + animationEventTracker.remove(element, 'animationend'); |
| } |
| } |
| @@ -129,14 +130,16 @@ function fadeInOption(el, opt_justShow) { |
| // To make the option visible during the first fade in. |
| el.hidden = false; |
| - var leftColumn = el.querySelector('.left-column'); |
| + var leftColumn = assertInstanceof(el.querySelector('.left-column'), |
| + HTMLElement); |
| wrapContentsInDiv(leftColumn, ['invisible']); |
| - var rightColumn = el.querySelector('.right-column'); |
| + var rightColumn = assertInstanceof(el.querySelector('.right-column'), |
| + HTMLElement); |
| wrapContentsInDiv(rightColumn, ['invisible']); |
| var toAnimate = el.querySelectorAll('.collapsible'); |
| for (var i = 0; i < toAnimate.length; i++) |
| - fadeInElement(toAnimate[i], opt_justShow); |
| + fadeInElement(assertInstanceof(toAnimate[i], HTMLElement), opt_justShow); |
| el.classList.add('visible'); |
| } |
| @@ -150,10 +153,13 @@ function fadeOutOption(el, opt_justHide) { |
| if (!el.classList.contains('visible')) |
| return; |
| - var leftColumn = el.querySelector('.left-column'); |
| + var leftColumn = assertInstanceof(el.querySelector('.left-column'), |
| + HTMLElement); |
| wrapContentsInDiv(leftColumn, ['visible']); |
| - var rightColumn = el.querySelector('.right-column'); |
| - wrapContentsInDiv(rightColumn, ['visible']); |
| + var rightColumn = assertInstanceof(el.querySelector('.right-column'), |
| + HTMLElement); |
| + if (rightColumn) |
| + wrapContentsInDiv(rightColumn, ['visible']); |
| var toAnimate = el.querySelectorAll('.collapsible'); |
| for (var i = 0; i < toAnimate.length; i++) { |
| @@ -162,7 +168,7 @@ function fadeOutOption(el, opt_justHide) { |
| toAnimate[i].classList.add('closing'); |
| toAnimate[i].classList.remove('visible'); |
| } else { |
| - fadeOutElement(toAnimate[i]); |
| + fadeOutElement(assertInstanceof(toAnimate[i], HTMLElement)); |
| } |
| } |
| el.classList.remove('visible'); |
| @@ -173,7 +179,7 @@ function fadeOutOption(el, opt_justHide) { |
| * |classes| in the new div, only if has not been already done. It is necessary |
| * for animating the height of table cells. |
| * @param {HTMLElement} el The element to be processed. |
|
dpapad
2017/05/05 23:30:29
Could this be !HTMLELement. Same question for !Arr
rbpotter
2017/05/06 00:02:19
Done.
|
| - * @param {array} classes The css classes to add. |
| + * @param {Array} classes The css classes to add. |
| */ |
| function wrapContentsInDiv(el, classes) { |
| var div = el.querySelector('div'); |