| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) IBM Corp. 2009 All rights reserved. | 2 * Copyright (C) IBM Corp. 2009 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 * @param {!WebInspector.Linkifier} linkifier | 226 * @param {!WebInspector.Linkifier} linkifier |
| 227 */ | 227 */ |
| 228 WebInspector.WatchExpression = function(expression, expandController, linkifier) | 228 WebInspector.WatchExpression = function(expression, expandController, linkifier) |
| 229 { | 229 { |
| 230 this._expression = expression; | 230 this._expression = expression; |
| 231 this._expandController = expandController; | 231 this._expandController = expandController; |
| 232 this._element = createElementWithClass("div", "watch-expression monospace"); | 232 this._element = createElementWithClass("div", "watch-expression monospace"); |
| 233 this._editing = false; | 233 this._editing = false; |
| 234 this._linkifier = linkifier; | 234 this._linkifier = linkifier; |
| 235 | 235 |
| 236 this._createWatchExpression(null, false); | 236 this._createWatchExpression(null); |
| 237 this.update(); | 237 this.update(); |
| 238 } | 238 } |
| 239 | 239 |
| 240 WebInspector.WatchExpression._watchObjectGroupId = "watch-group"; | 240 WebInspector.WatchExpression._watchObjectGroupId = "watch-group"; |
| 241 | 241 |
| 242 WebInspector.WatchExpression.Events = { | 242 WebInspector.WatchExpression.Events = { |
| 243 ExpressionUpdated: "ExpressionUpdated" | 243 ExpressionUpdated: "ExpressionUpdated" |
| 244 } | 244 } |
| 245 | 245 |
| 246 WebInspector.WatchExpression.prototype = { | 246 WebInspector.WatchExpression.prototype = { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 * @param {!Event} event | 334 * @param {!Event} event |
| 335 */ | 335 */ |
| 336 _deleteWatchExpression: function(event) | 336 _deleteWatchExpression: function(event) |
| 337 { | 337 { |
| 338 event.consume(true); | 338 event.consume(true); |
| 339 this._updateExpression(null); | 339 this._updateExpression(null); |
| 340 }, | 340 }, |
| 341 | 341 |
| 342 /** | 342 /** |
| 343 * @param {?WebInspector.RemoteObject} result | 343 * @param {?WebInspector.RemoteObject} result |
| 344 * @param {boolean} wasThrown | 344 * @param {!RuntimeAgent.ExceptionDetails=} exceptionDetails |
| 345 */ | 345 */ |
| 346 _createWatchExpression: function(result, wasThrown) | 346 _createWatchExpression: function(result, exceptionDetails) |
| 347 { | 347 { |
| 348 this._result = result; | 348 this._result = result; |
| 349 | 349 |
| 350 var headerElement = createElementWithClass("div", "watch-expression-head
er"); | 350 var headerElement = createElementWithClass("div", "watch-expression-head
er"); |
| 351 var deleteButton = headerElement.createChild("button", "watch-expression
-delete-button"); | 351 var deleteButton = headerElement.createChild("button", "watch-expression
-delete-button"); |
| 352 deleteButton.title = WebInspector.UIString("Delete watch expression"); | 352 deleteButton.title = WebInspector.UIString("Delete watch expression"); |
| 353 deleteButton.addEventListener("click", this._deleteWatchExpression.bind(
this), false); | 353 deleteButton.addEventListener("click", this._deleteWatchExpression.bind(
this), false); |
| 354 | 354 |
| 355 var titleElement = headerElement.createChild("div", "watch-expression-ti
tle"); | 355 var titleElement = headerElement.createChild("div", "watch-expression-ti
tle"); |
| 356 this._nameElement = WebInspector.ObjectPropertiesSection.createNameEleme
nt(this._expression); | 356 this._nameElement = WebInspector.ObjectPropertiesSection.createNameEleme
nt(this._expression); |
| 357 if (wasThrown || !result) { | 357 if (!!exceptionDetails || !result) { |
| 358 this._valueElement = createElementWithClass("span", "error-message v
alue"); | 358 this._valueElement = createElementWithClass("span", "error-message v
alue"); |
| 359 titleElement.classList.add("dimmed"); | 359 titleElement.classList.add("dimmed"); |
| 360 this._valueElement.textContent = WebInspector.UIString("<not availab
le>"); | 360 this._valueElement.textContent = WebInspector.UIString("<not availab
le>"); |
| 361 } else { | 361 } else { |
| 362 this._valueElement = WebInspector.ObjectPropertiesSection.createValu
eElementWithCustomSupport(result, wasThrown, titleElement, this._linkifier); | 362 this._valueElement = WebInspector.ObjectPropertiesSection.createValu
eElementWithCustomSupport(result, !!exceptionDetails, titleElement, this._linkif
ier); |
| 363 } | 363 } |
| 364 var separatorElement = createElementWithClass("span", "watch-expressions
-separator"); | 364 var separatorElement = createElementWithClass("span", "watch-expressions
-separator"); |
| 365 separatorElement.textContent = ": "; | 365 separatorElement.textContent = ": "; |
| 366 titleElement.appendChildren(this._nameElement, separatorElement, this._v
alueElement); | 366 titleElement.appendChildren(this._nameElement, separatorElement, this._v
alueElement); |
| 367 | 367 |
| 368 this._element.removeChildren(); | 368 this._element.removeChildren(); |
| 369 this._objectPropertiesSection = null; | 369 this._objectPropertiesSection = null; |
| 370 if (!wasThrown && result && result.hasChildren && !result.customPreview(
)) { | 370 if (!exceptionDetails && result && result.hasChildren && !result.customP
review()) { |
| 371 headerElement.classList.add("watch-expression-object-header"); | 371 headerElement.classList.add("watch-expression-object-header"); |
| 372 this._objectPropertiesSection = new WebInspector.ObjectPropertiesSec
tion(result, headerElement, this._linkifier); | 372 this._objectPropertiesSection = new WebInspector.ObjectPropertiesSec
tion(result, headerElement, this._linkifier); |
| 373 this._objectPresentationElement = this._objectPropertiesSection.elem
ent; | 373 this._objectPresentationElement = this._objectPropertiesSection.elem
ent; |
| 374 this._expandController.watchSection(/** @type {string} */ (this._exp
ression), this._objectPropertiesSection); | 374 this._expandController.watchSection(/** @type {string} */ (this._exp
ression), this._objectPropertiesSection); |
| 375 var objectTreeElement = this._objectPropertiesSection.objectTreeElem
ent(); | 375 var objectTreeElement = this._objectPropertiesSection.objectTreeElem
ent(); |
| 376 objectTreeElement.toggleOnClick = false; | 376 objectTreeElement.toggleOnClick = false; |
| 377 objectTreeElement.listItemElement.addEventListener("click", this._on
SectionClick.bind(this), false); | 377 objectTreeElement.listItemElement.addEventListener("click", this._on
SectionClick.bind(this), false); |
| 378 objectTreeElement.listItemElement.addEventListener("dblclick", this.
_dblClickOnWatchExpression.bind(this)); | 378 objectTreeElement.listItemElement.addEventListener("dblclick", this.
_dblClickOnWatchExpression.bind(this)); |
| 379 } else { | 379 } else { |
| 380 this._objectPresentationElement = headerElement; | 380 this._objectPresentationElement = headerElement; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 contextMenu.appendApplicableItems(this._result); | 438 contextMenu.appendApplicableItems(this._result); |
| 439 }, | 439 }, |
| 440 | 440 |
| 441 _copyValueButtonClicked: function() | 441 _copyValueButtonClicked: function() |
| 442 { | 442 { |
| 443 InspectorFrontendHost.copyText(this._valueElement.textContent); | 443 InspectorFrontendHost.copyText(this._valueElement.textContent); |
| 444 }, | 444 }, |
| 445 | 445 |
| 446 __proto__: WebInspector.Object.prototype | 446 __proto__: WebInspector.Object.prototype |
| 447 } | 447 } |
| OLD | NEW |