OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
8 * @param {string} title | 8 * @param {string} title |
9 */ | 9 */ |
10 WebInspector.ReportView = function(title) | 10 WebInspector.ReportView = function(title) |
11 { | 11 { |
12 WebInspector.VBox.call(this, true); | 12 WebInspector.VBox.call(this, true); |
13 this.registerRequiredCSS("ui/reportView.css"); | 13 this.registerRequiredCSS("ui/reportView.css"); |
14 | 14 |
15 var contentBox = this.contentElement.createChild("div", "report-content-box"
); | 15 var contentBox = this.contentElement.createChild("div", "report-content-box"
); |
16 this._headerElement = contentBox.createChild("div", "report-header vbox"); | 16 this._headerElement = contentBox.createChild("div", "report-header vbox"); |
17 this._headerElement.createChild("div", "report-title").textContent = title; | 17 this._headerElement.createChild("div", "report-title").textContent = title; |
18 | 18 |
19 this._sectionList = contentBox.createChild("div", "vbox"); | 19 this._sectionList = contentBox.createChild("div", "vbox"); |
20 } | 20 }; |
21 | 21 |
22 WebInspector.ReportView.prototype = { | 22 WebInspector.ReportView.prototype = { |
23 /** | 23 /** |
24 * @param {string} subtitle | 24 * @param {string} subtitle |
25 */ | 25 */ |
26 setSubtitle: function(subtitle) | 26 setSubtitle: function(subtitle) |
27 { | 27 { |
28 if (this._subtitleElement && this._subtitleElement.textContent === subti
tle) | 28 if (this._subtitleElement && this._subtitleElement.textContent === subti
tle) |
29 return; | 29 return; |
30 if (!this._subtitleElement) | 30 if (!this._subtitleElement) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 section.show(this._sectionList); | 69 section.show(this._sectionList); |
70 return section; | 70 return section; |
71 }, | 71 }, |
72 | 72 |
73 removeAllSection: function() | 73 removeAllSection: function() |
74 { | 74 { |
75 this._sectionList.removeChildren(); | 75 this._sectionList.removeChildren(); |
76 }, | 76 }, |
77 | 77 |
78 __proto__: WebInspector.VBox.prototype | 78 __proto__: WebInspector.VBox.prototype |
79 } | 79 }; |
80 | 80 |
81 /** | 81 /** |
82 * @constructor | 82 * @constructor |
83 * @extends {WebInspector.VBox} | 83 * @extends {WebInspector.VBox} |
84 * @param {string} title | 84 * @param {string} title |
85 * @param {string=} className | 85 * @param {string=} className |
86 */ | 86 */ |
87 WebInspector.ReportView.Section = function(title, className) | 87 WebInspector.ReportView.Section = function(title, className) |
88 { | 88 { |
89 WebInspector.VBox.call(this); | 89 WebInspector.VBox.call(this); |
90 this.element.classList.add("report-section"); | 90 this.element.classList.add("report-section"); |
91 if (className) | 91 if (className) |
92 this.element.classList.add(className); | 92 this.element.classList.add(className); |
93 this._headerElement = this.element.createChild("div", "report-section-header
"); | 93 this._headerElement = this.element.createChild("div", "report-section-header
"); |
94 this._titleElement = this._headerElement.createChild("div", "report-section-
title"); | 94 this._titleElement = this._headerElement.createChild("div", "report-section-
title"); |
95 this._titleElement.textContent = title; | 95 this._titleElement.textContent = title; |
96 this._fieldList = this.element.createChild("div", "vbox"); | 96 this._fieldList = this.element.createChild("div", "vbox"); |
97 /** @type {!Map.<string, !Element>} */ | 97 /** @type {!Map.<string, !Element>} */ |
98 this._fieldMap = new Map(); | 98 this._fieldMap = new Map(); |
99 } | 99 }; |
100 | 100 |
101 WebInspector.ReportView.Section.prototype = { | 101 WebInspector.ReportView.Section.prototype = { |
102 /** | 102 /** |
103 * @param {string} title | 103 * @param {string} title |
104 */ | 104 */ |
105 setTitle: function(title) | 105 setTitle: function(title) |
106 { | 106 { |
107 if (this._titleElement.textContent !== title) | 107 if (this._titleElement.textContent !== title) |
108 this._titleElement.textContent = title; | 108 this._titleElement.textContent = title; |
109 }, | 109 }, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 return this._fieldList.createChild("div", "report-row"); | 182 return this._fieldList.createChild("div", "report-row"); |
183 }, | 183 }, |
184 | 184 |
185 clearContent: function() | 185 clearContent: function() |
186 { | 186 { |
187 this._fieldList.removeChildren(); | 187 this._fieldList.removeChildren(); |
188 this._fieldMap.clear(); | 188 this._fieldMap.clear(); |
189 }, | 189 }, |
190 | 190 |
191 __proto__: WebInspector.VBox.prototype | 191 __proto__: WebInspector.VBox.prototype |
192 } | 192 }; |
OLD | NEW |