| 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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 535 * @param {string} objectGroupId |
| 536 * @param {function(?Array.<!WebInspector.DOMModel.EventListener>)} callback | 536 * @param {function(?Array.<!WebInspector.DOMModel.DOMEventListener>)} callb
ack |
| 537 */ | 537 */ |
| 538 eventListeners: function(objectGroupId, callback) | 538 eventListeners: function(objectGroupId, callback) |
| 539 { | 539 { |
| 540 var target = this.target(); | 540 var target = this.target(); |
| 541 | 541 |
| 542 /** | 542 /** |
| 543 * @param {?Protocol.Error} error | 543 * @param {?Protocol.Error} error |
| 544 * @param {!Array.<!DOMAgent.EventListener>} payloads | 544 * @param {!Array.<!DOMAgent.EventListener>} payloads |
| 545 */ | 545 */ |
| 546 function mycallback(error, payloads) | 546 function mycallback(error, payloads) |
| 547 { | 547 { |
| 548 if (error) { | 548 if (error) { |
| 549 callback(null); | 549 callback(null); |
| 550 return; | 550 return; |
| 551 } | 551 } |
| 552 callback(payloads.map(function(payload) { | 552 callback(payloads.map(function(payload) { |
| 553 return new WebInspector.DOMModel.EventListener(target, payload); | 553 return new WebInspector.DOMModel.DOMEventListener(target, payloa
d); |
| 554 })); | 554 })); |
| 555 } | 555 } |
| 556 this._agent.getEventListenersForNode(this.id, objectGroupId, mycallback)
; | 556 this._agent.getEventListenersForNode(this.id, objectGroupId, mycallback)
; |
| 557 }, | 557 }, |
| 558 | 558 |
| 559 /** | 559 /** |
| 560 * @return {string} | 560 * @return {string} |
| 561 */ | 561 */ |
| 562 path: function() | 562 path: function() |
| 563 { | 563 { |
| (...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2017 * @param {!Array.<!DOMAgent.BackendNode>} distributedNodes | 2017 * @param {!Array.<!DOMAgent.BackendNode>} distributedNodes |
| 2018 */ | 2018 */ |
| 2019 distributedNodesUpdated: function(insertionPointId, distributedNodes) | 2019 distributedNodesUpdated: function(insertionPointId, distributedNodes) |
| 2020 { | 2020 { |
| 2021 this._domModel._distributedNodesUpdated(insertionPointId, distributedNod
es); | 2021 this._domModel._distributedNodesUpdated(insertionPointId, distributedNod
es); |
| 2022 } | 2022 } |
| 2023 } | 2023 } |
| 2024 | 2024 |
| 2025 /** | 2025 /** |
| 2026 * @constructor | 2026 * @constructor |
| 2027 * @extends {WebInspector.SDKObject} | 2027 * @extends {WebInspector.EventListener<DOMAgent.EventListener>} |
| 2028 * @param {!WebInspector.Target} target | 2028 * @param {!WebInspector.Target} target |
| 2029 * @param {!DOMAgent.EventListener} payload | 2029 * @param {!DOMAgent.EventListener} payload |
| 2030 */ | 2030 */ |
| 2031 WebInspector.DOMModel.EventListener = function(target, payload) | 2031 WebInspector.DOMModel.DOMEventListener = function(target, payload) |
| 2032 { | 2032 { |
| 2033 WebInspector.SDKObject.call(this, target); | 2033 WebInspector.EventListener.call(this, target, payload); |
| 2034 this._payload = payload; | |
| 2035 var script = target.debuggerModel.scriptForId(payload.location.scriptId); | |
| 2036 var sourceName = script ? script.contentURL() : ""; | |
| 2037 this._sourceName = sourceName; | |
| 2038 } | 2034 } |
| 2039 | 2035 |
| 2040 WebInspector.DOMModel.EventListener.prototype = { | 2036 WebInspector.DOMModel.DOMEventListener.prototype = { |
| 2041 /** | 2037 /** |
| 2042 * @return {!DOMAgent.EventListener} | 2038 * @override |
| 2039 * @return {boolean} |
| 2043 */ | 2040 */ |
| 2044 payload: function() | 2041 isDOMEventListener: function() |
| 2045 { | 2042 { |
| 2046 return this._payload; | 2043 return true; |
| 2044 }, |
| 2045 |
| 2046 /** |
| 2047 * @return {number} |
| 2048 */ |
| 2049 nodeId: function() |
| 2050 { |
| 2051 return this._payload.nodeId; |
| 2047 }, | 2052 }, |
| 2048 | 2053 |
| 2049 /** | 2054 /** |
| 2050 * @return {?WebInspector.DOMNode} | 2055 * @return {?WebInspector.DOMNode} |
| 2051 */ | 2056 */ |
| 2052 node: function() | 2057 node: function() |
| 2053 { | 2058 { |
| 2054 return this.target().domModel.nodeForId(this._payload.nodeId); | 2059 return this.target().domModel.nodeForId(this.nodeId()); |
| 2055 }, | 2060 }, |
| 2056 | 2061 |
| 2057 /** | 2062 /** |
| 2058 * @return {!WebInspector.DebuggerModel.Location} | 2063 * @override |
| 2064 * @param {function(!Array<!WebInspector.RemoteObjectProperty>)} callback |
| 2065 * @param {string} objectGroupName |
| 2059 */ | 2066 */ |
| 2060 location: function() | 2067 getProperties: function(callback, objectGroupName) |
| 2061 { | 2068 { |
| 2062 return WebInspector.DebuggerModel.Location.fromPayload(this.target(), th
is._payload.location); | 2069 /** |
| 2070 * @this {WebInspector.DOMModel.DOMEventListener} |
| 2071 * @param {?WebInspector.RemoteObject} nodeObject |
| 2072 */ |
| 2073 function getPropertiesWithNodeObject(nodeObject) |
| 2074 { |
| 2075 /** |
| 2076 * @this {WebInspector.DOMModel.DOMEventListener} |
| 2077 * @param {!Array<!WebInspector.RemoteObjectProperty>} properties |
| 2078 */ |
| 2079 function mycallback(properties) |
| 2080 { |
| 2081 var runtimeModel = this.target().runtimeModel; |
| 2082 properties.push(runtimeModel.createRemotePropertyFromPrimitiveVa
lue("attachment", this._payload.isAttribute ? "attribute" : "script")); |
| 2083 if (nodeObject) |
| 2084 properties.push(new WebInspector.RemoteObjectProperty("node"
, nodeObject)); |
| 2085 callback(properties); |
| 2086 } |
| 2087 WebInspector.EventListener.prototype.getProperties.call(this, mycall
back.bind(this), objectGroupName); |
| 2088 } |
| 2089 this.node().resolveToObject(objectGroupName, getPropertiesWithNodeObject
.bind(this)); |
| 2063 }, | 2090 }, |
| 2064 | 2091 |
| 2065 /** | 2092 __proto__: WebInspector.EventListener.prototype |
| 2066 * @return {?WebInspector.RemoteObject} | |
| 2067 */ | |
| 2068 handler: function() | |
| 2069 { | |
| 2070 return this._payload.handler ? this.target().runtimeModel.createRemoteOb
ject(this._payload.handler) : null; | |
| 2071 }, | |
| 2072 | |
| 2073 /** | |
| 2074 * @return {string} | |
| 2075 */ | |
| 2076 sourceName: function() | |
| 2077 { | |
| 2078 return this._sourceName; | |
| 2079 }, | |
| 2080 | |
| 2081 __proto__: WebInspector.SDKObject.prototype | |
| 2082 } | 2093 } |
| 2083 | 2094 |
| 2084 /** | 2095 /** |
| 2085 * @interface | 2096 * @interface |
| 2086 */ | 2097 */ |
| 2087 WebInspector.DOMNodeHighlighter = function() { | 2098 WebInspector.DOMNodeHighlighter = function() { |
| 2088 } | 2099 } |
| 2089 | 2100 |
| 2090 WebInspector.DOMNodeHighlighter.prototype = { | 2101 WebInspector.DOMNodeHighlighter.prototype = { |
| 2091 /** | 2102 /** |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2150 | 2161 |
| 2151 /** | 2162 /** |
| 2152 * @override | 2163 * @override |
| 2153 * @param {!PageAgent.FrameId} frameId | 2164 * @param {!PageAgent.FrameId} frameId |
| 2154 */ | 2165 */ |
| 2155 highlightFrame: function(frameId) | 2166 highlightFrame: function(frameId) |
| 2156 { | 2167 { |
| 2157 this._agent.highlightFrame(frameId, WebInspector.Color.PageHighlight.Con
tent.toProtocolRGBA(), WebInspector.Color.PageHighlight.ContentOutline.toProtoco
lRGBA()); | 2168 this._agent.highlightFrame(frameId, WebInspector.Color.PageHighlight.Con
tent.toProtocolRGBA(), WebInspector.Color.PageHighlight.ContentOutline.toProtoco
lRGBA()); |
| 2158 } | 2169 } |
| 2159 } | 2170 } |
| OLD | NEW |