| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 _isEditorShowing: function() | 119 _isEditorShowing: function() |
| 120 { | 120 { |
| 121 return this.isShowing() && this._editorAttached; | 121 return this.isShowing() && this._editorAttached; |
| 122 }, | 122 }, |
| 123 | 123 |
| 124 willHide: function() | 124 willHide: function() |
| 125 { | 125 { |
| 126 WebInspector.View.prototype.willHide.call(this); | 126 WebInspector.View.prototype.willHide.call(this); |
| 127 | 127 |
| 128 this._clearPositionHighlight(); | 128 this._clearPositionHighlight(); |
| 129 this._clearLineToReveal(); | |
| 130 }, | 129 }, |
| 131 | 130 |
| 132 /** | 131 /** |
| 133 * @return {?Element} | 132 * @return {?Element} |
| 134 */ | 133 */ |
| 135 statusBarText: function() | 134 statusBarText: function() |
| 136 { | 135 { |
| 137 return this._sourcePosition.element; | 136 return this._sourcePosition.element; |
| 138 }, | 137 }, |
| 139 | 138 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 canHighlightPosition: function() | 205 canHighlightPosition: function() |
| 207 { | 206 { |
| 208 return true; | 207 return true; |
| 209 }, | 208 }, |
| 210 | 209 |
| 211 /** | 210 /** |
| 212 * @override | 211 * @override |
| 213 */ | 212 */ |
| 214 highlightPosition: function(line, column) | 213 highlightPosition: function(line, column) |
| 215 { | 214 { |
| 216 this._clearLineToReveal(); | |
| 217 this._clearLineToScrollTo(); | 215 this._clearLineToScrollTo(); |
| 218 this._clearSelectionToSet(); | 216 this._clearSelectionToSet(); |
| 219 this._positionToHighlight = { line: line, column: column }; | 217 this._positionToHighlight = { line: line, column: column }; |
| 220 this._innerHighlightPositionIfNeeded(); | 218 this._innerHighlightPositionIfNeeded(); |
| 221 }, | 219 }, |
| 222 | 220 |
| 223 _innerHighlightPositionIfNeeded: function() | 221 _innerHighlightPositionIfNeeded: function() |
| 224 { | 222 { |
| 225 if (!this._positionToHighlight) | 223 if (!this._positionToHighlight) |
| 226 return; | 224 return; |
| 227 | 225 |
| 228 if (!this.loaded || !this._isEditorShowing()) | 226 if (!this.loaded || !this._isEditorShowing()) |
| 229 return; | 227 return; |
| 230 | 228 |
| 231 this._textEditor.highlightPosition(this._positionToHighlight.line, this.
_positionToHighlight.column); | 229 this._textEditor.highlightPosition(this._positionToHighlight.line, this.
_positionToHighlight.column); |
| 232 delete this._positionToHighlight; | 230 delete this._positionToHighlight; |
| 233 }, | 231 }, |
| 234 | 232 |
| 235 _clearPositionHighlight: function() | 233 _clearPositionHighlight: function() |
| 236 { | 234 { |
| 237 this._textEditor.clearPositionHighlight(); | 235 this._textEditor.clearPositionHighlight(); |
| 238 delete this._positionToHighlight; | 236 delete this._positionToHighlight; |
| 239 }, | 237 }, |
| 240 | 238 |
| 241 /** | 239 /** |
| 242 * @param {number} line | 240 * @param {number} line |
| 243 */ | 241 */ |
| 244 revealLine: function(line) | |
| 245 { | |
| 246 this._clearPositionHighlight(); | |
| 247 this._clearLineToScrollTo(); | |
| 248 this._clearSelectionToSet(); | |
| 249 this._lineToReveal = line; | |
| 250 this._innerRevealLineIfNeeded(); | |
| 251 }, | |
| 252 | |
| 253 _innerRevealLineIfNeeded: function() | |
| 254 { | |
| 255 if (typeof this._lineToReveal === "number") { | |
| 256 if (this.loaded && this._isEditorShowing()) { | |
| 257 this._textEditor.revealLine(this._lineToReveal); | |
| 258 delete this._lineToReveal; | |
| 259 } | |
| 260 } | |
| 261 }, | |
| 262 | |
| 263 _clearLineToReveal: function() | |
| 264 { | |
| 265 delete this._lineToReveal; | |
| 266 }, | |
| 267 | |
| 268 /** | |
| 269 * @param {number} line | |
| 270 */ | |
| 271 scrollToLine: function(line) | 242 scrollToLine: function(line) |
| 272 { | 243 { |
| 273 this._clearPositionHighlight(); | 244 this._clearPositionHighlight(); |
| 274 this._clearLineToReveal(); | |
| 275 this._lineToScrollTo = line; | 245 this._lineToScrollTo = line; |
| 276 this._innerScrollToLineIfNeeded(); | 246 this._innerScrollToLineIfNeeded(); |
| 277 }, | 247 }, |
| 278 | 248 |
| 279 _innerScrollToLineIfNeeded: function() | 249 _innerScrollToLineIfNeeded: function() |
| 280 { | 250 { |
| 281 if (typeof this._lineToScrollTo === "number") { | 251 if (typeof this._lineToScrollTo === "number") { |
| 282 if (this.loaded && this._isEditorShowing()) { | 252 if (this.loaded && this._isEditorShowing()) { |
| 283 this._textEditor.scrollToLine(this._lineToScrollTo); | 253 this._textEditor.scrollToLine(this._lineToScrollTo); |
| 284 delete this._lineToScrollTo; | 254 delete this._lineToScrollTo; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 }, | 287 }, |
| 318 | 288 |
| 319 _clearSelectionToSet: function() | 289 _clearSelectionToSet: function() |
| 320 { | 290 { |
| 321 delete this._selectionToSet; | 291 delete this._selectionToSet; |
| 322 }, | 292 }, |
| 323 | 293 |
| 324 _wasShownOrLoaded: function() | 294 _wasShownOrLoaded: function() |
| 325 { | 295 { |
| 326 this._innerHighlightPositionIfNeeded(); | 296 this._innerHighlightPositionIfNeeded(); |
| 327 this._innerRevealLineIfNeeded(); | |
| 328 this._innerSetSelectionIfNeeded(); | 297 this._innerSetSelectionIfNeeded(); |
| 329 this._innerScrollToLineIfNeeded(); | 298 this._innerScrollToLineIfNeeded(); |
| 330 }, | 299 }, |
| 331 | 300 |
| 332 onTextChanged: function(oldRange, newRange) | 301 onTextChanged: function(oldRange, newRange) |
| 333 { | 302 { |
| 334 if (this._searchResultsChangedCallback && !this._isReplacing) | 303 if (this._searchResultsChangedCallback && !this._isReplacing) |
| 335 this._searchResultsChangedCallback(); | 304 this._searchResultsChangedCallback(); |
| 336 this.clearMessages(); | 305 this.clearMessages(); |
| 337 }, | 306 }, |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 | 845 |
| 877 /** | 846 /** |
| 878 * @param {?WebInspector.TextRange} from | 847 * @param {?WebInspector.TextRange} from |
| 879 * @param {?WebInspector.TextRange} to | 848 * @param {?WebInspector.TextRange} to |
| 880 */ | 849 */ |
| 881 onJumpToPosition: function(from, to) | 850 onJumpToPosition: function(from, to) |
| 882 { | 851 { |
| 883 this._sourceFrame.onJumpToPosition(from, to); | 852 this._sourceFrame.onJumpToPosition(from, to); |
| 884 } | 853 } |
| 885 } | 854 } |
| OLD | NEW |