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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 var selectedCallFrame = this._model.selectedCallFrame; | 293 var selectedCallFrame = this._model.selectedCallFrame; |
294 selectedCallFrame.evaluate(this._highlightElement.textContent, this._pop
overObjectGroup, false, false, showObjectPopover.bind(this)); | 294 selectedCallFrame.evaluate(this._highlightElement.textContent, this._pop
overObjectGroup, false, false, showObjectPopover.bind(this)); |
295 }, | 295 }, |
296 | 296 |
297 _onHidePopover: function() | 297 _onHidePopover: function() |
298 { | 298 { |
299 // Replace higlight element with its contents inplace. | 299 // Replace higlight element with its contents inplace. |
300 var highlightElement = this._highlightElement; | 300 var highlightElement = this._highlightElement; |
301 if (!highlightElement) | 301 if (!highlightElement) |
302 return; | 302 return; |
| 303 // FIXME: the text editor should maintain highlight on its own. The chec
k below is a workaround for |
| 304 // the case when highlight element is detached from DOM by the TextViewe
r when re-building the DOM. |
303 var parentElement = highlightElement.parentElement; | 305 var parentElement = highlightElement.parentElement; |
304 var child = highlightElement.firstChild; | 306 if (parentElement) { |
305 while (child) { | 307 var child = highlightElement.firstChild; |
306 var nextSibling = child.nextSibling; | 308 while (child) { |
307 parentElement.insertBefore(child, highlightElement); | 309 var nextSibling = child.nextSibling; |
308 child = nextSibling; | 310 parentElement.insertBefore(child, highlightElement); |
| 311 child = nextSibling; |
| 312 } |
| 313 parentElement.removeChild(highlightElement); |
309 } | 314 } |
310 parentElement.removeChild(highlightElement); | |
311 delete this._highlightElement; | 315 delete this._highlightElement; |
312 RuntimeAgent.releaseObjectGroup(this._popoverObjectGroup); | 316 RuntimeAgent.releaseObjectGroup(this._popoverObjectGroup); |
313 }, | 317 }, |
314 | 318 |
315 _highlightExpression: function(element) | 319 _highlightExpression: function(element) |
316 { | 320 { |
317 // Collect tokens belonging to evaluated expression. | 321 // Collect tokens belonging to evaluated expression. |
318 var tokens = [ element ]; | 322 var tokens = [ element ]; |
319 var token = element.previousSibling; | 323 var token = element.previousSibling; |
320 while (token && (token.className === "webkit-javascript-ident" || token.
className === "webkit-javascript-keyword" || token.textContent.trim() === "."))
{ | 324 while (token && (token.className === "webkit-javascript-ident" || token.
className === "webkit-javascript-keyword" || token.textContent.trim() === "."))
{ |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 }, | 471 }, |
468 | 472 |
469 _onTextViewerContentLoaded: function() | 473 _onTextViewerContentLoaded: function() |
470 { | 474 { |
471 if (typeof this._executionLineNumber === "number") | 475 if (typeof this._executionLineNumber === "number") |
472 this.setExecutionLine(this._executionLineNumber); | 476 this.setExecutionLine(this._executionLineNumber); |
473 } | 477 } |
474 } | 478 } |
475 | 479 |
476 WebInspector.JavaScriptSourceFrame.prototype.__proto__ = WebInspector.SourceFram
e.prototype; | 480 WebInspector.JavaScriptSourceFrame.prototype.__proto__ = WebInspector.SourceFram
e.prototype; |
OLD | NEW |