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

Unified Diff: Source/devtools/front_end/CodeMirrorTextEditor.js

Issue 204323003: DevTools: Merge highlightPosition and revealLine methods on SourceFrame. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed tests Created 6 years, 9 months 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
Index: Source/devtools/front_end/CodeMirrorTextEditor.js
diff --git a/Source/devtools/front_end/CodeMirrorTextEditor.js b/Source/devtools/front_end/CodeMirrorTextEditor.js
index 8ad3b9edfe44f19f80e15f0ddef94cedfb7b8300..e6185b60ab71e0f00010d8f220feb6104b7756f3 100644
--- a/Source/devtools/front_end/CodeMirrorTextEditor.js
+++ b/Source/devtools/front_end/CodeMirrorTextEditor.js
@@ -339,7 +339,7 @@ WebInspector.CodeMirrorTextEditor.prototype = {
function innerHighlightRegex()
{
if (range) {
- this.revealLine(range.startLine);
+ this._revealLine(range.startLine);
if (range.endColumn > WebInspector.CodeMirrorTextEditor.maxHighlightLength)
this.setSelection(range);
else
@@ -685,7 +685,7 @@ WebInspector.CodeMirrorTextEditor.prototype = {
/**
* @param {number} lineNumber
*/
- revealLine: function(lineNumber)
+ _revealLine: function(lineNumber)
{
this._innerRevealLine(lineNumber, this._codeMirror.getScrollInfo());
},
@@ -794,8 +794,9 @@ WebInspector.CodeMirrorTextEditor.prototype = {
/**
* @param {number} lineNumber
* @param {number=} columnNumber
+ * @param {boolean=} shouldHighlight
*/
- highlightPosition: function(lineNumber, columnNumber)
+ revealPosition: function(lineNumber, columnNumber, shouldHighlight)
{
lineNumber = Number.constrain(lineNumber, 0, this._codeMirror.lineCount() - 1);
if (typeof columnNumber !== "number")
@@ -806,9 +807,11 @@ WebInspector.CodeMirrorTextEditor.prototype = {
this._highlightedLine = this._codeMirror.getLineHandle(lineNumber);
if (!this._highlightedLine)
return;
- this.revealLine(lineNumber);
- this._codeMirror.addLineClass(this._highlightedLine, null, "cm-highlight");
- this._clearHighlightTimeout = setTimeout(this.clearPositionHighlight.bind(this), 2000);
+ this._revealLine(lineNumber);
+ if (shouldHighlight) {
+ this._codeMirror.addLineClass(this._highlightedLine, null, "cm-highlight");
+ this._clearHighlightTimeout = setTimeout(this.clearPositionHighlight.bind(this), 2000);
+ }
this.setSelection(WebInspector.TextRange.createFromLocation(lineNumber, columnNumber));
},
« no previous file with comments | « LayoutTests/inspector/sources/debugger/reveal-execution-line.html ('k') | Source/devtools/front_end/SourceFrame.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698