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

Side by Side Diff: ui/webui/resources/js/cr/ui/overlay.js

Issue 22661007: Make the body not scrollable and make a scrollable container div to host #extension-settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move to higher level of overlay. Created 7 years, 4 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
« no previous file with comments | « ui/webui/resources/css/overlay.css ('k') | 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 /** 5 /**
6 * @fileoverview Provides dialog-like behaviors for the tracing UI. 6 * @fileoverview Provides dialog-like behaviors for the tracing UI.
7 */ 7 */
8 cr.define('cr.ui.overlay', function() { 8 cr.define('cr.ui.overlay', function() {
9 /** 9 /**
10 * Gets the top, visible overlay. It makes the assumption that if multiple 10 * Gets the top, visible overlay. It makes the assumption that if multiple
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 */ 81 */
82 function setMaxHeightAllPages() { 82 function setMaxHeightAllPages() {
83 var pages = document.querySelectorAll('.overlay .page'); 83 var pages = document.querySelectorAll('.overlay .page');
84 84
85 var maxHeight = Math.min(0.9 * window.innerHeight, 640) + 'px'; 85 var maxHeight = Math.min(0.9 * window.innerHeight, 640) + 'px';
86 for (var i = 0; i < pages.length; i++) 86 for (var i = 0; i < pages.length; i++)
87 pages[i].style.maxHeight = maxHeight; 87 pages[i].style.maxHeight = maxHeight;
88 } 88 }
89 89
90 /** 90 /**
91 * Called when a overlay is shown or hidden to update the scrollability of
92 * root document body based on this overlay's visibility.
93 */
94 function onVisibilityChanged(visible) {
xiyuan 2013/08/13 17:23:35 |visible| is mis-leading. It looks more like hidde
zhchbin 2013/08/14 06:54:30 Done.
95 if (visible)
96 document.body.classList.remove('no-scroll');
97 else
98 document.body.classList.add('no-scroll');
99 }
100
101 /**
91 * Adds behavioral hooks for the given overlay. 102 * Adds behavioral hooks for the given overlay.
92 * @param {HTMLElement} overlay The .overlay. 103 * @param {HTMLElement} overlay The .overlay.
93 */ 104 */
94 function setupOverlay(overlay) { 105 function setupOverlay(overlay) {
95 // Close the overlay on clicking any of the pages' close buttons. 106 // Close the overlay on clicking any of the pages' close buttons.
96 var closeButtons = overlay.querySelectorAll('.page > .close-button'); 107 var closeButtons = overlay.querySelectorAll('.page > .close-button');
97 for (var i = 0; i < closeButtons.length; i++) { 108 for (var i = 0; i < closeButtons.length; i++) {
98 closeButtons[i].addEventListener('click', function(e) { 109 closeButtons[i].addEventListener('click', function(e) {
99 cr.dispatchSimpleEvent(overlay, 'cancelOverlay'); 110 cr.dispatchSimpleEvent(overlay, 'cancelOverlay');
100 }); 111 });
101 } 112 }
102 113
103 // Remove the 'pulse' animation any time the overlay is hidden or shown. 114 // Remove the 'pulse' animation any time the overlay is hidden or shown.
104 overlay.__defineSetter__('hidden', function(value) { 115 overlay.__defineSetter__('hidden', function(value) {
105 this.classList.remove('pulse'); 116 this.classList.remove('pulse');
117 if (value != this.hasAttribute('hidden'))
118 onVisibilityChanged(value);
119
106 if (value) 120 if (value)
107 this.setAttribute('hidden', true); 121 this.setAttribute('hidden', true);
108 else 122 else
109 this.removeAttribute('hidden'); 123 this.removeAttribute('hidden');
110 }); 124 });
111 overlay.__defineGetter__('hidden', function() { 125 overlay.__defineGetter__('hidden', function() {
112 return this.hasAttribute('hidden'); 126 return this.hasAttribute('hidden');
113 }); 127 });
114 128
115 // Shake when the user clicks away. 129 // Shake when the user clicks away.
(...skipping 10 matching lines...) Expand all
126 overlay.addEventListener('webkitAnimationEnd', function(e) { 140 overlay.addEventListener('webkitAnimationEnd', function(e) {
127 e.target.classList.remove('pulse'); 141 e.target.classList.remove('pulse');
128 }); 142 });
129 } 143 }
130 144
131 return { 145 return {
132 globalInitialization: globalInitialization, 146 globalInitialization: globalInitialization,
133 setupOverlay: setupOverlay, 147 setupOverlay: setupOverlay,
134 }; 148 };
135 }); 149 });
OLDNEW
« no previous file with comments | « ui/webui/resources/css/overlay.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698