| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 /** | 174 /** |
| 175 * @override | 175 * @override |
| 176 */ | 176 */ |
| 177 onattach: function() | 177 onattach: function() |
| 178 { | 178 { |
| 179 this.update(); | 179 this.update(); |
| 180 }, | 180 }, |
| 181 | 181 |
| 182 update: function() | 182 update: function() |
| 183 { | 183 { |
| 184 this.nameElement = document.createElementWithClass("span", "name"); | 184 this.nameElement = createElementWithClass("span", "name"); |
| 185 var name = this.property.name; | 185 var name = this.property.name; |
| 186 if (/^\s|\s$|^$|\n/.test(name)) | 186 if (/^\s|\s$|^$|\n/.test(name)) |
| 187 this.nameElement.createTextChildren("\"", name.replace(/\n/g, "\u21B
5"), "\""); | 187 this.nameElement.createTextChildren("\"", name.replace(/\n/g, "\u21B
5"), "\""); |
| 188 else | 188 else |
| 189 this.nameElement.textContent = name; | 189 this.nameElement.textContent = name; |
| 190 if (!this.property.enumerable) | 190 if (!this.property.enumerable) |
| 191 this.nameElement.classList.add("dimmed"); | 191 this.nameElement.classList.add("dimmed"); |
| 192 if (this.property.isAccessorProperty()) | 192 if (this.property.isAccessorProperty()) |
| 193 this.nameElement.classList.add("properties-accessor-property-name"); | 193 this.nameElement.classList.add("properties-accessor-property-name"); |
| 194 if (this.property.symbol) | 194 if (this.property.symbol) |
| 195 this.nameElement.addEventListener("contextmenu", this._contextMenuFi
red.bind(this, this.property.symbol), false); | 195 this.nameElement.addEventListener("contextmenu", this._contextMenuFi
red.bind(this, this.property.symbol), false); |
| 196 | 196 |
| 197 var separatorElement = document.createElementWithClass("span", "separato
r"); | 197 var separatorElement = createElementWithClass("span", "separator"); |
| 198 separatorElement.textContent = ": "; | 198 separatorElement.textContent = ": "; |
| 199 | 199 |
| 200 if (this.property.value) { | 200 if (this.property.value) { |
| 201 this.valueElement = document.createElementWithClass("span", "value")
; | 201 this.valueElement = createElementWithClass("span", "value"); |
| 202 var type = this.property.value.type; | 202 var type = this.property.value.type; |
| 203 var subtype = this.property.value.subtype; | 203 var subtype = this.property.value.subtype; |
| 204 var description = this.property.value.description; | 204 var description = this.property.value.description; |
| 205 var prefix; | 205 var prefix; |
| 206 var valueText; | 206 var valueText; |
| 207 var suffix; | 207 var suffix; |
| 208 if (this.property.wasThrown) { | 208 if (this.property.wasThrown) { |
| 209 prefix = "[Exception: "; | 209 prefix = "[Exception: "; |
| 210 valueText = description; | 210 valueText = description; |
| 211 suffix = "]"; | 211 suffix = "]"; |
| 212 } else if (type === "string" && typeof description === "string") { | 212 } else if (type === "string" && typeof description === "string") { |
| 213 // Render \n as a nice unicode cr symbol. | 213 // Render \n as a nice unicode cr symbol. |
| 214 prefix = "\""; | 214 prefix = "\""; |
| 215 valueText = description.replace(/\n/g, "\u21B5"); | 215 valueText = description.replace(/\n/g, "\u21B5"); |
| 216 suffix = "\""; | 216 suffix = "\""; |
| 217 this.valueElement._originalTextContent = "\"" + description + "\
""; | 217 this.valueElement._originalTextContent = "\"" + description + "\
""; |
| 218 } else if (type === "function" && typeof description === "string") { | 218 } else if (type === "function" && typeof description === "string") { |
| 219 // Render function description until the first \n. | 219 // Render function description until the first \n. |
| 220 valueText = /.*/.exec(description)[0].replace(/\s+$/g, ""); | 220 valueText = /.*/.exec(description)[0].replace(/\s+$/g, ""); |
| 221 this.valueElement._originalTextContent = description; | 221 this.valueElement._originalTextContent = description; |
| 222 } else if (type !== "object" || subtype !== "node") { | 222 } else if (type !== "object" || subtype !== "node") { |
| 223 valueText = description; | 223 valueText = description; |
| 224 } | 224 } |
| 225 this.valueElement.setTextContentTruncatedIfNeeded(valueText || ""); | 225 this.valueElement.setTextContentTruncatedIfNeeded(valueText || ""); |
| 226 if (prefix) | 226 if (prefix) |
| 227 this.valueElement.insertBefore(document.createTextNode(prefix),
this.valueElement.firstChild); | 227 this.valueElement.insertBefore(createTextNode(prefix), this.valu
eElement.firstChild); |
| 228 if (suffix) | 228 if (suffix) |
| 229 this.valueElement.createTextChild(suffix); | 229 this.valueElement.createTextChild(suffix); |
| 230 | 230 |
| 231 if (this.property.wasThrown) | 231 if (this.property.wasThrown) |
| 232 this.valueElement.classList.add("error"); | 232 this.valueElement.classList.add("error"); |
| 233 if (subtype || type) | 233 if (subtype || type) |
| 234 this.valueElement.classList.add("console-formatted-" + (subtype
|| type)); | 234 this.valueElement.classList.add("console-formatted-" + (subtype
|| type)); |
| 235 | 235 |
| 236 this.valueElement.addEventListener("contextmenu", this._contextMenuF
ired.bind(this, this.property.value), false); | 236 this.valueElement.addEventListener("contextmenu", this._contextMenuF
ired.bind(this, this.property.value), false); |
| 237 if (type === "object" && subtype === "node" && description) { | 237 if (type === "object" && subtype === "node" && description) { |
| 238 WebInspector.DOMPresentationUtils.createSpansForNodeTitle(this.v
alueElement, description); | 238 WebInspector.DOMPresentationUtils.createSpansForNodeTitle(this.v
alueElement, description); |
| 239 this.valueElement.addEventListener("mousemove", this._mouseMove.
bind(this, this.property.value), false); | 239 this.valueElement.addEventListener("mousemove", this._mouseMove.
bind(this, this.property.value), false); |
| 240 this.valueElement.addEventListener("mouseout", this._mouseOut.bi
nd(this, this.property.value), false); | 240 this.valueElement.addEventListener("mouseout", this._mouseOut.bi
nd(this, this.property.value), false); |
| 241 } else { | 241 } else { |
| 242 this.valueElement.title = description || ""; | 242 this.valueElement.title = description || ""; |
| 243 } | 243 } |
| 244 | 244 |
| 245 this.listItemElement.removeChildren(); | 245 this.listItemElement.removeChildren(); |
| 246 | 246 |
| 247 this.hasChildren = this.property.value.hasChildren && !this.property
.wasThrown; | 247 this.hasChildren = this.property.value.hasChildren && !this.property
.wasThrown; |
| 248 } else { | 248 } else { |
| 249 if (this.property.getter) { | 249 if (this.property.getter) { |
| 250 this.valueElement = WebInspector.ObjectPropertyTreeElement.creat
eRemoteObjectAccessorPropertySpan(this.property.parentObject, [this.property.nam
e], this._onInvokeGetterClick.bind(this)); | 250 this.valueElement = WebInspector.ObjectPropertyTreeElement.creat
eRemoteObjectAccessorPropertySpan(this.property.parentObject, [this.property.nam
e], this._onInvokeGetterClick.bind(this)); |
| 251 } else { | 251 } else { |
| 252 this.valueElement = document.createElementWithClass("span", "con
sole-formatted-undefined"); | 252 this.valueElement = createElementWithClass("span", "console-form
atted-undefined"); |
| 253 this.valueElement.textContent = WebInspector.UIString("<unreadab
le>"); | 253 this.valueElement.textContent = WebInspector.UIString("<unreadab
le>"); |
| 254 this.valueElement.title = WebInspector.UIString("No property get
ter"); | 254 this.valueElement.title = WebInspector.UIString("No property get
ter"); |
| 255 } | 255 } |
| 256 } | 256 } |
| 257 | 257 |
| 258 this.listItemElement.appendChildren(this.nameElement, separatorElement,
this.valueElement); | 258 this.listItemElement.appendChildren(this.nameElement, separatorElement,
this.valueElement); |
| 259 }, | 259 }, |
| 260 | 260 |
| 261 _contextMenuFired: function(value, event) | 261 _contextMenuFired: function(value, event) |
| 262 { | 262 { |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 } | 575 } |
| 576 | 576 |
| 577 /** | 577 /** |
| 578 * @param {!TreeElement|!TreeOutline} treeElement | 578 * @param {!TreeElement|!TreeOutline} treeElement |
| 579 * @param {?string=} emptyPlaceholder | 579 * @param {?string=} emptyPlaceholder |
| 580 */ | 580 */ |
| 581 WebInspector.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded = functio
n(treeElement, emptyPlaceholder) | 581 WebInspector.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded = functio
n(treeElement, emptyPlaceholder) |
| 582 { | 582 { |
| 583 if (treeElement.children.length) | 583 if (treeElement.children.length) |
| 584 return; | 584 return; |
| 585 var title = document.createElementWithClass("div", "info"); | 585 var title = createElementWithClass("div", "info"); |
| 586 title.textContent = emptyPlaceholder || WebInspector.UIString("No Properties
"); | 586 title.textContent = emptyPlaceholder || WebInspector.UIString("No Properties
"); |
| 587 var infoElement = new TreeElement(title, null, false); | 587 var infoElement = new TreeElement(title, null, false); |
| 588 treeElement.appendChild(infoElement); | 588 treeElement.appendChild(infoElement); |
| 589 } | 589 } |
| 590 | 590 |
| 591 /** | 591 /** |
| 592 * @param {?WebInspector.RemoteObject} object | 592 * @param {?WebInspector.RemoteObject} object |
| 593 * @param {!Array.<string>} propertyPath | 593 * @param {!Array.<string>} propertyPath |
| 594 * @param {function(?WebInspector.RemoteObject, boolean=)} callback | 594 * @param {function(?WebInspector.RemoteObject, boolean=)} callback |
| 595 * @return {!Element} | 595 * @return {!Element} |
| 596 */ | 596 */ |
| 597 WebInspector.ObjectPropertyTreeElement.createRemoteObjectAccessorPropertySpan =
function(object, propertyPath, callback) | 597 WebInspector.ObjectPropertyTreeElement.createRemoteObjectAccessorPropertySpan =
function(object, propertyPath, callback) |
| 598 { | 598 { |
| 599 var rootElement = document.createElement("span"); | 599 var rootElement = createElement("span"); |
| 600 var element = rootElement.createChild("span"); | 600 var element = rootElement.createChild("span"); |
| 601 element.textContent = WebInspector.UIString("(...)"); | 601 element.textContent = WebInspector.UIString("(...)"); |
| 602 if (!object) | 602 if (!object) |
| 603 return rootElement; | 603 return rootElement; |
| 604 element.classList.add("properties-calculate-value-button"); | 604 element.classList.add("properties-calculate-value-button"); |
| 605 element.title = WebInspector.UIString("Invoke property getter"); | 605 element.title = WebInspector.UIString("Invoke property getter"); |
| 606 element.addEventListener("click", onInvokeGetterClick, false); | 606 element.addEventListener("click", onInvokeGetterClick, false); |
| 607 | 607 |
| 608 function onInvokeGetterClick(event) | 608 function onInvokeGetterClick(event) |
| 609 { | 609 { |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 { | 1072 { |
| 1073 WebInspector.TextPrompt.call(this, WebInspector.ExecutionContextSelector.com
pletionsForTextPromptInCurrentContext); | 1073 WebInspector.TextPrompt.call(this, WebInspector.ExecutionContextSelector.com
pletionsForTextPromptInCurrentContext); |
| 1074 this.setSuggestBoxEnabled(true); | 1074 this.setSuggestBoxEnabled(true); |
| 1075 if (renderAsBlock) | 1075 if (renderAsBlock) |
| 1076 this.renderAsBlock(); | 1076 this.renderAsBlock(); |
| 1077 } | 1077 } |
| 1078 | 1078 |
| 1079 WebInspector.ObjectPropertyPrompt.prototype = { | 1079 WebInspector.ObjectPropertyPrompt.prototype = { |
| 1080 __proto__: WebInspector.TextPrompt.prototype | 1080 __proto__: WebInspector.TextPrompt.prototype |
| 1081 } | 1081 } |
| OLD | NEW |