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

Side by Side Diff: Source/devtools/front_end/timeline/TimelineUIUtils.js

Issue 662793002: [DevTools] Replace usages of document with custom functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 contentHelper.appendTextRow(WebInspector.UIString("CPU time"), Number.millis ToString(cpuTime, true)); 213 contentHelper.appendTextRow(WebInspector.UIString("CPU time"), Number.millis ToString(cpuTime, true));
214 contentHelper.appendTextRow(WebInspector.UIString("Message Count"), messageC ount); 214 contentHelper.appendTextRow(WebInspector.UIString("Message Count"), messageC ount);
215 return contentHelper.contentTable(); 215 return contentHelper.contentTable();
216 } 216 }
217 217
218 /** 218 /**
219 * @param {!Object} aggregatedStats 219 * @param {!Object} aggregatedStats
220 */ 220 */
221 WebInspector.TimelineUIUtils._generateAggregatedInfo = function(aggregatedStats) 221 WebInspector.TimelineUIUtils._generateAggregatedInfo = function(aggregatedStats)
222 { 222 {
223 var cell = document.createElement("span"); 223 var cell = createElement("span");
224 cell.className = "timeline-aggregated-info"; 224 cell.className = "timeline-aggregated-info";
225 for (var index in aggregatedStats) { 225 for (var index in aggregatedStats) {
226 var label = document.createElement("div"); 226 var label = createElement("div");
227 label.className = "timeline-aggregated-category timeline-" + index; 227 label.className = "timeline-aggregated-category timeline-" + index;
228 cell.appendChild(label); 228 cell.appendChild(label);
229 var text = document.createElement("span"); 229 var text = createElement("span");
230 text.textContent = Number.millisToString(aggregatedStats[index], true); 230 text.textContent = Number.millisToString(aggregatedStats[index], true);
231 cell.appendChild(text); 231 cell.appendChild(text);
232 } 232 }
233 return cell; 233 return cell;
234 } 234 }
235 235
236 /** 236 /**
237 * @param {!Object} aggregatedStats 237 * @param {!Object} aggregatedStats
238 * @param {!WebInspector.TimelineCategory=} selfCategory 238 * @param {!WebInspector.TimelineCategory=} selfCategory
239 * @param {number=} selfTime 239 * @param {number=} selfTime
240 * @return {!Element} 240 * @return {!Element}
241 */ 241 */
242 WebInspector.TimelineUIUtils.generatePieChart = function(aggregatedStats, selfCa tegory, selfTime) 242 WebInspector.TimelineUIUtils.generatePieChart = function(aggregatedStats, selfCa tegory, selfTime)
243 { 243 {
244 var element = document.createElement("div"); 244 var element = createElement("div");
245 element.className = "timeline-aggregated-info"; 245 element.className = "timeline-aggregated-info";
246 246
247 var total = 0; 247 var total = 0;
248 for (var categoryName in aggregatedStats) 248 for (var categoryName in aggregatedStats)
249 total += aggregatedStats[categoryName]; 249 total += aggregatedStats[categoryName];
250 250
251 function formatter(value) 251 function formatter(value)
252 { 252 {
253 return Number.millisToString(value, true); 253 return Number.millisToString(value, true);
254 } 254 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 425
426 __proto__: WebInspector.Object.prototype 426 __proto__: WebInspector.Object.prototype
427 } 427 }
428 428
429 /** 429 /**
430 * @constructor 430 * @constructor
431 * @param {string} title 431 * @param {string} title
432 */ 432 */
433 WebInspector.TimelinePopupContentHelper = function(title) 433 WebInspector.TimelinePopupContentHelper = function(title)
434 { 434 {
435 this._contentTable = document.createElement("table"); 435 this._contentTable = createElement("table");
436 var titleCell = this._createCell(WebInspector.UIString("%s - Details", title ), "timeline-details-title"); 436 var titleCell = this._createCell(WebInspector.UIString("%s - Details", title ), "timeline-details-title");
437 titleCell.colSpan = 2; 437 titleCell.colSpan = 2;
438 var titleRow = document.createElement("tr"); 438 var titleRow = createElement("tr");
439 titleRow.appendChild(titleCell); 439 titleRow.appendChild(titleCell);
440 this._contentTable.appendChild(titleRow); 440 this._contentTable.appendChild(titleRow);
441 } 441 }
442 442
443 WebInspector.TimelinePopupContentHelper.prototype = { 443 WebInspector.TimelinePopupContentHelper.prototype = {
444 /** 444 /**
445 * @return {!Element} 445 * @return {!Element}
446 */ 446 */
447 contentTable: function() 447 contentTable: function()
448 { 448 {
449 return this._contentTable; 449 return this._contentTable;
450 }, 450 },
451 451
452 /** 452 /**
453 * @param {string|number} content 453 * @param {string|number} content
454 * @param {string=} styleName 454 * @param {string=} styleName
455 */ 455 */
456 _createCell: function(content, styleName) 456 _createCell: function(content, styleName)
457 { 457 {
458 var text = document.createElement("label"); 458 var text = createElement("label");
459 text.createTextChild(String(content)); 459 text.createTextChild(String(content));
460 var cell = document.createElement("td"); 460 var cell = createElement("td");
461 cell.className = "timeline-details"; 461 cell.className = "timeline-details";
462 if (styleName) 462 if (styleName)
463 cell.className += " " + styleName; 463 cell.className += " " + styleName;
464 cell.textContent = content; 464 cell.textContent = content;
465 return cell; 465 return cell;
466 }, 466 },
467 467
468 /** 468 /**
469 * @param {string} title 469 * @param {string} title
470 * @param {string|number} content 470 * @param {string|number} content
471 */ 471 */
472 appendTextRow: function(title, content) 472 appendTextRow: function(title, content)
473 { 473 {
474 var row = document.createElement("tr"); 474 var row = createElement("tr");
475 row.appendChild(this._createCell(title, "timeline-details-row-title")); 475 row.appendChild(this._createCell(title, "timeline-details-row-title"));
476 row.appendChild(this._createCell(content, "timeline-details-row-data")); 476 row.appendChild(this._createCell(content, "timeline-details-row-data"));
477 this._contentTable.appendChild(row); 477 this._contentTable.appendChild(row);
478 }, 478 },
479 479
480 /** 480 /**
481 * @param {string} title 481 * @param {string} title
482 * @param {!Node|string} content 482 * @param {!Node|string} content
483 */ 483 */
484 appendElementRow: function(title, content) 484 appendElementRow: function(title, content)
485 { 485 {
486 var row = document.createElement("tr"); 486 var row = createElement("tr");
487 var titleCell = this._createCell(title, "timeline-details-row-title"); 487 var titleCell = this._createCell(title, "timeline-details-row-title");
488 row.appendChild(titleCell); 488 row.appendChild(titleCell);
489 var cell = document.createElement("td"); 489 var cell = createElement("td");
490 cell.className = "details"; 490 cell.className = "details";
491 if (content instanceof Node) 491 if (content instanceof Node)
492 cell.appendChild(content); 492 cell.appendChild(content);
493 else 493 else
494 cell.createTextChild(content || ""); 494 cell.createTextChild(content || "");
495 row.appendChild(cell); 495 row.appendChild(cell);
496 this._contentTable.appendChild(row); 496 this._contentTable.appendChild(row);
497 } 497 }
498 } 498 }
499 499
500 /** 500 /**
501 * @constructor 501 * @constructor
502 * @param {?WebInspector.Target} target 502 * @param {?WebInspector.Target} target
503 * @param {?WebInspector.Linkifier} linkifier 503 * @param {?WebInspector.Linkifier} linkifier
504 * @param {boolean} monospaceValues 504 * @param {boolean} monospaceValues
505 */ 505 */
506 WebInspector.TimelineDetailsContentHelper = function(target, linkifier, monospac eValues) 506 WebInspector.TimelineDetailsContentHelper = function(target, linkifier, monospac eValues)
507 { 507 {
508 this._linkifier = linkifier; 508 this._linkifier = linkifier;
509 this._target = target; 509 this._target = target;
510 this.element = document.createElement("div"); 510 this.element = createElement("div");
511 this.element.className = "timeline-details-view-block"; 511 this.element.className = "timeline-details-view-block";
512 this._monospaceValues = monospaceValues; 512 this._monospaceValues = monospaceValues;
513 } 513 }
514 514
515 WebInspector.TimelineDetailsContentHelper.prototype = { 515 WebInspector.TimelineDetailsContentHelper.prototype = {
516 /** 516 /**
517 * @param {string} title 517 * @param {string} title
518 * @param {string|number|boolean} value 518 * @param {string|number|boolean} value
519 */ 519 */
520 appendTextRow: function(title, value) 520 appendTextRow: function(title, value)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 for (var i = 0; i < stackTrace.length; ++i) { 567 for (var i = 0; i < stackTrace.length; ++i) {
568 var stackFrame = stackTrace[i]; 568 var stackFrame = stackTrace[i];
569 var row = stackTraceElement.createChild("div"); 569 var row = stackTraceElement.createChild("div");
570 row.createTextChild(stackFrame.functionName || WebInspector.UIString ("(anonymous function)")); 570 row.createTextChild(stackFrame.functionName || WebInspector.UIString ("(anonymous function)"));
571 row.createTextChild(" @ "); 571 row.createTextChild(" @ ");
572 var urlElement = this._linkifier.linkifyScriptLocation(this._target, stackFrame.scriptId, stackFrame.url, stackFrame.lineNumber - 1, stackFrame.colu mnNumber - 1); 572 var urlElement = this._linkifier.linkifyScriptLocation(this._target, stackFrame.scriptId, stackFrame.url, stackFrame.lineNumber - 1, stackFrame.colu mnNumber - 1);
573 row.appendChild(urlElement); 573 row.appendChild(urlElement);
574 } 574 }
575 } 575 }
576 } 576 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/timeline/TimelinePanel.js ('k') | Source/devtools/front_end/timeline/TimelineUIUtilsImpl.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698