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

Side by Side Diff: Source/devtools/front_end/elements/ElementsBreadcrumbs.js

Issue 1158133004: Devtools UX: Add elements toolbar with breadcrumbs (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix padding Created 5 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
« no previous file with comments | « no previous file | Source/devtools/front_end/elements/ElementsPanel.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 * @constructor 6 * @constructor
7 * @extends {WebInspector.HBox} 7 * @extends {WebInspector.HBox}
8 */ 8 */
9 WebInspector.ElementsBreadcrumbs = function() 9 WebInspector.ElementsBreadcrumbs = function()
10 { 10 {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // Find the focused crumb index. 216 // Find the focused crumb index.
217 if (crumb === focusedCrumb) 217 if (crumb === focusedCrumb)
218 focusedIndex = i; 218 focusedIndex = i;
219 219
220 crumb.classList.remove("compact", "collapsed", "hidden"); 220 crumb.classList.remove("compact", "collapsed", "hidden");
221 } 221 }
222 222
223 // Layout 1: Measure total and normal crumb sizes 223 // Layout 1: Measure total and normal crumb sizes
224 var contentElementWidth = this.contentElement.offsetWidth; 224 var contentElementWidth = this.contentElement.offsetWidth;
225 var normalSizes = []; 225 var normalSizes = [];
226 const leftMargin = Runtime.experiments.isEnabled("materialDesign") ? 7 : 0;
pfeldman 2015/06/01 16:20:33 Can we do this using css?
samli 2015/06/02 05:00:24 No. I don't want to impact the actual width of the
pfeldman 2015/06/02 10:54:52 Please don't use getComputedStyle and I don't unde
samli 2015/06/03 03:31:52 Done.
226 for (var i = 0; i < crumbs.childNodes.length; ++i) { 227 for (var i = 0; i < crumbs.childNodes.length; ++i) {
227 var crumb = crumbs.childNodes[i]; 228 var crumb = crumbs.childNodes[i];
228 normalSizes[i] = crumb.offsetWidth; 229 normalSizes[i] = crumb.offsetWidth + leftMargin;
229 } 230 }
230 231
231 // Layout 2: Measure collapsed crumb sizes 232 // Layout 2: Measure collapsed crumb sizes
232 var compactSizes = []; 233 var compactSizes = [];
233 for (var i = 0; i < crumbs.childNodes.length; ++i) { 234 for (var i = 0; i < crumbs.childNodes.length; ++i) {
234 var crumb = crumbs.childNodes[i]; 235 var crumb = crumbs.childNodes[i];
235 crumb.classList.add("compact"); 236 crumb.classList.add("compact");
236 } 237 }
237 for (var i = 0; i < crumbs.childNodes.length; ++i) { 238 for (var i = 0; i < crumbs.childNodes.length; ++i) {
238 var crumb = crumbs.childNodes[i]; 239 var crumb = crumbs.childNodes[i];
239 compactSizes[i] = crumb.offsetWidth; 240 compactSizes[i] = crumb.offsetWidth + leftMargin;
240 } 241 }
241 242
242 // Layout 3: Measure collapsed crumb size 243 // Layout 3: Measure collapsed crumb size
243 crumbs.firstChild.classList.add("collapsed"); 244 crumbs.firstChild.classList.add("collapsed");
244 var collapsedSize = crumbs.firstChild.offsetWidth; 245 var collapsedSize = crumbs.firstChild.offsetWidth + leftMargin;
245 246
246 // Clean up. 247 // Clean up.
247 for (var i = 0; i < crumbs.childNodes.length; ++i) { 248 for (var i = 0; i < crumbs.childNodes.length; ++i) {
248 var crumb = crumbs.childNodes[i]; 249 var crumb = crumbs.childNodes[i];
249 crumb.classList.remove("compact", "collapsed"); 250 crumb.classList.remove("compact", "collapsed");
250 } 251 }
251 252
252 function crumbsAreSmallerThanContainer() 253 function crumbsAreSmallerThanContainer()
253 { 254 {
254 var totalSize = 0; 255 var totalSize = 0;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 compact(selectedCrumb); 428 compact(selectedCrumb);
428 if (crumbsAreSmallerThanContainer()) 429 if (crumbsAreSmallerThanContainer())
429 return; 430 return;
430 431
431 // Collapse the selected crumb as a last resort. Pass true to prevent co alescing. 432 // Collapse the selected crumb as a last resort. Pass true to prevent co alescing.
432 collapse(selectedCrumb, true); 433 collapse(selectedCrumb, true);
433 }, 434 },
434 435
435 __proto__: WebInspector.HBox.prototype 436 __proto__: WebInspector.HBox.prototype
436 } 437 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/elements/ElementsPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698