Diff
Modified: trunk/LayoutTests/http/tests/inspector/live-edit-test.js (125437 => 125438)
--- trunk/LayoutTests/http/tests/inspector/live-edit-test.js 2012-08-13 19:49:40 UTC (rev 125437)
+++ trunk/LayoutTests/http/tests/inspector/live-edit-test.js 2012-08-13 20:05:13 UTC (rev 125438)
@@ -17,7 +17,7 @@
break;
}
sourceFrame.onTextChanged(oldRange, newRange);
- sourceFrame._textEditor._commitEditing();
+ sourceFrame._commitEditing();
}
};
Modified: trunk/Source/WebCore/ChangeLog (125437 => 125438)
--- trunk/Source/WebCore/ChangeLog 2012-08-13 19:49:40 UTC (rev 125437)
+++ trunk/Source/WebCore/ChangeLog 2012-08-13 20:05:13 UTC (rev 125438)
@@ -1,3 +1,21 @@
+2012-08-13 Pavel Feldman <[email protected]>
+
+ Web Inspector: remove commitEditing from the text editor delegate.
+ https://bugs.webkit.org/show_bug.cgi?id=93858
+
+ Reviewed by Vsevolod Vlasov.
+
+ This should be up to the source frame.
+
+ * inspector/front-end/DefaultTextEditor.js:
+ (WebInspector.DefaultTextEditor.prototype._registerShortcuts):
+ * inspector/front-end/SourceFrame.js:
+ (WebInspector.SourceFrame):
+ (WebInspector.SourceFrame.prototype.scrollChanged):
+ (WebInspector.SourceFrame.prototype._handleKeyDown):
+ (WebInspector.SourceFrame.prototype._commitEditing):
+ * inspector/front-end/TextEditor.js:
+
2012-08-13 Sheriff Bot <[email protected]>
Unreviewed, rolling out r125430.
Modified: trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js (125437 => 125438)
--- trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js 2012-08-13 19:49:40 UTC (rev 125437)
+++ trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js 2012-08-13 20:05:13 UTC (rev 125438)
@@ -324,8 +324,6 @@
var modifiers = WebInspector.KeyboardShortcut.Modifiers;
this._shortcuts = {};
- var commitEditing = this._commitEditing.bind(this);
- this._shortcuts[WebInspector.KeyboardShortcut.makeKey("s", modifiers.CtrlOrMeta)] = commitEditing;
var handleEnterKey = this._mainPanel.handleEnterKey.bind(this._mainPanel);
this._shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Enter.code, WebInspector.KeyboardShortcut.Modifiers.None)] = handleEnterKey;
@@ -365,17 +363,6 @@
contextMenu.show(event);
},
- _commitEditing: function()
- {
- if (this.readOnly())
- return false;
-
- this._delegate.commitEditing();
- if (this._url && WebInspector.fileManager.isURLSaved(this._url))
- WebInspector.fileManager.save(this._url, this._textModel.text(), false);
- return true;
- },
-
_handleScrollChanged: function(event)
{
var visibleFrom = this._mainPanel.element.scrollTop;
Modified: trunk/Source/WebCore/inspector/front-end/SourceFrame.js (125437 => 125438)
--- trunk/Source/WebCore/inspector/front-end/SourceFrame.js 2012-08-13 19:49:40 UTC (rev 125437)
+++ trunk/Source/WebCore/inspector/front-end/SourceFrame.js 2012-08-13 20:05:13 UTC (rev 125438)
@@ -56,6 +56,10 @@
this._messageBubbles = {};
this._textEditor.setReadOnly(!this.canEditSource());
+
+ this._shortcuts = {};
+ this._shortcuts[WebInspector.KeyboardShortcut.makeKey("s", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)] = this._commitEditing.bind(this);
+ this.element.addEventListener("keydown", this._handleKeyDown.bind(this), false);
}
/**
@@ -625,6 +629,26 @@
scrollChanged: function(lineNumber)
{
this.dispatchEventToListeners(WebInspector.SourceFrame.Events.ScrollChanged, lineNumber);
+ },
+
+ _handleKeyDown: function(e)
+ {
+ var shortcutKey = WebInspector.KeyboardShortcut.makeKeyFromEvent(e);
+ var handler = this._shortcuts[shortcutKey];
+ if (handler && handler())
+ e.consume(true);
+ },
+
+ _commitEditing: function()
+ {
+ if (this._textEditor.readOnly())
+ return false;
+
+ var content = this._textEditor.text();
+ this.commitEditing(content);
+ if (this._url && WebInspector.fileManager.isURLSaved(this._url))
+ WebInspector.fileManager.save(this._url, content, false);
+ return true;
}
}
@@ -646,11 +670,6 @@
this._sourceFrame.onTextChanged(oldRange, newRange);
},
- commitEditing: function()
- {
- this._sourceFrame.commitEditing(this._sourceFrame._textEditor.text());
- },
-
/**
* @param {WebInspector.TextRange} textRange
*/
Modified: trunk/Source/WebCore/inspector/front-end/TextEditor.js (125437 => 125438)
--- trunk/Source/WebCore/inspector/front-end/TextEditor.js 2012-08-13 19:49:40 UTC (rev 125437)
+++ trunk/Source/WebCore/inspector/front-end/TextEditor.js 2012-08-13 20:05:13 UTC (rev 125438)
@@ -193,8 +193,6 @@
*/
onTextChanged: function(oldRange, newRange) { },
- commitEditing: function() { },
-
/**
* @param {WebInspector.TextRange} textRange
*/