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

Unified Diff: chrome/browser/resources/print_preview/print_preview_animations.js

Issue 2863183004: Print Preview: Fix top level directory compile errors (Closed)
Patch Set: Address comments Created 3 years, 7 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: 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..d931694e1ceb4b9adaba532f5426b08358e12aa8 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');
@@ -172,8 +178,8 @@ function fadeOutOption(el, opt_justHide) {
* Wraps the contents of |el| in a div element and attaches css classes
* |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.
- * @param {array} classes The css classes to add.
+ * @param {!HTMLElement} el The element to be processed.
+ * @param {!Array} classes The css classes to add.
*/
function wrapContentsInDiv(el, classes) {
var div = el.querySelector('div');

Powered by Google App Engine
This is Rietveld 408576698