| 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 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 this.selectDOMNode(node, true); | 1211 this.selectDOMNode(node, true); |
| 1212 }, | 1212 }, |
| 1213 | 1213 |
| 1214 /** | 1214 /** |
| 1215 * @param {!Event} event | 1215 * @param {!Event} event |
| 1216 * @param {!WebInspector.ContextMenu} contextMenu | 1216 * @param {!WebInspector.ContextMenu} contextMenu |
| 1217 * @param {!Object} object | 1217 * @param {!Object} object |
| 1218 */ | 1218 */ |
| 1219 appendApplicableItems: function(event, contextMenu, object) | 1219 appendApplicableItems: function(event, contextMenu, object) |
| 1220 { | 1220 { |
| 1221 var commandCallback; | 1221 if (!(object instanceof WebInspector.RemoteObject && (/** @type {!WebIns
pector.RemoteObject} */ (object)).isNode()) |
| 1222 if (object instanceof WebInspector.RemoteObject) { | 1222 && !(object instanceof WebInspector.DOMNode)) { |
| 1223 var remoteObject = /** @type {!WebInspector.RemoteObject} */ (object
); | 1223 return; |
| 1224 if (remoteObject.isNode()) | |
| 1225 commandCallback = remoteObject.reveal.bind(remoteObject); | |
| 1226 } else if (object instanceof WebInspector.DOMNode) { | |
| 1227 var domNode = /** @type {!WebInspector.DOMNode} */ (object); | |
| 1228 commandCallback = domNode.reveal.bind(domNode); | |
| 1229 } | 1224 } |
| 1230 if (!commandCallback) | |
| 1231 return; | |
| 1232 // Skip adding "Reveal..." menu item for our own tree outline. | 1225 // Skip adding "Reveal..." menu item for our own tree outline. |
| 1233 if (this.element.isAncestor(/** @type {!Node} */ (event.target))) | 1226 if (this.element.isAncestor(/** @type {!Node} */ (event.target))) |
| 1234 return; | 1227 return; |
| 1228 var commandCallback = WebInspector.Revealer.reveal.bind(WebInspector.Rev
ealer, object); |
| 1235 contextMenu.appendItem(WebInspector.useLowerCaseMenuTitles() ? "Reveal i
n Elements panel" : "Reveal in Elements Panel", commandCallback); | 1229 contextMenu.appendItem(WebInspector.useLowerCaseMenuTitles() ? "Reveal i
n Elements panel" : "Reveal in Elements Panel", commandCallback); |
| 1236 }, | 1230 }, |
| 1237 | 1231 |
| 1238 _sidebarContextMenuEventFired: function(event) | 1232 _sidebarContextMenuEventFired: function(event) |
| 1239 { | 1233 { |
| 1240 var contextMenu = new WebInspector.ContextMenu(event); | 1234 var contextMenu = new WebInspector.ContextMenu(event); |
| 1241 contextMenu.show(); | 1235 contextMenu.show(); |
| 1242 }, | 1236 }, |
| 1243 | 1237 |
| 1244 _dockSideChanged: function() | 1238 _dockSideChanged: function() |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1453 remoteObject.pushNodeToFrontend(selectNode.bind(null, remoteObje
ct)); | 1447 remoteObject.pushNodeToFrontend(selectNode.bind(null, remoteObje
ct)); |
| 1454 } | 1448 } |
| 1455 | 1449 |
| 1456 /** | 1450 /** |
| 1457 * @param {?WebInspector.RemoteObject} remoteObject | 1451 * @param {?WebInspector.RemoteObject} remoteObject |
| 1458 * @param {?WebInspector.DOMNode} node | 1452 * @param {?WebInspector.DOMNode} node |
| 1459 */ | 1453 */ |
| 1460 function selectNode(remoteObject, node) | 1454 function selectNode(remoteObject, node) |
| 1461 { | 1455 { |
| 1462 if (node) { | 1456 if (node) { |
| 1463 node.reveal(); | 1457 WebInspector.Revealer.reveal(node); |
| 1464 return; | 1458 return; |
| 1465 } | 1459 } |
| 1466 if (!remoteObject || remoteObject.description !== "#text" || !remote
Object.isNode()) | 1460 if (!remoteObject || remoteObject.description !== "#text" || !remote
Object.isNode()) |
| 1467 return; | 1461 return; |
| 1468 remoteObject.callFunction(parentElement, undefined, revealElement); | 1462 remoteObject.callFunction(parentElement, undefined, revealElement); |
| 1469 } | 1463 } |
| 1470 | 1464 |
| 1471 /** | 1465 /** |
| 1472 * @suppressReceiverCheck | 1466 * @suppressReceiverCheck |
| 1473 * @this {Element} | 1467 * @this {Element} |
| 1474 */ | 1468 */ |
| 1475 function parentElement() | 1469 function parentElement() |
| 1476 { | 1470 { |
| 1477 return this.parentElement; | 1471 return this.parentElement; |
| 1478 } | 1472 } |
| 1479 } | 1473 } |
| 1480 } | 1474 } |
| OLD | NEW |