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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 this.nameElement.classList.add("properties-accessor-property-name"); | 197 this.nameElement.classList.add("properties-accessor-property-name"); |
198 | 198 |
199 var separatorElement = document.createElement("span"); | 199 var separatorElement = document.createElement("span"); |
200 separatorElement.className = "separator"; | 200 separatorElement.className = "separator"; |
201 separatorElement.textContent = ": "; | 201 separatorElement.textContent = ": "; |
202 | 202 |
203 if (this.property.value) { | 203 if (this.property.value) { |
204 this.valueElement = document.createElement("span"); | 204 this.valueElement = document.createElement("span"); |
205 this.valueElement.className = "value"; | 205 this.valueElement.className = "value"; |
206 var description = this.property.value.description; | 206 var description = this.property.value.description; |
207 // Render \n as a nice unicode cr symbol. | 207 var valueText; |
208 if (this.property.wasThrown) { | 208 if (this.property.wasThrown) { |
209 this.valueElement.textContent = "[Exception: " + description + "
]"; | 209 valueText = "[Exception: " + description + "]"; |
210 } else if (this.property.value.type === "string" && typeof descripti
on === "string") { | 210 } else if (this.property.value.type === "string" && typeof descripti
on === "string") { |
211 this.valueElement.textContent = "\"" + description.replace(/\n/g
, "\u21B5") + "\""; | 211 // Render \n as a nice unicode cr symbol. |
| 212 valueText = "\"" + description.replace(/\n/g, "\u21B5") + "\""; |
212 this.valueElement._originalTextContent = "\"" + description + "\
""; | 213 this.valueElement._originalTextContent = "\"" + description + "\
""; |
213 } else if (this.property.value.type === "function" && typeof descrip
tion === "string") { | 214 } else if (this.property.value.type === "function" && typeof descrip
tion === "string") { |
214 this.valueElement.textContent = /.*/.exec(description)[0].replac
e(/ +$/g, ""); | 215 valueText = /.*/.exec(description)[0].replace(/ +$/g, ""); |
215 this.valueElement._originalTextContent = description; | 216 this.valueElement._originalTextContent = description; |
216 } else if (this.property.value.type !== "object" || this.property.va
lue.subtype !== "node") { | 217 } else if (this.property.value.type !== "object" || this.property.va
lue.subtype !== "node") { |
217 this.valueElement.textContent = description; | 218 valueText = description; |
218 } | 219 } |
| 220 this.valueElement.setTextContentTruncatedIfNeeded(valueText || ""); |
219 | 221 |
220 if (this.property.wasThrown) | 222 if (this.property.wasThrown) |
221 this.valueElement.classList.add("error"); | 223 this.valueElement.classList.add("error"); |
222 if (this.property.value.subtype) | 224 if (this.property.value.subtype) |
223 this.valueElement.classList.add("console-formatted-" + this.prop
erty.value.subtype); | 225 this.valueElement.classList.add("console-formatted-" + this.prop
erty.value.subtype); |
224 else if (this.property.value.type) | 226 else if (this.property.value.type) |
225 this.valueElement.classList.add("console-formatted-" + this.prop
erty.value.type); | 227 this.valueElement.classList.add("console-formatted-" + this.prop
erty.value.type); |
226 | 228 |
227 this.valueElement.addEventListener("contextmenu", this._contextMenuF
ired.bind(this, this.property.value), false); | 229 this.valueElement.addEventListener("contextmenu", this._contextMenuF
ired.bind(this, this.property.value), false); |
228 if (this.property.value.type === "object" && this.property.value.sub
type === "node" && this.property.value.description) { | 230 if (this.property.value.type === "object" && this.property.value.sub
type === "node" && this.property.value.description) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 { | 311 { |
310 var elementAndValueToEdit = this.elementAndValueToEdit(event); | 312 var elementAndValueToEdit = this.elementAndValueToEdit(event); |
311 var elementToEdit = elementAndValueToEdit[0]; | 313 var elementToEdit = elementAndValueToEdit[0]; |
312 var valueToEdit = elementAndValueToEdit[1]; | 314 var valueToEdit = elementAndValueToEdit[1]; |
313 | 315 |
314 if (WebInspector.isBeingEdited(elementToEdit) || !this.treeOutline.secti
on.editable || this._readOnly) | 316 if (WebInspector.isBeingEdited(elementToEdit) || !this.treeOutline.secti
on.editable || this._readOnly) |
315 return; | 317 return; |
316 | 318 |
317 // Edit original source. | 319 // Edit original source. |
318 if (typeof valueToEdit !== "undefined") | 320 if (typeof valueToEdit !== "undefined") |
319 elementToEdit.textContent = valueToEdit; | 321 elementToEdit.setTextContentTruncatedIfNeeded(valueToEdit, WebInspec
tor.UIString("<string is too large to edit>")); |
320 | 322 |
321 var context = { expanded: this.expanded, elementToEdit: elementToEdit, p
reviousContent: elementToEdit.textContent }; | 323 var context = { expanded: this.expanded, elementToEdit: elementToEdit, p
reviousContent: elementToEdit.textContent }; |
322 | 324 |
323 // Lie about our children to prevent expanding on double click and to co
llapse subproperties. | 325 // Lie about our children to prevent expanding on double click and to co
llapse subproperties. |
324 this.hasChildren = false; | 326 this.hasChildren = false; |
325 | 327 |
326 this.listItemElement.classList.add("editing-sub-part"); | 328 this.listItemElement.classList.add("editing-sub-part"); |
327 | 329 |
328 this._prompt = new WebInspector.ObjectPropertyPrompt(this.editingCommitt
ed.bind(this, null, elementToEdit.textContent, context.previousContent, context)
, this.editingCancelled.bind(this, null, context), this.renderPromptAsBlock()); | 330 this._prompt = new WebInspector.ObjectPropertyPrompt(this.editingCommitt
ed.bind(this, null, elementToEdit.textContent, context.previousContent, context)
, this.editingCancelled.bind(this, null, context), this.renderPromptAsBlock()); |
329 | 331 |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 { | 981 { |
980 WebInspector.TextPrompt.call(this, WebInspector.runtimeModel.completionsForT
extPrompt.bind(WebInspector.runtimeModel)); | 982 WebInspector.TextPrompt.call(this, WebInspector.runtimeModel.completionsForT
extPrompt.bind(WebInspector.runtimeModel)); |
981 this.setSuggestBoxEnabled("generic-suggest"); | 983 this.setSuggestBoxEnabled("generic-suggest"); |
982 if (renderAsBlock) | 984 if (renderAsBlock) |
983 this.renderAsBlock(); | 985 this.renderAsBlock(); |
984 } | 986 } |
985 | 987 |
986 WebInspector.ObjectPropertyPrompt.prototype = { | 988 WebInspector.ObjectPropertyPrompt.prototype = { |
987 __proto__: WebInspector.TextPrompt.prototype | 989 __proto__: WebInspector.TextPrompt.prototype |
988 } | 990 } |
OLD | NEW |