| 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 { | 525 { |
| 526 if (!error) | 526 if (!error) |
| 527 InspectorFrontendHost.copyText(text); | 527 InspectorFrontendHost.copyText(text); |
| 528 if (callback) | 528 if (callback) |
| 529 callback(error ? null : text); | 529 callback(error ? null : text); |
| 530 } | 530 } |
| 531 this._agent.getOuterHTML(this.id, copy); | 531 this._agent.getOuterHTML(this.id, copy); |
| 532 }, | 532 }, |
| 533 | 533 |
| 534 /** | 534 /** |
| 535 * @param {string} objectGroupId | |
| 536 * @param {function(?Array.<!WebInspector.DOMModel.EventListener>)} callback | |
| 537 */ | |
| 538 eventListeners: function(objectGroupId, callback) | |
| 539 { | |
| 540 var domModel = this._domModel; | |
| 541 var debuggerModel = WebInspector.DebuggerModel.fromTarget(domModel.targe
t()); | |
| 542 if (!debuggerModel) { | |
| 543 callback(null); | |
| 544 return; | |
| 545 } | |
| 546 | |
| 547 /** | |
| 548 * @param {?Protocol.Error} error | |
| 549 * @param {!Array.<!DOMAgent.EventListener>} payloads | |
| 550 */ | |
| 551 function mycallback(error, payloads) | |
| 552 { | |
| 553 if (error) { | |
| 554 callback(null); | |
| 555 return; | |
| 556 } | |
| 557 callback(payloads.map(function(payload) { | |
| 558 return new WebInspector.DOMModel.EventListener(domModel, /** @ty
pe {!WebInspector.DebuggerModel} */ (debuggerModel), payload); | |
| 559 })); | |
| 560 } | |
| 561 this._agent.getEventListenersForNode(this.id, objectGroupId, mycallback)
; | |
| 562 }, | |
| 563 | |
| 564 /** | |
| 565 * @return {string} | 535 * @return {string} |
| 566 */ | 536 */ |
| 567 path: function() | 537 path: function() |
| 568 { | 538 { |
| 569 /** | 539 /** |
| 570 * @param {?WebInspector.DOMNode} node | 540 * @param {?WebInspector.DOMNode} node |
| 571 */ | 541 */ |
| 572 function canPush(node) | 542 function canPush(node) |
| 573 { | 543 { |
| 574 return node && ("index" in node || (node.isShadowRoot() && node.pare
ntNode)) && node._nodeName.length; | 544 return node && ("index" in node || (node.isShadowRoot() && node.pare
ntNode)) && node._nodeName.length; |
| (...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2049 * @param {!DOMAgent.NodeId} insertionPointId | 2019 * @param {!DOMAgent.NodeId} insertionPointId |
| 2050 * @param {!Array.<!DOMAgent.BackendNode>} distributedNodes | 2020 * @param {!Array.<!DOMAgent.BackendNode>} distributedNodes |
| 2051 */ | 2021 */ |
| 2052 distributedNodesUpdated: function(insertionPointId, distributedNodes) | 2022 distributedNodesUpdated: function(insertionPointId, distributedNodes) |
| 2053 { | 2023 { |
| 2054 this._domModel._distributedNodesUpdated(insertionPointId, distributedNod
es); | 2024 this._domModel._distributedNodesUpdated(insertionPointId, distributedNod
es); |
| 2055 } | 2025 } |
| 2056 } | 2026 } |
| 2057 | 2027 |
| 2058 /** | 2028 /** |
| 2059 * @constructor | |
| 2060 * @extends {WebInspector.SDKObject} | |
| 2061 * @param {!WebInspector.DOMModel} domModel | |
| 2062 * @param {!WebInspector.DebuggerModel} debuggerModel | |
| 2063 * @param {!DOMAgent.EventListener} payload | |
| 2064 */ | |
| 2065 WebInspector.DOMModel.EventListener = function(domModel, debuggerModel, payload) | |
| 2066 { | |
| 2067 WebInspector.SDKObject.call(this, domModel.target()); | |
| 2068 this._domModel = domModel; | |
| 2069 this._debuggerModel = debuggerModel; | |
| 2070 this._payload = payload; | |
| 2071 var script = debuggerModel.scriptForId(payload.location.scriptId); | |
| 2072 var sourceName = script ? script.contentURL() : ""; | |
| 2073 this._sourceName = sourceName; | |
| 2074 } | |
| 2075 | |
| 2076 WebInspector.DOMModel.EventListener.prototype = { | |
| 2077 /** | |
| 2078 * @return {!DOMAgent.EventListener} | |
| 2079 */ | |
| 2080 payload: function() | |
| 2081 { | |
| 2082 return this._payload; | |
| 2083 }, | |
| 2084 | |
| 2085 /** | |
| 2086 * @return {?WebInspector.DOMNode} | |
| 2087 */ | |
| 2088 node: function() | |
| 2089 { | |
| 2090 return this._domModel.nodeForId(this._payload.nodeId); | |
| 2091 }, | |
| 2092 | |
| 2093 /** | |
| 2094 * @return {!WebInspector.DebuggerModel.Location} | |
| 2095 */ | |
| 2096 location: function() | |
| 2097 { | |
| 2098 return WebInspector.DebuggerModel.Location.fromPayload(this._debuggerMod
el, this._payload.location); | |
| 2099 }, | |
| 2100 | |
| 2101 /** | |
| 2102 * @return {?WebInspector.RemoteObject} | |
| 2103 */ | |
| 2104 handler: function() | |
| 2105 { | |
| 2106 return this._payload.handler ? this.target().runtimeModel.createRemoteOb
ject(this._payload.handler) : null; | |
| 2107 }, | |
| 2108 | |
| 2109 /** | |
| 2110 * @return {string} | |
| 2111 */ | |
| 2112 sourceName: function() | |
| 2113 { | |
| 2114 return this._sourceName; | |
| 2115 }, | |
| 2116 | |
| 2117 __proto__: WebInspector.SDKObject.prototype | |
| 2118 } | |
| 2119 | |
| 2120 /** | |
| 2121 * @interface | 2029 * @interface |
| 2122 */ | 2030 */ |
| 2123 WebInspector.DOMNodeHighlighter = function() { | 2031 WebInspector.DOMNodeHighlighter = function() { |
| 2124 } | 2032 } |
| 2125 | 2033 |
| 2126 WebInspector.DOMNodeHighlighter.prototype = { | 2034 WebInspector.DOMNodeHighlighter.prototype = { |
| 2127 /** | 2035 /** |
| 2128 * @param {?WebInspector.DOMNode} node | 2036 * @param {?WebInspector.DOMNode} node |
| 2129 * @param {!DOMAgent.HighlightConfig} config | 2037 * @param {!DOMAgent.HighlightConfig} config |
| 2130 * @param {!DOMAgent.BackendNodeId=} backendNodeId | 2038 * @param {!DOMAgent.BackendNodeId=} backendNodeId |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2195 } | 2103 } |
| 2196 | 2104 |
| 2197 /** | 2105 /** |
| 2198 * @param {!WebInspector.Target} target | 2106 * @param {!WebInspector.Target} target |
| 2199 * @return {?WebInspector.DOMModel} | 2107 * @return {?WebInspector.DOMModel} |
| 2200 */ | 2108 */ |
| 2201 WebInspector.DOMModel.fromTarget = function(target) | 2109 WebInspector.DOMModel.fromTarget = function(target) |
| 2202 { | 2110 { |
| 2203 return /** @type {?WebInspector.DOMModel} */ (target.model(WebInspector.DOMM
odel)); | 2111 return /** @type {?WebInspector.DOMModel} */ (target.model(WebInspector.DOMM
odel)); |
| 2204 } | 2112 } |
| OLD | NEW |