Diff
Modified: trunk/Source/WebCore/ChangeLog (141425 => 141426)
--- trunk/Source/WebCore/ChangeLog 2013-01-31 16:45:44 UTC (rev 141425)
+++ trunk/Source/WebCore/ChangeLog 2013-01-31 17:17:30 UTC (rev 141426)
@@ -1,5 +1,30 @@
2013-01-31 Andrey Lushnikov <[email protected]>
+ Web Inspector: show cursor location in DTE
+ https://bugs.webkit.org/show_bug.cgi?id=108478
+
+ Reviewed by Pavel Feldman.
+
+ Add a new status bar element to SourceFrame to display current
+ DefaultTextEditor cursor position.
+
+ No new tests.
+
+ * English.lproj/localizedStrings.js:
+ * inspector/front-end/DefaultTextEditor.js:
+ (WebInspector.DefaultTextEditor.prototype.copyRange):
+ * inspector/front-end/SourceFrame.js:
+ (WebInspector.SourceFrame):
+ (WebInspector.SourceFrame.prototype.statusBarItems):
+ (WebInspector.SourceFrame.prototype.selectionChanged):
+ (WebInspector.SourceFrame.prototype._updateSourcePosition):
+ * inspector/front-end/TextEditor.js:
+ (WebInspector.TextEditor.prototype.copyRange):
+ * inspector/front-end/inspector.css:
+ (.source-frame-position):
+
+2013-01-31 Andrey Lushnikov <[email protected]>
+
Web Inspector: overlay highlight in DTE gets messed up when zoom factor changes.
https://bugs.webkit.org/show_bug.cgi?id=108486
Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js (141425 => 141426)
--- trunk/Source/WebCore/English.lproj/localizedStrings.js 2013-01-31 16:45:44 UTC (rev 141425)
+++ trunk/Source/WebCore/English.lproj/localizedStrings.js 2013-01-31 17:17:30 UTC (rev 141426)
@@ -14,6 +14,7 @@
localizedStrings["%.2f%"] = "%.2f%";
localizedStrings["%.2f\u2009s"] = "%.2f\u2009s";
localizedStrings["%.3f\u2009ms"] = "%.3f\u2009ms";
+localizedStrings["%d characters selected"] = "%d characters selected";
localizedStrings["%d console messages are not shown."] = "%d console messages are not shown.";
localizedStrings["%d cookies (%s)"] = "%d cookies (%s)";
localizedStrings["%d descendant with forced state"] = "%d descendant with forced state";
@@ -24,6 +25,7 @@
localizedStrings["%d errors"] = "%d errors";
localizedStrings["%d errors, %d warning"] = "%d errors, %d warning";
localizedStrings["%d errors, %d warnings"] = "%d errors, %d warnings";
+localizedStrings["%d lines, %d characters selected"] = "%d lines, %d characters selected";
localizedStrings["%d of %d"] = "%d of %d";
localizedStrings["%d of %d records shown"] = "%d of %d records shown";
localizedStrings["%d of %d frames shown"] = "%d of %d frames shown";
@@ -241,6 +243,7 @@
localizedStrings["Key"] = "Key";
localizedStrings["Shortcuts"] = "Shortcuts";
localizedStrings["Layout"] = "Layout";
+localizedStrings["Line %d, Column %d"] = "Line %d, Column %d";
localizedStrings["Listeners: %d"] = "Listeners: %d";
localizedStrings["Local Storage"] = "Local Storage";
localizedStrings["Load event fired"] = "Load event fired";
Modified: trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js (141425 => 141426)
--- trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js 2013-01-31 16:45:44 UTC (rev 141425)
+++ trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js 2013-01-31 17:17:30 UTC (rev 141426)
@@ -111,6 +111,15 @@
WebInspector.DefaultTextEditor.prototype = {
/**
+ * @param {WebInspector.TextRange} range
+ * @return {string}
+ */
+ copyRange: function(range)
+ {
+ return this._textModel.copyRange(range);
+ },
+
+ /**
* @param {string} regex
* @param {string} cssClass
* @return {WebInspector.TextEditorMainPanel.HighlightDescriptor}
Modified: trunk/Source/WebCore/inspector/front-end/SourceFrame.js (141425 => 141426)
--- trunk/Source/WebCore/inspector/front-end/SourceFrame.js 2013-01-31 16:45:44 UTC (rev 141425)
+++ trunk/Source/WebCore/inspector/front-end/SourceFrame.js 2013-01-31 17:17:30 UTC (rev 141426)
@@ -61,6 +61,9 @@
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);
+
+ this._sourcePositionElement = document.createElement("div");
+ this._sourcePositionElement.className = "source-frame-position";
}
/**
@@ -113,7 +116,7 @@
*/
statusBarItems: function()
{
- return [];
+ return [this._sourcePositionElement];
},
defaultFocusedElement: function()
@@ -621,10 +624,31 @@
*/
selectionChanged: function(textRange)
{
+ this._updateSourcePosition(textRange);
this.dispatchEventToListeners(WebInspector.SourceFrame.Events.SelectionChanged, textRange);
},
/**
+ * @param {WebInspector.TextRange} textRange
+ */
+ _updateSourcePosition: function(textRange)
+ {
+ if (!textRange)
+ return;
+
+ if (textRange.isEmpty()) {
+ this._sourcePositionElement.textContent = WebInspector.UIString("Line %d, Column %d", textRange.endLine + 1, textRange.endColumn + 1);
+ return;
+ }
+
+ var selectedText = this._textEditor.copyRange(textRange);
+ if (textRange.startLine === textRange.endLine)
+ this._sourcePositionElement.textContent = WebInspector.UIString("%d characters selected", selectedText.length);
+ else
+ this._sourcePositionElement.textContent = WebInspector.UIString("%d lines, %d characters selected", textRange.endLine - textRange.startLine + 1, selectedText.length);
+ },
+
+ /**
* @param {number} lineNumber
*/
scrollChanged: function(lineNumber)
Modified: trunk/Source/WebCore/inspector/front-end/TextEditor.js (141425 => 141426)
--- trunk/Source/WebCore/inspector/front-end/TextEditor.js 2013-01-31 16:45:44 UTC (rev 141425)
+++ trunk/Source/WebCore/inspector/front-end/TextEditor.js 2013-01-31 17:17:30 UTC (rev 141426)
@@ -100,6 +100,12 @@
*/
setExecutionLine: function(lineNumber) { },
+ /**
+ * @param {WebInspector.TextRange} range
+ * @return {string}
+ */
+ copyRange: function(range) { },
+
clearExecutionLine: function() { },
/**
Modified: trunk/Source/WebCore/inspector/front-end/inspector.css (141425 => 141426)
--- trunk/Source/WebCore/inspector/front-end/inspector.css 2013-01-31 16:45:44 UTC (rev 141425)
+++ trunk/Source/WebCore/inspector/front-end/inspector.css 2013-01-31 17:17:30 UTC (rev 141426)
@@ -3056,3 +3056,8 @@
border-left: none;
margin-top: 1px;
}
+
+.source-frame-position {
+ padding-left: 2px;
+ padding-top: 5px;
+}