Changeset 219017 in webkit
- Timestamp:
- Jun 30, 2017, 2:57:09 PM (8 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r219015 r219017 1 2017-06-30 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Add small delay before showing the progress spinner when loading resources 4 https://bugs.webkit.org/show_bug.cgi?id=173437 5 6 Reviewed by Joseph Pecoraro. 7 8 * UserInterface/Views/ResourceContentView.js: 9 (WebInspector.ResourceContentView): 10 (WebInspector.ResourceContentView.prototype.removeLoadingIndicator): Added. 11 (WebInspector.ResourceContentView.prototype._contentError): 12 (WebInspector.ResourceContentView.prototype._hasContent): 13 Delay the creation of the spinner for 100ms. If the content is available before then, just 14 clear the timeout and the spinner will never be created/shown. 15 16 We measured an average of 35ms to load and display images with slow cases being around 55ms. 17 100ms was chosen for the timeout to give some room to allow for abnormally slow loading 18 while not being too long as to be outright noticable. 19 20 * UserInterface/Views/FontResourceContentView.js: 21 (WebInspector.FontResourceContentView.prototype.contentAvailable): 22 * UserInterface/Views/ImageResourceContentView.js: 23 (WebInspector.ImageResourceContentView.prototype.contentAvailable): 24 * UserInterface/Views/TextResourceContentView.js: 25 (WebInspector.TextResourceContentView.prototype._contentWillPopulate): 26 Calls the new protected function removeLoadingIndicator to ensure that the spinner (and any 27 other element) is removed. 28 29 This is necessary because TextResourceContentView effectively has two phases of loading its 30 content: getting the content and formatting it for display. The first follows the same path 31 as the other ResourceContentView subclasses, the second waits for the ContentWillPopulate 32 event on SourceCodeTextEditor before it actually adds the content as a subview. In this 33 case, the spinner should only be removed right before the content is actually added, not 34 once it's ready. 35 1 36 2017-06-30 Commit Queue <commit-queue@webkit.org> 2 37 -
trunk/Source/WebInspectorUI/UserInterface/Views/FontResourceContentView.js
r216138 r219017 73 73 this._styleElement.parentNode.removeChild(this._styleElement); 74 74 75 this. element.removeChildren();75 this.removeLoadingIndicator(); 76 76 77 77 this._styleElement = document.createElement("style"); -
trunk/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js
r218544 r219017 54 54 } 55 55 56 this. element.removeChildren();56 this.removeLoadingIndicator(); 57 57 58 58 this._imageElement = document.createElement("img"); -
trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js
r217258 r219017 37 37 this.element.classList.add(styleClassName, "resource"); 38 38 39 // Append a spinner while waiting for contentAvailable. The subclasses are responsible for removing 40 // the spinner before showing the resource content. 41 var spinner = new WebInspector.IndeterminateProgressSpinner; 42 this.element.appendChild(spinner.element); 39 this._spinnerTimeout = setTimeout(() => { 40 // Append a spinner while waiting for contentAvailable. Subclasses are responsible for 41 // removing the spinner before showing the resource content by calling removeLoadingIndicator. 42 let spinner = new WebInspector.IndeterminateProgressSpinner; 43 this.element.appendChild(spinner.element); 44 45 this._spinnerTimeout = undefined; 46 }, 100); 43 47 44 48 this.element.addEventListener("click", this._mouseWasClicked.bind(this), false); … … 98 102 } 99 103 104 // Protected 105 106 removeLoadingIndicator() 107 { 108 if (this._spinnerTimeout) { 109 clearTimeout(this._spinnerTimeout); 110 this._spinnerTimeout = undefined; 111 } 112 113 this.element.removeChildren(); 114 } 115 100 116 // Private 101 117 … … 118 134 return; 119 135 120 this.element.removeChildren(); 136 this.removeLoadingIndicator(); 137 121 138 this.element.appendChild(WebInspector.createMessageTextView(error, true)); 122 139 … … 126 143 _hasContent() 127 144 { 128 return !this.element.querySelector(".indeterminate-progress-spinner");145 return this.element.hasChildNodes() && !this.element.querySelector(".indeterminate-progress-spinner"); 129 146 } 130 147 -
trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js
r217258 r219017 192 192 return; 193 193 194 this.element.removeChildren(); 194 this.removeLoadingIndicator(); 195 195 196 this.addSubview(this._textEditor); 196 197 }
Note:
See TracChangeset
for help on using the changeset viewer.