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

Unified Diff: Source/devtools/front_end/SourceFrame.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
« no previous file with comments | « Source/devtools/front_end/CodeMirrorTextEditor.js ('k') | Source/devtools/front_end/SourcesPanel.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/SourceFrame.js
diff --git a/Source/devtools/front_end/SourceFrame.js b/Source/devtools/front_end/SourceFrame.js
index 03f73d4a75011fa448add1d5bcd04190ab83fd76..74d76dadf10a04f88f9025c4856c004cd3292d0d 100644
--- a/Source/devtools/front_end/SourceFrame.js
+++ b/Source/devtools/front_end/SourceFrame.js
@@ -125,8 +125,7 @@ WebInspector.SourceFrame.prototype = {
{
WebInspector.View.prototype.willHide.call(this);
- this._clearPositionHighlight();
- this._clearLineToReveal();
+ this._clearPositionToReveal();
},
/**
@@ -213,56 +212,38 @@ WebInspector.SourceFrame.prototype = {
*/
highlightPosition: function(line, column)
{
- this._clearLineToReveal();
- this._clearLineToScrollTo();
- this._clearSelectionToSet();
- this._positionToHighlight = { line: line, column: column };
- this._innerHighlightPositionIfNeeded();
- },
-
- _innerHighlightPositionIfNeeded: function()
- {
- if (!this._positionToHighlight)
- return;
-
- if (!this.loaded || !this._isEditorShowing())
- return;
-
- this._textEditor.highlightPosition(this._positionToHighlight.line, this._positionToHighlight.column);
- delete this._positionToHighlight;
- },
-
- _clearPositionHighlight: function()
- {
- this._textEditor.clearPositionHighlight();
- delete this._positionToHighlight;
+ this.revealPosition(line, column, true);
},
/**
* @param {number} line
+ * @param {number=} column
+ * @param {boolean=} shouldHighlight
*/
- revealLine: function(line)
+ revealPosition: function(line, column, shouldHighlight)
{
- this._clearPositionHighlight();
this._clearLineToScrollTo();
this._clearSelectionToSet();
- this._lineToReveal = line;
- this._innerRevealLineIfNeeded();
+ this._positionToReveal = { line: line, column: column, shouldHighlight: shouldHighlight };
+ this._innerRevealPositionIfNeeded();
},
- _innerRevealLineIfNeeded: function()
+ _innerRevealPositionIfNeeded: function()
{
- if (typeof this._lineToReveal === "number") {
- if (this.loaded && this._isEditorShowing()) {
- this._textEditor.revealLine(this._lineToReveal);
- delete this._lineToReveal;
- }
- }
+ if (!this._positionToReveal)
+ return;
+
+ if (!this.loaded || !this._isEditorShowing())
+ return;
+
+ this._textEditor.revealPosition(this._positionToReveal.line, this._positionToReveal.column, this._positionToReveal.shouldHighlight);
+ delete this._positionToReveal;
},
- _clearLineToReveal: function()
+ _clearPositionToReveal: function()
{
- delete this._lineToReveal;
+ this._textEditor.clearPositionHighlight();
+ delete this._positionToReveal;
},
/**
@@ -270,8 +251,7 @@ WebInspector.SourceFrame.prototype = {
*/
scrollToLine: function(line)
{
- this._clearPositionHighlight();
- this._clearLineToReveal();
+ this._clearPositionToReveal();
this._lineToScrollTo = line;
this._innerScrollToLineIfNeeded();
},
@@ -323,8 +303,7 @@ WebInspector.SourceFrame.prototype = {
_wasShownOrLoaded: function()
{
- this._innerHighlightPositionIfNeeded();
- this._innerRevealLineIfNeeded();
+ this._innerRevealPositionIfNeeded();
this._innerSetSelectionIfNeeded();
this._innerScrollToLineIfNeeded();
},
« no previous file with comments | « Source/devtools/front_end/CodeMirrorTextEditor.js ('k') | Source/devtools/front_end/SourcesPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698