Changeset 240368 in webkit
- Timestamp:
- Jan 23, 2019 4:59:12 PM (5 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r240351 r240368 1 2019-01-23 Nikita Vasilyev <nvasilyev@apple.com> 2 3 Web Inspector: Refactor WI.CSSStyleDeclaration.prototype.update 4 https://bugs.webkit.org/show_bug.cgi?id=193737 5 6 Reviewed by Matt Baker. 7 8 Remove unused event data from the WI.CSSStyleDeclaration.Event.PropertiesChanged event. 9 10 * UserInterface/Models/CSSStyleDeclaration.js: 11 (WI.CSSStyleDeclaration.prototype.update): 12 1 13 2019-01-23 Devin Rousso <drousso@apple.com> 2 14 -
trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js
r240314 r240368 112 112 properties = properties || []; 113 113 114 varoldProperties = this._properties || [];115 varoldText = this._text;114 let oldProperties = this._properties || []; 115 let oldText = this._text; 116 116 117 117 this._text = text; … … 124 124 this._visibleProperties = null; 125 125 126 vareditable = this.editable;126 let editable = this.editable; 127 127 128 128 for (let property of this._properties) { … … 141 141 } 142 142 143 var removedProperties = []; 144 for (var i = 0; i < oldProperties.length; ++i) { 145 var oldProperty = oldProperties[i]; 146 147 if (!this._enabledProperties.includes(oldProperty)) { 148 // Clear the index, since it is no longer valid. 149 oldProperty.index = NaN; 150 151 removedProperties.push(oldProperty); 152 153 // Keep around old properties in pending in case they 154 // are needed again during editing. 155 if (editable) 156 this._pendingProperties.push(oldProperty); 157 } 143 for (let oldProperty of oldProperties) { 144 if (this._enabledProperties.includes(oldProperty)) 145 continue; 146 147 // Clear the index, since it is no longer valid. 148 oldProperty.index = NaN; 149 150 // Keep around old properties in pending in case they 151 // are needed again during editing. 152 if (editable) 153 this._pendingProperties.push(oldProperty); 158 154 } 159 155 … … 161 157 return; 162 158 163 var addedProperties = [];164 for (var i = 0; i < this._enabledProperties.length; ++i) {165 if (!oldProperties.includes(this._enabledProperties[i]))166 addedProperties.push(this._enabledProperties[i]);167 }168 169 159 // Don't fire the event if there is text and it hasn't changed. 170 if (oldText && this._text && oldText === this._text) { 171 if (!this._locked || suppressLock) { 172 // We shouldn't have any added or removed properties in this case. 173 console.assert(!addedProperties.length && !removedProperties.length); 174 } 175 176 if (!addedProperties.length && !removedProperties.length) 177 return; 178 } 160 if (oldText && this._text && oldText === this._text) 161 return; 179 162 180 163 function delayed() 181 164 { 182 this.dispatchEventToListeners(WI.CSSStyleDeclaration.Event.PropertiesChanged , {addedProperties, removedProperties});165 this.dispatchEventToListeners(WI.CSSStyleDeclaration.Event.PropertiesChanged); 183 166 } 184 167
Note: See TracChangeset
for help on using the changeset viewer.