OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. |
3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 /** | 32 /** |
33 * @constructor | 33 * @constructor |
34 * @extends {WebInspector.TargetAware} | 34 * @extends {WebInspector.TargetAware} |
35 * @param {!WebInspector.DOMModel} domModel | 35 * @param {!WebInspector.DOMModel} domModel |
36 * @param {?WebInspector.DOMDocument} doc | 36 * @param {?WebInspector.DOMDocument} doc |
37 * @param {boolean} isInShadowTree | 37 * @param {boolean} isInShadowTree |
38 * @param {!DOMAgent.Node} payload | 38 * @param {!DOMAgent.Node} payload |
39 */ | 39 */ |
40 WebInspector.DOMNode = function(domModel, doc, isInShadowTree, payload) { | 40 WebInspector.DOMNode = function(domModel, doc, isInShadowTree, payload) { |
41 WebInspector.TargetAware.call(this, domModel._target); | 41 WebInspector.TargetAware.call(this, domModel.target()); |
42 this._domModel = domModel; | 42 this._domModel = domModel; |
43 this._agent = domModel._agent; | 43 this._agent = domModel._agent; |
44 this.ownerDocument = doc; | 44 this.ownerDocument = doc; |
45 this._isInShadowTree = isInShadowTree; | 45 this._isInShadowTree = isInShadowTree; |
46 | 46 |
47 this.id = payload.nodeId; | 47 this.id = payload.nodeId; |
48 domModel._idToDOMNode[this.id] = this; | 48 domModel._idToDOMNode[this.id] = this; |
49 this._nodeType = payload.nodeType; | 49 this._nodeType = payload.nodeType; |
50 this._nodeName = payload.nodeName; | 50 this._nodeName = payload.nodeName; |
51 this._localName = payload.localName; | 51 this._localName = payload.localName; |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 function copy(error, text) | 461 function copy(error, text) |
462 { | 462 { |
463 if (!error) | 463 if (!error) |
464 InspectorFrontendHost.copyText(text); | 464 InspectorFrontendHost.copyText(text); |
465 } | 465 } |
466 this._agent.getOuterHTML(this.id, copy); | 466 this._agent.getOuterHTML(this.id, copy); |
467 }, | 467 }, |
468 | 468 |
469 /** | 469 /** |
470 * @param {string} objectGroupId | 470 * @param {string} objectGroupId |
471 * @param {function(?Protocol.Error, !Array.<!DOMAgent.EventListener>)=} cal
lback | 471 * @param {function(?Array.<!WebInspector.DOMModel.EventListener>)} callback |
472 */ | 472 */ |
473 eventListeners: function(objectGroupId, callback) | 473 eventListeners: function(objectGroupId, callback) |
474 { | 474 { |
475 this._agent.getEventListenersForNode(this.id, objectGroupId, callback); | 475 var target = this.target(); |
| 476 |
| 477 /** |
| 478 * @param {?Protocol.Error} error |
| 479 * @param {!Array.<!DOMAgent.EventListener>} payloads |
| 480 */ |
| 481 function mycallback(error, payloads) |
| 482 { |
| 483 if (error) { |
| 484 callback(null); |
| 485 return; |
| 486 } |
| 487 callback(payloads.map(function(payload) { |
| 488 return new WebInspector.DOMModel.EventListener(target, payload); |
| 489 })); |
| 490 } |
| 491 this._agent.getEventListenersForNode(this.id, objectGroupId, mycallback)
; |
476 }, | 492 }, |
477 | 493 |
478 /** | 494 /** |
479 * @return {string} | 495 * @return {string} |
480 */ | 496 */ |
481 path: function() | 497 path: function() |
482 { | 498 { |
483 /** | 499 /** |
484 * @param {?WebInspector.DOMNode} node | 500 * @param {?WebInspector.DOMNode} node |
485 */ | 501 */ |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 this.baseURL = payload.baseURL || ""; | 869 this.baseURL = payload.baseURL || ""; |
854 this.xmlVersion = payload.xmlVersion; | 870 this.xmlVersion = payload.xmlVersion; |
855 this._listeners = {}; | 871 this._listeners = {}; |
856 } | 872 } |
857 | 873 |
858 WebInspector.DOMDocument.prototype = { | 874 WebInspector.DOMDocument.prototype = { |
859 __proto__: WebInspector.DOMNode.prototype | 875 __proto__: WebInspector.DOMNode.prototype |
860 } | 876 } |
861 | 877 |
862 /** | 878 /** |
863 * @extends {WebInspector.Object} | |
864 * @constructor | 879 * @constructor |
| 880 * @extends {WebInspector.TargetAwareObject} |
865 * @param {!WebInspector.Target} target | 881 * @param {!WebInspector.Target} target |
866 */ | 882 */ |
867 WebInspector.DOMModel = function(target) { | 883 WebInspector.DOMModel = function(target) { |
868 this._target = target; | 884 WebInspector.TargetAwareObject.call(this, target); |
| 885 |
869 this._agent = target.domAgent(); | 886 this._agent = target.domAgent(); |
870 | 887 |
871 /** @type {!Object.<number, !WebInspector.DOMNode>} */ | 888 /** @type {!Object.<number, !WebInspector.DOMNode>} */ |
872 this._idToDOMNode = {}; | 889 this._idToDOMNode = {}; |
873 /** @type {?WebInspector.DOMDocument} */ | 890 /** @type {?WebInspector.DOMDocument} */ |
874 this._document = null; | 891 this._document = null; |
875 /** @type {!Object.<number, boolean>} */ | 892 /** @type {!Object.<number, boolean>} */ |
876 this._attributeLoadNodeIds = {}; | 893 this._attributeLoadNodeIds = {}; |
877 InspectorBackend.registerDOMDispatcher(new WebInspector.DOMDispatcher(this))
; | 894 InspectorBackend.registerDOMDispatcher(new WebInspector.DOMDispatcher(this))
; |
878 | 895 |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 }, | 1561 }, |
1545 | 1562 |
1546 /** | 1563 /** |
1547 * @param {?WebInspector.DOMNodeHighlighter} highlighter | 1564 * @param {?WebInspector.DOMNodeHighlighter} highlighter |
1548 */ | 1565 */ |
1549 setHighlighter: function(highlighter) | 1566 setHighlighter: function(highlighter) |
1550 { | 1567 { |
1551 this._highlighter = highlighter || this._defaultHighlighter; | 1568 this._highlighter = highlighter || this._defaultHighlighter; |
1552 }, | 1569 }, |
1553 | 1570 |
1554 __proto__: WebInspector.Object.prototype | 1571 __proto__: WebInspector.TargetAwareObject.prototype |
1555 } | 1572 } |
1556 | 1573 |
1557 /** | 1574 /** |
1558 * @constructor | 1575 * @constructor |
1559 * @implements {DOMAgent.Dispatcher} | 1576 * @implements {DOMAgent.Dispatcher} |
1560 * @param {!WebInspector.DOMModel} domModel | 1577 * @param {!WebInspector.DOMModel} domModel |
1561 */ | 1578 */ |
1562 WebInspector.DOMDispatcher = function(domModel) | 1579 WebInspector.DOMDispatcher = function(domModel) |
1563 { | 1580 { |
1564 this._domModel = domModel; | 1581 this._domModel = domModel; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 * @param {!DOMAgent.NodeId} parentId | 1699 * @param {!DOMAgent.NodeId} parentId |
1683 * @param {!DOMAgent.NodeId} pseudoElementId | 1700 * @param {!DOMAgent.NodeId} pseudoElementId |
1684 */ | 1701 */ |
1685 pseudoElementRemoved: function(parentId, pseudoElementId) | 1702 pseudoElementRemoved: function(parentId, pseudoElementId) |
1686 { | 1703 { |
1687 this._domModel._pseudoElementRemoved(parentId, pseudoElementId); | 1704 this._domModel._pseudoElementRemoved(parentId, pseudoElementId); |
1688 } | 1705 } |
1689 } | 1706 } |
1690 | 1707 |
1691 /** | 1708 /** |
| 1709 * @constructor |
| 1710 * @extends {WebInspector.TargetAware} |
| 1711 * @param {!WebInspector.Target} target |
| 1712 * @param {!DOMAgent.EventListener} payload |
| 1713 */ |
| 1714 WebInspector.DOMModel.EventListener = function(target, payload) |
| 1715 { |
| 1716 WebInspector.TargetAware.call(this, target); |
| 1717 this._payload = payload; |
| 1718 } |
| 1719 |
| 1720 WebInspector.DOMModel.EventListener.prototype = { |
| 1721 /** |
| 1722 * @return {!DOMAgent.EventListener} |
| 1723 */ |
| 1724 payload: function() |
| 1725 { |
| 1726 return this._payload; |
| 1727 }, |
| 1728 |
| 1729 /** |
| 1730 * @return {?WebInspector.DOMNode} |
| 1731 */ |
| 1732 node: function() |
| 1733 { |
| 1734 return this.target().domModel.nodeForId(this._payload.nodeId); |
| 1735 }, |
| 1736 |
| 1737 /** |
| 1738 * @return {!WebInspector.DebuggerModel.Location} |
| 1739 */ |
| 1740 location: function() |
| 1741 { |
| 1742 return WebInspector.DebuggerModel.Location.fromPayload(this.target(), th
is._payload.location); |
| 1743 }, |
| 1744 |
| 1745 /** |
| 1746 * @return {?WebInspector.RemoteObject} |
| 1747 */ |
| 1748 handler: function() |
| 1749 { |
| 1750 return this._payload.handler ? this.target().runtimeModel.createRemoteOb
ject(this._payload.handler) : null; |
| 1751 }, |
| 1752 |
| 1753 __proto__: WebInspector.TargetAware.prototype |
| 1754 } |
| 1755 |
| 1756 /** |
1692 * @interface | 1757 * @interface |
1693 */ | 1758 */ |
1694 WebInspector.DOMNodeHighlighter = function() { | 1759 WebInspector.DOMNodeHighlighter = function() { |
1695 } | 1760 } |
1696 | 1761 |
1697 WebInspector.DOMNodeHighlighter.prototype = { | 1762 WebInspector.DOMNodeHighlighter.prototype = { |
1698 /** | 1763 /** |
1699 * @param {!DOMAgent.NodeId} nodeId | 1764 * @param {!DOMAgent.NodeId} nodeId |
1700 * @param {!DOMAgent.HighlightConfig} config | 1765 * @param {!DOMAgent.HighlightConfig} config |
1701 * @param {!RuntimeAgent.RemoteObjectId=} objectId | 1766 * @param {!RuntimeAgent.RemoteObjectId=} objectId |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1744 setInspectModeEnabled: function(enabled, inspectUAShadowDOM, config, callbac
k) | 1809 setInspectModeEnabled: function(enabled, inspectUAShadowDOM, config, callbac
k) |
1745 { | 1810 { |
1746 this._agent.setInspectModeEnabled(enabled, inspectUAShadowDOM, config, c
allback); | 1811 this._agent.setInspectModeEnabled(enabled, inspectUAShadowDOM, config, c
allback); |
1747 } | 1812 } |
1748 } | 1813 } |
1749 | 1814 |
1750 /** | 1815 /** |
1751 * @type {!WebInspector.DOMModel} | 1816 * @type {!WebInspector.DOMModel} |
1752 */ | 1817 */ |
1753 WebInspector.domModel; | 1818 WebInspector.domModel; |
OLD | NEW |