Changeset 116848 in webkit
- Timestamp:
- May 12, 2012 4:09:27 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r116847 r116848 1 2012-05-12 Pavel Feldman <pfeldman@chromium.org> 2 3 Web Inspector: shrink SourceFrame editing API to two methods (was 4). 4 https://bugs.webkit.org/show_bug.cgi?id=86288 5 6 Reviewed by Yury Semikhatsky. 7 8 Used specific workflow in two SourceFrame implementations. 9 10 * inspector/front-end/JavaScriptSourceFrame.js: 11 (WebInspector.JavaScriptSourceFrame.prototype.commitEditing): 12 (WebInspector.JavaScriptSourceFrame.prototype.afterTextChanged): 13 (WebInspector.JavaScriptSourceFrame.prototype._didEditContent): 14 * inspector/front-end/ResourceView.js: 15 (WebInspector.EditableResourceSourceFrame.prototype.commitEditing.callbackWrapper): 16 (WebInspector.EditableResourceSourceFrame.prototype.commitEditing): 17 * inspector/front-end/SourceFrame.js: 18 (WebInspector.SourceFrame.prototype.commitEditing): 19 (WebInspector.TextViewerDelegateForSourceFrame.prototype.commitEditing): 20 1 21 2012-05-11 Yury Semikhatsky <yurys@chromium.org> 2 22 -
trunk/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js
r116791 r116848 109 109 }, 110 110 111 editContent: function(newContent, callback) 111 /** 112 * @param {string} text 113 */ 114 commitEditing: function(text) 112 115 { 113 116 this._editingContent = true; 114 WebInspector.DebuggerResourceBinding.setScriptSource(this._uiSourceCode, newContent, callback);117 WebInspector.DebuggerResourceBinding.setScriptSource(this._uiSourceCode, text, this._didEditContent.bind(this, text)); 115 118 }, 116 119 … … 174 177 this._setScriptSourceIsDirty(true); 175 178 else 176 this. didEditContent(null, this._originalContent);179 this._didEditContent(this._originalContent, null); 177 180 }, 178 181 … … 201 204 }, 202 205 203 didEditContent: function(error, content)206 _didEditContent: function(content, error) 204 207 { 205 208 delete this._editingContent; 206 209 207 WebInspector.SourceFrame.prototype.didEditContent.call(this, error, content); 208 if (error) 209 return; 210 if (error) { 211 WebInspector.log(error, WebInspector.ConsoleMessage.MessageLevel.Error, true); 212 return; 213 } 210 214 211 215 this._originalContent = content; -
trunk/Source/WebCore/inspector/front-end/ResourceView.js
r115984 r116848 133 133 134 134 WebInspector.EditableResourceSourceFrame.prototype = { 135 /** 136 * @return {boolean} 137 */ 135 138 canEditSource: function() 136 139 { … … 139 142 }, 140 143 141 editContent: function(newText, callback) 144 /** 145 * @param {string} text 146 */ 147 commitEditing: function(text) 142 148 { 143 149 this._clearIncrementalUpdateTimer(); … … 146 152 function callbackWrapper(text) 147 153 { 148 callback(text);149 154 delete this._settingContent; 155 this.dispatchEventToListeners(WebInspector.EditableResourceSourceFrame.Events.TextEdited, this); 150 156 } 151 this.resource.setContent( newText, majorChange, callbackWrapper.bind(this));152 }, 153 157 this.resource.setContent(text, majorChange, callbackWrapper.bind(this)); 158 }, 159 154 160 afterTextChanged: function(oldRange, newRange) 155 161 { … … 177 183 }, 178 184 179 didEditContent: function(error, content)180 {181 WebInspector.SourceFrame.prototype.didEditContent.call(this, error, content);182 this.dispatchEventToListeners(WebInspector.EditableResourceSourceFrame.Events.TextEdited, this);183 },184 185 185 isDirty: function() 186 186 { -
trunk/Source/WebCore/inspector/front-end/SourceFrame.js
r116789 r116848 517 517 }, 518 518 519 /** 520 * @return {boolean} 521 */ 519 522 canEditSource: function() 520 523 { … … 522 525 }, 523 526 524 commitEditing: function() 525 { 526 function callback(error) 527 { 528 this.didEditContent(error, this._textModel.text); 529 } 530 this.editContent(this._textModel.text, callback.bind(this)); 531 }, 532 533 didEditContent: function(error, content) 534 { 535 if (error) { 536 WebInspector.log(error, WebInspector.ConsoleMessage.MessageLevel.Error, true); 537 return; 538 } 539 }, 540 541 editContent: function(newContent, callback) 527 /** 528 * @param {string} text 529 */ 530 commitEditing: function(text) 542 531 { 543 532 } … … 569 558 commitEditing: function() 570 559 { 571 this._sourceFrame.commitEditing( );560 this._sourceFrame.commitEditing(this._sourceFrame._textModel.text); 572 561 }, 573 562
Note: See TracChangeset
for help on using the changeset viewer.