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 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2177 } | 2180 } |
2178 | 2181 |
2179 node.getOuterHTML(this._startEditingAsHTML.bind(this, commitChange)); | 2182 node.getOuterHTML(this._startEditingAsHTML.bind(this, commitChange)); |
2180 }, | 2183 }, |
2181 | 2184 |
2182 _copyHTML: function() | 2185 _copyHTML: function() |
2183 { | 2186 { |
2184 this._node.copyNode(); | 2187 this._node.copyNode(); |
2185 }, | 2188 }, |
2186 | 2189 |
| 2190 _copyCSSPath: function() |
| 2191 { |
| 2192 this._node.copyCSSPath(true); |
| 2193 }, |
| 2194 |
2187 _copyXPath: function() | 2195 _copyXPath: function() |
2188 { | 2196 { |
2189 this._node.copyXPath(true); | 2197 this._node.copyXPath(true); |
2190 }, | 2198 }, |
2191 | 2199 |
2192 _inspectDOMProperties: function() | 2200 _inspectDOMProperties: function() |
2193 { | 2201 { |
2194 WebInspector.RemoteObject.resolveNode(this._node, "console", callback); | 2202 WebInspector.RemoteObject.resolveNode(this._node, "console", callback); |
2195 | 2203 |
2196 /** | 2204 /** |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2450 * @constructor | 2458 * @constructor |
2451 * @param {boolean} isUpdated | 2459 * @param {boolean} isUpdated |
2452 * @param {WebInspector.DOMNode=} parent | 2460 * @param {WebInspector.DOMNode=} parent |
2453 */ | 2461 */ |
2454 WebInspector.ElementsTreeUpdater.UpdateEntry = function(isUpdated, parent) | 2462 WebInspector.ElementsTreeUpdater.UpdateEntry = function(isUpdated, parent) |
2455 { | 2463 { |
2456 this.isUpdated = isUpdated; | 2464 this.isUpdated = isUpdated; |
2457 if (parent) | 2465 if (parent) |
2458 this.parent = parent; | 2466 this.parent = parent; |
2459 } | 2467 } |
OLD | NEW |