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

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

Issue 8371017: Print Preview: Changing the structure of the html/css. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updating unittests Created 9 years, 2 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 | « chrome/browser/resources/print_preview/print_preview.html ('k') | chrome/browser/resources/webui.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 60caa7ae533bf6205e6c3b540e04591c960a9b80..b717e249be8b283c14ec85ca349f2362ec6e5a5e 100644
--- a/chrome/browser/resources/print_preview/print_preview_animations.js
+++ b/chrome/browser/resources/print_preview/print_preview_animations.js
@@ -78,3 +78,60 @@ function fadeInOutCleanup(animationName) {
animEl.parentNode.removeChild(animEl);
}
+/**
+ * Fades in a printing option existing under |el|.
+ * @param {HTMLElement} el The element to hide.
+ */
+function fadeInOption(el) {
+ if (el.classList.contains('visible'))
+ return;
+
+ wrapContentsInDiv(el.querySelector('h1'), ['invisible']);
+ var rightColumn = el.querySelector('.right-column');
+ wrapContentsInDiv(rightColumn, ['invisible']);
+
+ var toAnimate = el.querySelectorAll('.collapsible');
+ for (var i = 0; i < toAnimate.length; i++)
+ fadeInElement(toAnimate[i]);
+ el.classList.add('visible');
+}
+
+/**
+ * Fades out a printing option existing under |el|.
+ * @param {HTMLElement} el The element to hide.
+ */
+function fadeOutOption(el) {
+ if (!el.classList.contains('visible'))
+ return;
+
+ wrapContentsInDiv(el.querySelector('h1'), ['visible']);
+ var rightColumn = el.querySelector('.right-column');
+ wrapContentsInDiv(rightColumn, ['visible']);
+
+ var toAnimate = el.querySelectorAll('.collapsible');
+ for (var i = 0; i < toAnimate.length; i++)
+ fadeOutElement(toAnimate[i]);
+ el.classList.remove('visible');
+}
+
+/**
+ * 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 neccesary
+ * for animating the height of table cells.
+ * @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');
+ if (!div || !div.classList.contains('collapsible')) {
+ div = document.createElement('div');
+ while (el.childNodes.length > 0)
+ div.appendChild(el.firstChild);
+ el.appendChild(div);
+ }
+
+ div.className = '';
+ div.classList.add('collapsible');
+ for (var i = 0; i < classes.length; i++)
+ div.classList.add(classes[i]);
+}
« no previous file with comments | « chrome/browser/resources/print_preview/print_preview.html ('k') | chrome/browser/resources/webui.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698