| 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 |
| 25 */ |
| 26 setSubtitle: function(subtitle) |
| 27 { |
| 28 if (this._subtitleElement && this._subtitleElement.textContent === subti
tle) |
| 29 return; |
| 30 if (!this._subtitleElement) |
| 31 this._subtitleElement = this._headerElement.createChild("div", "repo
rt-subtitle"); |
| 32 this._subtitleElement.textContent = subtitle; |
| 33 }, |
| 34 |
| 35 /** |
| 24 * @param {?string} url | 36 * @param {?string} url |
| 25 */ | 37 */ |
| 26 setURL: function(url) | 38 setURL: function(url) |
| 27 { | 39 { |
| 28 if (this._url === url) | 40 if (this._url === url) |
| 29 return; | 41 return; |
| 30 if (!this._urlElement) | 42 if (!this._urlElement) |
| 31 this._urlElement = this._headerElement.createChild("div", "report-ur
l link"); | 43 this._urlElement = this._headerElement.createChild("div", "report-ur
l link"); |
| 32 | 44 |
| 33 this._url = url; | 45 this._url = url; |
| 34 this._urlElement.removeChildren(); | 46 this._urlElement.removeChildren(); |
| 35 if (url) | 47 if (url) |
| 36 this._urlElement.appendChild(WebInspector.linkifyURLAsNode(url)); | 48 this._urlElement.appendChild(WebInspector.linkifyURLAsNode(url)); |
| 37 }, | 49 }, |
| 38 | 50 |
| 39 /** | 51 /** |
| 40 * @return {!WebInspector.Toolbar} | 52 * @return {!WebInspector.Toolbar} |
| 41 */ | 53 */ |
| 42 createToolbar: function() | 54 createToolbar: function() |
| 43 { | 55 { |
| 44 var toolbar = new WebInspector.Toolbar(""); | 56 var toolbar = new WebInspector.Toolbar(""); |
| 45 this._headerElement.appendChild(toolbar.element); | 57 this._headerElement.appendChild(toolbar.element); |
| 46 return toolbar; | 58 return toolbar; |
| 47 }, | 59 }, |
| 48 | 60 |
| 49 /** | 61 /** |
| 50 * @param {string} title | 62 * @param {string} title |
| 63 * @param {string=} className |
| 51 * @return {!WebInspector.ReportView.Section} | 64 * @return {!WebInspector.ReportView.Section} |
| 52 */ | 65 */ |
| 53 appendSection: function(title) | 66 appendSection: function(title, className) |
| 54 { | 67 { |
| 55 var section = new WebInspector.ReportView.Section(title); | 68 var section = new WebInspector.ReportView.Section(title, className); |
| 56 section.show(this._sectionList); | 69 section.show(this._sectionList); |
| 57 return section; | 70 return section; |
| 58 }, | 71 }, |
| 59 | 72 |
| 60 removeAllSection: function() | 73 removeAllSection: function() |
| 61 { | 74 { |
| 62 this._sectionList.removeChildren(); | 75 this._sectionList.removeChildren(); |
| 63 }, | 76 }, |
| 64 | 77 |
| 65 __proto__: WebInspector.VBox.prototype | 78 __proto__: WebInspector.VBox.prototype |
| 66 } | 79 } |
| 67 | 80 |
| 68 /** | 81 /** |
| 69 * @constructor | 82 * @constructor |
| 70 * @extends {WebInspector.VBox} | 83 * @extends {WebInspector.VBox} |
| 71 * @param {string} title | 84 * @param {string} title |
| 85 * @param {string=} className |
| 72 */ | 86 */ |
| 73 WebInspector.ReportView.Section = function(title) | 87 WebInspector.ReportView.Section = function(title, className) |
| 74 { | 88 { |
| 75 WebInspector.VBox.call(this); | 89 WebInspector.VBox.call(this); |
| 76 this.element.classList.add("report-section"); | 90 this.element.classList.add("report-section"); |
| 91 if (className) |
| 92 this.element.classList.add(className); |
| 77 this._headerElement = this.element.createChild("div", "report-section-header
"); | 93 this._headerElement = this.element.createChild("div", "report-section-header
"); |
| 78 this._titleElement = this._headerElement.createChild("div", "report-section-
title"); | 94 this._titleElement = this._headerElement.createChild("div", "report-section-
title"); |
| 79 this._titleElement.textContent = title; | 95 this._titleElement.textContent = title; |
| 80 this._fieldList = this.element.createChild("div", "vbox"); | 96 this._fieldList = this.element.createChild("div", "vbox"); |
| 81 /** @type {!Map.<string, !Element>} */ | 97 /** @type {!Map.<string, !Element>} */ |
| 82 this._fieldMap = new Map(); | 98 this._fieldMap = new Map(); |
| 83 } | 99 } |
| 84 | 100 |
| 85 WebInspector.ReportView.Section.prototype = { | 101 WebInspector.ReportView.Section.prototype = { |
| 86 /** | 102 /** |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 }, | 183 }, |
| 168 | 184 |
| 169 clearContent: function() | 185 clearContent: function() |
| 170 { | 186 { |
| 171 this._fieldList.removeChildren(); | 187 this._fieldList.removeChildren(); |
| 172 this._fieldMap.clear(); | 188 this._fieldMap.clear(); |
| 173 }, | 189 }, |
| 174 | 190 |
| 175 __proto__: WebInspector.VBox.prototype | 191 __proto__: WebInspector.VBox.prototype |
| 176 } | 192 } |
| OLD | NEW |