summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/inspector/front-end/SourceFrame.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/WebCore/inspector/front-end/SourceFrame.js')
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/front-end/SourceFrame.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/SourceFrame.js b/src/3rdparty/webkit/WebCore/inspector/front-end/SourceFrame.js
index 18d9073d0..930eb162b 100644
--- a/src/3rdparty/webkit/WebCore/inspector/front-end/SourceFrame.js
+++ b/src/3rdparty/webkit/WebCore/inspector/front-end/SourceFrame.js
@@ -27,6 +27,7 @@ WebInspector.SourceFrame = function(element, addBreakpointDelegate)
{
this.messages = [];
this.breakpoints = [];
+ this._shortcuts = {};
this.addBreakpointDelegate = addBreakpointDelegate;
@@ -199,8 +200,16 @@ WebInspector.SourceFrame.prototype = {
{
WebInspector.addMainEventListeners(this.element.contentDocument);
this.element.contentDocument.addEventListener("mousedown", this._documentMouseDown.bind(this), true);
+ this.element.contentDocument.addEventListener("keydown", this._documentKeyDown.bind(this), true);
+ this.element.contentDocument.addEventListener("keyup", WebInspector.documentKeyUp.bind(WebInspector), true);
this.element.contentDocument.addEventListener("webkitAnimationEnd", this._highlightLineEnds.bind(this), false);
+ // Register 'eval' shortcut.
+ var isMac = InspectorController.platform().indexOf("mac-") === 0;
+ var platformSpecificModifier = isMac ? WebInspector.KeyboardShortcut.Modifiers.Meta : WebInspector.KeyboardShortcut.Modifiers.Ctrl;
+ var shortcut = WebInspector.KeyboardShortcut.makeKey(69 /* 'E' */, platformSpecificModifier | WebInspector.KeyboardShortcut.Modifiers.Shift);
+ this._shortcuts[shortcut] = this._evalSelectionInCallFrame.bind(this);
+
var headElement = this.element.contentDocument.getElementsByTagName("head")[0];
if (!headElement) {
headElement = this.element.contentDocument.createElement("head");
@@ -286,6 +295,36 @@ WebInspector.SourceFrame.prototype = {
this.addBreakpointDelegate(this.lineNumberForSourceRow(sourceRow));
},
+ _documentKeyDown: function(event)
+ {
+ var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
+ var handler = this._shortcuts[shortcut];
+ if (handler) {
+ handler(event);
+ event.preventDefault();
+ } else {
+ WebInspector.documentKeyDown(event);
+ }
+ },
+
+ _evalSelectionInCallFrame: function(event)
+ {
+ if (!WebInspector.panels.scripts || !WebInspector.panels.scripts.paused)
+ return;
+
+ var selection = this.element.contentWindow.getSelection();
+ if (!selection.rangeCount)
+ return;
+
+ var expression = selection.getRangeAt(0).toString().trimWhitespace();
+ WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false, function(result, exception) {
+ WebInspector.showConsole();
+ var commandMessage = new WebInspector.ConsoleCommand(expression);
+ WebInspector.console.addMessage(commandMessage);
+ WebInspector.console.addMessage(new WebInspector.ConsoleCommandResult(result, exception, commandMessage));
+ });
+ },
+
_breakpointEnableChanged: function(event)
{
var breakpoint = event.target;
@@ -332,6 +371,8 @@ WebInspector.SourceFrame.prototype = {
if (!sourceRow)
return;
+ breakpoint.sourceText = sourceRow.getElementsByClassName('webkit-line-content')[0].textContent;
+
this._drawBreakpointImagesIfNeeded();
sourceRow._breakpointObject = breakpoint;