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

Side by Side Diff: Source/devtools/front_end/timeline/TimelineView.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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 this._timelineGrid.addEventDividers(dividers); 143 this._timelineGrid.addEventDividers(dividers);
144 }, 144 },
145 145
146 _updateFrameBars: function(frames) 146 _updateFrameBars: function(frames)
147 { 147 {
148 var clientWidth = this._graphRowsElementWidth; 148 var clientWidth = this._graphRowsElementWidth;
149 if (this._frameContainer) { 149 if (this._frameContainer) {
150 this._frameContainer.removeChildren(); 150 this._frameContainer.removeChildren();
151 } else { 151 } else {
152 const frameContainerBorderWidth = 1; 152 const frameContainerBorderWidth = 1;
153 this._frameContainer = document.createElementWithClass("div", "fill timeline-frame-container"); 153 this._frameContainer = createElementWithClass("div", "fill timeline- frame-container");
154 this._frameContainer.style.height = WebInspector.TimelinePanel.rowHe ight + frameContainerBorderWidth + "px"; 154 this._frameContainer.style.height = WebInspector.TimelinePanel.rowHe ight + frameContainerBorderWidth + "px";
155 this._frameContainer.addEventListener("dblclick", this._onFrameDoubl eClicked.bind(this), false); 155 this._frameContainer.addEventListener("dblclick", this._onFrameDoubl eClicked.bind(this), false);
156 this._frameContainer.addEventListener("click", this._onFrameClicked. bind(this), false); 156 this._frameContainer.addEventListener("click", this._onFrameClicked. bind(this), false);
157 } 157 }
158 this._frameStripByFrame.clear(); 158 this._frameStripByFrame.clear();
159 159
160 var dividers = []; 160 var dividers = [];
161 161
162 for (var i = 0; i < frames.length; ++i) { 162 for (var i = 0; i < frames.length; ++i) {
163 var frame = frames[i]; 163 var frame = frames[i];
164 var frameStart = this._calculator.computePosition(frame.startTime); 164 var frameStart = this._calculator.computePosition(frame.startTime);
165 var frameEnd = this._calculator.computePosition(frame.endTime); 165 var frameEnd = this._calculator.computePosition(frame.endTime);
166 166
167 var frameStrip = document.createElementWithClass("div", "timeline-fr ame-strip"); 167 var frameStrip = createElementWithClass("div", "timeline-frame-strip ");
168 var actualStart = Math.max(frameStart, 0); 168 var actualStart = Math.max(frameStart, 0);
169 var width = frameEnd - actualStart; 169 var width = frameEnd - actualStart;
170 frameStrip.style.left = actualStart + "px"; 170 frameStrip.style.left = actualStart + "px";
171 frameStrip.style.width = width + "px"; 171 frameStrip.style.width = width + "px";
172 frameStrip._frame = frame; 172 frameStrip._frame = frame;
173 this._frameStripByFrame.set(frame, frameStrip); 173 this._frameStripByFrame.set(frame, frameStrip);
174 174
175 const minWidthForFrameInfo = 60; 175 const minWidthForFrameInfo = 60;
176 if (width > minWidthForFrameInfo) 176 if (width > minWidthForFrameInfo)
177 frameStrip.textContent = Number.millisToString(frame.endTime - f rame.startTime, true); 177 frameStrip.textContent = Number.millisToString(frame.endTime - f rame.startTime, true);
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 } 1023 }
1024 1024
1025 /** 1025 /**
1026 * @constructor 1026 * @constructor
1027 * @param {!WebInspector.Linkifier} linkifier 1027 * @param {!WebInspector.Linkifier} linkifier
1028 * @param {function(!WebInspector.TimelinePresentationModel.Record)} selectRecor d 1028 * @param {function(!WebInspector.TimelinePresentationModel.Record)} selectRecor d
1029 * @param {function()} scheduleRefresh 1029 * @param {function()} scheduleRefresh
1030 */ 1030 */
1031 WebInspector.TimelineRecordListRow = function(linkifier, selectRecord, scheduleR efresh) 1031 WebInspector.TimelineRecordListRow = function(linkifier, selectRecord, scheduleR efresh)
1032 { 1032 {
1033 this.element = document.createElement("div"); 1033 this.element = createElement("div");
1034 this.element.row = this; 1034 this.element.row = this;
1035 this.element.style.cursor = "pointer"; 1035 this.element.style.cursor = "pointer";
1036 this.element.addEventListener("click", this._onClick.bind(this), false); 1036 this.element.addEventListener("click", this._onClick.bind(this), false);
1037 this.element.addEventListener("mouseover", this._onMouseOver.bind(this), fal se); 1037 this.element.addEventListener("mouseover", this._onMouseOver.bind(this), fal se);
1038 this.element.addEventListener("mouseout", this._onMouseOut.bind(this), false ); 1038 this.element.addEventListener("mouseout", this._onMouseOut.bind(this), false );
1039 this._linkifier = linkifier; 1039 this._linkifier = linkifier;
1040 1040
1041 // Warning is float right block, it goes first. 1041 // Warning is float right block, it goes first.
1042 this._warningElement = this.element.createChild("div", "timeline-tree-item-w arning hidden"); 1042 this._warningElement = this.element.createChild("div", "timeline-tree-item-w arning hidden");
1043 1043
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 } 1156 }
1157 1157
1158 /** 1158 /**
1159 * @constructor 1159 * @constructor
1160 * @param {!Element} graphContainer 1160 * @param {!Element} graphContainer
1161 * @param {function(!WebInspector.TimelinePresentationModel.Record)} selectRecor d 1161 * @param {function(!WebInspector.TimelinePresentationModel.Record)} selectRecor d
1162 * @param {function()} scheduleRefresh 1162 * @param {function()} scheduleRefresh
1163 */ 1163 */
1164 WebInspector.TimelineRecordGraphRow = function(graphContainer, selectRecord, sch eduleRefresh) 1164 WebInspector.TimelineRecordGraphRow = function(graphContainer, selectRecord, sch eduleRefresh)
1165 { 1165 {
1166 this.element = document.createElement("div"); 1166 this.element = createElement("div");
1167 this.element.row = this; 1167 this.element.row = this;
1168 this.element.addEventListener("mouseover", this._onMouseOver.bind(this), fal se); 1168 this.element.addEventListener("mouseover", this._onMouseOver.bind(this), fal se);
1169 this.element.addEventListener("mouseout", this._onMouseOut.bind(this), false ); 1169 this.element.addEventListener("mouseout", this._onMouseOut.bind(this), false );
1170 this.element.addEventListener("click", this._onClick.bind(this), false); 1170 this.element.addEventListener("click", this._onClick.bind(this), false);
1171 1171
1172 this._barAreaElement = this.element.createChild("div", "timeline-graph-bar-a rea"); 1172 this._barAreaElement = this.element.createChild("div", "timeline-graph-bar-a rea");
1173 1173
1174 this._barCpuElement = this._barAreaElement.createChild("div", "timeline-grap h-bar cpu"); 1174 this._barCpuElement = this._barAreaElement.createChild("div", "timeline-grap h-bar cpu");
1175 this._barCpuElement.row = this; 1175 this._barCpuElement.row = this;
1176 1176
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 } else { 1297 } else {
1298 this._element.classList.add("hidden"); 1298 this._element.classList.add("hidden");
1299 } 1299 }
1300 }, 1300 },
1301 1301
1302 _dispose: function() 1302 _dispose: function()
1303 { 1303 {
1304 this._element.remove(); 1304 this._element.remove();
1305 } 1305 }
1306 } 1306 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698