| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 this.toolbar().appendToolbarItem(addButton); | 47 this.toolbar().appendToolbarItem(addButton); |
| 48 var refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("Re
fresh"), "refresh-toolbar-item"); | 48 var refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("Re
fresh"), "refresh-toolbar-item"); |
| 49 refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this
)); | 49 refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this
)); |
| 50 this.toolbar().appendToolbarItem(refreshButton); | 50 this.toolbar().appendToolbarItem(refreshButton); |
| 51 | 51 |
| 52 this._bodyElement = this.element.createChild("div", "vbox watch-expressions"
); | 52 this._bodyElement = this.element.createChild("div", "vbox watch-expressions"
); |
| 53 this._bodyElement.addEventListener("contextmenu", this._contextMenu.bind(thi
s), false); | 53 this._bodyElement.addEventListener("contextmenu", this._contextMenu.bind(thi
s), false); |
| 54 this._expandController = new WebInspector.ObjectPropertiesSectionExpandContr
oller(); | 54 this._expandController = new WebInspector.ObjectPropertiesSectionExpandContr
oller(); |
| 55 | 55 |
| 56 WebInspector.context.addFlavorChangeListener(WebInspector.ExecutionContext,
this.refreshExpressions, this); | 56 WebInspector.context.addFlavorChangeListener(WebInspector.ExecutionContext,
this.refreshExpressions, this); |
| 57 |
| 58 this._linkifier = new WebInspector.Linkifier(); |
| 57 } | 59 } |
| 58 | 60 |
| 59 WebInspector.WatchExpressionsSidebarPane.prototype = { | 61 WebInspector.WatchExpressionsSidebarPane.prototype = { |
| 60 wasShown: function() | 62 wasShown: function() |
| 61 { | 63 { |
| 62 this._refreshExpressionsIfNeeded(); | 64 this._refreshExpressionsIfNeeded(); |
| 63 }, | 65 }, |
| 64 | 66 |
| 65 refreshExpressions: function() | 67 refreshExpressions: function() |
| 66 { | 68 { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 * @param {!WebInspector.Event} event | 124 * @param {!WebInspector.Event} event |
| 123 */ | 125 */ |
| 124 _refreshButtonClicked: function(event) | 126 _refreshButtonClicked: function(event) |
| 125 { | 127 { |
| 126 event.consume(); | 128 event.consume(); |
| 127 this.refreshExpressions(); | 129 this.refreshExpressions(); |
| 128 }, | 130 }, |
| 129 | 131 |
| 130 _rebuildWatchExpressions: function() | 132 _rebuildWatchExpressions: function() |
| 131 { | 133 { |
| 134 this._linkifier.reset(); |
| 132 this._bodyElement.removeChildren(); | 135 this._bodyElement.removeChildren(); |
| 133 this._watchExpressions = []; | 136 this._watchExpressions = []; |
| 134 this._emptyElement = this._bodyElement.createChild("div", "info"); | 137 this._emptyElement = this._bodyElement.createChild("div", "info"); |
| 135 this._emptyElement.textContent = WebInspector.UIString("No Watch Express
ions"); | 138 this._emptyElement.textContent = WebInspector.UIString("No Watch Express
ions"); |
| 136 var watchExpressionStrings = this._watchExpressionsSetting.get(); | 139 var watchExpressionStrings = this._watchExpressionsSetting.get(); |
| 137 for (var i = 0; i < watchExpressionStrings.length; ++i) { | 140 for (var i = 0; i < watchExpressionStrings.length; ++i) { |
| 138 var expression = watchExpressionStrings[i]; | 141 var expression = watchExpressionStrings[i]; |
| 139 if (!expression) | 142 if (!expression) |
| 140 continue; | 143 continue; |
| 141 | 144 |
| 142 this._createWatchExpression(expression); | 145 this._createWatchExpression(expression); |
| 143 } | 146 } |
| 144 }, | 147 }, |
| 145 | 148 |
| 146 /** | 149 /** |
| 147 * @param {?string} expression | 150 * @param {?string} expression |
| 148 * @return {!WebInspector.WatchExpression} | 151 * @return {!WebInspector.WatchExpression} |
| 149 */ | 152 */ |
| 150 _createWatchExpression: function(expression) | 153 _createWatchExpression: function(expression) |
| 151 { | 154 { |
| 152 this._emptyElement.classList.add("hidden"); | 155 this._emptyElement.classList.add("hidden"); |
| 153 var watchExpression = new WebInspector.WatchExpression(expression, this.
_expandController); | 156 var watchExpression = new WebInspector.WatchExpression(expression, this.
_expandController, this._linkifier); |
| 154 watchExpression.addEventListener(WebInspector.WatchExpression.Events.Exp
ressionUpdated, this._watchExpressionUpdated.bind(this)); | 157 watchExpression.addEventListener(WebInspector.WatchExpression.Events.Exp
ressionUpdated, this._watchExpressionUpdated.bind(this)); |
| 155 this._bodyElement.appendChild(watchExpression.element()); | 158 this._bodyElement.appendChild(watchExpression.element()); |
| 156 this._watchExpressions.push(watchExpression); | 159 this._watchExpressions.push(watchExpression); |
| 157 return watchExpression; | 160 return watchExpression; |
| 158 }, | 161 }, |
| 159 | 162 |
| 160 /** | 163 /** |
| 161 * @param {!WebInspector.Event} event | 164 * @param {!WebInspector.Event} event |
| 162 */ | 165 */ |
| 163 _watchExpressionUpdated: function(event) | 166 _watchExpressionUpdated: function(event) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 }, | 214 }, |
| 212 | 215 |
| 213 __proto__: WebInspector.SidebarPane.prototype | 216 __proto__: WebInspector.SidebarPane.prototype |
| 214 } | 217 } |
| 215 | 218 |
| 216 /** | 219 /** |
| 217 * @constructor | 220 * @constructor |
| 218 * @extends {WebInspector.Object} | 221 * @extends {WebInspector.Object} |
| 219 * @param {?string} expression | 222 * @param {?string} expression |
| 220 * @param {!WebInspector.ObjectPropertiesSectionExpandController} expandControll
er | 223 * @param {!WebInspector.ObjectPropertiesSectionExpandController} expandControll
er |
| 224 * @param {!WebInspector.Linkifier} linkifier |
| 221 */ | 225 */ |
| 222 WebInspector.WatchExpression = function(expression, expandController) | 226 WebInspector.WatchExpression = function(expression, expandController, linkifier) |
| 223 { | 227 { |
| 224 this._expression = expression; | 228 this._expression = expression; |
| 225 this._expandController = expandController; | 229 this._expandController = expandController; |
| 226 this._element = createElementWithClass("div", "watch-expression monospace"); | 230 this._element = createElementWithClass("div", "watch-expression monospace"); |
| 227 this._editing = false; | 231 this._editing = false; |
| 232 this._linkifier = linkifier; |
| 228 | 233 |
| 229 this._createWatchExpression(null, false); | 234 this._createWatchExpression(null, false); |
| 230 this.update(); | 235 this.update(); |
| 231 } | 236 } |
| 232 | 237 |
| 233 WebInspector.WatchExpression._watchObjectGroupId = "watch-group"; | 238 WebInspector.WatchExpression._watchObjectGroupId = "watch-group"; |
| 234 | 239 |
| 235 WebInspector.WatchExpression.Events = { | 240 WebInspector.WatchExpression.Events = { |
| 236 ExpressionUpdated: "ExpressionUpdated" | 241 ExpressionUpdated: "ExpressionUpdated" |
| 237 } | 242 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 deleteButton.title = WebInspector.UIString("Delete watch expression"); | 350 deleteButton.title = WebInspector.UIString("Delete watch expression"); |
| 346 deleteButton.addEventListener("click", this._deleteWatchExpression.bind(
this), false); | 351 deleteButton.addEventListener("click", this._deleteWatchExpression.bind(
this), false); |
| 347 | 352 |
| 348 var titleElement = headerElement.createChild("div", "watch-expression-ti
tle"); | 353 var titleElement = headerElement.createChild("div", "watch-expression-ti
tle"); |
| 349 this._nameElement = WebInspector.ObjectPropertiesSection.createNameEleme
nt(this._expression); | 354 this._nameElement = WebInspector.ObjectPropertiesSection.createNameEleme
nt(this._expression); |
| 350 if (wasThrown || !result) { | 355 if (wasThrown || !result) { |
| 351 this._valueElement = createElementWithClass("span", "error-message v
alue"); | 356 this._valueElement = createElementWithClass("span", "error-message v
alue"); |
| 352 titleElement.classList.add("dimmed"); | 357 titleElement.classList.add("dimmed"); |
| 353 this._valueElement.textContent = WebInspector.UIString("<not availab
le>"); | 358 this._valueElement.textContent = WebInspector.UIString("<not availab
le>"); |
| 354 } else { | 359 } else { |
| 355 this._valueElement = WebInspector.ObjectPropertiesSection.createValu
eElementWithCustomSupport(result, wasThrown, titleElement); | 360 this._valueElement = WebInspector.ObjectPropertiesSection.createValu
eElementWithCustomSupport(result, wasThrown, titleElement, this._linkifier); |
| 356 } | 361 } |
| 357 var separatorElement = createElementWithClass("span", "watch-expressions
-separator"); | 362 var separatorElement = createElementWithClass("span", "watch-expressions
-separator"); |
| 358 separatorElement.textContent = ": "; | 363 separatorElement.textContent = ": "; |
| 359 titleElement.appendChildren(this._nameElement, separatorElement, this._v
alueElement); | 364 titleElement.appendChildren(this._nameElement, separatorElement, this._v
alueElement); |
| 360 | 365 |
| 361 this._element.removeChildren(); | 366 this._element.removeChildren(); |
| 362 this._objectPropertiesSection = null; | 367 this._objectPropertiesSection = null; |
| 363 if (!wasThrown && result && result.hasChildren && !result.customPreview(
)) { | 368 if (!wasThrown && result && result.hasChildren && !result.customPreview(
)) { |
| 364 headerElement.classList.add("watch-expression-object-header"); | 369 headerElement.classList.add("watch-expression-object-header"); |
| 365 this._objectPropertiesSection = new WebInspector.ObjectPropertiesSec
tion(result, headerElement); | 370 this._objectPropertiesSection = new WebInspector.ObjectPropertiesSec
tion(result, headerElement, this._linkifier); |
| 366 this._objectPresentationElement = this._objectPropertiesSection.elem
ent; | 371 this._objectPresentationElement = this._objectPropertiesSection.elem
ent; |
| 367 this._expandController.watchSection(/** @type {string} */ (this._exp
ression), this._objectPropertiesSection); | 372 this._expandController.watchSection(/** @type {string} */ (this._exp
ression), this._objectPropertiesSection); |
| 368 var objectTreeElement = this._objectPropertiesSection.objectTreeElem
ent(); | 373 var objectTreeElement = this._objectPropertiesSection.objectTreeElem
ent(); |
| 369 objectTreeElement.toggleOnClick = false; | 374 objectTreeElement.toggleOnClick = false; |
| 370 objectTreeElement.listItemElement.addEventListener("click", this._on
SectionClick.bind(this), false); | 375 objectTreeElement.listItemElement.addEventListener("click", this._on
SectionClick.bind(this), false); |
| 371 objectTreeElement.listItemElement.addEventListener("dblclick", this.
_dblClickOnWatchExpression.bind(this)); | 376 objectTreeElement.listItemElement.addEventListener("dblclick", this.
_dblClickOnWatchExpression.bind(this)); |
| 372 } else { | 377 } else { |
| 373 this._objectPresentationElement = headerElement; | 378 this._objectPresentationElement = headerElement; |
| 374 this._objectPresentationElement.addEventListener("dblclick", this._d
blClickOnWatchExpression.bind(this)); | 379 this._objectPresentationElement.addEventListener("dblclick", this._d
blClickOnWatchExpression.bind(this)); |
| 375 } | 380 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 contextMenu.appendApplicableItems(this._result); | 436 contextMenu.appendApplicableItems(this._result); |
| 432 }, | 437 }, |
| 433 | 438 |
| 434 _copyValueButtonClicked: function() | 439 _copyValueButtonClicked: function() |
| 435 { | 440 { |
| 436 InspectorFrontendHost.copyText(this._valueElement.textContent); | 441 InspectorFrontendHost.copyText(this._valueElement.textContent); |
| 437 }, | 442 }, |
| 438 | 443 |
| 439 __proto__: WebInspector.Object.prototype | 444 __proto__: WebInspector.Object.prototype |
| 440 } | 445 } |
| OLD | NEW |