Changeset 243720 in webkit
- Timestamp:
- Apr 1, 2019, 3:41:28 PM (7 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
UserInterface/Views/CanvasContentView.js (modified) (7 diffs)
-
UserInterface/Views/CanvasOverviewContentView.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r243718 r243720 1 2019-04-01 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Canvas: auto-record after page load sometimes shows the wrong UI 4 https://bugs.webkit.org/show_bug.cgi?id=196320 5 <rdar://problem/49356686> 6 7 Reviewed by Joseph Pecoraro. 8 9 It was previously possible that the timing of a recording being started and the preview 10 image being loaded would not always be in the same order. 11 12 Utilize the existing `View.prototype.layout` mechanics to ensure that updates are coalesced 13 and that the changes are always applied in a particular order. 14 15 * UserInterface/Views/CanvasContentView.js: 16 (WI.CanvasContentView): 17 (WI.CanvasContentView.prototype.refreshPreview): Added. 18 (WI.CanvasContentView.prototype.initialLayout): 19 (WI.CanvasContentView.prototype.layout): 20 (WI.CanvasContentView.prototype.shown): 21 (WI.CanvasContentView.prototype.attached): 22 (WI.CanvasContentView.prototype._refreshPixelSize): 23 (WI.CanvasContentView.prototype.refresh): Deleted. 24 (WI.CanvasContentView.prototype._recordingStarted): Deleted. 25 (WI.CanvasContentView.prototype._recordingProgress): Deleted. 26 (WI.CanvasContentView.prototype._recordingStopped): Deleted. 27 (WI.CanvasContentView.prototype._shaderProgramAdded): Deleted. 28 (WI.CanvasContentView.prototype._shaderProgramRemoved): Deleted. 29 30 * UserInterface/Views/CanvasOverviewContentView.js: 31 (WI.CanvasOverviewContentView.prototype._refreshPreviews): 32 1 33 2019-04-01 Devin Rousso <drousso@apple.com> 2 34 -
trunk/Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js
r242937 r243720 46 46 this._refreshButtonNavigationItem = new WI.ButtonNavigationItem("refresh", WI.UIString("Refresh"), "Images/ReloadFull.svg", 13, 13); 47 47 this._refreshButtonNavigationItem.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low; 48 this._refreshButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this.refresh , this);48 this._refreshButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this.refreshPreview, this); 49 49 50 50 this._showGridButtonNavigationItem = new WI.ActivateButtonNavigationItem("show-grid", WI.UIString("Show Grid"), WI.UIString("Hide Grid"), "Images/NavigationItemCheckers.svg", 13, 13); … … 63 63 } 64 64 65 refresh ()65 refreshPreview() 66 66 { 67 67 this._pendingContent = null; … … 159 159 this._showError(); 160 160 161 if (isCard) {161 if (isCard) 162 162 this._refreshPixelSize(); 163 this._updateMemoryCost();164 this._updateProgressView();165 }166 163 } 167 164 … … 170 167 super.layout(); 171 168 172 if (!this._pendingContent) 173 return; 174 175 if (this._errorElement) { 176 this._errorElement.remove(); 177 this._errorElement = null; 178 } 179 180 if (!this._previewImageElement) { 181 this._previewImageElement = document.createElement("img"); 182 this._previewImageElement.addEventListener("error", this._showError.bind(this)); 183 } 184 185 this._previewImageElement.src = this._pendingContent; 186 this._pendingContent = null; 187 188 if (!this._previewImageElement.parentNode) 189 this._previewContainerElement.appendChild(this._previewImageElement); 190 191 this._updateImageGrid(); 192 } 193 194 shown() 195 { 196 super.shown(); 197 198 this.refresh(); 169 if (this._pendingContent) { 170 if (this._errorElement) { 171 this._errorElement.remove(); 172 this._errorElement = null; 173 } 174 175 if (!this._previewImageElement) { 176 this._previewImageElement = document.createElement("img"); 177 this._previewImageElement.addEventListener("error", this._showError.bind(this)); 178 } 179 180 this._previewImageElement.src = this._pendingContent; 181 this._pendingContent = null; 182 183 if (!this._previewImageElement.parentNode) 184 this._previewContainerElement.appendChild(this._previewImageElement); 185 } 199 186 200 187 this._updateRecordNavigationItem(); 201 188 this._updateProgressView(); 189 this._updateViewRelatedItems(); 190 this._updateMemoryCost(); 191 this._updateImageGrid(); 192 } 193 194 shown() 195 { 196 super.shown(); 197 198 this.refreshPreview(); 202 199 } 203 200 … … 207 204 208 205 this.representedObject.addEventListener(WI.Canvas.Event.MemoryChanged, this._updateMemoryCost, this); 209 this.representedObject.addEventListener(WI.Canvas.Event.RecordingStarted, this. _recordingStarted, this);210 this.representedObject.addEventListener(WI.Canvas.Event.RecordingProgress, this. _recordingProgress, this);211 this.representedObject.addEventListener(WI.Canvas.Event.RecordingStopped, this. _recordingStopped, this);212 this.representedObject.shaderProgramCollection.addEventListener(WI.Collection.Event.ItemAdded, this. _shaderProgramAdded, this);213 this.representedObject.shaderProgramCollection.addEventListener(WI.Collection.Event.ItemRemoved, this. _shaderProgramRemoved, this);206 this.representedObject.addEventListener(WI.Canvas.Event.RecordingStarted, this.needsLayout, this); 207 this.representedObject.addEventListener(WI.Canvas.Event.RecordingProgress, this.needsLayout, this); 208 this.representedObject.addEventListener(WI.Canvas.Event.RecordingStopped, this.needsLayout, this); 209 this.representedObject.shaderProgramCollection.addEventListener(WI.Collection.Event.ItemAdded, this.needsLayout, this); 210 this.representedObject.shaderProgramCollection.addEventListener(WI.Collection.Event.ItemRemoved, this.needsLayout, this); 214 211 215 212 this.representedObject.requestNode().then((node) => { … … 267 264 } 268 265 269 _recordingStarted(event)270 {271 this._updateRecordNavigationItem();272 this._updateProgressView();273 }274 275 _recordingProgress(event)276 {277 this._updateProgressView();278 }279 280 _recordingStopped(event)281 {282 this._updateRecordNavigationItem();283 this._updateProgressView();284 this._updateViewRelatedItems();285 }286 287 _shaderProgramAdded(event)288 {289 this._updateViewRelatedItems();290 }291 292 _shaderProgramRemoved(event)293 {294 this._updateViewRelatedItems();295 }296 297 266 _refreshPixelSize() 298 267 { … … 310 279 } 311 280 312 this.refresh ();281 this.refreshPreview(); 313 282 }; 314 283 -
trunk/Source/WebInspectorUI/UserInterface/Views/CanvasOverviewContentView.js
r242809 r243720 147 147 { 148 148 for (let canvasContentView of this.subviews) 149 canvasContentView.refresh ();149 canvasContentView.refreshPreview(); 150 150 } 151 151
Note:
See TracChangeset
for help on using the changeset viewer.