2011-03-16 Andrey Adaikin <aandrey@google.com>

        Reviewed by Yury Semikhatsky.

        Web Inspector: Remove live-edit code
        https://bugs.webkit.org/show_bug.cgi?id=56177

        * inspector/front-end/Settings.js:
        * inspector/front-end/SourceFrame.js:
        (WebInspector.SourceFrame):
        (WebInspector.SourceFrame.prototype._doubleClick):
        * inspector/front-end/TextViewer.js:
        (WebInspector.TextEditorMainPanel):
        (WebInspector.TextEditorMainPanel.prototype.set readOnly):

git-svn-id: svn://svn.chromium.org/blink/trunk@81238 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 2516c3f7
2011-03-16 Andrey Adaikin <aandrey@google.com>
Reviewed by Yury Semikhatsky.
Web Inspector: Remove live-edit code
https://bugs.webkit.org/show_bug.cgi?id=56177
* inspector/front-end/Settings.js:
* inspector/front-end/SourceFrame.js:
(WebInspector.SourceFrame):
(WebInspector.SourceFrame.prototype._doubleClick):
* inspector/front-end/TextViewer.js:
(WebInspector.TextEditorMainPanel):
(WebInspector.TextEditorMainPanel.prototype.set readOnly):
2011-03-16 Alexis Menard <alexis.menard@openbossa.org> 2011-03-16 Alexis Menard <alexis.menard@openbossa.org>
Reviewed by Martin Robinson. Reviewed by Martin Robinson.
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
var Preferences = { var Preferences = {
sourceEditorEnabled: true,
canEditScriptSource: false, canEditScriptSource: false,
maxInlineTextChildLength: 80, maxInlineTextChildLength: 80,
minConsoleHeight: 75, minConsoleHeight: 75,
......
...@@ -47,10 +47,8 @@ WebInspector.SourceFrame = function(delegate, url) ...@@ -47,10 +47,8 @@ WebInspector.SourceFrame = function(delegate, url)
this._rowMessages = {}; this._rowMessages = {};
this._messageBubbles = {}; this._messageBubbles = {};
if (Preferences.sourceEditorEnabled) { this._registerShortcuts();
this._registerShortcuts(); this.element.addEventListener("keydown", this._handleKeyDown.bind(this), false);
this.element.addEventListener("keydown", this._handleKeyDown.bind(this), false);
}
} }
WebInspector.SourceFrame.Events = { WebInspector.SourceFrame.Events = {
...@@ -822,28 +820,10 @@ WebInspector.SourceFrame.prototype = { ...@@ -822,28 +820,10 @@ WebInspector.SourceFrame.prototype = {
if (!lineRow) if (!lineRow)
return; // Do not trigger editing from line numbers. return; // Do not trigger editing from line numbers.
if (Preferences.sourceEditorEnabled) { if (this._textViewer.readOnly) {
if (this._textViewer.readOnly) { this._textViewer.readOnly = false;
this._textViewer.readOnly = false; window.getSelection().collapseToStart();
window.getSelection().collapseToStart();
}
return;
}
this._textViewer.editLine(lineRow, this._didEditLine.bind(this, lineRow.lineNumber));
},
_didEditLine: function(lineNumber, newContent)
{
var lines = [];
var oldLines = this._content.text.split('\n');
for (var i = 0; i < oldLines.length; ++i) {
if (i === lineNumber)
lines.push(newContent);
else
lines.push(oldLines[i]);
} }
this._delegate.editScriptSource(lines.join("\n"));
} }
} }
......
...@@ -121,11 +121,6 @@ WebInspector.TextViewer.prototype = { ...@@ -121,11 +121,6 @@ WebInspector.TextViewer.prototype = {
this._gutterPanel.freeCachedElements(); this._gutterPanel.freeCachedElements();
}, },
editLine: function(lineRow, callback)
{
this._mainPanel.editLine(lineRow, callback);
},
get scrollTop() get scrollTop()
{ {
return this._mainPanel.element.scrollTop; return this._mainPanel.element.scrollTop;
...@@ -699,10 +694,6 @@ WebInspector.TextEditorMainPanel = function(textModel, url, syncScrollListener, ...@@ -699,10 +694,6 @@ WebInspector.TextEditorMainPanel = function(textModel, url, syncScrollListener,
this.element.addEventListener("scroll", this._scroll.bind(this), false); this.element.addEventListener("scroll", this._scroll.bind(this), false);
// FIXME: Remove old live editing functionality and Preferences.sourceEditorEnabled flag.
if (!Preferences.sourceEditorEnabled)
this._container.addEventListener("keydown", this._handleKeyDown.bind(this), false);
// In WebKit the DOMNodeRemoved event is fired AFTER the node is removed, thus it should be // In WebKit the DOMNodeRemoved event is fired AFTER the node is removed, thus it should be
// attached to all DOM nodes that we want to track. Instead, we attach the DOMNodeRemoved // attached to all DOM nodes that we want to track. Instead, we attach the DOMNodeRemoved
// listeners only on the line rows, and use DOMSubtreeModified to track node removals inside // listeners only on the line rows, and use DOMSubtreeModified to track node removals inside
...@@ -724,10 +715,6 @@ WebInspector.TextEditorMainPanel.prototype = { ...@@ -724,10 +715,6 @@ WebInspector.TextEditorMainPanel.prototype = {
set readOnly(readOnly) set readOnly(readOnly)
{ {
// FIXME: Remove the Preferences.sourceEditorEnabled flag.
if (!Preferences.sourceEditorEnabled)
return;
this.beginDomUpdates(); this.beginDomUpdates();
this._readOnly = readOnly; this._readOnly = readOnly;
if (this._readOnly) if (this._readOnly)
...@@ -783,55 +770,6 @@ WebInspector.TextEditorMainPanel.prototype = { ...@@ -783,55 +770,6 @@ WebInspector.TextEditorMainPanel.prototype = {
this._cachedRows = []; this._cachedRows = [];
}, },
_handleKeyDown: function()
{
if (this._editingLine || event.metaKey || event.shiftKey || event.ctrlKey || event.altKey)
return;
var scrollValue = 0;
if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Up.code)
scrollValue = -1;
else if (event.keyCode == WebInspector.KeyboardShortcut.Keys.Down.code)
scrollValue = 1;
if (scrollValue) {
event.preventDefault();
event.stopPropagation();
this.element.scrollByLines(scrollValue);
return;
}
scrollValue = 0;
if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Left.code)
scrollValue = -40;
else if (event.keyCode == WebInspector.KeyboardShortcut.Keys.Right.code)
scrollValue = 40;
if (scrollValue) {
event.preventDefault();
event.stopPropagation();
this.element.scrollLeft += scrollValue;
}
},
editLine: function(lineRow, callback)
{
var oldContent = lineRow.innerHTML;
function finishEditing(committed, e, newContent)
{
if (committed)
callback(newContent);
lineRow.innerHTML = oldContent;
delete this._editingLine;
}
this._editingLine = WebInspector.startEditing(lineRow, {
context: null,
commitHandler: finishEditing.bind(this, true),
cancelHandler: finishEditing.bind(this, false),
multiline: true
});
},
_buildChunks: function() _buildChunks: function()
{ {
for (var i = 0; i < this._textModel.linesCount; ++i) for (var i = 0; i < this._textModel.linesCount; ++i)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment