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

Side by Side Diff: Source/devtools/front_end/timeline/TimelinePanel.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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 */ 143 */
144 searchableView: function() 144 searchableView: function()
145 { 145 {
146 return this._searchableView; 146 return this._searchableView;
147 }, 147 },
148 148
149 wasShown: function() 149 wasShown: function()
150 { 150 {
151 if (!WebInspector.TimelinePanel._categoryStylesInitialized) { 151 if (!WebInspector.TimelinePanel._categoryStylesInitialized) {
152 WebInspector.TimelinePanel._categoryStylesInitialized = true; 152 WebInspector.TimelinePanel._categoryStylesInitialized = true;
153 var style = document.createElement("style"); 153 var style = createElement("style");
154 var categories = WebInspector.TimelineUIUtils.categories(); 154 var categories = WebInspector.TimelineUIUtils.categories();
155 style.textContent = Object.values(categories).map(WebInspector.Timel ineUIUtils.createStyleRuleForCategory).join("\n"); 155 style.textContent = Object.values(categories).map(WebInspector.Timel ineUIUtils.createStyleRuleForCategory).join("\n");
156 document.head.appendChild(style); 156 document.head.appendChild(style);
157 } 157 }
158 }, 158 },
159 159
160 _dockSideChanged: function() 160 _dockSideChanged: function()
161 { 161 {
162 var dockSide = WebInspector.dockController.dockSide(); 162 var dockSide = WebInspector.dockController.dockSide();
163 var vertically = false; 163 var vertically = false;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 * @param {string} name 295 * @param {string} name
296 * @param {!WebInspector.Setting} setting 296 * @param {!WebInspector.Setting} setting
297 * @param {string} tooltip 297 * @param {string} tooltip
298 * @return {!Element} 298 * @return {!Element}
299 */ 299 */
300 _createSettingCheckbox: function(name, setting, tooltip) 300 _createSettingCheckbox: function(name, setting, tooltip)
301 { 301 {
302 if (!this._recordingOptionUIControls) 302 if (!this._recordingOptionUIControls)
303 this._recordingOptionUIControls = []; 303 this._recordingOptionUIControls = [];
304 304
305 var checkboxElement = document.createElement("input"); 305 var checkboxElement = createElement("input");
306 var labelElement = WebInspector.SettingsUI.createSettingCheckbox(name, s etting, true, checkboxElement, tooltip); 306 var labelElement = WebInspector.SettingsUI.createSettingCheckbox(name, s etting, true, checkboxElement, tooltip);
307 this._recordingOptionUIControls.push({ "label": labelElement, "checkbox" : checkboxElement }); 307 this._recordingOptionUIControls.push({ "label": labelElement, "checkbox" : checkboxElement });
308 return labelElement; 308 return labelElement;
309 }, 309 },
310 310
311 _createStatusBarItems: function() 311 _createStatusBarItems: function()
312 { 312 {
313 var panelStatusBarElement = this.element.createChild("div", "panel-statu s-bar"); 313 var panelStatusBarElement = this.element.createChild("div", "panel-statu s-bar");
314 this._statusBarButtons = /** @type {!Array.<!WebInspector.StatusBarItem> } */ ([]); 314 this._statusBarButtons = /** @type {!Array.<!WebInspector.StatusBarItem> } */ ([]);
315 315
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 if (task.startTime() > endTime) 1070 if (task.startTime() > endTime)
1071 break; 1071 break;
1072 aggregateTimeForRecordWithinWindow(task); 1072 aggregateTimeForRecordWithinWindow(task);
1073 } 1073 }
1074 1074
1075 var aggregatedTotal = 0; 1075 var aggregatedTotal = 0;
1076 for (var categoryName in aggregatedStats) 1076 for (var categoryName in aggregatedStats)
1077 aggregatedTotal += aggregatedStats[categoryName]; 1077 aggregatedTotal += aggregatedStats[categoryName];
1078 aggregatedStats["idle"] = Math.max(0, endTime - startTime - aggregatedTo tal); 1078 aggregatedStats["idle"] = Math.max(0, endTime - startTime - aggregatedTo tal);
1079 1079
1080 var pieChartContainer = document.createElement("div"); 1080 var pieChartContainer = createElement("div");
1081 pieChartContainer.classList.add("vbox", "timeline-range-summary"); 1081 pieChartContainer.classList.add("vbox", "timeline-range-summary");
1082 var startOffset = startTime - this._model.minimumRecordTime(); 1082 var startOffset = startTime - this._model.minimumRecordTime();
1083 var endOffset = endTime - this._model.minimumRecordTime(); 1083 var endOffset = endTime - this._model.minimumRecordTime();
1084 var title = WebInspector.UIString("Range: %s \u2013 %s", Number.millisTo String(startOffset), Number.millisToString(endOffset)); 1084 var title = WebInspector.UIString("Range: %s \u2013 %s", Number.millisTo String(startOffset), Number.millisToString(endOffset));
1085 1085
1086 for (var i = 0; i < this._overviewControls.length; ++i) { 1086 for (var i = 0; i < this._overviewControls.length; ++i) {
1087 if (this._overviewControls[i] instanceof WebInspector.TimelinePowerO verview) { 1087 if (this._overviewControls[i] instanceof WebInspector.TimelinePowerO verview) {
1088 var energy = this._overviewControls[i].calculateEnergy(startTime , endTime); 1088 var energy = this._overviewControls[i].calculateEnergy(startTime , endTime);
1089 title += WebInspector.UIString(" Energy: %.2f Joules", energy); 1089 title += WebInspector.UIString(" Energy: %.2f Joules", energy);
1090 title += WebInspector.UIString(" Accuracy: %s", WebInspector.po werProfiler.getAccuracyLevel()); 1090 title += WebInspector.UIString(" Accuracy: %s", WebInspector.po werProfiler.getAccuracyLevel());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 } 1124 }
1125 1125
1126 /** 1126 /**
1127 * @constructor 1127 * @constructor
1128 * @extends {WebInspector.TabbedPane} 1128 * @extends {WebInspector.TabbedPane}
1129 */ 1129 */
1130 WebInspector.TimelineDetailsView = function() 1130 WebInspector.TimelineDetailsView = function()
1131 { 1131 {
1132 WebInspector.TabbedPane.call(this); 1132 WebInspector.TabbedPane.call(this);
1133 1133
1134 this._recordTitleElement = document.createElement("div"); 1134 this._recordTitleElement = createElement("div");
1135 this._recordTitleElement.classList.add("record-title"); 1135 this._recordTitleElement.classList.add("record-title");
1136 this.headerElement().insertBefore(this._recordTitleElement, this.headerEleme nt().firstChild) 1136 this.headerElement().insertBefore(this._recordTitleElement, this.headerEleme nt().firstChild)
1137 this._defaultDetailsView = new WebInspector.VBox(); 1137 this._defaultDetailsView = new WebInspector.VBox();
1138 this._defaultDetailsView.element.classList.add("timeline-details-view"); 1138 this._defaultDetailsView.element.classList.add("timeline-details-view");
1139 this._defaultDetailsContentElement = this._defaultDetailsView.element.create Child("div", "timeline-details-view-body"); 1139 this._defaultDetailsContentElement = this._defaultDetailsView.element.create Child("div", "timeline-details-view-body");
1140 1140
1141 this.appendTab("default", WebInspector.UIString("Details"), this._defaultDet ailsView); 1141 this.appendTab("default", WebInspector.UIString("Details"), this._defaultDet ailsView);
1142 1142
1143 this.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected, this._ tabSelected, this); 1143 this.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected, this._ tabSelected, this);
1144 } 1144 }
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 1463
1464 WebInspector.TimelinePanelFactory.prototype = { 1464 WebInspector.TimelinePanelFactory.prototype = {
1465 /** 1465 /**
1466 * @return {!WebInspector.Panel} 1466 * @return {!WebInspector.Panel}
1467 */ 1467 */
1468 createPanel: function() 1468 createPanel: function()
1469 { 1469 {
1470 return WebInspector.TimelinePanel._instance(); 1470 return WebInspector.TimelinePanel._instance();
1471 } 1471 }
1472 } 1472 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/timeline/PaintProfilerView.js ('k') | Source/devtools/front_end/timeline/TimelineUIUtils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698