Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1326 var attribute = event.target.enclosingNodeOrSelfWithClass("webkit-html-a ttribute"); | 1326 var attribute = event.target.enclosingNodeOrSelfWithClass("webkit-html-a ttribute"); |
| 1327 var newAttribute = event.target.enclosingNodeOrSelfWithClass("add-attrib ute"); | 1327 var newAttribute = event.target.enclosingNodeOrSelfWithClass("add-attrib ute"); |
| 1328 if (attribute && !newAttribute) | 1328 if (attribute && !newAttribute) |
| 1329 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCa seMenuTitles() ? "Edit attribute" : "Edit Attribute"), this._startEditingAttribu te.bind(this, attribute, event.target)); | 1329 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCa seMenuTitles() ? "Edit attribute" : "Edit Attribute"), this._startEditingAttribu te.bind(this, attribute, event.target)); |
| 1330 contextMenu.appendSeparator(); | 1330 contextMenu.appendSeparator(); |
| 1331 if (this.treeOutline._setPseudoClassCallback) { | 1331 if (this.treeOutline._setPseudoClassCallback) { |
| 1332 var pseudoSubMenu = contextMenu.appendSubMenuItem(WebInspector.UIStr ing(WebInspector.useLowerCaseMenuTitles() ? "Force element state" : "Force Eleme nt State")); | 1332 var pseudoSubMenu = contextMenu.appendSubMenuItem(WebInspector.UIStr ing(WebInspector.useLowerCaseMenuTitles() ? "Force element state" : "Force Eleme nt State")); |
| 1333 this._populateForcedPseudoStateItems(pseudoSubMenu); | 1333 this._populateForcedPseudoStateItems(pseudoSubMenu); |
| 1334 contextMenu.appendSeparator(); | 1334 contextMenu.appendSeparator(); |
| 1335 } | 1335 } |
| 1336 | |
| 1337 this._populateNodeContextMenu(contextMenu); | 1336 this._populateNodeContextMenu(contextMenu); |
| 1338 this.treeOutline._populateContextMenu(contextMenu, this._node); | 1337 this.treeOutline._populateContextMenu(contextMenu, this._node); |
| 1339 this._populateScrollIntoView(contextMenu); | 1338 this._populateScrollIntoView(contextMenu); |
| 1340 }, | 1339 }, |
| 1341 | 1340 |
| 1342 /** | 1341 /** |
| 1343 * @param {WebInspector.ContextMenu} contextMenu | 1342 * @param {WebInspector.ContextMenu} contextMenu |
| 1344 */ | 1343 */ |
| 1345 _populateScrollIntoView: function(contextMenu) | 1344 _populateScrollIntoView: function(contextMenu) |
| 1346 { | 1345 { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 1364 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Edit text" : "Edit Text"), this._startEditingTextNode.bind(this, t extNode)); | 1363 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Edit text" : "Edit Text"), this._startEditingTextNode.bind(this, t extNode)); |
| 1365 this._populateNodeContextMenu(contextMenu); | 1364 this._populateNodeContextMenu(contextMenu); |
| 1366 }, | 1365 }, |
| 1367 | 1366 |
| 1368 _populateNodeContextMenu: function(contextMenu) | 1367 _populateNodeContextMenu: function(contextMenu) |
| 1369 { | 1368 { |
| 1370 // Add free-form node-related actions. | 1369 // Add free-form node-related actions. |
| 1371 var openTagElement = this.treeOutline.getCachedTreeElement(this.represen tedObject) || this; | 1370 var openTagElement = this.treeOutline.getCachedTreeElement(this.represen tedObject) || this; |
| 1372 contextMenu.appendItem(WebInspector.UIString("Edit as HTML"), openTagEle ment._editAsHTML.bind(openTagElement)); | 1371 contextMenu.appendItem(WebInspector.UIString("Edit as HTML"), openTagEle ment._editAsHTML.bind(openTagElement)); |
| 1373 contextMenu.appendItem(WebInspector.UIString("Copy as HTML"), this._copy HTML.bind(this)); | 1372 contextMenu.appendItem(WebInspector.UIString("Copy as HTML"), this._copy HTML.bind(this)); |
| 1373 | |
| 1374 // Place it here so that all "Copy"-ing items stick together. | |
| 1375 if (this.representedObject.nodeType() === Node.ELEMENT_NODE) | |
| 1376 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCa seMenuTitles() ? "Copy CSS path" : "Copy CSS Path"), this._copyCSSPath.bind(this )); | |
| 1374 contextMenu.appendItem(WebInspector.UIString("Copy XPath"), this._copyXP ath.bind(this)); | 1377 contextMenu.appendItem(WebInspector.UIString("Copy XPath"), this._copyXP ath.bind(this)); |
| 1375 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Delete node" : "Delete Node"), this.remove.bind(this)); | 1378 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Delete node" : "Delete Node"), this.remove.bind(this)); |
| 1376 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Inspect DOM properties" : "Inspect DOM Properties"), this._inspect DOMProperties.bind(this)); | 1379 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Inspect DOM properties" : "Inspect DOM Properties"), this._inspect DOMProperties.bind(this)); |
| 1377 }, | 1380 }, |
| 1378 | 1381 |
| 1379 _startEditing: function() | 1382 _startEditing: function() |
| 1380 { | 1383 { |
| 1381 if (this.treeOutline.selectedDOMNode() !== this._node) | 1384 if (this.treeOutline.selectedDOMNode() !== this._node) |
| 1382 return; | 1385 return; |
| 1383 | 1386 |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2187 } | 2190 } |
| 2188 | 2191 |
| 2189 node.getOuterHTML(this._startEditingAsHTML.bind(this, commitChange)); | 2192 node.getOuterHTML(this._startEditingAsHTML.bind(this, commitChange)); |
| 2190 }, | 2193 }, |
| 2191 | 2194 |
| 2192 _copyHTML: function() | 2195 _copyHTML: function() |
| 2193 { | 2196 { |
| 2194 this._node.copyNode(); | 2197 this._node.copyNode(); |
| 2195 }, | 2198 }, |
| 2196 | 2199 |
| 2200 _copyCSSPath: function() | |
| 2201 { | |
| 2202 this._node.copyCSSPath(true); | |
|
pfeldman
2013/11/20 14:08:48
Why aren't we using this when creating new rules?
apavlov
2013/11/20 14:23:19
An excellent idea!
| |
| 2203 }, | |
| 2204 | |
| 2197 _copyXPath: function() | 2205 _copyXPath: function() |
| 2198 { | 2206 { |
| 2199 this._node.copyXPath(true); | 2207 this._node.copyXPath(true); |
| 2200 }, | 2208 }, |
| 2201 | 2209 |
| 2202 _inspectDOMProperties: function() | 2210 _inspectDOMProperties: function() |
| 2203 { | 2211 { |
| 2204 WebInspector.RemoteObject.resolveNode(this._node, "console", callback); | 2212 WebInspector.RemoteObject.resolveNode(this._node, "console", callback); |
| 2205 | 2213 |
| 2206 /** | 2214 /** |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2460 * @constructor | 2468 * @constructor |
| 2461 * @param {boolean} isUpdated | 2469 * @param {boolean} isUpdated |
| 2462 * @param {WebInspector.DOMNode=} parent | 2470 * @param {WebInspector.DOMNode=} parent |
| 2463 */ | 2471 */ |
| 2464 WebInspector.ElementsTreeUpdater.UpdateEntry = function(isUpdated, parent) | 2472 WebInspector.ElementsTreeUpdater.UpdateEntry = function(isUpdated, parent) |
| 2465 { | 2473 { |
| 2466 this.isUpdated = isUpdated; | 2474 this.isUpdated = isUpdated; |
| 2467 if (parent) | 2475 if (parent) |
| 2468 this.parent = parent; | 2476 this.parent = parent; |
| 2469 } | 2477 } |
| OLD | NEW |