Changeset 186580 in webkit
- Timestamp:
- Jul 8, 2015, 10:47:04 PM (10 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 4 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r186576 r186580 1 2015-07-08 Timothy Hatcher <timothy@apple.com> 2 3 Web Inspector: Add page weight and time back to the toolbar dashboard 4 https://bugs.webkit.org/show_bug.cgi?id=146755 5 6 Revert r183328 which removed the page weight and load time from the dashboard. We have space 7 in the dashboard, we can put these back since we didn't find a better home for them. 8 9 Reviewed by Joseph Pecoraro. 10 11 * Localizations/en.lproj/localizedStrings.js: Updated. 12 * UserInterface/Base/Main.js: 13 (WebInspector.showNetworkTab): 14 * UserInterface/Images/Time.svg: Added. 15 * UserInterface/Images/Weight.svg: Added. 16 * UserInterface/Images/gtk/Time.svg: Added. 17 * UserInterface/Images/gtk/Weight.svg: Added. 18 * UserInterface/Models/DefaultDashboard.js: 19 (WebInspector.DefaultDashboard): 20 (WebInspector.DefaultDashboard.prototype.get resourcesSize): 21 (WebInspector.DefaultDashboard.prototype.set resourcesSize): 22 (WebInspector.DefaultDashboard.prototype.get time): 23 (WebInspector.DefaultDashboard.prototype.set time): 24 (WebInspector.DefaultDashboard.prototype._mainResourceDidChange): 25 (WebInspector.DefaultDashboard.prototype._capturingStopped): 26 (WebInspector.DefaultDashboard.prototype._startUpdatingTime): 27 (WebInspector.DefaultDashboard.prototype._stopUpdatingTime): 28 (WebInspector.DefaultDashboard.prototype._updateTime): 29 * UserInterface/Views/DashboardContainerView.css: 30 (body.web .toolbar .dashboard-container): 31 (body.javascript .toolbar .dashboard-container): 32 (.toolbar.collapsed .dashboard-container): 33 (.toolbar .dashboard-container): Deleted. 34 * UserInterface/Views/DefaultDashboardView.css: 35 (body.web .toolbar.collapsed .dashboard.default > :matches(.resourcesSize, .time, .logs)): 36 (body.javascript .toolbar .dashboard.default > :matches(.resourcesCount, .resourcesSize, .time)): 37 (.toolbar .dashboard.default > .resourcesSize): 38 (.toolbar .dashboard.default > .time > img): 39 (.toolbar .dashboard.default > .resourcesSize > img): 40 (body.web .toolbar.collapsed .dashboard.default > .item.resourcesCount): Deleted. 41 (body.javascript .toolbar .dashboard.default > .item.resourcesCount): Deleted. 42 * UserInterface/Views/DefaultDashboardView.js: 43 (WebInspector.DefaultDashboardView): 44 (WebInspector.DefaultDashboardView.prototype._updateDisplay): 45 (WebInspector.DefaultDashboardView.prototype._networkItemWasClicked): 46 (WebInspector.DefaultDashboardView.prototype._timelineItemWasClicked): 47 1 48 2015-07-08 Devin Rousso <drousso@apple.com> 2 49 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r186489 r186580 490 490 localizedStrings["The “%s”\ntable is empty."] = "The “%s”\ntable is empty."; 491 491 localizedStrings["This property needs a value.\nClick to open autocomplete."] = "This property needs a value.\nClick to open autocomplete."; 492 localizedStrings["Time until the load event fired, click to show the Network Requests timeline"] = "Time until the load event fired, click to show the Network Requests timeline"; 492 493 localizedStrings["Timeline Events"] = "Timeline Events"; 493 494 localizedStrings["Timeline Recording %d"] = "Timeline Recording %d"; … … 501 502 localizedStrings["Total Time"] = "Total Time"; 502 503 localizedStrings["Total number of resources, click to show the Resources tab"] = "Total number of resources, click to show the Resources tab"; 504 localizedStrings["Total size of all resources, click to show the Network Requests timeline"] = "Total size of all resources, click to show the Network Requests timeline"; 503 505 localizedStrings["Transfered"] = "Transfered"; 504 506 localizedStrings["Triggered Breakpoint"] = "Triggered Breakpoint"; -
trunk/Source/WebInspectorUI/UserInterface/Base/Main.js
r186466 r186580 811 811 }; 812 812 813 WebInspector.showNetworkTab = function() 814 { 815 var tabContentView = this.tabBrowser.bestTabContentViewForClass(WebInspector.NetworkTabContentView); 816 if (!tabContentView) 817 tabContentView = new WebInspector.NetworkTabContentView; 818 this.tabBrowser.showTabForContentView(tabContentView); 819 }; 820 813 821 WebInspector.showTimelineTab = function() 814 822 { -
trunk/Source/WebInspectorUI/UserInterface/Models/DefaultDashboard.js
r185263 r186580 30 30 super(); 31 31 32 this._waitingForFirstMainResourceToStartTrackingSize = true; 33 34 // Necessary event required to track page load time and resource sizes. 35 WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this); 36 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, this._capturingStopped, this); 37 32 38 // Necessary events required to track load of resources. 33 WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);34 39 WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this); 35 40 WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.FrameWasAdded, this._frameWasAdded, this); … … 42 47 43 48 this._resourcesCount = 0; 49 this._resourcesSize = 0; 50 this._time = 0; 44 51 this._logs = 0; 45 52 this._errors = 0; … … 60 67 } 61 68 69 get resourcesSize() 70 { 71 return this._resourcesSize; 72 } 73 74 set resourcesSize(value) 75 { 76 this._resourcesSize = value; 77 this._dataDidChange(); 78 } 79 80 get time() 81 { 82 return this._time; 83 } 84 85 set time(value) 86 { 87 this._time = value; 88 this._dataDidChange(); 89 } 90 62 91 get logs() 63 92 { … … 102 131 _mainResourceDidChange(event) 103 132 { 133 console.assert(event.target instanceof WebInspector.Frame); 134 104 135 if (!event.target.isMainFrame()) 105 136 return; 106 137 107 138 this._resourcesCount = 1; 108 this._dataDidChange(); 139 this._resourcesSize = WebInspector.frameResourceManager.mainFrame.mainResource.size || 0; 140 141 // Only update the time if we are recording the timeline. 142 if (!WebInspector.timelineManager.isCapturing()) { 143 this._time = 0; 144 return; 145 } 146 147 // We should only track resource sizes on fresh loads. 148 if (this._waitingForFirstMainResourceToStartTrackingSize) { 149 this._waitingForFirstMainResourceToStartTrackingSize = false; 150 WebInspector.Resource.addEventListener(WebInspector.Resource.Event.SizeDidChange, this._resourceSizeDidChange, this); 151 } 152 153 this._dataDidChange(); 154 this._startUpdatingTime(); 155 } 156 157 _capturingStopped(event) 158 { 159 // If recording stops, we should stop the timer if it hasn't stopped already. 160 this._stopUpdatingTime(); 109 161 } 110 162 … … 117 169 { 118 170 ++this.resourcesCount; 171 } 172 173 _startUpdatingTime() 174 { 175 this._stopUpdatingTime(); 176 177 this.time = 0; 178 179 this._timelineBaseTime = Date.now(); 180 this._timeIntervalDelay = 50; 181 this._timeIntervalIdentifier = setInterval(this._updateTime.bind(this), this._timeIntervalDelay); 182 } 183 184 _stopUpdatingTime() 185 { 186 if (!this._timeIntervalIdentifier) 187 return; 188 189 clearInterval(this._timeIntervalIdentifier); 190 this._timeIntervalIdentifier = undefined; 191 } 192 193 _updateTime() 194 { 195 var duration = Date.now() - this._timelineBaseTime; 196 197 var timeIntervalDelay = this._timeIntervalDelay; 198 if (duration >= 1000) // 1 second 199 timeIntervalDelay = 100; 200 else if (duration >= 60000) // 60 seconds 201 timeIntervalDelay = 1000; 202 else if (duration >= 3600000) // 1 minute 203 timeIntervalDelay = 10000; 204 205 if (timeIntervalDelay !== this._timeIntervalDelay) { 206 this._timeIntervalDelay = timeIntervalDelay; 207 208 clearInterval(this._timeIntervalIdentifier); 209 this._timeIntervalIdentifier = setInterval(this._updateTime.bind(this), this._timeIntervalDelay); 210 } 211 212 var mainFrame = WebInspector.frameResourceManager.mainFrame; 213 var mainFrameStartTime = mainFrame.mainResource.firstTimestamp; 214 var mainFrameLoadEventTime = mainFrame.loadEventTimestamp; 215 216 if (isNaN(mainFrameStartTime) || isNaN(mainFrameLoadEventTime)) { 217 this.time = duration / 1000; 218 return; 219 } 220 221 this.time = mainFrameLoadEventTime - mainFrameStartTime; 222 223 this._stopUpdatingTime(); 119 224 } 120 225 -
trunk/Source/WebInspectorUI/UserInterface/Views/DashboardContainerView.css
r185759 r186580 26 26 .toolbar .dashboard-container { 27 27 position: relative; 28 width: 36vw;29 28 30 29 border-radius: 4px; … … 33 32 } 34 33 34 body.web .toolbar .dashboard-container { 35 width: 36vw; 36 min-width: 350px; 37 } 38 39 body.javascript .toolbar .dashboard-container { 40 width: 25vw; 41 min-width: 175px; 42 } 35 43 36 44 .toolbar.collapsed .dashboard-container { 37 width: 175px; 45 min-width: 175px !important; 46 width: 175px !important; 38 47 } 39 48 -
trunk/Source/WebInspectorUI/UserInterface/Views/DefaultDashboardView.css
r184748 r186580 24 24 */ 25 25 26 body.web .toolbar.collapsed .dashboard.default > .item.resourcesCount{26 body.web .toolbar.collapsed .dashboard.default > :matches(.resourcesSize, .time, .logs) { 27 27 display: none; 28 28 } 29 29 30 body.javascript .toolbar .dashboard.default > .item.resourcesCount{30 body.javascript .toolbar .dashboard.default > :matches(.resourcesCount, .resourcesSize, .time) { 31 31 display: none; 32 32 } … … 52 52 border-radius: 4px; 53 53 border: 1px solid transparent; 54 } 55 56 .toolbar .dashboard.default > .time, 57 .toolbar .dashboard.default > .resourcesSize { 58 min-width: 70px; 54 59 } 55 60 … … 102 107 } 103 108 109 .toolbar .dashboard.default > .time > img { 110 content: url(../Images/Time.svg); 111 } 112 104 113 .toolbar .dashboard.default > .logs > img { 105 114 content: url(../Images/Logs.svg); 115 } 116 117 .toolbar .dashboard.default > .resourcesSize > img { 118 content: url(../Images/Weight.svg); 106 119 } 107 120 -
trunk/Source/WebInspectorUI/UserInterface/Views/DefaultDashboardView.js
r183333 r186580 35 35 resourcesCount: { 36 36 tooltip: WebInspector.UIString("Total number of resources, click to show the Resources tab"), 37 handler: this._resourcesWasClicked 37 handler: this._resourcesItemWasClicked 38 }, 39 resourcesSize: { 40 tooltip: WebInspector.UIString("Total size of all resources, click to show the Network Requests timeline"), 41 handler: this._networkItemWasClicked 42 }, 43 time: { 44 tooltip: WebInspector.UIString("Time until the load event fired, click to show the Network Requests timeline"), 45 handler: this._timelineItemWasClicked 38 46 }, 39 47 logs: { … … 64 72 this._setConsoleItemValue(category, dashboard[category]); 65 73 74 var timeItem = this._items.time; 75 timeItem.text = dashboard.time ? Number.secondsToString(dashboard.time) : "\u2014"; 76 this._setItemEnabled(timeItem, dashboard.time > 0); 77 66 78 var countItem = this._items.resourcesCount; 67 79 countItem.text = this._formatPossibleLargeNumber(dashboard.resourcesCount); 68 80 this._setItemEnabled(countItem, dashboard.resourcesCount > 0); 81 82 var sizeItem = this._items.resourcesSize; 83 sizeItem.text = dashboard.resourcesSize ? Number.bytesToString(dashboard.resourcesSize, false) : "\u2014"; 84 this._setItemEnabled(sizeItem, dashboard.resourcesSize > 0); 69 85 } 70 86 … … 110 126 } 111 127 112 _resources WasClicked()128 _resourcesItemWasClicked() 113 129 { 114 130 WebInspector.showResourcesTab(); 131 } 132 133 _networkItemWasClicked() 134 { 135 WebInspector.showNetworkTab(); 136 } 137 138 _timelineItemWasClicked() 139 { 140 WebInspector.showTimelineTab(); 115 141 } 116 142
Note:
See TracChangeset
for help on using the changeset viewer.