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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/NetworkWaterfallColumn.js

Issue 2740803002: [DevTools] Simplify Popover API (Closed)
Patch Set: addressed comments Created 3 years, 9 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 Network.NetworkWaterfallColumn = class extends UI.VBox { 4 Network.NetworkWaterfallColumn = class extends UI.VBox {
5 /** 5 /**
6 * @param {number} rowHeight 6 * @param {number} rowHeight
7 * @param {!Network.NetworkTimeCalculator} calculator 7 * @param {!Network.NetworkTimeCalculator} calculator
8 */ 8 */
9 constructor(rowHeight, calculator) { 9 constructor(rowHeight, calculator) {
10 // TODO(allada) Make this a shadowDOM when the NetworkWaterfallColumn gets m oved into NetworkLogViewColumns. 10 // TODO(allada) Make this a shadowDOM when the NetworkWaterfallColumn gets m oved into NetworkLogViewColumns.
(...skipping 17 matching lines...) Expand all
28 this._headerHeight = 0; 28 this._headerHeight = 0;
29 this._calculator = calculator; 29 this._calculator = calculator;
30 30
31 this._offsetWidth = 0; 31 this._offsetWidth = 0;
32 this._offsetHeight = 0; 32 this._offsetHeight = 0;
33 this._startTime = this._calculator.minimumBoundary(); 33 this._startTime = this._calculator.minimumBoundary();
34 this._endTime = this._calculator.maximumBoundary(); 34 this._endTime = this._calculator.maximumBoundary();
35 35
36 this._popoverHelper = new UI.PopoverHelper(this.element); 36 this._popoverHelper = new UI.PopoverHelper(this.element);
37 this._popoverHelper.initializeCallbacks(this._getPopoverAnchor.bind(this), t his._showPopover.bind(this)); 37 this._popoverHelper.initializeCallbacks(this._getPopoverAnchor.bind(this), t his._showPopover.bind(this));
38 this._popoverHelper.setHasPadding(true);
38 this._popoverHelper.setTimeout(300, 300); 39 this._popoverHelper.setTimeout(300, 300);
39 40
40 /** @type {!Array<!Network.NetworkNode>} */ 41 /** @type {!Array<!Network.NetworkNode>} */
41 this._nodes = []; 42 this._nodes = [];
42 43
43 /** @type {?Network.NetworkNode} */ 44 /** @type {?Network.NetworkNode} */
44 this._hoveredNode = null; 45 this._hoveredNode = null;
45 46
46 /** @type {!Map<string, !Array<number>>} */ 47 /** @type {!Map<string, !Array<number>>} */
47 this._eventDividers = new Map(); 48 this._eventDividers = new Map();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 var anchorBox = this.element.boxInWindow(); 162 var anchorBox = this.element.boxInWindow();
162 anchorBox.x += start; 163 anchorBox.x += start;
163 anchorBox.y += y; 164 anchorBox.y += y;
164 anchorBox.width = end - start; 165 anchorBox.width = end - start;
165 anchorBox.height = barHeight; 166 anchorBox.height = barHeight;
166 return anchorBox; 167 return anchorBox;
167 } 168 }
168 169
169 /** 170 /**
170 * @param {!Element|!AnchorBox} anchor 171 * @param {!Element|!AnchorBox} anchor
171 * @param {!UI.Popover} popover 172 * @param {!UI.GlassPane} popover
173 * @return {!Promise<boolean>}
172 */ 174 */
173 _showPopover(anchor, popover) { 175 _showPopover(anchor, popover) {
174 if (!this._hoveredNode) 176 if (!this._hoveredNode)
175 return; 177 return Promise.resolve(false);
176 var request = this._hoveredNode.request(); 178 var request = this._hoveredNode.request();
177 if (!request) 179 if (!request)
178 return; 180 return Promise.resolve(false);
179 var content = Network.RequestTimingView.createTimingTable(request, this._cal culator); 181 var content = Network.RequestTimingView.createTimingTable(request, this._cal culator);
180 popover.showForAnchor(content, anchor); 182 popover.contentElement.appendChild(content);
183 return Promise.resolve(true);
181 } 184 }
182 185
183 /** 186 /**
184 * @param {?Network.NetworkNode} node 187 * @param {?Network.NetworkNode} node
185 * @param {boolean} highlightInitiatorChain 188 * @param {boolean} highlightInitiatorChain
186 */ 189 */
187 _setHoveredNode(node, highlightInitiatorChain) { 190 _setHoveredNode(node, highlightInitiatorChain) {
188 if (this._hoveredNode) 191 if (this._hoveredNode)
189 this._hoveredNode.setHovered(false, false); 192 this._hoveredNode.setHovered(false, false);
190 this._hoveredNode = node; 193 this._hoveredNode = node;
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 websocket: 'hsl(0, 0%, 95%)', 648 websocket: 'hsl(0, 0%, 95%)',
646 xhr: 'hsl(53, 100%, 80%)', 649 xhr: 'hsl(53, 100%, 80%)',
647 other: 'hsl(0, 0%, 95%)' 650 other: 'hsl(0, 0%, 95%)'
648 }; 651 };
649 652
650 /** @typedef {!{fillStyle: (string|undefined), lineWidth: (number|undefined), bo rderColor: (string|undefined)}} */ 653 /** @typedef {!{fillStyle: (string|undefined), lineWidth: (number|undefined), bo rderColor: (string|undefined)}} */
651 Network.NetworkWaterfallColumn._LayerStyles; 654 Network.NetworkWaterfallColumn._LayerStyles;
652 655
653 /** @typedef {!{x: number, y: number, text: string}} */ 656 /** @typedef {!{x: number, y: number, text: string}} */
654 Network.NetworkWaterfallColumn._TextLayer; 657 Network.NetworkWaterfallColumn._TextLayer;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698