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

Side by Side Diff: chrome/browser/resources/policy.js

Issue 17341004: Don't rely on the second argument to DOMTokenList.toggle in about:policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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('policy', function() { 5 cr.define('policy', function() {
6 /** 6 /**
7 * A box that shows the status of cloud policy for a device or user. 7 * A box that shows the status of cloud policy for a device or user.
8 * @constructor 8 * @constructor
9 * @extends {HTMLFieldSetElement} 9 * @extends {HTMLFieldSetElement}
10 */ 10 */
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // overflow the column once it has been hidden and replaced by a link. 155 // overflow the column once it has been hidden and replaced by a link.
156 var valueContainer = this.querySelector('.value-container'); 156 var valueContainer = this.querySelector('.value-container');
157 if (valueContainer.valueWidth == undefined) { 157 if (valueContainer.valueWidth == undefined) {
158 valueContainer.valueWidth = 158 valueContainer.valueWidth =
159 valueContainer.querySelector('.value').offsetWidth; 159 valueContainer.querySelector('.value').offsetWidth;
160 } 160 }
161 161
162 // Determine whether the contents of the value column overflows. The 162 // Determine whether the contents of the value column overflows. The
163 // visibility of the contents, replacement link and additional row 163 // visibility of the contents, replacement link and additional row
164 // containing the complete value that depend on this are handled by CSS. 164 // containing the complete value that depend on this are handled by CSS.
165 this.classList.toggle( 165 if (valueContainer.offsetWidth < valueContainer.valueWidth)
166 'has-overflowed-value', 166 this.classList.add('has-overflowed-value');
167 valueContainer.offsetWidth < valueContainer.valueWidth); 167 else
168 this.classList.remove('has-overflowed-value');
168 }, 169 },
169 170
170 /** 171 /**
171 * Update the text of the link that toggles the visibility of an additional 172 * Update the text of the link that toggles the visibility of an additional
172 * row containing the complete policy value, depending on the toggle state. 173 * row containing the complete policy value, depending on the toggle state.
173 * @private 174 * @private
174 */ 175 */
175 updateToggleExpandedValueText_: function(event) { 176 updateToggleExpandedValueText_: function(event) {
176 this.querySelector('.toggle-expanded-value').textContent = 177 this.querySelector('.toggle-expanded-value').textContent =
177 loadTimeData.getString( 178 loadTimeData.getString(
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 */ 273 */
273 filter: function() { 274 filter: function() {
274 var showUnset = $('show-unset').checked; 275 var showUnset = $('show-unset').checked;
275 var policies = this.getElementsByTagName('tbody'); 276 var policies = this.getElementsByTagName('tbody');
276 for (var i = 0; i < policies.length; i++) { 277 for (var i = 0; i < policies.length; i++) {
277 var policy = policies[i]; 278 var policy = policies[i];
278 policy.hidden = 279 policy.hidden =
279 policy.unset && !showUnset || 280 policy.unset && !showUnset ||
280 policy.name.toLowerCase().indexOf(this.filterPattern_) == -1; 281 policy.name.toLowerCase().indexOf(this.filterPattern_) == -1;
281 } 282 }
282 this.parentElement.classList.toggle( 283 if (this.querySelector('tbody:not([hidden])'))
283 'empty', !this.querySelector('tbody:not([hidden])')); 284 this.parentElement.classList.remove('empty');
285 else
286 this.parentElement.classList.add('empty');
284 setTimeout(this.checkOverflow_.bind(this), 0); 287 setTimeout(this.checkOverflow_.bind(this), 0);
285 }, 288 },
286 289
287 /** 290 /**
288 * Check the table columns for overflow. 291 * Check the table columns for overflow.
289 * @private 292 * @private
290 */ 293 */
291 checkOverflow_: function() { 294 checkOverflow_: function() {
292 var policies = this.getElementsByTagName('tbody'); 295 var policies = this.getElementsByTagName('tbody');
293 for (var i = 0; i < policies.length; i++) { 296 for (var i = 0; i < policies.length; i++) {
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 return { 539 return {
537 Page: Page 540 Page: Page
538 }; 541 };
539 }); 542 });
540 543
541 // Have the main initialization function be called when the page finishes 544 // Have the main initialization function be called when the page finishes
542 // loading. 545 // loading.
543 document.addEventListener( 546 document.addEventListener(
544 'DOMContentLoaded', 547 'DOMContentLoaded',
545 policy.Page.getInstance().initialize.bind(policy.Page.getInstance())); 548 policy.Page.getInstance().initialize.bind(policy.Page.getInstance()));
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