Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1160)

Unified Diff: WebCore/inspector/front-end/SourceView.js

Issue 5446003: Merge 72938 - 2010-11-30 Pavel Feldman <pfeldman@chromium.org>... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/597/
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « WebCore/inspector/front-end/ScriptsPanel.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: WebCore/inspector/front-end/SourceView.js
===================================================================
--- WebCore/inspector/front-end/SourceView.js (revision 73033)
+++ WebCore/inspector/front-end/SourceView.js (working copy)
@@ -147,16 +147,30 @@
lines.push(textModel.line(i));
}
- var linesCountToShift = newContent.split("\n").length - 1;
- var newContent = lines.join("\n");
- WebInspector.panels.scripts.editScriptSource(this._sourceIDForLine(line), newContent, line, linesCountToShift, this._editLineComplete.bind(this, newContent), cancelEditingCallback);
+ var editData = {};
+ editData.sourceID = this._sourceIDForLine(line);
+ editData.content = lines.join("\n");
+ editData.line = line;
+ editData.linesCountToShift = newContent.split("\n").length - 1;
+
+ WebInspector.panels.scripts.editScriptSource(editData, this._editLineComplete.bind(this, editData), cancelEditingCallback);
},
- _editLineComplete: function(newContent)
+ _editLineComplete: function(editData, newContent)
{
- this.resource.content = newContent;
+ this.resource.setContent(newContent, this._revertEditLine.bind(this, editData));
},
+ _revertEditLine: function(editData, contentToRevertTo)
+ {
+ var newEditData = {};
+ newEditData.sourceID = editData.sourceID;
+ newEditData.content = editData.content;
+ newEditData.line = editData.line;
+ newEditData.linesCountToShift = -editData.linesCountToShift;
+ WebInspector.panels.scripts.editScriptSource(newEditData, this._editLineComplete.bind(this, newEditData));
+ },
+
_sourceIDForLine: function(line)
{
var sourceID = null;
« no previous file with comments | « WebCore/inspector/front-end/ScriptsPanel.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698