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

Side by Side Diff: chrome/browser/resources/options/browser_options.js

Issue 393943003: Settings page sliding transition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 cr.define('options', function() { 5 cr.define('options', function() {
6 var OptionsPage = options.OptionsPage; 6 var OptionsPage = options.OptionsPage;
7 var Page = cr.ui.pageManager.Page; 7 var Page = cr.ui.pageManager.Page;
8 var PageManager = cr.ui.pageManager.PageManager; 8 var PageManager = cr.ui.pageManager.PageManager;
9 var ArrayDataModel = cr.ui.ArrayDataModel; 9 var ArrayDataModel = cr.ui.ArrayDataModel;
10 var RepeatingButton = cr.ui.RepeatingButton; 10 var RepeatingButton = cr.ui.RepeatingButton;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 /** 67 /**
68 * Track if page initialization is complete. All C++ UI handlers have the 68 * Track if page initialization is complete. All C++ UI handlers have the
69 * chance to manipulate page content within their InitializePage methods. 69 * chance to manipulate page content within their InitializePage methods.
70 * This flag is set to true after all initializers have been called. 70 * This flag is set to true after all initializers have been called.
71 * @type {boolean} 71 * @type {boolean}
72 * @private 72 * @private
73 */ 73 */
74 initializationComplete_: false, 74 initializationComplete_: false,
75 75
76 /**
77 * When a section is waiting to change its height, this will be a number.
78 * Otherwise it'll be null.
79 * @type {?number}
80 * @private
81 */
82 sectionHeightChangeTimeout_: null,
83
84 /** @override */ 76 /** @override */
85 initializePage: function() { 77 initializePage: function() {
86 Page.prototype.initializePage.call(this); 78 Page.prototype.initializePage.call(this);
87 var self = this; 79 var self = this;
88 80
89 if (window.top != window) { 81 if (window.top != window) {
90 // The options page is not in its own window. 82 // The options page is not in its own window.
91 document.body.classList.add('uber-frame'); 83 document.body.classList.add('uber-frame');
92 PageManager.horizontalOffset = 155; 84 PageManager.horizontalOffset = 155;
93 } 85 }
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 // end event as the upcoming code will cancel the current one. 730 // end event as the upcoming code will cancel the current one.
739 if (section.classList.contains('sliding')) 731 if (section.classList.contains('sliding'))
740 cr.dispatchSimpleEvent(section, 'webkitTransitionEnd'); 732 cr.dispatchSimpleEvent(section, 'webkitTransitionEnd');
741 733
742 this.addTransitionEndListener_(section); 734 this.addTransitionEndListener_(section);
743 735
744 section.hidden = false; 736 section.hidden = false;
745 section.style.height = (showing ? 0 : container.offsetHeight) + 'px'; 737 section.style.height = (showing ? 0 : container.offsetHeight) + 'px';
746 section.classList.add('sliding'); 738 section.classList.add('sliding');
747 739
748 if (this.sectionHeightChangeTimeout_ !== null) 740 // Force a style recalc before starting the animation.
749 clearTimeout(this.sectionHeightChangeTimeout_); 741 /** @suppress {uselessCode} */
742 section.offsetHeight;
750 743
751 this.sectionHeightChangeTimeout_ = setTimeout(function() { 744 section.style.height = (showing ? container.offsetHeight : 0) + 'px';
752 section.style.height = (showing ? container.offsetHeight : 0) + 'px';
753 this.sectionHeightChangeTimeout_ = null;
754 });
755 }, 745 },
756 746
757 /** 747 /**
758 * Shows the given section. 748 * Shows the given section.
759 * @param {HTMLElement} section The section to be shown. 749 * @param {HTMLElement} section The section to be shown.
760 * @param {HTMLElement} container The container for the section. Must be 750 * @param {HTMLElement} container The container for the section. Must be
761 * inside of |section|. 751 * inside of |section|.
762 * @param {boolean} animate Indicate if the expansion should be animated. 752 * @param {boolean} animate Indicate if the expansion should be animated.
763 * @private 753 * @private
764 */ 754 */
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 BrowserOptions.getLoggedInUsername = function() { 1964 BrowserOptions.getLoggedInUsername = function() {
1975 return BrowserOptions.getInstance().username_; 1965 return BrowserOptions.getInstance().username_;
1976 }; 1966 };
1977 } 1967 }
1978 1968
1979 // Export 1969 // Export
1980 return { 1970 return {
1981 BrowserOptions: BrowserOptions 1971 BrowserOptions: BrowserOptions
1982 }; 1972 };
1983 }); 1973 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698