| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 var isEditing = false; | 177 var isEditing = false; |
| 178 for (var watchExpression of this._watchExpressions) | 178 for (var watchExpression of this._watchExpressions) |
| 179 isEditing |= watchExpression.isEditing(); | 179 isEditing |= watchExpression.isEditing(); |
| 180 | 180 |
| 181 if (!isEditing) | 181 if (!isEditing) |
| 182 contextMenu.appendItem(WebInspector.UIString.capitalize("Add ^watch
^expression"), this._addButtonClicked.bind(this)); | 182 contextMenu.appendItem(WebInspector.UIString.capitalize("Add ^watch
^expression"), this._addButtonClicked.bind(this)); |
| 183 | 183 |
| 184 if (this._watchExpressions.length > 1) | 184 if (this._watchExpressions.length > 1) |
| 185 contextMenu.appendItem(WebInspector.UIString.capitalize("Delete ^all
^watch ^expressions"), this._deleteAllButtonClicked.bind(this)); | 185 contextMenu.appendItem(WebInspector.UIString.capitalize("Delete ^all
^watch ^expressions"), this._deleteAllButtonClicked.bind(this)); |
| 186 | 186 |
| 187 var target = event.deepElementFromPoint(); |
| 188 if (!target) |
| 189 return; |
| 187 for (var watchExpression of this._watchExpressions) | 190 for (var watchExpression of this._watchExpressions) |
| 188 if (watchExpression.element().containsEventPoint(event)) | 191 if (watchExpression.element().isSelfOrAncestor(target)) |
| 189 watchExpression._populateContextMenu(contextMenu, event); | 192 watchExpression._populateContextMenu(contextMenu, event); |
| 190 }, | 193 }, |
| 191 | 194 |
| 192 _deleteAllButtonClicked: function() | 195 _deleteAllButtonClicked: function() |
| 193 { | 196 { |
| 194 this._watchExpressions = []; | 197 this._watchExpressions = []; |
| 195 this._saveExpressions(); | 198 this._saveExpressions(); |
| 196 this.update(); | 199 this.update(); |
| 197 }, | 200 }, |
| 198 | 201 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 * @param {!Event} event | 442 * @param {!Event} event |
| 440 */ | 443 */ |
| 441 _populateContextMenu: function(contextMenu, event) | 444 _populateContextMenu: function(contextMenu, event) |
| 442 { | 445 { |
| 443 if (!this.isEditing()) | 446 if (!this.isEditing()) |
| 444 contextMenu.appendItem(WebInspector.UIString.capitalize("Delete ^wat
ch ^expression"), this._updateExpression.bind(this, null)); | 447 contextMenu.appendItem(WebInspector.UIString.capitalize("Delete ^wat
ch ^expression"), this._updateExpression.bind(this, null)); |
| 445 | 448 |
| 446 if (!this.isEditing() && this._result && (this._result.type === "number"
|| this._result.type === "string")) | 449 if (!this.isEditing() && this._result && (this._result.type === "number"
|| this._result.type === "string")) |
| 447 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^value
"), this._copyValueButtonClicked.bind(this)); | 450 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^value
"), this._copyValueButtonClicked.bind(this)); |
| 448 | 451 |
| 449 if (this._valueElement.containsEventPoint(event)) | 452 var target = event.deepElementFromPoint(); |
| 453 if (target && this._valueElement.isSelfOrAncestor(target)) |
| 450 contextMenu.appendApplicableItems(this._result); | 454 contextMenu.appendApplicableItems(this._result); |
| 451 }, | 455 }, |
| 452 | 456 |
| 453 _copyValueButtonClicked: function() | 457 _copyValueButtonClicked: function() |
| 454 { | 458 { |
| 455 InspectorFrontendHost.copyText(this._valueElement.textContent); | 459 InspectorFrontendHost.copyText(this._valueElement.textContent); |
| 456 }, | 460 }, |
| 457 | 461 |
| 458 __proto__: WebInspector.Object.prototype | 462 __proto__: WebInspector.Object.prototype |
| 459 } | 463 } |
| OLD | NEW |