OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 * @param {!Element} anchorElement | 68 * @param {!Element} anchorElement |
69 * @param {!Element} popoverContentElement | 69 * @param {!Element} popoverContentElement |
70 * @param {?WebInspector.DebuggerModel.FunctionDetails} response | 70 * @param {?WebInspector.DebuggerModel.FunctionDetails} response |
71 * @this {WebInspector.ObjectPopoverHelper} | 71 * @this {WebInspector.ObjectPopoverHelper} |
72 */ | 72 */ |
73 function didGetDetails(target, anchorElement, popoverContentElement, res
ponse) | 73 function didGetDetails(target, anchorElement, popoverContentElement, res
ponse) |
74 { | 74 { |
75 if (!response) | 75 if (!response) |
76 return; | 76 return; |
77 | 77 |
78 var container = document.createElement("div"); | 78 var container = createElement("div"); |
79 container.className = "inline-block"; | 79 container.className = "inline-block"; |
80 | 80 |
81 var title = container.createChild("div", "function-popover-title sou
rce-code"); | 81 var title = container.createChild("div", "function-popover-title sou
rce-code"); |
82 var functionName = title.createChild("span", "function-name"); | 82 var functionName = title.createChild("span", "function-name"); |
83 functionName.textContent = response.functionName || WebInspector.UIS
tring("(anonymous function)"); | 83 functionName.textContent = response.functionName || WebInspector.UIS
tring("(anonymous function)"); |
84 | 84 |
85 var rawLocation = response.location; | 85 var rawLocation = response.location; |
86 var sourceURL = response.sourceURL; | 86 var sourceURL = response.sourceURL; |
87 if (rawLocation && sourceURL) { | 87 if (rawLocation && sourceURL) { |
88 this._linkifier = new WebInspector.Linkifier(); | 88 this._linkifier = new WebInspector.Linkifier(); |
(...skipping 18 matching lines...) Expand all Loading... |
107 if (wasThrown) { | 107 if (wasThrown) { |
108 this.hidePopover(); | 108 this.hidePopover(); |
109 return; | 109 return; |
110 } | 110 } |
111 this._objectTarget = result.target(); | 111 this._objectTarget = result.target(); |
112 var anchorElement = anchorOverride || element; | 112 var anchorElement = anchorOverride || element; |
113 var description = (this._remoteObjectFormatter && this._remoteObject
Formatter(result)) || result.description; | 113 var description = (this._remoteObjectFormatter && this._remoteObject
Formatter(result)) || result.description; |
114 description = description.trimEnd(WebInspector.ObjectPopoverHelper.M
axPopoverTextLength); | 114 description = description.trimEnd(WebInspector.ObjectPopoverHelper.M
axPopoverTextLength); |
115 var popoverContentElement = null; | 115 var popoverContentElement = null; |
116 if (result.type !== "object") { | 116 if (result.type !== "object") { |
117 popoverContentElement = document.createElement("span"); | 117 popoverContentElement = createElement("span"); |
118 popoverContentElement.className = "monospace console-formatted-"
+ result.type; | 118 popoverContentElement.className = "monospace console-formatted-"
+ result.type; |
119 popoverContentElement.style.whiteSpace = "pre"; | 119 popoverContentElement.style.whiteSpace = "pre"; |
120 if (result.type === "string") | 120 if (result.type === "string") |
121 popoverContentElement.createTextChildren("\"", description,
"\""); | 121 popoverContentElement.createTextChildren("\"", description,
"\""); |
122 else | 122 else |
123 popoverContentElement.textContent = description; | 123 popoverContentElement.textContent = description; |
124 if (result.type === "function") { | 124 if (result.type === "function") { |
125 result.functionDetails(didGetDetails.bind(this, result.targe
t(), anchorElement, popoverContentElement)); | 125 result.functionDetails(didGetDetails.bind(this, result.targe
t(), anchorElement, popoverContentElement)); |
126 return; | 126 return; |
127 } | 127 } |
128 popover.show(popoverContentElement, anchorElement); | 128 popover.show(popoverContentElement, anchorElement); |
129 } else { | 129 } else { |
130 if (result.subtype === "node") { | 130 if (result.subtype === "node") { |
131 result.highlightAsDOMNode(); | 131 result.highlightAsDOMNode(); |
132 this._resultHighlightedAsDOM = result; | 132 this._resultHighlightedAsDOM = result; |
133 } | 133 } |
134 popoverContentElement = document.createElement("div"); | 134 popoverContentElement = createElement("div"); |
135 this._titleElement = document.createElement("div"); | 135 this._titleElement = createElement("div"); |
136 this._titleElement.className = "source-frame-popover-title monos
pace"; | 136 this._titleElement.className = "source-frame-popover-title monos
pace"; |
137 this._titleElement.textContent = description; | 137 this._titleElement.textContent = description; |
138 popoverContentElement.appendChild(this._titleElement); | 138 popoverContentElement.appendChild(this._titleElement); |
139 | 139 |
140 var section = new WebInspector.ObjectPropertiesSection(result); | 140 var section = new WebInspector.ObjectPropertiesSection(result); |
141 // For HTML DOM wrappers, append "#id" to title, if not empty. | 141 // For HTML DOM wrappers, append "#id" to title, if not empty. |
142 if (description.substr(0, 4) === "HTML") { | 142 if (description.substr(0, 4) === "HTML") { |
143 this._sectionUpdateProperties = section.updateProperties.bin
d(section); | 143 this._sectionUpdateProperties = section.updateProperties.bin
d(section); |
144 section.updateProperties = this._updateHTMLId.bind(this); | 144 section.updateProperties = this._updateHTMLId.bind(this); |
145 } | 145 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 if (properties[i].value.description) | 181 if (properties[i].value.description) |
182 this._titleElement.textContent += "#" + properties[i].value.
description; | 182 this._titleElement.textContent += "#" + properties[i].value.
description; |
183 break; | 183 break; |
184 } | 184 } |
185 } | 185 } |
186 this._sectionUpdateProperties(properties, rootTreeElementConstructor, ro
otPropertyComparer); | 186 this._sectionUpdateProperties(properties, rootTreeElementConstructor, ro
otPropertyComparer); |
187 }, | 187 }, |
188 | 188 |
189 __proto__: WebInspector.PopoverHelper.prototype | 189 __proto__: WebInspector.PopoverHelper.prototype |
190 } | 190 } |
OLD | NEW |