Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/WatchExpressionsSidebarPane.js

Issue 2393763002: [DevTools] Cleanup DOMExtension.js. (Closed)
Patch Set: test Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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();
lushnikov 2016/10/05 16:03:59 that's bail-out early if there's no target if (!t
dgozman 2016/10/05 17:29:30 Done.
187 for (var watchExpression of this._watchExpressions) 188 for (var watchExpression of this._watchExpressions)
188 if (watchExpression.element().containsEventPoint(event)) 189 if (target && watchExpression.element().isSelfOrAncestor(target))
189 watchExpression._populateContextMenu(contextMenu, event); 190 watchExpression._populateContextMenu(contextMenu, event);
190 }, 191 },
191 192
192 _deleteAllButtonClicked: function() 193 _deleteAllButtonClicked: function()
193 { 194 {
194 this._watchExpressions = []; 195 this._watchExpressions = [];
195 this._saveExpressions(); 196 this._saveExpressions();
196 this.update(); 197 this.update();
197 }, 198 },
198 199
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 * @param {!Event} event 440 * @param {!Event} event
440 */ 441 */
441 _populateContextMenu: function(contextMenu, event) 442 _populateContextMenu: function(contextMenu, event)
442 { 443 {
443 if (!this.isEditing()) 444 if (!this.isEditing())
444 contextMenu.appendItem(WebInspector.UIString.capitalize("Delete ^wat ch ^expression"), this._updateExpression.bind(this, null)); 445 contextMenu.appendItem(WebInspector.UIString.capitalize("Delete ^wat ch ^expression"), this._updateExpression.bind(this, null));
445 446
446 if (!this.isEditing() && this._result && (this._result.type === "number" || this._result.type === "string")) 447 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)); 448 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^value "), this._copyValueButtonClicked.bind(this));
448 449
449 if (this._valueElement.containsEventPoint(event)) 450 var target = event.deepElementFromPoint();
451 if (target && this._valueElement.isSelfOrAncestor(target))
450 contextMenu.appendApplicableItems(this._result); 452 contextMenu.appendApplicableItems(this._result);
451 }, 453 },
452 454
453 _copyValueButtonClicked: function() 455 _copyValueButtonClicked: function()
454 { 456 {
455 InspectorFrontendHost.copyText(this._valueElement.textContent); 457 InspectorFrontendHost.copyText(this._valueElement.textContent);
456 }, 458 },
457 459
458 __proto__: WebInspector.Object.prototype 460 __proto__: WebInspector.Object.prototype
459 } 461 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698